summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/remotetab.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/noncore/tools/remote/remotetab.cpp b/noncore/tools/remote/remotetab.cpp
index c89d8c2..065feac 100644
--- a/noncore/tools/remote/remotetab.cpp
+++ b/noncore/tools/remote/remotetab.cpp
@@ -6,109 +6,113 @@ This program is free software; you can redistribute it and/or modify it under th
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version. 7version.
8 8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details. 11Public License for more details.
12 12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/ 15*/
16 16
17#include <qmessagebox.h> 17#include <qmessagebox.h>
18 18
19#include "remotetab.h" 19#include "remotetab.h"
20#include "lirchandler.h" 20#include "lirchandler.h"
21 21
22RemoteTab::RemoteTab(QWidget *parent, const char *name):QWidget(parent,name) 22RemoteTab::RemoteTab(QWidget *parent, const char *name):QWidget(parent,name)
23{ 23{
24 QVBoxLayout *layout = new QVBoxLayout(this); 24 QVBoxLayout *layout = new QVBoxLayout(this);
25 25
26 topGroup = new TopGroup(this); 26 topGroup = new TopGroup(this);
27 //topGroup->setMaximumHeight(22); 27 //topGroup->setMaximumHeight(22);
28 layout->addWidget(topGroup, 0, 0); 28 layout->addWidget(topGroup, 0, 0);
29 printf("%d %d", topGroup->width(), topGroup->height()); 29 printf("%d %d", topGroup->width(), topGroup->height());
30 30
31 layout->addSpacing(1); 31 layout->addSpacing(1);
32 32
33 dvdGroup = new DVDGroup(this); 33 dvdGroup = new DVDGroup(this);
34 //dvdGroup->setMaximumHeight(68); 34 //dvdGroup->setMaximumHeight(68);
35 layout->addWidget(dvdGroup, 0, 0); 35 layout->addWidget(dvdGroup, 0, 0);
36 36
37 layout->addSpacing(1); 37 layout->addSpacing(1);
38 38
39 vcrGroup = new VCRGroup(this); 39 vcrGroup = new VCRGroup(this);
40 layout->addWidget(vcrGroup, 0, 0); 40 layout->addWidget(vcrGroup, 0, 0);
41 //vcrGroup->setMaximumHeight(45); 41 //vcrGroup->setMaximumHeight(45);
42 42
43 layout->addSpacing(1); 43 layout->addSpacing(1);
44 44
45 channelGroup = new ChannelGroup(this); 45 channelGroup = new ChannelGroup(this);
46 //channelGroup->setMaximumHeight(91); 46 //channelGroup->setMaximumHeight(91);
47 layout->addWidget(channelGroup, 0, 0); 47 layout->addWidget(channelGroup, 0, 0);
48 48
49 this->setMaximumWidth(240); 49 this->setMaximumWidth(240);
50} 50}
51 51
52int RemoteTab::sendIR() 52int RemoteTab::sendIR()
53{ 53{
54 LircHandler lh;
55
56 if(!lh.checkLircdConfValid(false))
57 return 0;
58
54 QString curr_remote = topGroup->getRemotesText(); 59 QString curr_remote = topGroup->getRemotesText();
55 if(curr_remote != "") 60 if(curr_remote != "")
56 cfg->setGroup(curr_remote); 61 cfg->setGroup(curr_remote);
57 else { 62 else {
58 QMessageBox::warning(this, tr("Error"), tr("Please select or create\na remote layout"), QMessageBox::Ok, QMessageBox::NoButton); 63 QMessageBox::warning(this, tr("Error"), tr("Please select or create\na remote layout"), QMessageBox::Ok, QMessageBox::NoButton);
59 return 0; 64 return 0;
60 } 65 }
61 66
62 const QObject *button = sender(); 67 const QObject *button = sender();
63 QString string = cfg->readEntry(button->name()); 68 QString string = cfg->readEntry(button->name());
64 if(string != "") { 69 if(string != "") {
65 string+='\n'; 70 string+='\n';
66 LircHandler lh;
67 return lh.sendIR(string.latin1()); 71 return lh.sendIR(string.latin1());
68 } 72 }
69 else { 73 else {
70 QMessageBox::warning(this, tr("Error"), tr("This button has not\nbeen configured"), QMessageBox::Ok, QMessageBox::NoButton); 74 QMessageBox::warning(this, tr("Error"), tr("This button has not\nbeen configured"), QMessageBox::Ok, QMessageBox::NoButton);
71 return 0; 75 return 0;
72 } 76 }
73} 77}
74 78
75void RemoteTab::setConfig(Config *newCfg) 79void RemoteTab::setConfig(Config *newCfg)
76{ 80{
77 cfg = newCfg; 81 cfg = newCfg;
78 cfg->setGroup("Remotes"); 82 cfg->setGroup("Remotes");
79 topGroup->updateRemotes(cfg); 83 topGroup->updateRemotes(cfg);
80 84
81 QString curr_remote = topGroup->getRemotesText(); 85 QString curr_remote = topGroup->getRemotesText();
82 if(curr_remote != "") 86 if(curr_remote != "")
83 remoteSelected(curr_remote); 87 remoteSelected(curr_remote);
84} 88}
85 89
86void RemoteTab::remoteSelected(const QString &string) 90void RemoteTab::remoteSelected(const QString &string)
87{ 91{
88 printf("1%s\n", string.latin1() ); 92 printf("1%s\n", string.latin1() );
89 cfg->setGroup(string); 93 cfg->setGroup(string);
90 const QObject *obj; 94 const QObject *obj;
91 95
92 const QObjectList *objList = topGroup->children(); 96 const QObjectList *objList = topGroup->children();
93 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) 97 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
94 { 98 {
95 if(obj->inherits("QPushButton")) 99 if(obj->inherits("QPushButton"))
96 { 100 {
97 if(cfg->hasKey((QString)obj->name()+"Label")) 101 if(cfg->hasKey((QString)obj->name()+"Label"))
98 { 102 {
99 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") ); 103 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
100 } 104 }
101 else 105 else
102 { 106 {
103 cfg->setGroup("Default"); 107 cfg->setGroup("Default");
104 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") ); 108 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
105 cfg->setGroup(string); 109 cfg->setGroup(string);
106 } 110 }
107 } 111 }
108 } 112 }
109 113
110 objList = dvdGroup->children(); 114 objList = dvdGroup->children();
111 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) 115 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
112 { 116 {
113 if(obj->inherits("QPushButton")) 117 if(obj->inherits("QPushButton"))
114 { 118 {