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 <qdialog.h> 00018 #include <qstring.h> 00019 #include <qstringlist.h> 00020 #include <qcombobox.h> 00021 #include <qlayout.h> 00022 #include <qlabel.h> 00023 #include <qlineedit.h> 00024 #include <qmessagebox.h> 00025 #include <stdio.h> 00026 #include <stdlib.h> 00027 #include <string.h> 00028 #include <sys/socket.h> 00029 #include <sys/types.h> 00030 #include <sys/un.h> 00031 #include <unistd.h> 00032 #include <errno.h> 00033 00034 #define PACKET_SIZE 256 00035 #define TIMEOUT 3 00036 00037 class ButtonDialog : public QDialog 00038 { 00039 Q_OBJECT 00040 public: 00041 ButtonDialog(QString buttonName, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0); 00042 void setIRSocket(int newfd); 00043 const char *readPacket(); 00044 QStringList getRemotes(); 00045 QStringList getButtons(const char *remoteName); 00046 QStringList getList(); 00047 QString getLabel(); 00048 public slots: 00049 void remoteSelected(const QString &string); 00050 void buttonSelected(const QString &string); 00051 private: 00052 QComboBox *remote; 00053 QComboBox *button; 00054 QStringList list; 00055 QLineEdit *label; 00056 int fd; 00057 int timeout; 00058 struct sockaddr_un addr; 00059 };
1.4.2