Diffstat (limited to 'noncore/tools/remote/remote.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/tools/remote/remote.cpp | 102 |
1 files changed, 54 insertions, 48 deletions
diff --git a/noncore/tools/remote/remote.cpp b/noncore/tools/remote/remote.cpp index 7972def..638629f 100644 --- a/noncore/tools/remote/remote.cpp +++ b/noncore/tools/remote/remote.cpp | |||
@@ -1,46 +1,52 @@ | |||
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" | ||
18 | |||
19 | /* OPIE */ | ||
17 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
19 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | |||
24 | /* QT */ | ||
20 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
21 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
22 | #include <qlayout.h> | 27 | #include <qlayout.h> |
23 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
24 | #include <qpaintdevice.h> | 29 | #include <qpaintdevice.h> |
25 | #include <qobject.h> | 30 | #include <qobject.h> |
31 | |||
32 | /* STD */ | ||
26 | #include <sys/socket.h> | 33 | #include <sys/socket.h> |
27 | #include <sys/types.h> | 34 | #include <sys/types.h> |
28 | #include <sys/un.h> | 35 | #include <sys/un.h> |
29 | #include <unistd.h> | 36 | #include <unistd.h> |
30 | #include <stdio.h> | 37 | #include <stdio.h> |
31 | #include <signal.h> | 38 | #include <signal.h> |
32 | 39 | ||
33 | #include "mainview.h" | ||
34 | 40 | ||
35 | /*void reconnect(int &fd) | 41 | /*void reconnect(int &fd) |
36 | { | 42 | { |
37 | //struct sockaddr_un addr; | 43 | //struct sockaddr_un addr; |
38 | 44 | ||
39 | addr.sun_family=AF_UNIX; | 45 | addr.sun_family=AF_UNIX; |
40 | strcpy(addr.sun_path,"/dev/lircd"); | 46 | strcpy(addr.sun_path,"/dev/lircd"); |
41 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | 47 | fd = socket(AF_UNIX, SOCK_STREAM, 0); |
42 | 48 | ||
43 | if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | 49 | if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) |
44 | { | 50 | { |
45 | QMessageBox *mb = new QMessageBox("error", | 51 | QMessageBox *mb = new QMessageBox("error", |
46 | "couldnt connect to socket", | 52 | "couldnt connect to socket", |
@@ -54,47 +60,47 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
54 | */ | 60 | */ |
55 | 61 | ||
56 | int main( int argc, char **argv ) | 62 | int main( int argc, char **argv ) |
57 | { | 63 | { |
58 | QPEApplication a( argc, argv ); | 64 | QPEApplication a( argc, argv ); |
59 | MainView w; | 65 | MainView w; |
60 | 66 | ||
61 | int fd; | 67 | int fd; |
62 | //struct sockaddr_un addr; | 68 | //struct sockaddr_un addr; |
63 | //char read_buffer[BUFFERSIZE+1]; | 69 | //char read_buffer[BUFFERSIZE+1]; |
64 | //char write_buffer[] = "LIST\n"; | 70 | //char write_buffer[] = "LIST\n"; |
65 | 71 | ||
66 | //addr.sun_family=AF_UNIX; | 72 | //addr.sun_family=AF_UNIX; |
67 | //strcpy(addr.sun_path,"/dev/lircd"); | 73 | //strcpy(addr.sun_path,"/dev/lircd"); |
68 | //fd = socket(AF_UNIX, SOCK_STREAM, 0); | 74 | //fd = socket(AF_UNIX, SOCK_STREAM, 0); |
69 | 75 | ||
70 | //printf("fd1: %d\n", fd); | 76 | //printf("fd1: %d\n", fd); |
71 | /* | 77 | /* |
72 | if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | 78 | if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) |
73 | { | 79 | { |
74 | QMessageBox *mb = new QMessageBox("error", | 80 | QMessageBox *mb = new QMessageBox("error", |
75 | "couldnt connect to socket", | 81 | "couldnt connect to socket", |
76 | QMessageBox::NoIcon, | 82 | QMessageBox::NoIcon, |
77 | QMessageBox::Ok, | 83 | QMessageBox::Ok, |
78 | QMessageBox::NoButton, | 84 | QMessageBox::NoButton, |
79 | QMessageBox::NoButton); | 85 | QMessageBox::NoButton); |
80 | mb->exec(); | 86 | mb->exec(); |
81 | } | 87 | } |
82 | */ | 88 | */ |
83 | 89 | ||
84 | //printf("%d\n", write(fd, write_buffer, sizeof(write_buffer) ) ); | 90 | //printf("%d\n", write(fd, write_buffer, sizeof(write_buffer) ) ); |
85 | 91 | ||
86 | //printf("%d\n", read(fd, read_buffer, BUFFERSIZE ) ); | 92 | //printf("%d\n", read(fd, read_buffer, BUFFERSIZE ) ); |
87 | 93 | ||
88 | //QMessageBox *mbtest = new QMessageBox("lirc test", | 94 | //QMessageBox *mbtest = new QMessageBox("lirc test", |
89 | // *new QString((const char *) read_buffer), | 95 | // *new QString((const char *) read_buffer), |
90 | // QMessageBox::NoIcon, | 96 | // QMessageBox::NoIcon, |
91 | // QMessageBox::Ok, | 97 | // QMessageBox::Ok, |
92 | // QMessageBox::NoButton, | 98 | // QMessageBox::NoButton, |
93 | // QMessageBox::NoButton); | 99 | // QMessageBox::NoButton); |
94 | //mbtest->exec(); | 100 | //mbtest->exec(); |
95 | 101 | ||
96 | a.setMainWidget( &w ); | 102 | a.setMainWidget( &w ); |
97 | w.setIRSocket(fd); | 103 | w.setIRSocket(fd); |
98 | w.showMaximized(); | 104 | QPEApplication::showWidget( &w ); |
99 | return a.exec(); | 105 | return a.exec(); |
100 | } | 106 | } |