-rw-r--r-- | noncore/apps/keyz-cfg/cfgdlg.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/cfgdlg.h | 2 | ||||
-rw-r--r-- | noncore/apps/keyz-cfg/main.cpp | 12 |
3 files changed, 11 insertions, 9 deletions
diff --git a/noncore/apps/keyz-cfg/cfgdlg.cpp b/noncore/apps/keyz-cfg/cfgdlg.cpp index 863f21e..3965198 100644 --- a/noncore/apps/keyz-cfg/cfgdlg.cpp +++ b/noncore/apps/keyz-cfg/cfgdlg.cpp | |||
@@ -1,78 +1,80 @@ | |||
1 | 1 | ||
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <qpe/qcopenvelope_qws.h> | 4 | #include <qpe/qcopenvelope_qws.h> |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #include "cfgdlg.h" | 6 | #include "cfgdlg.h" |
7 | 7 | ||
8 | CfgDlg::CfgDlg(QWidget* parent, CfgFile* cf, QApplication* app):QDialog(parent), cfile(cf), application(app) { | 8 | CfgDlg::CfgDlg(QWidget* parent, CfgFile* cf, QApplication* app, bool mod): |
9 | QDialog(parent, "CfgDlg", mod), cfile(cf), application(app) { | ||
10 | |||
9 | setCaption(tr("keyz configurator")); | 11 | setCaption(tr("keyz configurator")); |
10 | 12 | ||
11 | QGridLayout* gl = new QGridLayout(this, 7, 5, 5, 5); | 13 | QGridLayout* gl = new QGridLayout(this, 7, 5, 5, 5); |
12 | 14 | ||
13 | QLabel* flabel = new QLabel("Available Keymaps", this); | 15 | QLabel* flabel = new QLabel("Available Keymaps", this); |
14 | files = new QListBox(this); | 16 | files = new QListBox(this); |
15 | QPushButton* addButton = new QPushButton(">>", this); //add->setText("Add"); | 17 | QPushButton* addButton = new QPushButton(">>", this); //add->setText("Add"); |
16 | connect(addButton, SIGNAL(clicked()), this, SLOT(add())); | 18 | connect(addButton, SIGNAL(clicked()), this, SLOT(add())); |
17 | QLabel* klabel = new QLabel("Selected Keymaps", this); | 19 | QLabel* klabel = new QLabel("Selected Keymaps", this); |
18 | keymaps = new QListBox(this); | 20 | keymaps = new QListBox(this); |
19 | connect(keymaps, SIGNAL(highlighted(const QString&)), this, SLOT(keymapHighlighted(const QString&))); | 21 | connect(keymaps, SIGNAL(highlighted(const QString&)), this, SLOT(keymapHighlighted(const QString&))); |
20 | QPushButton* delButton = new QPushButton("<<", this); //del->setText("Delete"); | 22 | QPushButton* delButton = new QPushButton("<<", this); //del->setText("Delete"); |
21 | connect(delButton, SIGNAL(clicked()), this, SLOT(del())); | 23 | connect(delButton, SIGNAL(clicked()), this, SLOT(del())); |
22 | QPushButton* slabelButton = new QPushButton("Set Label", this); //apply->setText("Apply"); | 24 | QPushButton* slabelButton = new QPushButton("Set Label", this); //apply->setText("Apply"); |
23 | connect(slabelButton, SIGNAL(clicked()), this, SLOT(setLabel())); | 25 | connect(slabelButton, SIGNAL(clicked()), this, SLOT(setLabel())); |
24 | QLabel* l = new QLabel("Label", this); | 26 | QLabel* l = new QLabel("Label", this); |
25 | label = new QLineEdit(this); | 27 | label = new QLineEdit(this); |
26 | QLabel* adlabel = new QLabel("Auto Repeat Delay (ms)", this); | 28 | QLabel* adlabel = new QLabel("Auto Repeat Delay (ms)", this); |
27 | QLabel* aplabel = new QLabel("Auto Repeat Period (ms)", this); | 29 | QLabel* aplabel = new QLabel("Auto Repeat Period (ms)", this); |
28 | ad = new QSpinBox(50, 5000, 5, this); | 30 | ad = new QSpinBox(50, 5000, 5, this); |
29 | ap = new QSpinBox(0, 5000, 5, this); | 31 | ap = new QSpinBox(0, 5000, 5, this); |
30 | 32 | ||
31 | //QLabel* adms = new QLabel("ms", this); | 33 | //QLabel* adms = new QLabel("ms", this); |
32 | //QLabel* apms = new QLabel("ms", this); | 34 | //QLabel* apms = new QLabel("ms", this); |
33 | 35 | ||
34 | //QCheckBox* enable = new QCheckBox("Enable", t); | 36 | //QCheckBox* enable = new QCheckBox("Enable", t); |
35 | 37 | ||
36 | gl->setColStretch(0, 1); | 38 | gl->setColStretch(0, 1); |
37 | gl->setColStretch(1, 1); | 39 | gl->setColStretch(1, 1); |
38 | gl->setColStretch(3, 1); | 40 | gl->setColStretch(3, 1); |
39 | gl->setColStretch(4, 1); | 41 | gl->setColStretch(4, 1); |
40 | gl->setRowStretch(3, 1); | 42 | gl->setRowStretch(3, 1); |
41 | gl->addMultiCellWidget(flabel, 0, 0, 0, 1); | 43 | gl->addMultiCellWidget(flabel, 0, 0, 0, 1); |
42 | gl->addMultiCellWidget(klabel, 0, 0, 3, 4); | 44 | gl->addMultiCellWidget(klabel, 0, 0, 3, 4); |
43 | gl->addMultiCellWidget(files, 1, 3, 0, 1); | 45 | gl->addMultiCellWidget(files, 1, 3, 0, 1); |
44 | gl->addMultiCellWidget(keymaps, 1, 3, 3, 4); | 46 | gl->addMultiCellWidget(keymaps, 1, 3, 3, 4); |
45 | gl->addWidget(addButton, 1, 2); | 47 | gl->addWidget(addButton, 1, 2); |
46 | gl->addWidget(delButton, 2, 2); | 48 | gl->addWidget(delButton, 2, 2); |
47 | 49 | ||
48 | gl->addWidget(l, 4, 0); | 50 | gl->addWidget(l, 4, 0); |
49 | gl->addWidget(label, 4, 1); | 51 | gl->addWidget(label, 4, 1); |
50 | gl->addMultiCellWidget(slabelButton, 4, 4, 3, 4); | 52 | gl->addMultiCellWidget(slabelButton, 4, 4, 3, 4); |
51 | 53 | ||
52 | gl->addMultiCellWidget(adlabel, 5, 5, 0, 2); | 54 | gl->addMultiCellWidget(adlabel, 5, 5, 0, 2); |
53 | gl->addMultiCellWidget(ad, 5, 5, 3, 4); | 55 | gl->addMultiCellWidget(ad, 5, 5, 3, 4); |
54 | //gl->addWidget(adms, 5, 3); | 56 | //gl->addWidget(adms, 5, 3); |
55 | 57 | ||
56 | gl->addMultiCellWidget(aplabel, 6, 6, 0, 2); | 58 | gl->addMultiCellWidget(aplabel, 6, 6, 0, 2); |
57 | gl->addMultiCellWidget(ap, 6, 6, 3, 4); | 59 | gl->addMultiCellWidget(ap, 6, 6, 3, 4); |
58 | 60 | ||
59 | //gl->addWidget(apms, 6, 3); | 61 | //gl->addWidget(apms, 6, 3); |
60 | 62 | ||
61 | QList<CfgEntry>& e = cfile->getEntries(); | 63 | QList<CfgEntry>& e = cfile->getEntries(); |
62 | 64 | ||
63 | for(uint i = 0; i < e.count(); i++) { | 65 | for(uint i = 0; i < e.count(); i++) { |
64 | CfgEntry* entry = e.at(i); | 66 | CfgEntry* entry = e.at(i); |
65 | keymaps->insertItem(entry->getFile()); | 67 | keymaps->insertItem(entry->getFile()); |
66 | m.insert(entry->getFile(), entry->getLabel()); | 68 | m.insert(entry->getFile(), entry->getLabel()); |
67 | } | 69 | } |
68 | 70 | ||
69 | QDir dir(QPEApplication::qpeDir()+"/share/zkb", "*.xml"); | 71 | QDir dir(QPEApplication::qpeDir()+"/share/zkb", "*.xml"); |
70 | QStringList flist = dir.entryList(); | 72 | QStringList flist = dir.entryList(); |
71 | QStringList::Iterator sit; | 73 | QStringList::Iterator sit; |
72 | for(sit = flist.begin(); sit != flist.end(); ++sit) { | 74 | for(sit = flist.begin(); sit != flist.end(); ++sit) { |
73 | if (*sit != "common.xml" && *sit != "zkb.xml" && m.find(*sit) == m.end()) { | 75 | if (*sit != "common.xml" && *sit != "zkb.xml" && m.find(*sit) == m.end()) { |
74 | files->insertItem(*sit); | 76 | files->insertItem(*sit); |
75 | } | 77 | } |
76 | } | 78 | } |
77 | 79 | ||
78 | ad->setValue(cfile->getAutorepeatDelay()); | 80 | ad->setValue(cfile->getAutorepeatDelay()); |
diff --git a/noncore/apps/keyz-cfg/cfgdlg.h b/noncore/apps/keyz-cfg/cfgdlg.h index 16732ee..cbefdf1 100644 --- a/noncore/apps/keyz-cfg/cfgdlg.h +++ b/noncore/apps/keyz-cfg/cfgdlg.h | |||
@@ -1,39 +1,39 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlistbox.h> | 2 | #include <qlistbox.h> |
3 | #include <qpushbutton.h> | 3 | #include <qpushbutton.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
7 | #include <qspinbox.h> | 7 | #include <qspinbox.h> |
8 | #include <qdialog.h> | 8 | #include <qdialog.h> |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | 10 | ||
11 | #include "cfgfile.h" | 11 | #include "cfgfile.h" |
12 | 12 | ||
13 | class CfgDlg : public QDialog { | 13 | class CfgDlg : public QDialog { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | CfgDlg(QWidget* parent, CfgFile* cfile, QApplication *); | 17 | CfgDlg(QWidget* parent, CfgFile* cfile, QApplication *, bool b = false); |
18 | virtual ~CfgDlg(); | 18 | virtual ~CfgDlg(); |
19 | 19 | ||
20 | protected: | 20 | protected: |
21 | CfgFile* cfile; | 21 | CfgFile* cfile; |
22 | QApplication* application; | 22 | QApplication* application; |
23 | 23 | ||
24 | QMap<QString, QString> m; | 24 | QMap<QString, QString> m; |
25 | 25 | ||
26 | QListBox* files; | 26 | QListBox* files; |
27 | QListBox* keymaps; | 27 | QListBox* keymaps; |
28 | QLineEdit* label; | 28 | QLineEdit* label; |
29 | QSpinBox* ap; | 29 | QSpinBox* ap; |
30 | QSpinBox* ad; | 30 | QSpinBox* ad; |
31 | 31 | ||
32 | virtual void accept(); | 32 | virtual void accept(); |
33 | 33 | ||
34 | protected slots: | 34 | protected slots: |
35 | void add(); | 35 | void add(); |
36 | void del(); | 36 | void del(); |
37 | void setLabel(); | 37 | void setLabel(); |
38 | void keymapHighlighted(const QString&); | 38 | void keymapHighlighted(const QString&); |
39 | }; | 39 | }; |
diff --git a/noncore/apps/keyz-cfg/main.cpp b/noncore/apps/keyz-cfg/main.cpp index 55cc23e..4615562 100644 --- a/noncore/apps/keyz-cfg/main.cpp +++ b/noncore/apps/keyz-cfg/main.cpp | |||
@@ -1,22 +1,22 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qlayout.h> | ||
3 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
4 | 5 | ||
5 | #include "cfgdlg.h" | 6 | #include "cfgdlg.h" |
6 | 7 | ||
7 | int main( int argc, char **argv ) { | 8 | int main( int argc, char **argv ) { |
8 | QPEApplication app(argc, argv); | 9 | QPEApplication app(argc, argv); |
9 | CfgFile cfile; | 10 | CfgFile cfile; |
10 | CfgParser cp; | 11 | CfgParser cp; |
11 | cp.load(QPEApplication::qpeDir()+"/share/zkb/zkb.xml", cfile); | 12 | cp.load(QPEApplication::qpeDir()+"/share/zkb/zkb.xml", cfile); |
12 | 13 | ||
13 | QMainWindow m; | ||
14 | CfgDlg c(&m, &cfile, &app); | ||
15 | app.showMainWidget(&m); | ||
16 | m.hide(); | ||
17 | c.showMaximized(); | ||
18 | 14 | ||
19 | int ret = app.exec(); | 15 | CfgDlg c(0, &cfile, &app, true); |
16 | |||
17 | |||
18 | app.showMainWidget(&c); | ||
19 | int ret = QPEApplication::execDialog(&c); | ||
20 | 20 | ||
21 | return ret; | 21 | return ret; |
22 | } | 22 | } |