-rw-r--r-- | noncore/tools/remote/buttondialog.cpp | 45 | ||||
-rw-r--r-- | noncore/tools/remote/buttondialog.h | 6 |
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 | |||
@@ -18,3 +18,4 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
18 | 18 | ||
19 | ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f) | 19 | ButtonDialog::ButtonDialog(QString buttonName, QString action, QWidget *parent, const char*name, bool modal, WFlags f) |
20 | : QDialog(parent, name, modal, f) | ||
20 | { | 21 | { |
@@ -45,3 +46,2 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, | |||
45 | hlayout1->addSpacing(5); | 46 | hlayout1->addSpacing(5); |
46 | remote->insertItem("Remote "); | ||
47 | remote->insertStringList(lh->getRemotes()); | 47 | remote->insertStringList(lh->getRemotes()); |
@@ -56,4 +56,2 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, | |||
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 | ||
@@ -67,2 +65,28 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, | |||
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 | } |
@@ -76,15 +100,10 @@ void 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 | |||
82 | void ButtonDialog::buttonSelected(const QString &string) | ||
83 | { | ||
84 | list+=string; | ||
85 | } | 103 | } |
86 | 104 | ||
87 | QStringList ButtonDialog::getList() | 105 | QString ButtonDialog::getAction() |
88 | { | 106 | { |
89 | return list; | 107 | QString action("SEND_ONCE " + remote->currentText() + " " + button->currentText()); |
108 | return action; | ||
90 | } | 109 | } |
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 | |||
@@ -39,5 +39,5 @@ class ButtonDialog : public QDialog | |||
39 | public: | 39 | public: |
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(); |
@@ -45,3 +45,2 @@ public slots: | |||
45 | void remoteSelected(const QString &string); | 45 | void remoteSelected(const QString &string); |
46 | void buttonSelected(const QString &string); | ||
47 | private: | 46 | private: |
@@ -49,3 +48,2 @@ private: | |||
49 | QComboBox *button; | 48 | QComboBox *button; |
50 | QStringList list; | ||
51 | QLineEdit *label; | 49 | QLineEdit *label; |