summaryrefslogtreecommitdiff
path: root/noncore
authorpaule <paule>2007-01-28 06:41:22 (UTC)
committer paule <paule>2007-01-28 06:41:22 (UTC)
commitb17ca0982b26c0f18ccd3113906206f8fb49df2a (patch) (unidiff)
treec6e98cc4bdab06ed9b1c198badc185abbfe58088 /noncore
parentec2309cb69365847762db542c41951629cd06cbe (diff)
downloadopie-b17ca0982b26c0f18ccd3113906206f8fb49df2a.zip
opie-b17ca0982b26c0f18ccd3113906206f8fb49df2a.tar.gz
opie-b17ca0982b26c0f18ccd3113906206f8fb49df2a.tar.bz2
Load in current button action on opening
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/buttondialog.cpp45
-rw-r--r--noncore/tools/remote/buttondialog.h6
2 files changed, 34 insertions, 17 deletions
diff --git a/noncore/tools/remote/buttondialog.cpp b/noncore/tools/remote/buttondialog.cpp
index 56738d1..7d03f27 100644
--- a/noncore/tools/remote/buttondialog.cpp
+++ b/noncore/tools/remote/buttondialog.cpp
@@ -16,7 +16,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 16
17#include "buttondialog.h" 17#include "buttondialog.h"
18 18
19ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f) 19ButtonDialog::ButtonDialog(QString buttonName, QString action, QWidget *parent, const char*name, bool modal, WFlags f)
20: QDialog(parent, name, modal, f)
20{ 21{
21 setCaption(tr(buttonName)); 22 setCaption(tr(buttonName));
22 23
@@ -43,7 +44,6 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name,
43 hlayout1->addSpacing(5); 44 hlayout1->addSpacing(5);
44 hlayout1->addWidget(remote); 45 hlayout1->addWidget(remote);
45 hlayout1->addSpacing(5); 46 hlayout1->addSpacing(5);
46 remote->insertItem("Remote ");
47 remote->insertStringList(lh->getRemotes()); 47 remote->insertStringList(lh->getRemotes());
48 connect(remote, SIGNAL(activated(const QString&)), this, SLOT(remoteSelected(const QString&)) ); 48 connect(remote, SIGNAL(activated(const QString&)), this, SLOT(remoteSelected(const QString&)) );
49 49
@@ -54,8 +54,6 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name,
54 hlayout2->addSpacing(5); 54 hlayout2->addSpacing(5);
55 hlayout2->addWidget(button); 55 hlayout2->addWidget(button);
56 hlayout2->addSpacing(5); 56 hlayout2->addSpacing(5);
57 button->insertItem("Button ");
58 connect(button, SIGNAL(activated(const QString&)), this, SLOT(buttonSelected(const QString&)) );
59 57
60 label = new QLineEdit(this, "label"); 58 label = new QLineEdit(this, "label");
61 label->setText(buttonName); 59 label->setText(buttonName);
@@ -65,6 +63,32 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name,
65 hlayout3->addSpacing(5); 63 hlayout3->addSpacing(5);
66 hlayout3->addWidget(label); 64 hlayout3->addWidget(label);
67 hlayout3->addSpacing(5); 65 hlayout3->addSpacing(5);
66
67 QStringList actionArgs = QStringList::split(' ', action);
68 if(actionArgs.count() > 1) {
69 // Remote
70 for(int i=0;i<remote->count();i++) {
71 if(remote->text(i) == actionArgs[1]) {
72 remote->setCurrentItem(i);
73 break;
74 }
75 }
76 }
77 // Populate the list of buttons
78 remoteSelected(remote->currentText());
79
80 if(actionArgs.count() > 2) {
81 // Button
82 for(int i=0;i<button->count();i++) {
83 if(button->text(i) == actionArgs[2]) {
84 button->setCurrentItem(i);
85 break;
86 }
87 }
88 }
89 else {
90 button->setCurrentItem(-1);
91 }
68} 92}
69 93
70ButtonDialog::~ButtonDialog() 94ButtonDialog::~ButtonDialog()
@@ -74,19 +98,14 @@ ButtonDialog::~ButtonDialog()
74 98
75void ButtonDialog::remoteSelected(const QString &string) 99void ButtonDialog::remoteSelected(const QString &string)
76{ 100{
101 button->clear();
77 button->insertStringList(lh->getButtons(string.latin1()) ); 102 button->insertStringList(lh->getButtons(string.latin1()) );
78 list="SEND_ONCE";
79 list+=string;
80}
81
82void ButtonDialog::buttonSelected(const QString &string)
83{
84 list+=string;
85} 103}
86 104
87QStringList ButtonDialog::getList() 105QString ButtonDialog::getAction()
88{ 106{
89 return list; 107 QString action("SEND_ONCE " + remote->currentText() + " " + button->currentText());
108 return action;
90} 109}
91 110
92QString ButtonDialog::getLabel() 111QString ButtonDialog::getLabel()
diff --git a/noncore/tools/remote/buttondialog.h b/noncore/tools/remote/buttondialog.h
index cc697b5..f66903f 100644
--- a/noncore/tools/remote/buttondialog.h
+++ b/noncore/tools/remote/buttondialog.h
@@ -37,17 +37,15 @@ class ButtonDialog : public QDialog
37{ 37{
38 Q_OBJECT 38 Q_OBJECT
39public: 39public:
40 ButtonDialog(QString buttonName, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0); 40 ButtonDialog(QString buttonName, QString action, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0);
41 ~ButtonDialog(); 41 ~ButtonDialog();
42 QStringList getList(); 42 QString getAction();
43 QString getLabel(); 43 QString getLabel();
44public slots: 44public slots:
45 void remoteSelected(const QString &string); 45 void remoteSelected(const QString &string);
46 void buttonSelected(const QString &string);
47private: 46private:
48 QComboBox *remote; 47 QComboBox *remote;
49 QComboBox *button; 48 QComboBox *button;
50 QStringList list;
51 QLineEdit *label; 49 QLineEdit *label;
52 LircHandler *lh; 50 LircHandler *lh;
53}; 51};