Diffstat (limited to 'noncore/tools/remote/remote.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/tools/remote/remote.cpp | 73 |
1 files changed, 14 insertions, 59 deletions
diff --git a/noncore/tools/remote/remote.cpp b/noncore/tools/remote/remote.cpp index 35d06bc..67fc57d 100644 --- a/noncore/tools/remote/remote.cpp +++ b/noncore/tools/remote/remote.cpp | |||
@@ -16,90 +16,45 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
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 | /*void reconnect(int &fd) | ||
41 | { | ||
42 | //struct sockaddr_un addr; | ||
43 | |||
44 | addr.sun_family=AF_UNIX; | ||
45 | strcpy(addr.sun_path,"/dev/lircd"); | ||
46 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | ||
47 | |||
48 | if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | ||
49 | { | ||
50 | QMessageBox *mb = new QMessageBox("error", | ||
51 | "couldnt connect to socket", | ||
52 | QMessageBox::NoIcon, | ||
53 | QMessageBox::Ok, | ||
54 | QMessageBox::NoButton, | ||
55 | QMessageBox::NoButton); | ||
56 | mb->exec(); | ||
57 | } | ||
58 | } | ||
59 | */ | ||
60 | |||
61 | int main( int argc, char **argv ) | 40 | int main( int argc, char **argv ) |
62 | { | 41 | { |
63 | QPEApplication a( argc, argv ); | 42 | QPEApplication a( argc, argv ); |
64 | MainView w; | 43 | MainView w; |
65 | |||
66 | int fd; | ||
67 | //struct sockaddr_un addr; | ||
68 | //char read_buffer[BUFFERSIZE+1]; | ||
69 | //char write_buffer[] = "LIST\n"; | ||
70 | |||
71 | //addr.sun_family=AF_UNIX; | ||
72 | //strcpy(addr.sun_path,"/dev/lircd"); | ||
73 | //fd = socket(AF_UNIX, SOCK_STREAM, 0); | ||
74 | |||
75 | //printf("fd1: %d\n", fd); | ||
76 | /* | ||
77 | if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | ||
78 | { | ||
79 | QMessageBox *mb = new QMessageBox("error", | ||
80 | "couldnt connect to socket", | ||
81 | QMessageBox::NoIcon, | ||
82 | QMessageBox::Ok, | ||
83 | QMessageBox::NoButton, | ||
84 | QMessageBox::NoButton); | ||
85 | mb->exec(); | ||
86 | } | ||
87 | */ | ||
88 | |||
89 | //printf("%d\n", write(fd, write_buffer, sizeof(write_buffer) ) ); | ||
90 | |||
91 | //printf("%d\n", read(fd, read_buffer, BUFFERSIZE ) ); | ||
92 | |||
93 | //QMessageBox *mbtest = new QMessageBox("lirc test", | ||
94 | // *new QString((const char *) read_buffer), | ||
95 | // QMessageBox::NoIcon, | ||
96 | // QMessageBox::Ok, | ||
97 | // QMessageBox::NoButton, | ||
98 | // QMessageBox::NoButton); | ||
99 | //mbtest->exec(); | ||
100 | |||
101 | a.setMainWidget( &w ); | 44 | a.setMainWidget( &w ); |
102 | w.setIRSocket(fd); | ||
103 | QPEApplication::showWidget( &w ); | 45 | QPEApplication::showWidget( &w ); |
104 | return a.exec(); | 46 | |
47 | LircHandler lh; | ||
48 | if(!lh.isLircdRunning()) { | ||
49 | QMessageBox mb("Error!", | ||
50 | "Lircd is not running", | ||
51 | QMessageBox::NoIcon, | ||
52 | QMessageBox::Ok, | ||
53 | QMessageBox::NoButton, | ||
54 | QMessageBox::NoButton); | ||
55 | mb.exec(); | ||
56 | |||
57 | } | ||
58 | |||
59 | return a.exec(); | ||
105 | } | 60 | } |