1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: QT C++ based Class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "dlgsetting.h" |
|
19 #include <QtGui> |
|
20 |
|
21 DlgSetting::DlgSetting(UiSetting* settingObj, QWidget *parent) |
|
22 : QDialog(parent), setting(settingObj) |
|
23 { |
|
24 SetupUI(); |
|
25 } |
|
26 |
|
27 void DlgSetting::SetupUI() |
|
28 { |
|
29 this->setContextMenuPolicy(Qt::NoContextMenu); |
|
30 QGridLayout *mainLayout = new QGridLayout(this); |
|
31 this->setLayout(mainLayout); |
|
32 |
|
33 chkShowoutput = new QCheckBox(this); |
|
34 chkShowoutput->setText(tr("Show output in execution.")); |
|
35 chkShowoutput->setChecked(setting->ReadSetting(KShowOutput) == "true"); |
|
36 |
|
37 lblFilter = new QLabel(this); |
|
38 lblFilter->setText(tr("Filter for displayed titles.")); |
|
39 ledFilter = new QLineEdit(this); |
|
40 ledFilter->setFrame(true); |
|
41 ledFilter->setText(setting->ReadSetting(KFilter)); |
|
42 chkFilterCaseSens = new QCheckBox(this); |
|
43 chkFilterCaseSens->setText(tr("Filter is case sensitive.")); |
|
44 chkFilterCaseSens->setChecked(setting->ReadSetting(KFilterCaseSens) == "true"); |
|
45 |
|
46 QWidget *toolWidget = new QWidget(this); |
|
47 QGridLayout *toolLayout = new QGridLayout(this); |
|
48 |
|
49 toolWidget->setLayout(toolLayout); |
|
50 btnOk = new QPushButton(tr("Ok"), toolWidget); |
|
51 QObject::connect(btnOk, SIGNAL(clicked()), this, |
|
52 SLOT(on_btnOk_clicked())); |
|
53 btnCancel = new QPushButton(tr("Cancel"), toolWidget); |
|
54 QObject::connect(btnCancel, SIGNAL(clicked()), this, |
|
55 SLOT(on_btnCancel_clicked())); |
|
56 toolLayout->addWidget(btnOk, 0, 0); |
|
57 toolLayout->addWidget(btnCancel, 0, 1); |
|
58 |
|
59 QWidget *nullWidget = new QWidget(this); |
|
60 nullWidget->setMinimumHeight(30); |
|
61 |
|
62 mainLayout->addWidget(nullWidget, 0, 0); |
|
63 mainLayout->addWidget(chkShowoutput, 1, 0); |
|
64 mainLayout->addWidget(lblFilter, 3, 0); |
|
65 mainLayout->addWidget(ledFilter, 4, 0); |
|
66 mainLayout->addWidget(chkFilterCaseSens, 5, 0); |
|
67 mainLayout->addWidget(toolWidget, 7, 0); |
|
68 |
|
69 } |
|
70 |
|
71 void DlgSetting::on_btnOk_clicked() |
|
72 { |
|
73 if(chkShowoutput->checkState() == Qt::Checked) |
|
74 { |
|
75 setting->SetSetting(KShowOutput, "true"); |
|
76 } |
|
77 else |
|
78 { |
|
79 setting->SetSetting(KShowOutput, "false"); |
|
80 } |
|
81 setting->SetSetting(KFilter, ledFilter->text()); |
|
82 setting->SetSetting(KFilterCaseSens, (chkFilterCaseSens->checkState() == Qt::Checked) ? ("true") : ("false")); |
|
83 this->accept(); |
|
84 } |
|
85 |
|
86 void DlgSetting::on_btnCancel_clicked() |
|
87 { |
|
88 this->reject(); |
|
89 } |
|
90 |
|
91 // End of File |
|