20a0189014afc644e5c396eaa2bd6e2c64f10fb5
[lichviet-widget] / settingsdlg.cpp
1 /*
2 Copyright (C) 2011  by Cuong Le <metacuong@gmail.com>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>
16 */
17
18 #include "settingsdlg.h"
19
20
21 SettingsDlg::SettingsDlg(QWidget *parent) :
22     QDialog(parent)
23 {
24     this->setWindowTitle(QString::fromUtf8("Lựa Chọn"));
25
26     buttonBox = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
27     buttonBox->setOrientation(Qt::Vertical);
28     connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
29     connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
30
31     tabWidget = new QTabWidget;
32     tabWidget ->addTab(new ThemeTab(), QString::fromUtf8("Mẫu widget"));
33     tabWidget ->addTab(new GeneralTab(), QString::fromUtf8("Giới thiệu"));
34
35     mainLayout = new QGridLayout(this);
36
37     mainLayout->addWidget(tabWidget,0,0,1,1);
38     mainLayout->addWidget(buttonBox,0,1,1,1);
39
40 \
41     this->setLayout(mainLayout);
42
43 }
44
45 void SettingsDlg::showSettingsDialog(){
46     this->show();
47 }
48
49 GeneralTab::GeneralTab(QWidget *parent)
50      : QWidget(parent)
51 {
52     mainLayout = new QVBoxLayout;
53     setLayout(mainLayout);
54 }
55
56 ThemeTab::ThemeTab(QWidget *parent)
57      : QWidget(parent)
58 {
59     themes = new QListWidget(this);
60     themes->addItem(new QListWidgetItem( QString::fromUtf8("Mặc định")));
61     themes->addItem(new QListWidgetItem( QString::fromUtf8("Vừa phải")));
62     themes->addItem(new QListWidgetItem( QString::fromUtf8("Lớn")));
63
64     mainLayout = new QVBoxLayout;
65     mainLayout->addWidget(themes);
66     setLayout(mainLayout);
67 }
68