00001 /* 00002 Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. 00003 Copyright (C) 2002 Thomas Stephens 00004 00005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public 00006 License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later 00007 version. 00008 00009 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 00010 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 00011 Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free 00014 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00015 */ 00016 00017 #include <qpe/config.h> 00018 #include <qwidget.h> 00019 #include <qlayout.h> 00020 #include <qvbox.h> 00021 #include <qmessagebox.h> 00022 #include <qstring.h> 00023 #include <qsize.h> 00024 #include <qobjectlist.h> 00025 00026 #include <stdio.h> 00027 #include <stdlib.h> 00028 #include <string.h> 00029 #include <sys/socket.h> 00030 #include <sys/types.h> 00031 #include <sys/un.h> 00032 #include <unistd.h> 00033 #include <errno.h> 00034 00035 #include "topgroup.h" 00036 #include "dvdgroup.h" 00037 #include "channelgroup.h" 00038 #include "vcrgroup.h" 00039 00040 #define PACKET_SIZE 256 00041 #define TIMEOUT 3 00042 00043 class RemoteTab : public QWidget 00044 { 00045 Q_OBJECT 00046 public: 00047 RemoteTab(QWidget *parent=0, const char *name=0); 00048 void setIRSocket(int newfd); 00049 const char *readPacket(); 00050 void setConfig(Config *newCfg); 00051 void updateRemotesList(); 00052 public slots: 00053 int sendIR(); 00054 void remoteSelected(const QString &string); 00055 private: 00056 int fd; 00057 int timeout; 00058 struct sockaddr_un addr; 00059 Config *cfg; 00060 TopGroup *topGroup; 00061 DVDGroup *dvdGroup; 00062 VCRGroup *vcrGroup; 00063 ChannelGroup *channelGroup; 00064 };
1.4.2