-rw-r--r-- | noncore/tools/remote/mainview.cpp | 5 | ||||
-rw-r--r-- | noncore/tools/remote/mainview.h | 1 | ||||
-rw-r--r-- | noncore/tools/remote/remote.cpp | 18 |
3 files changed, 20 insertions, 4 deletions
diff --git a/noncore/tools/remote/mainview.cpp b/noncore/tools/remote/mainview.cpp index 8c87785..a00a75a 100644 --- a/noncore/tools/remote/mainview.cpp +++ b/noncore/tools/remote/mainview.cpp | |||
@@ -7,48 +7,53 @@ License as published by the Free Software Foundation; either version 2 of the Li | |||
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "mainview.h" | 17 | #include "mainview.h" |
18 | 18 | ||
19 | #include <opie2/oresource.h> | 19 | #include <opie2/oresource.h> |
20 | 20 | ||
21 | MainView::MainView(QWidget *parent, const char *name) : QWidget(parent, name) | 21 | MainView::MainView(QWidget *parent, const char *name) : QWidget(parent, name) |
22 | { | 22 | { |
23 | setIcon( Opie::Core::OResource::loadPixmap( "remote", Opie::Core::OResource::SmallIcon ) ); | 23 | setIcon( Opie::Core::OResource::loadPixmap( "remote", Opie::Core::OResource::SmallIcon ) ); |
24 | setCaption(tr("Remote") ); | 24 | setCaption(tr("Remote") ); |
25 | 25 | ||
26 | QVBoxLayout *layout = new QVBoxLayout(this); | 26 | QVBoxLayout *layout = new QVBoxLayout(this); |
27 | QTabWidget *tabs = new QTabWidget(this); | 27 | QTabWidget *tabs = new QTabWidget(this); |
28 | 28 | ||
29 | layout->addWidget(tabs); | 29 | layout->addWidget(tabs); |
30 | 30 | ||
31 | remote = new RemoteTab(tabs); | 31 | remote = new RemoteTab(tabs); |
32 | learn = new LearnTab(tabs); | 32 | learn = new LearnTab(tabs); |
33 | config = new ConfigTab(tabs); | 33 | config = new ConfigTab(tabs); |
34 | help = new HelpTab(tabs); | 34 | help = new HelpTab(tabs); |
35 | connect(config, SIGNAL(remotesChanged()), this, SLOT(updateRemotesList()) ); | 35 | connect(config, SIGNAL(remotesChanged()), this, SLOT(updateRemotesList()) ); |
36 | 36 | ||
37 | tabs->addTab(remote, tr("Remote") ); | 37 | tabs->addTab(remote, tr("Remote") ); |
38 | tabs->addTab(learn,tr("Learn") ); | 38 | tabs->addTab(learn,tr("Learn") ); |
39 | tabs->addTab(config,tr("Config") ); | 39 | tabs->addTab(config,tr("Config") ); |
40 | tabs->addTab(help, tr("Help") ); | 40 | tabs->addTab(help, tr("Help") ); |
41 | 41 | ||
42 | printf("1\n"); | 42 | printf("1\n"); |
43 | cfg = new Config("Remote"); | 43 | cfg = new Config("Remote"); |
44 | printf("2\n"); | 44 | printf("2\n"); |
45 | 45 | ||
46 | remote->setConfig(cfg); | 46 | remote->setConfig(cfg); |
47 | config->setConfig(cfg); | 47 | config->setConfig(cfg); |
48 | } | 48 | } |
49 | 49 | ||
50 | void MainView::updateRemotesList() | 50 | void MainView::updateRemotesList() |
51 | { | 51 | { |
52 | remote->updateRemotesList(); | 52 | remote->updateRemotesList(); |
53 | printf("MainView: got remotes changed signal\n"); | 53 | printf("MainView: got remotes changed signal\n"); |
54 | } | 54 | } |
55 | |||
56 | void MainView::updateLearnTab() | ||
57 | { | ||
58 | learn->updateRemotesList(); | ||
59 | } | ||
diff --git a/noncore/tools/remote/mainview.h b/noncore/tools/remote/mainview.h index b1ddde4..26b8086 100644 --- a/noncore/tools/remote/mainview.h +++ b/noncore/tools/remote/mainview.h | |||
@@ -1,52 +1,53 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qtabwidget.h> | 20 | #include <qtabwidget.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qpaintdevice.h> | 23 | #include <qpaintdevice.h> |
24 | #include <qobject.h> | 24 | #include <qobject.h> |
25 | #include <sys/socket.h> | 25 | #include <sys/socket.h> |
26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
27 | #include <sys/un.h> | 27 | #include <sys/un.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | #include <signal.h> | 30 | #include <signal.h> |
31 | 31 | ||
32 | #include "remotetab.h" | 32 | #include "remotetab.h" |
33 | #include "learntab.h" | 33 | #include "learntab.h" |
34 | #include "configtab.h" | 34 | #include "configtab.h" |
35 | #include "helptab.h" | 35 | #include "helptab.h" |
36 | 36 | ||
37 | #define BUFFERSIZE 256 | 37 | #define BUFFERSIZE 256 |
38 | 38 | ||
39 | class MainView : public QWidget | 39 | class MainView : public QWidget |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
43 | MainView(QWidget *parent=0, const char *name=0); | 43 | MainView(QWidget *parent=0, const char *name=0); |
44 | public slots: | 44 | public slots: |
45 | void updateRemotesList(); | 45 | void updateRemotesList(); |
46 | void updateLearnTab(); | ||
46 | private: | 47 | private: |
47 | RemoteTab *remote; | 48 | RemoteTab *remote; |
48 | ConfigTab *config; | 49 | ConfigTab *config; |
49 | LearnTab *learn; | 50 | LearnTab *learn; |
50 | HelpTab *help; | 51 | HelpTab *help; |
51 | Config *cfg; | 52 | Config *cfg; |
52 | }; | 53 | }; |
diff --git a/noncore/tools/remote/remote.cpp b/noncore/tools/remote/remote.cpp index 5b756cb..03d70c4 100644 --- a/noncore/tools/remote/remote.cpp +++ b/noncore/tools/remote/remote.cpp | |||
@@ -1,64 +1,74 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "mainview.h" | 17 | #include "mainview.h" |
18 | 18 | ||
19 | /* OPIE */ | 19 | /* OPIE */ |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | 22 | ||
23 | /* QT */ | 23 | /* QT */ |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qtabwidget.h> | 25 | #include <qtabwidget.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qpaintdevice.h> | 28 | #include <qpaintdevice.h> |
29 | #include <qobject.h> | 29 | #include <qobject.h> |
30 | 30 | ||
31 | /* STD */ | 31 | /* STD */ |
32 | #include <sys/socket.h> | 32 | #include <sys/socket.h> |
33 | #include <sys/types.h> | 33 | #include <sys/types.h> |
34 | #include <sys/un.h> | 34 | #include <sys/un.h> |
35 | #include <unistd.h> | 35 | #include <unistd.h> |
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | #include <signal.h> | 37 | #include <signal.h> |
38 | 38 | ||
39 | 39 | ||
40 | int main( int argc, char **argv ) | 40 | int main( int argc, char **argv ) |
41 | { | 41 | { |
42 | QPEApplication a( argc, argv ); | 42 | QPEApplication a( argc, argv ); |
43 | 43 | ||
44 | LircHandler lh; | 44 | LircHandler lh; |
45 | bool disablelirc = false; | ||
45 | 46 | ||
46 | lh.disableIrDA(); | 47 | lh.disableIrDA(); |
47 | lh.setupModules(); | 48 | lh.setupModules(); |
48 | lh.startLircd(); | 49 | lh.startLircd(); |
49 | if(!lh.isLircdRunning()) { | 50 | |
50 | QMessageBox::critical(NULL, QObject::tr("Error"), | 51 | if(lh.checkLircdConfValid(false)) { |
51 | QObject::tr("Unable to start lircd"), | 52 | if(!lh.isLircdRunning()) { |
52 | QMessageBox::Ok, QMessageBox::NoButton); | 53 | QMessageBox::critical(NULL, QObject::tr("Error"), |
54 | QObject::tr("Unable to start lircd"), | ||
55 | QMessageBox::Ok, QMessageBox::NoButton); | ||
56 | disablelirc = true; | ||
57 | } | ||
58 | } | ||
59 | else { | ||
60 | disablelirc = true; | ||
53 | } | 61 | } |
54 | 62 | ||
55 | MainView w; | 63 | MainView w; |
64 | if(!disablelirc) | ||
65 | w.updateLearnTab(); | ||
56 | a.setMainWidget( &w ); | 66 | a.setMainWidget( &w ); |
57 | QPEApplication::showWidget( &w ); | 67 | QPEApplication::showWidget( &w ); |
58 | int result = a.exec(); | 68 | int result = a.exec(); |
59 | 69 | ||
60 | lh.stopLircd(); | 70 | lh.stopLircd(); |
61 | lh.cleanupModules(); | 71 | lh.cleanupModules(); |
62 | 72 | ||
63 | return result; | 73 | return result; |
64 | } | 74 | } |