summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-05-12 08:39:15 (UTC)
committer harlekin <harlekin>2002-05-12 08:39:15 (UTC)
commit8362e586d0fd9a0ad6cea3f26d624a05196a60f8 (patch) (unidiff)
tree82bd5b113cd9f526c6555888cffbfdd907406eb9
parent28e86f19c9da68dca417b531e63e534c4545916b (diff)
downloadopie-8362e586d0fd9a0ad6cea3f26d624a05196a60f8.zip
opie-8362e586d0fd9a0ad6cea3f26d624a05196a60f8.tar.gz
opie-8362e586d0fd9a0ad6cea3f26d624a05196a60f8.tar.bz2
opie remote control
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/INSTALL12
-rw-r--r--noncore/tools/remote/LICENSE258
-rw-r--r--noncore/tools/remote/README24
-rw-r--r--noncore/tools/remote/buttondialog.cpp268
-rw-r--r--noncore/tools/remote/buttondialog.h59
-rw-r--r--noncore/tools/remote/buttonlist35
-rw-r--r--noncore/tools/remote/channelgroup.cpp100
-rw-r--r--noncore/tools/remote/channelgroup.h26
-rw-r--r--noncore/tools/remote/channelgroupconf.cpp100
-rw-r--r--noncore/tools/remote/channelgroupconf.h26
-rw-r--r--noncore/tools/remote/configtab.cpp218
-rw-r--r--noncore/tools/remote/configtab.h55
-rw-r--r--noncore/tools/remote/dvdgroup.cpp93
-rw-r--r--noncore/tools/remote/dvdgroup.h27
-rw-r--r--noncore/tools/remote/dvdgroupconf.cpp87
-rw-r--r--noncore/tools/remote/dvdgroupconf.h25
-rw-r--r--noncore/tools/remote/learntab.cpp26
-rw-r--r--noncore/tools/remote/learntab.h26
-rw-r--r--noncore/tools/remote/mainconfig.cpp22
-rw-r--r--noncore/tools/remote/mainconfig.h31
-rw-r--r--noncore/tools/remote/mainview.cpp68
-rw-r--r--noncore/tools/remote/mainview.h54
-rw-r--r--noncore/tools/remote/opie-remote.control10
-rw-r--r--noncore/tools/remote/packetread.h200
-rw-r--r--noncore/tools/remote/remote.cpp100
-rw-r--r--noncore/tools/remote/remote.pro9
-rw-r--r--noncore/tools/remote/remotetab.cpp250
-rw-r--r--noncore/tools/remote/remotetab.h64
-rw-r--r--noncore/tools/remote/topgroup.cpp54
-rw-r--r--noncore/tools/remote/topgroup.h31
-rw-r--r--noncore/tools/remote/topgroupconf.cpp70
-rw-r--r--noncore/tools/remote/topgroupconf.h34
-rw-r--r--noncore/tools/remote/vcrgroup.cpp88
-rw-r--r--noncore/tools/remote/vcrgroup.h27
-rw-r--r--noncore/tools/remote/vcrgroupconf.cpp73
-rw-r--r--noncore/tools/remote/vcrgroupconf.h25
36 files changed, 2675 insertions, 0 deletions
diff --git a/noncore/tools/remote/INSTALL b/noncore/tools/remote/INSTALL
new file mode 100644
index 0000000..02f9d6c
--- a/dev/null
+++ b/noncore/tools/remote/INSTALL
@@ -0,0 +1,12 @@
1requires cross compiler, qt/e, and opie sources or qtopia sdk to compile
2
31. extract into opie source directory
42. add LOCALAPPS=remote to top of opie makefile (or, just add "remote" to the LOCALAPPS variable, if it already exists
53. run ./configure -platform ipaq in opie directory
64. cd remote
75. make
86. binary is ../bin/remote, you might want to run arm-linux-strip before you use it.
97. executable and remote.desktop to ipaq.
108. chmod a+x remote on ipaq
119. copy binary to /opt/QtPalmtop/bin
1210. copy remote.desktop to /opt/QtPalmtop/apps/Applications
diff --git a/noncore/tools/remote/LICENSE b/noncore/tools/remote/LICENSE
new file mode 100644
index 0000000..30ffb17
--- a/dev/null
+++ b/noncore/tools/remote/LICENSE
@@ -0,0 +1,258 @@
1Copyright (C) 1989, 1991 Free Software Foundation, Inc.
2 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3
4 Everyone is permitted to copy and distribute verbatim copies
5 of this license document, but changing it is not allowed.
6
7Preamble
8
9The licenses for most software are designed to take away your freedom to share
10 and change it. By contrast, the GNU General Public License is intended to
11 guarantee your freedom to share and change free software--to make sure the
12 software is free for all its users. This General Public License applies to most
13 of the Free Software Foundation's software and to any other program whose
14 authors commit to using it. (Some other Free Software Foundation software is
15 covered by the GNU Library General Public License instead.) You can apply it to
16 your programs, too.
17
18When we speak of free software, we are referring to freedom, not price. Our
19 General Public Licenses are designed to make sure that you have the freedom to
20 distribute copies of free software (and charge for this service if you wish),
21 that you receive source code or can get it if you want it, that you can change
22 the software or use pieces of it in new free programs; and that you know you
23 can do these things.
24
25 To protect your rights, we need to make restrictions that forbid anyone to deny
26 you these rights or to ask you to surrender the rights. These restrictions
27 translate to certain responsibilities for you if you distribute copies of the
28 software, or if you modify it.
29
30For example, if you distribute copies of such a program, whether gratis or for a
31 fee, you must give the recipients all the rights that you have. You must make
32 sure that they, too, receive or can get the source code. And you must show them
33 these terms so they know their rights.
34
35We protect your rights with two steps: (1) copyright the software, and (2) offer
36 you this license which gives you legal permission to copy, distribute and/or
37 modify the software.
38
39Also, for each author's protection and ours, we want to make certain that
40 everyone understands that there is no warranty for this free software. If the
41 software is modified by someone else and passed on, we want its recipients to
42 know that what they have is not the original, so that any problems introduced
43 by others will not reflect on the original authors' reputations.
44
45Finally, any free program is threatened constantly by software patents. We wish
46 to avoid the danger that redistributors of a free program will individually
47 obtain patent licenses, in effect making the program proprietary. To prevent
48 this, we have made it clear that any patent must be licensed for everyone's
49 free use or not licensed at all.
50
51The precise terms and conditions for copying, distribution and modification
52 follow.
53
54TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
55
560. This License applies to any program or other work which contains a notice
57 placed by the copyright holder saying it may be distributed under the terms of
58 this General Public License. The "Program", below, refers to any such program
59 or work, and a "work based on the Program" means either the Program or any
60 derivative work under copyright law: that is to say, a work containing the
61 Program or a portion of it, either verbatim or with modifications and/or
62 translated into another language. (Hereinafter, translation is included without
63 limitation in the term "modification".) Each licensee is addressed as "you".
64
65Activities other than copying, distribution and modification are not covered by
66 this License; they are outside its scope. The act of running the Program is not
67 restricted, and the output from the Program is covered only if its contents
68 constitute a work based on the Program (independent of having been made by
69 running the Program). Whether that is true depends on what the Program does.
70
711. You may copy and distribute verbatim copies of the Program's source code as
72 you receive it, in any medium, provided that you conspicuously and
73 appropriately publish on each copy an appropriate copyright notice and
74 disclaimer of warranty; keep intact all the notices that refer to this License
75 and to the absence of any warranty; and give any other recipients of the
76 Program a copy of this License along with the Program.
77
78You may charge a fee for the physical act of transferring a copy, and you may at
79 your option offer warranty protection in exchange for a fee.
80
812. You may modify your copy or copies of the Program or any portion of it, thus
82 forming a work based on the Program, and copy and distribute such modifications
83 or work under the terms of Section 1 above, provided that you also meet all of
84 these conditions:
85
86
87a) You must cause the modified files to carry prominent notices stating that you
88 changed the files and the date of any change.
89
90b) You must cause any work that you distribute or publish, that in whole or in
91 part contains or is derived from the Program or any part thereof, to be
92 licensed as a whole at no charge to all third parties under the terms of this
93 License.
94
95c) If the modified program normally reads commands interactively when run, you
96 must cause it, when started running for such interactive use in the most
97 ordinary way, to print or display an announcement including an appropriate
98 copyright notice and a notice that there is no warranty (or else, saying that
99 you provide a warranty) and that users may redistribute the program under these
100 conditions, and telling the user how to view a copy of this License.
101 (Exception: if the Program itself is interactive but does not normally print
102 such an announcement, your work based on the Program is not required to print
103 an announcement.)
104
105These requirements apply to the modified work as a whole. If identifiable
106 sections of that work are not derived from the Program, and can be reasonably
107 considered independent and separate works in themselves, then this License, and
108 its terms, do not apply to those sections when you distribute them as separate
109 works. But when you distribute the same sections as part of a whole which is a
110 work based on the Program, the distribution of the whole must be on the terms
111 of this License, whose permissions for other licensees extend to the entire
112 whole, and thus to each and every part regardless of who wrote it.
113
114Thus, it is not the intent of this section to claim rights or contest your
115 rights to work written entirely by you; rather, the intent is to exercise the
116 right to control the distribution of derivative or collective works based on
117 the Program.
118
119In addition, mere aggregation of another work not based on the Program with the
120 Program (or with a work based on the Program) on a volume of a storage or
121 distribution medium does not bring the other work under the scope of this
122 License.
123
1243. You may copy and distribute the Program (or a work based on it, under Section
125 2) in object code or executable form under the terms of Sections 1 and 2 above
126 provided that you also do one of the following:
127
128
129a) Accompany it with the complete corresponding machine-readable source code,
130 which must be distributed under the terms of Sections 1 and 2 above on a medium
131 customarily used for software interchange; or,
132
133 b) Accompany it with a written offer, valid for at least three years, to give
134 any third party, for a charge no more than your cost of physically performing
135 source distribution, a complete machine-readable copy of the corresponding
136 source code, to be distributed under the terms of Sections 1 and 2 above on a
137 medium customarily used for software interchange; or,
138
139c) Accompany it with the information you received as to the offer to distribute
140 corresponding source code. (This alternative is allowed only for noncommercial
141 distribution and only if you received the program in object code or executable
142 form with such an offer, in accord with Subsection b above.)
143
144The source code for a work means the preferred form of the work for making
145 modifications to it. For an executable work, complete source code means all the
146 source code for all modules it contains, plus any associated interface
147 definition files, plus the scripts used to control compilation and installation
148 of the executable. However, as a special exception, the source code distributed
149 need not include anything that is normally distributed (in either source or
150 binary form) with the major components (compiler, kernel, and so on) of the
151 operating system on which the executable runs, unless that component itself
152 accompanies the executable.
153
154If distribution of executable or object code is made by offering access to copy
155 from a designated place, then offering equivalent access to copy the source
156 code from the same place counts as distribution of the source code, even though
157 third parties are not compelled to copy the source along with the object code.
158
1594. You may not copy, modify, sublicense, or distribute the Program except as
160 expressly provided under this License. Any attempt otherwise to copy, modify,
161 sublicense or distribute the Program is void, and will automatically terminate
162 your rights under this License. However, parties who have received copies, or
163 rights, from you under this License will not have their licenses terminated so
164 long as such parties remain in full compliance.
165
1665. You are not required to accept this License, since you have not signed it.
167 However, nothing else grants you permission to modify or distribute the Program
168 or its derivative works. These actions are prohibited by law if you do not
169 accept this License. Therefore, by modifying or distributing the Program (or
170 any work based on the Program), you indicate your acceptance of this License to
171 do so, and all its terms and conditions for copying, distributing or modifying
172 the Program or works based on it.
173
1746. Each time you redistribute the Program (or any work based on the Program),
175 the recipient automatically receives a license from the original licensor to
176 copy, distribute or modify the Program subject to these terms and conditions.
177 You may not impose any further restrictions on the recipients' exercise of the
178 rights granted herein. You are not responsible for enforcing compliance by
179 third parties to this License.
180
1817. If, as a consequence of a court judgment or allegation of patent infringement
182 or for any other reason (not limited to patent issues), conditions are imposed
183 on you (whether by court order, agreement or otherwise) that contradict the
184 conditions of this License, they do not excuse you from the conditions of this
185 License. If you cannot distribute so as to satisfy simultaneously your
186 obligations under this License and any other pertinent obligations, then as a
187 consequence you may not distribute the Program at all. For example, if a patent
188 license would not permit royalty-free redistribution of the Program by all
189 those who receive copies directly or indirectly through you, then the only way
190 you could satisfy both it and this License would be to refrain entirely from
191 distribution of the Program.
192
193If any portion of this section is held invalid or unenforceable under any
194 particular circumstance, the balance of the section is intended to apply and
195 the section as a whole is intended to apply in other circumstances.
196
197It is not the purpose of this section to induce you to infringe any patents or
198 other property right claims or to contest validity of any such claims; this
199 section has the sole purpose of protecting the integrity of the free software
200 distribution system, which is implemented by public license practices. Many
201 people have made generous contributions to the wide range of software
202 distributed through that system in reliance on consistent application of that
203 system; it is up to the author/donor to decide if he or she is willing to
204 distribute software through any other system and a licensee cannot impose that
205 choice.
206
207 This section is intended to make thoroughly clear what is believed to be a
208 consequence of the rest of this License.
209
2108. If the distribution and/or use of the Program is restricted in certain
211 countries either by patents or by copyrighted interfaces, the original
212 copyright holder who places the Program under this License may add an explicit
213 geographical distribution limitation excluding those countries, so that
214 distribution is permitted only in or among countries not thus excluded. In such
215 case, this License incorporates the limitation as if written in the body of
216 this License.
217
2189. The Free Software Foundation may publish revised and/or new versions of the
219 General Public License from time to time. Such new versions will be similar in
220 spirit to the present version, but may differ in detail to address new problems
221 or concerns.
222
223Each version is given a distinguishing version number. If the Program specifies
224 a version number of this License which applies to it and "any later version",
225 you have the option of following the terms and conditions either of that
226 version or of any later version published by the Free Software Foundation. If
227 the Program does not specify a version number of this License, you may choose
228 any version ever published by the Free Software Foundation.
229
23010. If you wish to incorporate parts of the Program into other free programs
231 whose distribution conditions are different, write to the author to ask for
232 permission. For software which is copyrighted by the Free Software Foundation,
233 write to the Free Software Foundation; we sometimes make exceptions for this.
234 Our decision will be guided by the two goals of preserving the free status of
235 all derivatives of our free software and of promoting the sharing and reuse of
236 software generally.
237
238NO WARRANTY
239
24011. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE
241 PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
242 STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
243 PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
244 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
245 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
246 PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU
247 ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
248
24912. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
250 ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
251 PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
252 GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
253 INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
254 BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
255 FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
256 OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
257
258END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/noncore/tools/remote/README b/noncore/tools/remote/README
new file mode 100644
index 0000000..6f8a0c2
--- a/dev/null
+++ b/noncore/tools/remote/README
@@ -0,0 +1,24 @@
1opie-remote
2
3Opie-remote is a remote control emulator for the Compaq iPaq and the Sharp
4Zaurus. It requires lirc (http://www.lirc.org) to run. There are lirc ipkgs
5for the iPaq in the Handhelds.org feed. You must first install the
6lirc-modules-[kernel version] ipkg, and then the lirc ipkg with the
7-force-depends option. The Zaurus is supported, but requires you to compile
8from lirc's CVS. Zaurus support should be in lirc 0.6.6 and up. Check the learn
9tab in opie-remote for more detailed configuration and usage instructions.
10
11I will talk to the Open Zaurus people about providing an lirc ipkg for the
12Zaurus, but i cant make one, as i dont have a Zaurus, and cannot test it.
13
14todo:
15add a frontend for irrecord (to make it a true learning remote)
16make the UI completely user configurable (button layout, position, etc)
17ButtonDialog needs to support default remote and button settings, so what the
18button is already set to shows up.
19fix any bugs
20
21contact info:
22thomas: spiralman@softhome.net (currently the only developer)
23im also on #opie and #handhelds.org on irc.openprojects.net a lot, so look for
24me there.
diff --git a/noncore/tools/remote/buttondialog.cpp b/noncore/tools/remote/buttondialog.cpp
new file mode 100644
index 0000000..e7ff4b4
--- a/dev/null
+++ b/noncore/tools/remote/buttondialog.cpp
@@ -0,0 +1,268 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "buttondialog.h"
18
19ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0):QDialog(parent, name, modal, f)
20{
21 setCaption(tr(buttonName));
22
23 QVBoxLayout *layout = new QVBoxLayout(this);
24
25 QHBoxLayout *hlayout1 = new QHBoxLayout(this);
26 QHBoxLayout *hlayout2 = new QHBoxLayout(this);
27 QHBoxLayout *hlayout3 = new QHBoxLayout(this);
28
29 layout->addSpacing(5);
30 layout->addLayout(hlayout1);
31 layout->addSpacing(5);
32 layout->addLayout(hlayout2);
33 layout->addSpacing(5);
34 layout->addLayout(hlayout3);
35 layout->addSpacing(5);
36
37 remote = new QComboBox(false, this, "remote");
38 QLabel *remoteLabel = new QLabel(remote, "Remote: ", this, "remoteLabel");
39 hlayout1->addSpacing(5);
40 hlayout1->addWidget(remoteLabel);
41 hlayout1->addSpacing(5);
42 hlayout1->addWidget(remote);
43 hlayout1->addSpacing(5);
44 remote->insertItem("Remote ");
45 remote->insertStringList(getRemotes());
46 connect(remote, SIGNAL(activated(const QString &)), this, SLOT(remoteSelected(const QString&)) );
47
48 button = new QComboBox(false, this, "button");
49 QLabel *buttonLabel = new QLabel(remote, "Button: ", this, "buttonLabel");
50 hlayout2->addSpacing(5);
51 hlayout2->addWidget(buttonLabel);
52 hlayout2->addSpacing(5);
53 hlayout2->addWidget(button);
54 hlayout2->addSpacing(5);
55 button->insertItem("Button ");
56 connect(button, SIGNAL(activated(const QString &)), this, SLOT(buttonSelected(const QString&)) );
57
58 label = new QLineEdit(this, "label");
59 label->setText(buttonName);
60 QLabel *labelLabel = new QLabel(label, "Label: ", this, "labelLabel");
61 hlayout3->addSpacing(5);
62 hlayout3->addWidget(labelLabel);
63 hlayout3->addSpacing(5);
64 hlayout3->addWidget(label);
65 hlayout3->addSpacing(5);
66}
67
68void ButtonDialog::remoteSelected(const QString &string)
69{
70 button->insertStringList(getButtons(string.latin1()) );
71 list="SEND_ONCE";
72 list+=string;
73}
74
75void ButtonDialog::buttonSelected(const QString &string)
76{
77 list+=string;
78}
79
80QStringList ButtonDialog::getList()
81{
82 return list;
83}
84
85QString ButtonDialog::getLabel()
86{
87 return label->text();
88}
89
90QStringList ButtonDialog::getRemotes()
91{
92 const char write_buffer[] = "LIST\n";
93 const char *readbuffer;
94 int i, numlines;
95 QStringList list;
96
97 addr.sun_family=AF_UNIX;
98 strcpy(addr.sun_path,"/dev/lircd");
99
100 fd = socket(AF_UNIX, SOCK_STREAM, 0);
101
102 if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
103 {
104 QMessageBox *mb = new QMessageBox("Error!",
105 "couldnt connect to socket",
106 QMessageBox::NoIcon,
107 QMessageBox::Ok,
108 QMessageBox::NoButton,
109 QMessageBox::NoButton);
110 mb->exec();
111 perror("ButtonDialog::GetRemotes");
112 return NULL;
113 }
114
115 write(fd, write_buffer, strlen(write_buffer));
116
117 for(i=0; i<5; i++)
118 {
119 printf("%d\n", i);
120 readbuffer = readPacket();
121 printf("%s", readbuffer);
122 printf("%d\n", i);
123 }
124
125 numlines = atoi(readbuffer);
126
127 for(i=0; i<numlines; i++)
128 {
129 list+=readPacket();
130 }
131
132 if(strcasecmp(readPacket(), "END") != 0)
133 {
134 QMessageBox *mb = new QMessageBox("Error!",
135 "bad packet",
136 QMessageBox::NoIcon,
137 QMessageBox::Ok,
138 QMessageBox::NoButton,
139 QMessageBox::NoButton);
140 mb->exec();
141 perror("ButtonDialog::GetRemotes");
142 return NULL;
143 }
144
145 std::close(fd);
146 return list;
147}
148
149QStringList ButtonDialog::getButtons(const char *remoteName)
150{
151 QString write_buffer = "LIST ";
152 const char *readbuffer;
153 int i, j, numlines;
154 QStringList list;
155 QString string;
156
157 write_buffer += remoteName;
158 write_buffer += '\n';
159
160 fd = socket(AF_UNIX, SOCK_STREAM, 0);
161
162 if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
163 {
164 QMessageBox *mb = new QMessageBox("Error!",
165 "couldnt connect to socket",
166 QMessageBox::NoIcon,
167 QMessageBox::Ok,
168 QMessageBox::NoButton,
169 QMessageBox::NoButton);
170 mb->exec();
171 perror("ButtonDialog::GetButtons");
172 return NULL;
173 }
174
175 write(fd, write_buffer.latin1(), strlen(write_buffer) );
176
177 for(i=0; i<5; i++)
178 {
179 readbuffer = readPacket();
180 }
181
182 numlines = atoi(readbuffer);
183
184 for(i=0; i<numlines; i++)
185 {
186 list+=readPacket();
187 for(j=0; j<list[i].length(); j++)
188 {
189 if(list[i][j] == ' ')
190 break;
191 }
192 list[i].remove(0, j+1);
193 }
194
195 if(strcasecmp(readPacket(), "END") != 0)
196 {
197 QMessageBox *mb = new QMessageBox("Error!",
198 "bad packet",
199 QMessageBox::NoIcon,
200 QMessageBox::Ok,
201 QMessageBox::NoButton,
202 QMessageBox::NoButton);
203 mb->exec();
204 perror("ButtonDialog::GetButtons");
205 return NULL;
206 }
207
208 std::close(fd);
209 return list;
210}
211
212
213//this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html
214const char *ButtonDialog::readPacket()
215{
216 static char buffer[PACKET_SIZE+1]="";
217 char *end;
218 static int ptr=0,end_len=0;
219 ssize_t ret;
220 timeout = 0;
221
222 if(ptr>0)
223 {
224 memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1);
225 ptr=strlen(buffer);
226 end=strchr(buffer,'\n');
227 }
228 else
229 {
230 end=NULL;
231 }
232 alarm(TIMEOUT);
233 while(end==NULL)
234 {
235 if(PACKET_SIZE<=ptr)
236 {
237 fprintf(stderr,"bad packet\n");
238 ptr=0;
239 return(NULL);
240 }
241 ret=read(fd,buffer+ptr,PACKET_SIZE-ptr);
242
243 if(ret<=0 || timeout)
244 {
245 if(timeout)
246 {
247 fprintf(stderr,"timeout\n");
248 }
249 else
250 {
251 alarm(0);
252 }
253 ptr=0;
254 return(NULL);
255 }
256 buffer[ptr+ret]=0;
257 ptr=strlen(buffer);
258 end=strchr(buffer,'\n');
259 }
260 alarm(0);timeout=0;
261
262 end[0]=0;
263 ptr=strlen(buffer)+1;
264//# ifdef DEBUG
265 //printf("buffer: -%s-\n",buffer);
266//# endif
267 return(buffer);
268}
diff --git a/noncore/tools/remote/buttondialog.h b/noncore/tools/remote/buttondialog.h
new file mode 100644
index 0000000..33dc4ef
--- a/dev/null
+++ b/noncore/tools/remote/buttondialog.h
@@ -0,0 +1,59 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qdialog.h>
18#include <qstring.h>
19#include <qstringlist.h>
20#include <qcombobox.h>
21#include <qlayout.h>
22#include <qlabel.h>
23#include <qlineedit.h>
24#include <qmessagebox.h>
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28#include <sys/socket.h>
29#include <sys/types.h>
30#include <sys/un.h>
31#include <unistd.h>
32#include <errno.h>
33
34#define PACKET_SIZE 256
35#define TIMEOUT 3
36
37class ButtonDialog : public QDialog
38{
39 Q_OBJECT
40public:
41 ButtonDialog(QString buttonName, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0);
42 void setIRSocket(int newfd);
43 const char *readPacket();
44 QStringList getRemotes();
45 QStringList getButtons(const char *remoteName);
46 QStringList getList();
47 QString getLabel();
48public slots:
49 void remoteSelected(const QString &string);
50 void buttonSelected(const QString &string);
51private:
52 QComboBox *remote;
53 QComboBox *button;
54 QStringList list;
55 QLineEdit *label;
56 int fd;
57 int timeout;
58 struct sockaddr_un addr;
59};
diff --git a/noncore/tools/remote/buttonlist b/noncore/tools/remote/buttonlist
new file mode 100644
index 0000000..543c361
--- a/dev/null
+++ b/noncore/tools/remote/buttonlist
@@ -0,0 +1,35 @@
1power
2source
3eject
4menu
5top
6left
7enter
8right
9up
10down
11audio
12sub
13angle
14play
15pause
16stop
17record
18back
19rewind
20ff
21next
22vol+
23vol-
24chan+
25chan-
261
272
283
294
305
316
327
338
349
350 \ No newline at end of file
diff --git a/noncore/tools/remote/channelgroup.cpp b/noncore/tools/remote/channelgroup.cpp
new file mode 100644
index 0000000..9f90284
--- a/dev/null
+++ b/noncore/tools/remote/channelgroup.cpp
@@ -0,0 +1,100 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "channelgroup.h"
18
19ChannelGroup::ChannelGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name)
20{
21 QGridLayout *layout = new QGridLayout(this);
22 QVBoxLayout *volLayout = new QVBoxLayout(this);
23 QVBoxLayout *chanLayout = new QVBoxLayout(this);
24
25 layout->addRowSpacing(1,1);
26 layout->addRowSpacing(3,1);
27 layout->addRowSpacing(5,1);
28
29 layout->addColSpacing(1,1);
30 layout->addColSpacing(3,1);
31 layout->addColSpacing(5,1);
32 layout->addColSpacing(7,1);
33
34 QPushButton *one = new QPushButton("1", this, "one");
35 layout->addWidget(one, 0, 2, 0);
36 connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
37
38 QPushButton *two = new QPushButton("2", this, "two");
39 layout->addWidget(two, 0, 4, 0);
40 connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
41
42 QPushButton *three = new QPushButton("3", this, "three");
43 layout->addWidget(three, 0, 6, 0);
44 connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
45
46 QPushButton *four = new QPushButton("4", this, "four");
47 layout->addWidget(four, 2, 2, 0);
48 connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
49
50 QPushButton *five = new QPushButton("5", this, "five");
51 layout->addWidget(five, 2, 4, 0);
52 connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
53
54 QPushButton *six = new QPushButton("6", this, "six");
55 layout->addWidget(six, 2, 6, 0);
56 connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
57
58 QPushButton *seven = new QPushButton("7", this, "seven");
59 layout->addWidget(seven, 4, 2, 0);
60 connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
61
62 QPushButton *eight = new QPushButton("8", this, "eight");
63 layout->addWidget(eight, 4, 4, 0);
64 connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
65
66 QPushButton *nine = new QPushButton("9", this, "nine");
67 layout->addWidget(nine, 4, 6, 0);
68 connect(nine, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
69
70 QPushButton *zero = new QPushButton("0", this, "zero");
71 layout->addWidget(zero, 6, 4, 0);
72 connect(zero, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
73
74 layout->addMultiCellLayout(volLayout, 0, 6, 0, 0, 0);
75 layout->addMultiCellLayout(chanLayout, 0, 6, 8, 8, 0);
76
77 QPushButton *volUp = new QPushButton("+", this, "volUp");
78 volLayout->addWidget(volUp, 1, 0);
79 connect(volUp, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
80
81 QLabel *volLabel = new QLabel("Volume ", this, "volLabel");
82 volLayout->addWidget(volLabel, 0, 0);
83
84 QPushButton *volDown = new QPushButton("-", this, "volDown");
85 volLayout->addWidget(volDown, 1, 0);
86 connect(volDown, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
87
88
89 QPushButton *chanUp = new QPushButton("+", this, "chanUp");
90 chanLayout->addWidget(chanUp, 1, 0);
91 connect(chanUp, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
92
93 QLabel *chanLabel = new QLabel("Channel", this, "chanLabel");
94 chanLayout->addWidget(chanLabel, 0, 0);
95
96 QPushButton *chanDown = new QPushButton("-", this, "chanDown");
97 chanLayout->addWidget(chanDown, 1, 0);
98 connect(chanDown, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
99
100}
diff --git a/noncore/tools/remote/channelgroup.h b/noncore/tools/remote/channelgroup.h
new file mode 100644
index 0000000..0b7b114
--- a/dev/null
+++ b/noncore/tools/remote/channelgroup.h
@@ -0,0 +1,26 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qwidget.h>
18#include <qpushbutton.h>
19#include <qlayout.h>
20#include <qlabel.h>
21
22class ChannelGroup : public QWidget
23{
24public:
25 ChannelGroup(QWidget *parent=0, const char *name=0);
26};
diff --git a/noncore/tools/remote/channelgroupconf.cpp b/noncore/tools/remote/channelgroupconf.cpp
new file mode 100644
index 0000000..2d98115
--- a/dev/null
+++ b/noncore/tools/remote/channelgroupconf.cpp
@@ -0,0 +1,100 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "channelgroupconf.h"
18
19ChannelGroupConf::ChannelGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name)
20{
21 QGridLayout *layout = new QGridLayout(this);
22 QVBoxLayout *volLayout = new QVBoxLayout(this);
23 QVBoxLayout *chanLayout = new QVBoxLayout(this);
24
25 layout->addRowSpacing(1,5);
26 layout->addRowSpacing(3,5);
27 layout->addRowSpacing(5,5);
28
29 layout->addColSpacing(1,1);
30 layout->addColSpacing(3,1);
31 layout->addColSpacing(5,1);
32 layout->addColSpacing(7,1);
33
34 QPushButton *one = new QPushButton("1", this, "one");
35 layout->addWidget(one, 0, 2, 0);
36 connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
37
38 QPushButton *two = new QPushButton("2", this, "two");
39 layout->addWidget(two, 0, 4, 0);
40 connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
41
42 QPushButton *three = new QPushButton("3", this, "three");
43 layout->addWidget(three, 0, 6, 0);
44 connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
45
46 QPushButton *four = new QPushButton("4", this, "four");
47 layout->addWidget(four, 2, 2, 0);
48 connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
49
50 QPushButton *five = new QPushButton("5", this, "five");
51 layout->addWidget(five, 2, 4, 0);
52 connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
53
54 QPushButton *six = new QPushButton("6", this, "six");
55 layout->addWidget(six, 2, 6, 0);
56 connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
57
58 QPushButton *seven = new QPushButton("7", this, "seven");
59 layout->addWidget(seven, 4, 2, 0);
60 connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
61
62 QPushButton *eight = new QPushButton("8", this, "eight");
63 layout->addWidget(eight, 4, 4, 0);
64 connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
65
66 QPushButton *nine = new QPushButton("9", this, "nine");
67 layout->addWidget(nine, 4, 6, 0);
68 connect(nine, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
69
70 QPushButton *zero = new QPushButton("0", this, "zero");
71 layout->addWidget(zero, 6, 4, 0);
72 connect(zero, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
73
74 layout->addMultiCellLayout(volLayout, 0, 6, 0, 0, 0);
75 layout->addMultiCellLayout(chanLayout, 0, 6, 8, 8, 0);
76
77 QPushButton *volUp = new QPushButton("+", this, "volUp");
78 volLayout->addWidget(volUp, 1, 0);
79 connect(volUp, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
80
81 QLabel *volLabel = new QLabel("Volume ", this, "volLabel");
82 volLayout->addWidget(volLabel, 0, 0);
83
84 QPushButton *volDown = new QPushButton("-", this, "volDown");
85 volLayout->addWidget(volDown, 1, 0);
86 connect(volDown, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
87
88
89 QPushButton *chanUp = new QPushButton("+", this, "chanUp");
90 chanLayout->addWidget(chanUp, 1, 0);
91 connect(chanUp, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
92
93 QLabel *chanLabel = new QLabel("Channel", this, "chanLabel");
94 chanLayout->addWidget(chanLabel, 0, 0);
95
96 QPushButton *chanDown = new QPushButton("-", this, "chanDown");
97 chanLayout->addWidget(chanDown, 1, 0);
98 connect(chanDown, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
99
100}
diff --git a/noncore/tools/remote/channelgroupconf.h b/noncore/tools/remote/channelgroupconf.h
new file mode 100644
index 0000000..b5f2392
--- a/dev/null
+++ b/noncore/tools/remote/channelgroupconf.h
@@ -0,0 +1,26 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C)
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qwidget.h>
18#include <qpushbutton.h>
19#include <qlayout.h>
20#include <qlabel.h>
21
22class ChannelGroupConf : public QWidget
23{
24public:
25 ChannelGroupConf(QWidget *parent=0, const char *name=0);
26};
diff --git a/noncore/tools/remote/configtab.cpp b/noncore/tools/remote/configtab.cpp
new file mode 100644
index 0000000..f5896a9
--- a/dev/null
+++ b/noncore/tools/remote/configtab.cpp
@@ -0,0 +1,218 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "configtab.h"
18
19ConfigTab::ConfigTab(QWidget *parent=0, const char *name=0):QWidget(parent,name)
20{
21
22 QVBoxLayout *layout = new QVBoxLayout(this);
23
24 topGroupConf = new TopGroupConf(this, "topGroupConf");
25 layout->addWidget(topGroupConf, 1);
26 layout->addSpacing(1);
27
28 dvdGroupConf = new DVDGroupConf(this, "dvdGroupConf");
29 layout->addWidget(dvdGroupConf, 1);
30 layout->addSpacing(1);
31
32 vcrGroupConf = new VCRGroupConf(this, "vcrGroupConf");
33 layout->addWidget(vcrGroupConf, 1);
34 layout->addSpacing(1);
35
36 channelGroupConf = new ChannelGroupConf(this, "channelGroupConf");
37 layout->addWidget(channelGroupConf, 1);
38
39
40}
41
42void ConfigTab::setConfig(Config *newCfg)
43{
44 cfg = newCfg;
45 cfg->setGroup("Remotes");
46 topGroupConf->updateRemotes(cfg->readListEntry("remoteList", ',') );
47 cfg->setGroup("Default");
48 const QObject *obj;
49
50 const QObjectList *objList = topGroupConf->children();
51 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
52 {
53 if(obj->inherits("QPushButton"))
54 {
55 if(!cfg->hasKey((QString)obj->name()+"Label"))
56 {
57 cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text());
58 }
59 }
60 }
61
62 objList = dvdGroupConf->children();
63 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
64 {
65 if(obj->inherits("QPushButton"))
66 {
67 if(!cfg->hasKey((QString)obj->name()+"Label"))
68 {
69 cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text());
70 }
71 }
72 }
73
74 objList = vcrGroupConf->children();
75 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
76 {
77 if(obj->inherits("QPushButton"))
78 {
79 if(!cfg->hasKey((QString)obj->name()+"Label"))
80 {
81 cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text());
82 }
83 }
84 }
85
86 objList = channelGroupConf->children();
87 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
88 {
89 if(obj->inherits("QPushButton"))
90 {
91 if(!cfg->hasKey((QString)obj->name()+"Label"))
92 {
93 cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text());
94 }
95 }
96 }
97 cfg->write();
98
99 cfg->setGroup("Remotes");
100}
101/*
102void ConfigTab::savePressed()
103{
104 cfg->setGroup(remotes->currentText());
105 ButtonDialog *bd = new ButtonDialog(this, "BD", true, 0);
106 if( bd->exec() == 1)
107 {
108 printf("%s\n", bd->getList().join(" ").latin1());
109 }
110}
111*/
112
113void ConfigTab::newPressed()
114{
115 QStringList list;
116 cfg->setGroup("Remotes");
117 list=cfg->readListEntry("remoteList", ',');
118 list+=topGroupConf->getRemotesText();
119 cfg->writeEntry("remoteList", list, ',');
120 cfg->setGroup(topGroupConf->getRemotesText());
121 topGroupConf->updateRemotes(QStringList(topGroupConf->getRemotesText()) );
122 cfg->write();
123 emit remotesChanged();
124 remoteSelected(topGroupConf->getRemotesText());
125}
126
127void ConfigTab::remoteSelected(const QString &string)
128{
129 cfg->setGroup(string);
130 const QObject *obj;
131
132 const QObjectList *objList = topGroupConf->children();
133 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
134 {
135 if(obj->inherits("QPushButton"))
136 {
137 if(cfg->hasKey((QString)obj->name()+"Label"))
138 {
139 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
140 }
141 else
142 {
143 cfg->setGroup("Default");
144 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
145 cfg->setGroup(string);
146 }
147 }
148 }
149
150 objList = dvdGroupConf->children();
151 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
152 {
153 if(obj->inherits("QPushButton"))
154 {
155 if(cfg->hasKey((QString)obj->name()+"Label"))
156 {
157 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
158 }
159 else
160 {
161 cfg->setGroup("Default");
162 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
163 cfg->setGroup(string);
164 }
165 }
166 }
167
168 objList = vcrGroupConf->children();
169 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
170 {
171 if(obj->inherits("QPushButton"))
172 {
173 if(cfg->hasKey((QString)obj->name()+"Label"))
174 {
175 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
176 }
177 else
178 {
179 cfg->setGroup("Default");
180 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
181 cfg->setGroup(string);
182 }
183 }
184 }
185
186 objList = channelGroupConf->children();
187 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
188 {
189 if(obj->inherits("QPushButton"))
190 {
191 if(cfg->hasKey((QString)obj->name()+"Label"))
192 {
193 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
194 }
195 else
196 {
197 cfg->setGroup("Default");
198 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
199 cfg->setGroup(string);
200 }
201 }
202 }
203}
204
205void ConfigTab::buttonPressed()
206{
207 const QObject *button = sender();
208 QString string = button->name();
209
210 ButtonDialog *bd = new ButtonDialog(((QPushButton *)button)->text(), this, "BD", true, 0);
211 if( bd->exec() == 1)
212 {
213 cfg->writeEntry(string, bd->getList().join(" ").latin1());
214 cfg->writeEntry(string+"Label", bd->getLabel().latin1());
215 }
216 cfg->write();
217 ((QPushButton *)button)->setText(bd->getLabel());
218}
diff --git a/noncore/tools/remote/configtab.h b/noncore/tools/remote/configtab.h
new file mode 100644
index 0000000..a04a84f
--- a/dev/null
+++ b/noncore/tools/remote/configtab.h
@@ -0,0 +1,55 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qpe/config.h>
18#include <qwidget.h>
19#include <qlayout.h>
20#include <qcombobox.h>
21#include <qpushbutton.h>
22#include <qlabel.h>
23#include <qstring.h>
24#include <qstringlist.h>
25#include <qmessagebox.h>
26#include <qobjectlist.h>
27//#include <qscrollview.h>
28//#include <qcolor.h>
29//#include <qvbox.h>
30
31#include "buttondialog.h"
32#include "channelgroupconf.h"
33#include "dvdgroupconf.h"
34#include "topgroupconf.h"
35#include "vcrgroupconf.h"
36
37class ConfigTab : public QWidget
38{
39 Q_OBJECT
40public:
41 ConfigTab(QWidget *parent=0, const char *name=0);
42 void setConfig(Config *newCfg);
43public slots:
44 void newPressed();
45 void remoteSelected(const QString &string);
46 void buttonPressed();
47signals:
48 void remotesChanged();
49private:
50 Config *cfg;
51 TopGroupConf *topGroupConf;
52 DVDGroupConf *dvdGroupConf;
53 VCRGroupConf *vcrGroupConf;
54 ChannelGroupConf *channelGroupConf;
55};
diff --git a/noncore/tools/remote/dvdgroup.cpp b/noncore/tools/remote/dvdgroup.cpp
new file mode 100644
index 0000000..a75c48a
--- a/dev/null
+++ b/noncore/tools/remote/dvdgroup.cpp
@@ -0,0 +1,93 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public
7License as published by the Free Software Foundation; either version 2 of the
8License, or (at your option) any later
9version.
10
11This program is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the
13implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
15GNU General
16Public License for more details.
17
18You should have received a copy of the GNU General Public License along with
19this program; if not, write to the Free
20Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include "dvdgroup.h"
24
25DVDGroup::DVDGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name)
26{
27 QGridLayout *layout = new QGridLayout(this);
28
29//put rows between the buttons of size 1
30 layout->addRowSpacing(1,1);
31 layout->addRowSpacing(3,1);
32
33//put collumns between the buttons of size 5
34 layout->addColSpacing(1,5);
35 layout->addColSpacing(3,5);
36 layout->addColSpacing(5,5);
37 layout->addColSpacing(7,5);
38
39//make sure that the collumns with the buttons in them stretch before the filler collumns do
40//since there is so little room, there is no need to do this for the rows
41 layout->setColStretch(4,1);
42 layout->setColStretch(2,1);
43 layout->setColStretch(6,1);
44 layout->setColStretch(8,1);
45 layout->setColStretch(0,1);
46
47//add the menu navigation buttons, and connect them to the RemoteTab slots...
48 QPushButton *up = new QPushButton("Up", this,"up");
49 layout->addWidget(up, 0, 4, 0);
50 connect(up, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
51
52 QPushButton *down = new QPushButton("Down",this,"down");
53 layout->addWidget(down, 4, 4, 0);
54 connect(down, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
55
56 QPushButton *left = new QPushButton("Left",this,"left");
57 layout->addWidget(left, 2, 2, 0);
58 connect(left, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
59
60 QPushButton *right = new QPushButton("Right", this, "right");
61 layout->addWidget(right, 2, 6, 0);
62 connect(right, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
63
64 QPushButton *enter = new QPushButton("Enter",this,"enter");
65 layout->addWidget(enter, 2, 4, 0);
66 connect(enter, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
67
68//add some other buttons
69
70 QPushButton *eject = new QPushButton("Eject", this, "eject");
71 layout->addWidget(eject, 0, 0, 0);
72 connect(eject, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
73
74 QPushButton *menu = new QPushButton("Menu", this, "menu");
75 layout->addWidget(menu, 2, 0, 0);
76 connect(menu, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
77
78 QPushButton *topMenu = new QPushButton("Top", this, "topMenu");
79 layout->addWidget(topMenu, 4, 0, 0);
80 connect(topMenu, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
81
82 QPushButton *audio = new QPushButton("Audio", this, "audio");
83 layout->addWidget(audio, 0, 8, 0);
84 connect(audio, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
85
86 QPushButton *sub = new QPushButton("Sub", this, "sub");
87 layout->addWidget(sub, 2, 8, 0);
88 connect(sub, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
89
90 QPushButton *angle = new QPushButton("Angle", this, "angle");
91 layout->addWidget(angle, 4, 8, 0);
92 connect(angle, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
93}
diff --git a/noncore/tools/remote/dvdgroup.h b/noncore/tools/remote/dvdgroup.h
new file mode 100644
index 0000000..04c301b
--- a/dev/null
+++ b/noncore/tools/remote/dvdgroup.h
@@ -0,0 +1,27 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qwidget.h>
18#include <qpushbutton.h>
19#include <qlayout.h>
20#include <qpe/resource.h>
21#include <qiconset.h>
22
23class DVDGroup : public QWidget
24{
25public:
26 DVDGroup(QWidget *parent=0, const char *name=0);
27};
diff --git a/noncore/tools/remote/dvdgroupconf.cpp b/noncore/tools/remote/dvdgroupconf.cpp
new file mode 100644
index 0000000..5bfe393
--- a/dev/null
+++ b/noncore/tools/remote/dvdgroupconf.cpp
@@ -0,0 +1,87 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "dvdgroupconf.h"
18
19DVDGroupConf::DVDGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name)
20{
21 QGridLayout *layout = new QGridLayout(this);
22
23//put rows between the buttons of size 1
24 layout->addRowSpacing(1,1);
25 layout->addRowSpacing(3,1);
26
27//put collumns between the buttons of size 5
28 layout->addColSpacing(1,5);
29 layout->addColSpacing(3,5);
30 layout->addColSpacing(5,5);
31 layout->addColSpacing(7,5);
32
33//make sure that the collumns with the buttons in them stretch before the filler collumns do
34//since there is so little room, there is no need to do this for the rows
35 layout->setColStretch(4,1);
36 layout->setColStretch(2,1);
37 layout->setColStretch(6,1);
38 layout->setColStretch(8,1);
39 layout->setColStretch(0,1);
40
41//add the menu navigation buttons, and connect them to the RemoteTab slots...
42 QPushButton *up = new QPushButton("Up",this,"up");
43 layout->addWidget(up, 0, 4, 0);
44 connect(up, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
45
46 QPushButton *down = new QPushButton("Down",this,"down");
47 layout->addWidget(down, 4, 4, 0);
48 connect(down, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
49
50 QPushButton *left = new QPushButton("Left",this,"left");
51 layout->addWidget(left, 2, 2, 0);
52 connect(left, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
53
54 QPushButton *right = new QPushButton("Right", this, "right");
55 layout->addWidget(right, 2, 6, 0);
56 connect(right, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
57
58 QPushButton *enter = new QPushButton("Enter",this,"enter");
59 layout->addWidget(enter, 2, 4, 0);
60 connect(enter, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
61
62//add some other buttons
63
64 QPushButton *eject = new QPushButton("Eject", this, "eject");
65 layout->addWidget(eject, 0, 0, 0);
66 connect(eject, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
67
68 QPushButton *menu = new QPushButton("Menu", this, "menu");
69 layout->addWidget(menu, 2, 0, 0);
70 connect(menu, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
71
72 QPushButton *topMenu = new QPushButton("Top", this, "topMenu");
73 layout->addWidget(topMenu, 4, 0, 0);
74 connect(topMenu, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
75
76 QPushButton *audio = new QPushButton("Audio", this, "audio");
77 layout->addWidget(audio, 0, 8, 0);
78 connect(audio, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
79
80 QPushButton *sub = new QPushButton("Sub", this, "sub");
81 layout->addWidget(sub, 2, 8, 0);
82 connect(sub, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
83
84 QPushButton *angle = new QPushButton("Angle", this, "angle");
85 layout->addWidget(angle, 4, 8, 0);
86 connect(angle, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
87}
diff --git a/noncore/tools/remote/dvdgroupconf.h b/noncore/tools/remote/dvdgroupconf.h
new file mode 100644
index 0000000..67ee231
--- a/dev/null
+++ b/noncore/tools/remote/dvdgroupconf.h
@@ -0,0 +1,25 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qwidget.h>
18#include <qpushbutton.h>
19#include <qlayout.h>
20
21class DVDGroupConf : public QWidget
22{
23public:
24 DVDGroupConf(QWidget *parent=0, const char *name=0);
25};
diff --git a/noncore/tools/remote/learntab.cpp b/noncore/tools/remote/learntab.cpp
new file mode 100644
index 0000000..054bc7b
--- a/dev/null
+++ b/noncore/tools/remote/learntab.cpp
@@ -0,0 +1,26 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "learntab.h"
18
19LearnTab::LearnTab(QWidget *parent=0, const char *name=0):QWidget(parent,name)
20{
21 QVBoxLayout *layout = new QVBoxLayout(this);
22 QString *string = new QString("<qt><h1>Opie-Remote Usage Instructions</h1><p>First, some definitions. A Remote is a remote entry in an lircd.conf file, it represents one remote you want to emulate. A Remote Layout is one entry in your ~/Settings/Remote.conf file. It represents the buttons that you see on your screen. Each button on a Remote Layout can be mapped to any button in a Remote. This way you can have, for example, a vcr remote layout, in which all the play/pause/etc buttons are mapped to the buttons on your vcr's remote. However, most VCR's don't have volume controls, so the volume buttons can be mapped to the volume buttons on your TV.</p><p>The first things you need the lirc and lirc-modules ipkgs. If you installed this from an ipkg, they should already be there, thanks to the wonderful world of dependencies. If not, get them. The next thing you need is an lircd.conf file. you can get these at <a href=http://www.lirc.org/>http://www.lirc.org/</a>. Read the documentation there to figure out how to make your own, if one for your remote doesn't exist, or how to have multiple remotes in one lircd.conf file. Once you have a good lircd.conf file, put it in /etc, kill the lircd daemon (if its running) and do a modprobe lirc_sir. Then, run lircd again.</p><p>The next thing you want to do is to create a remote layout. Go to the config tab, and enter a name for your remote layout in the pulldown menu. Dont use the name Remotes, as that could confuse the app. Hopefully, that will be fixed soon. after entering the name you want to use, press New, and then select the name again from the pulldown menu (another oddity that i hope to fix). Then, press each button that you want to map, and a dialog should appear. Select the remote and button that you want to use, and click OK. Once you are done, go to the Remote tab, and select the new remote from the dropdown menu. It should works fine. If at any time you want to change a remote layout, go to the Config tab, select the layout from the dropdown menu, and change the buttons you want to change.</p><p>This is program is written and maintaned by Thomas (spiralman) Stephens. <a href=mailto:spiralman@softhome.net>spiralman@softhome.net</a>. Or, look for me on #opie or #handhelds.org on irc.openprojects.net.</p></qt>");
23
24 QTextView *textView = new QTextView(*string, 0, this);
25 layout->addWidget(textView);
26}
diff --git a/noncore/tools/remote/learntab.h b/noncore/tools/remote/learntab.h
new file mode 100644
index 0000000..c03f605
--- a/dev/null
+++ b/noncore/tools/remote/learntab.h
@@ -0,0 +1,26 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qwidget.h>
18#include <qtextview.h>
19#include <qstring.h>
20#include <qlayout.h>
21
22class LearnTab : public QWidget
23{
24public:
25 LearnTab(QWidget *parent=0, const char *name=0);
26};
diff --git a/noncore/tools/remote/mainconfig.cpp b/noncore/tools/remote/mainconfig.cpp
new file mode 100644
index 0000000..d0476e9
--- a/dev/null
+++ b/noncore/tools/remote/mainconfig.cpp
@@ -0,0 +1,22 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "mainconfig.h"
18
19RemoteConfig *MainConfig::getRemote(const char *name)
20{
21
22}
diff --git a/noncore/tools/remote/mainconfig.h b/noncore/tools/remote/mainconfig.h
new file mode 100644
index 0000000..5c53137
--- a/dev/null
+++ b/noncore/tools/remote/mainconfig.h
@@ -0,0 +1,31 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qpe/config.h>
18#include <qstringlist.h>
19
20class MainConfig
21{
22public:
23 RemoteConfig *getRemote(const char *name);
24 QStringList *getRemoteList();
25 Config *getConfig();
26 void update();
27private:
28 RemoteConfig *remotes;
29 Config cfg;
30 QStringList *remoteList;
31};
diff --git a/noncore/tools/remote/mainview.cpp b/noncore/tools/remote/mainview.cpp
new file mode 100644
index 0000000..47027fb
--- a/dev/null
+++ b/noncore/tools/remote/mainview.cpp
@@ -0,0 +1,68 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "mainview.h"
18
19MainView::MainView(QWidget *parent, const char *name=0) : QWidget(parent, name)
20{
21 setIcon( Resource::loadPixmap( "remote" ) );
22 setCaption(tr("Remote") );
23
24 QVBoxLayout *layout = new QVBoxLayout(this);
25 QTabWidget *tabs = new QTabWidget(this);
26
27 layout->addWidget(tabs);
28
29 printf("MainView: 1\n");
30 remote = new RemoteTab(tabs);
31 printf("MainView: 2\n");
32 learn = new LearnTab(tabs);
33 printf("MainView: 3\n");
34 config = new ConfigTab(tabs);
35 printf("MainView: 4\n");
36 connect(config, SIGNAL(remotesChanged()), this, SLOT(updateRemotesList()) );
37 printf("MainView: 5\n");
38
39 remote->setIRSocket(fd);
40
41 tabs->addTab(remote, tr("Remote") );
42 tabs->addTab(learn,tr("Learn") );
43 tabs->addTab(config,tr("Config") );
44
45 printf("1\n");
46 cfg = new Config("Remote");
47 printf("2\n");
48
49 remote->setConfig(cfg);
50 config->setConfig(cfg);
51}
52
53int MainView::getIRSocket()
54{
55 return fd;
56}
57
58void MainView::setIRSocket(int newfd)
59{
60 fd = newfd;
61 remote->setIRSocket(fd);
62}
63
64void MainView::updateRemotesList()
65{
66 remote->updateRemotesList();
67 printf("MainView: got remotes changed signal\n");
68}
diff --git a/noncore/tools/remote/mainview.h b/noncore/tools/remote/mainview.h
new file mode 100644
index 0000000..2434064
--- a/dev/null
+++ b/noncore/tools/remote/mainview.h
@@ -0,0 +1,54 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qpe/qpeapplication.h>
18#include <qpe/resource.h>
19#include <qpe/config.h>
20#include <qpushbutton.h>
21#include <qtabwidget.h>
22#include <qlayout.h>
23#include <qmessagebox.h>
24#include <qpaintdevice.h>
25#include <qobject.h>
26#include <sys/socket.h>
27#include <sys/types.h>
28#include <sys/un.h>
29#include <unistd.h>
30#include <stdio.h>
31#include <signal.h>
32
33#include "remotetab.h"
34#include "learntab.h"
35#include "configtab.h"
36
37#define BUFFERSIZE 256
38
39class MainView : public QWidget
40{
41 Q_OBJECT
42public:
43 MainView(QWidget *parent=0, const char *name=0);
44 int getIRSocket();
45 void setIRSocket(int newfd);
46public slots:
47 void updateRemotesList();
48private:
49 int fd;
50 RemoteTab *remote;
51 ConfigTab *config;
52 LearnTab *learn;
53 Config *cfg;
54};
diff --git a/noncore/tools/remote/opie-remote.control b/noncore/tools/remote/opie-remote.control
new file mode 100644
index 0000000..191a197
--- a/dev/null
+++ b/noncore/tools/remote/opie-remote.control
@@ -0,0 +1,10 @@
1Files: bin/remote apps/Applications/remote.desktop pics/remote/*.png
2Priority: optional
3Section: opie/applications
4Maintainer: Thomas Stephens <spiralman@softhome.net>
5Architecture: arm
6Version: 0.3-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION), lirc
8License: GPL
9Description: a remote control
10 A remote control using irda. A frontend to lirc. \ No newline at end of file
diff --git a/noncore/tools/remote/packetread.h b/noncore/tools/remote/packetread.h
new file mode 100644
index 0000000..5dc1ad4
--- a/dev/null
+++ b/noncore/tools/remote/packetread.h
@@ -0,0 +1,200 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
16file not used
17*/
18
19#include <stdio.h>
20#include <stdlib.h>
21#include <string.h>
22#include <sys/socket.h>
23#include <sys/types.h>
24#include <sys/un.h>
25#include <unistd.h>
26#include <errno.h>
27
28#define PACKET_SIZE 256
29#define TIMEOUT 3
30
31//this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html
32const char *readPacket(int fd)
33{
34 static char buffer[PACKET_SIZE+1]="";
35 char *end;
36 static int ptr=0,end_len=0;
37 ssize_t ret;
38
39 if(ptr>0)
40 {
41 memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1);
42 ptr=strlen(buffer);
43 end=strchr(buffer,'\n');
44 }
45 else
46 {
47 end=NULL;
48 }
49 alarm(TIMEOUT);
50 while(end==NULL)
51 {
52 if(PACKET_SIZE<=ptr)
53 {
54 // fprintf(stderr,"%s: bad packet\n",progname);
55 ptr=0;
56 return(NULL);
57 }
58 ret=read(fd,buffer+ptr,PACKET_SIZE-ptr);
59
60 if(ret<=0 || timeout)
61 {
62 if(timeout)
63 {
64 // fprintf(stderr,"%s: timeout\n",progname);
65 }
66 else
67 {
68 alarm(0);
69 }
70 ptr=0;
71 return(NULL);
72 }
73 buffer[ptr+ret]=0;
74 ptr=strlen(buffer);
75 end=strchr(buffer,'\n');
76 }
77 alarm(0);timeout=0;
78
79 end[0]=0;
80 ptr=strlen(buffer)+1;
81//# ifdef DEBUG
82 //printf("buffer: -%s-\n",buffer);
83//# endif
84 return(buffer);
85}
86QStringList getRemotes(int fd)
87{
88 const char write_buffer[] = "LIST\n";
89 const char *readbuffer;
90 int i, numlines;
91 QStringList list;
92
93 fd = socket(AF_UNIX, SOCK_STREAM, 0);
94
95 if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
96 {
97 QMessageBox *mb = new QMessageBox("Error!",
98 "couldnt connect to socket",
99 QMessageBox::NoIcon,
100 QMessageBox::Ok,
101 QMessageBox::NoButton,
102 QMessageBox::NoButton);
103 mb->exec();
104 perror("ConfigTab::GetRemotes");
105 return NULL;
106 }
107
108 write(fd, write_buffer, strlen(write_buffer) );
109
110 for(i=0; i<5; i++)
111 {
112 readbuffer = readPacket(int fd);
113 }
114
115 numlines = atoi(readbuffer);
116
117 for(i=0; i<numlines; i++)
118 {
119 list+=readPacket();
120 }
121
122 if(strcasecmp(readPacket(), "END") != 0)
123 {
124 QMessageBox *mb = new QMessageBox("Error!",
125 "bad packet",
126 QMessageBox::NoIcon,
127 QMessageBox::Ok,
128 QMessageBox::NoButton,
129 QMessageBox::NoButton);
130 mb->exec();
131 perror("ConfigTab::GetRemotes");
132 return NULL;
133 }
134
135 std::close(fd);
136 return list;
137}
138
139QStringList getButtons(int fd, const char *remoteName)
140{
141 QString write_buffer = "LIST ";
142 const char *readbuffer;
143 int i, j, numlines;
144 QStringList list;
145 QString string;
146
147 write_buffer += remoteName;
148 write_buffer += '\n';
149
150 fd = socket(AF_UNIX, SOCK_STREAM, 0);
151
152 if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
153 {
154 QMessageBox *mb = new QMessageBox("Error!",
155 "couldnt connect to socket",
156 QMessageBox::NoIcon,
157 QMessageBox::Ok,
158 QMessageBox::NoButton,
159 QMessageBox::NoButton);
160 mb->exec();
161 perror("ConfigTab::GetRemotes");
162 return NULL;
163 }
164
165 write(fd, write_buffer.latin1(), strlen(write_buffer) );
166
167 for(i=0; i<5; i++)
168 {
169 readbuffer = readPacket();
170 }
171
172 numlines = atoi(readbuffer);
173
174 for(i=0; i<numlines; i++)
175 {
176 list+=readPacket();
177 for(j=0; j<list[i].length(); j++)
178 {
179 if(list[i][j] == ' ')
180 break;
181 }
182 list[i].remove(0, j+1);
183 }
184
185 if(strcasecmp(readPacket(), "END") != 0)
186 {
187 QMessageBox *mb = new QMessageBox("Error!",
188 "bad packet",
189 QMessageBox::NoIcon,
190 QMessageBox::Ok,
191 QMessageBox::NoButton,
192 QMessageBox::NoButton);
193 mb->exec();
194 perror("ConfigTab::GetRemotes");
195 return NULL;
196 }
197
198 std::close(fd);
199 return list;
200}
diff --git a/noncore/tools/remote/remote.cpp b/noncore/tools/remote/remote.cpp
new file mode 100644
index 0000000..7972def
--- a/dev/null
+++ b/noncore/tools/remote/remote.cpp
@@ -0,0 +1,100 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qpe/qpeapplication.h>
18#include <qpe/resource.h>
19#include <qpe/config.h>
20#include <qpushbutton.h>
21#include <qtabwidget.h>
22#include <qlayout.h>
23#include <qmessagebox.h>
24#include <qpaintdevice.h>
25#include <qobject.h>
26#include <sys/socket.h>
27#include <sys/types.h>
28#include <sys/un.h>
29#include <unistd.h>
30#include <stdio.h>
31#include <signal.h>
32
33#include "mainview.h"
34
35/*void reconnect(int &fd)
36{
37 //struct sockaddr_un addr;
38
39 addr.sun_family=AF_UNIX;
40 strcpy(addr.sun_path,"/dev/lircd");
41 fd = socket(AF_UNIX, SOCK_STREAM, 0);
42
43 if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
44 {
45 QMessageBox *mb = new QMessageBox("error",
46 "couldnt connect to socket",
47 QMessageBox::NoIcon,
48 QMessageBox::Ok,
49 QMessageBox::NoButton,
50 QMessageBox::NoButton);
51 mb->exec();
52 }
53}
54*/
55
56int main( int argc, char **argv )
57{
58 QPEApplication a( argc, argv );
59 MainView w;
60
61 int fd;
62 //struct sockaddr_un addr;
63 //char read_buffer[BUFFERSIZE+1];
64 //char write_buffer[] = "LIST\n";
65
66 //addr.sun_family=AF_UNIX;
67 //strcpy(addr.sun_path,"/dev/lircd");
68 //fd = socket(AF_UNIX, SOCK_STREAM, 0);
69
70 //printf("fd1: %d\n", fd);
71/*
72 if(connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
73 {
74 QMessageBox *mb = new QMessageBox("error",
75 "couldnt connect to socket",
76 QMessageBox::NoIcon,
77 QMessageBox::Ok,
78 QMessageBox::NoButton,
79 QMessageBox::NoButton);
80 mb->exec();
81 }
82*/
83
84 //printf("%d\n", write(fd, write_buffer, sizeof(write_buffer) ) );
85
86 //printf("%d\n", read(fd, read_buffer, BUFFERSIZE ) );
87
88 //QMessageBox *mbtest = new QMessageBox("lirc test",
89 // *new QString((const char *) read_buffer),
90 // QMessageBox::NoIcon,
91 // QMessageBox::Ok,
92 // QMessageBox::NoButton,
93 // QMessageBox::NoButton);
94 //mbtest->exec();
95
96 a.setMainWidget( &w );
97 w.setIRSocket(fd);
98 w.showMaximized();
99 return a.exec();
100}
diff --git a/noncore/tools/remote/remote.pro b/noncore/tools/remote/remote.pro
new file mode 100644
index 0000000..cab9d70
--- a/dev/null
+++ b/noncore/tools/remote/remote.pro
@@ -0,0 +1,9 @@
1 TEMPLATE=app
2 CONFIG +=qt warn_on release
3 DESTDIR =$(OPIEDIR)/bin
4 HEADERS = remotetab.h learntab.h configtab.h topgroup.h dvdgroup.h channelgroup.h vcrgroup.h buttondialog.h topgroupconf.h dvdgroupconf.h channelgroupconf.h vcrgroupconf.h mainview.h
5 SOURCES =remote.cpp remotetab.cpp learntab.cpp configtab.cpp topgroup.cpp dvdgroup.cpp channelgroup.cpp vcrgroup.cpp buttondialog.cpp topgroupconf.cpp dvdgroupconf.cpp channelgroupconf.cpp vcrgroupconf.cpp mainview.cpp
6 INCLUDEPATH+=$(OPIEDIR)/include
7 DEPENDPATH+=$(OPIEDIR)/include
8 LIBS +=-lqpe
9TARGET = remote
diff --git a/noncore/tools/remote/remotetab.cpp b/noncore/tools/remote/remotetab.cpp
new file mode 100644
index 0000000..f3a8945
--- a/dev/null
+++ b/noncore/tools/remote/remotetab.cpp
@@ -0,0 +1,250 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "remotetab.h"
18
19RemoteTab::RemoteTab(QWidget *parent=0, const char *name=0):QWidget(parent,name)
20{
21 QVBoxLayout *layout = new QVBoxLayout(this);
22
23 topGroup = new TopGroup(this);
24 //topGroup->setMaximumHeight(22);
25 layout->addWidget(topGroup, 0, 0);
26 printf("%d %d", topGroup->width(), topGroup->height());
27
28 layout->addSpacing(1);
29
30 dvdGroup = new DVDGroup(this);
31 //dvdGroup->setMaximumHeight(68);
32 layout->addWidget(dvdGroup, 0, 0);
33
34 layout->addSpacing(1);
35
36 vcrGroup = new VCRGroup(this);
37 layout->addWidget(vcrGroup, 0, 0);
38 //vcrGroup->setMaximumHeight(45);
39
40 layout->addSpacing(1);
41
42 channelGroup = new ChannelGroup(this);
43 //channelGroup->setMaximumHeight(91);
44 layout->addWidget(channelGroup, 0, 0);
45
46 this->setMaximumWidth(240);
47
48 timeout = 0;
49
50 addr.sun_family=AF_UNIX;
51 strcpy(addr.sun_path,"/dev/lircd");
52}
53
54void RemoteTab::sendIR()
55{
56 const QObject *button = sender();
57 QString string = cfg->readEntry(button->name());
58 string+='\n';
59 const char *write_buffer = string.latin1();
60 const char *read_buffer;
61 bool done=false;
62
63 fd = socket(AF_UNIX, SOCK_STREAM, 0);
64
65 if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
66 {
67 QMessageBox *mb = new QMessageBox("Error!",
68 "couldnt connect to socket",
69 QMessageBox::NoIcon,
70 QMessageBox::Ok,
71 QMessageBox::NoButton,
72 QMessageBox::NoButton);
73 mb->exec();
74 perror("RemoteTab::SendIR");
75 }
76
77 printf("fd2: %d\n", fd);
78 printf("%s", write_buffer);
79
80 printf("1\n");
81 printf("%d\n", write(fd, write_buffer, strlen(write_buffer) ) );
82 printf("2\n");
83 while(!done)
84 {
85 read_buffer=readPacket();
86 printf("%s\n", read_buffer);
87 if(strcasecmp(read_buffer, "END") == 0)
88 {
89 printf("done reading packet\n");
90 done=true;
91 }
92 }
93 std::close(fd);
94}
95
96 // printf("%s\n", readPacket());
97 // printf("%d\n", read(fd, read_buffer,sizeof(read_buffer)) );
98 // printf("%s", read_buffer);
99
100//this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html
101const char *RemoteTab::readPacket()
102{
103 static char buffer[PACKET_SIZE+1]="";
104 char *end;
105 static int ptr=0,end_len=0;
106 ssize_t ret;
107
108 if(ptr>0)
109 {
110 memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1);
111 ptr=strlen(buffer);
112 end=strchr(buffer,'\n');
113 }
114 else
115 {
116 end=NULL;
117 }
118 alarm(TIMEOUT);
119 while(end==NULL)
120 {
121 if(PACKET_SIZE<=ptr)
122 {
123 // fprintf(stderr,"%s: bad packet\n",progname);
124 ptr=0;
125 return(NULL);
126 }
127 ret=read(fd,buffer+ptr,PACKET_SIZE-ptr);
128
129 if(ret<=0 || timeout)
130 {
131 if(timeout)
132 {
133 // fprintf(stderr,"%s: timeout\n",progname);
134 }
135 else
136 {
137 alarm(0);
138 }
139 ptr=0;
140 return(NULL);
141 }
142 buffer[ptr+ret]=0;
143 ptr=strlen(buffer);
144 end=strchr(buffer,'\n');
145 }
146 alarm(0);timeout=0;
147
148 end[0]=0;
149 ptr=strlen(buffer)+1;
150//# ifdef DEBUG
151 //printf("buffer: -%s-\n",buffer);
152//# endif
153 return(buffer);
154}
155
156void RemoteTab::setIRSocket(int newfd)
157{
158 fd = newfd;
159}
160
161void RemoteTab::setConfig(Config *newCfg)
162{
163 cfg = newCfg;
164 cfg->setGroup("Remotes");
165 topGroup->updateRemotes(cfg);
166}
167
168void RemoteTab::remoteSelected(const QString &string)
169{
170 printf("1%s\n", string.latin1() );
171 cfg->setGroup(string);
172 const QObject *obj;
173
174 const QObjectList *objList = topGroup->children();
175 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
176 {
177 if(obj->inherits("QPushButton"))
178 {
179 if(cfg->hasKey((QString)obj->name()+"Label"))
180 {
181 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
182 }
183 else
184 {
185 cfg->setGroup("Default");
186 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
187 cfg->setGroup(string);
188 }
189 }
190 }
191
192 objList = dvdGroup->children();
193 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
194 {
195 if(obj->inherits("QPushButton"))
196 {
197 if(cfg->hasKey((QString)obj->name()+"Label"))
198 {
199 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
200 }
201 else
202 {
203 cfg->setGroup("Default");
204 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
205 cfg->setGroup(string);
206 }
207 }
208 }
209
210 objList = vcrGroup->children();
211 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
212 {
213 if(obj->inherits("QPushButton"))
214 {
215 if(cfg->hasKey((QString)obj->name()+"Label"))
216 {
217 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
218 }
219 else
220 {
221 cfg->setGroup("Default");
222 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
223 cfg->setGroup(string);
224 }
225 }
226 }
227
228 objList = channelGroup->children();
229 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
230 {
231 if(obj->inherits("QPushButton"))
232 {
233 if(cfg->hasKey((QString)obj->name()+"Label"))
234 {
235 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
236 }
237 else
238 {
239 cfg->setGroup("Default");
240 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
241 cfg->setGroup(string);
242 }
243 }
244 }
245}
246
247void RemoteTab::updateRemotesList()
248{
249 topGroup->updateRemotes(cfg);
250}
diff --git a/noncore/tools/remote/remotetab.h b/noncore/tools/remote/remotetab.h
new file mode 100644
index 0000000..77a7318
--- a/dev/null
+++ b/noncore/tools/remote/remotetab.h
@@ -0,0 +1,64 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qpe/config.h>
18#include <qwidget.h>
19#include <qlayout.h>
20#include <qvbox.h>
21#include <qmessagebox.h>
22#include <qstring.h>
23#include <qsize.h>
24#include <qobjectlist.h>
25
26#include <stdio.h>
27#include <stdlib.h>
28#include <string.h>
29#include <sys/socket.h>
30#include <sys/types.h>
31#include <sys/un.h>
32#include <unistd.h>
33#include <errno.h>
34
35#include "topgroup.h"
36#include "dvdgroup.h"
37#include "channelgroup.h"
38#include "vcrgroup.h"
39
40#define PACKET_SIZE 256
41#define TIMEOUT 3
42
43class RemoteTab : public QWidget
44{
45 Q_OBJECT
46public:
47 RemoteTab(QWidget *parent=0, const char *name=0);
48 void setIRSocket(int newfd);
49 const char *readPacket();
50 void setConfig(Config *newCfg);
51 void updateRemotesList();
52public slots:
53 void sendIR();
54 void remoteSelected(const QString &string);
55private:
56 int fd;
57 int timeout;
58 struct sockaddr_un addr;
59 Config *cfg;
60 TopGroup *topGroup;
61 DVDGroup *dvdGroup;
62 VCRGroup *vcrGroup;
63 ChannelGroup *channelGroup;
64};
diff --git a/noncore/tools/remote/topgroup.cpp b/noncore/tools/remote/topgroup.cpp
new file mode 100644
index 0000000..94ea622
--- a/dev/null
+++ b/noncore/tools/remote/topgroup.cpp
@@ -0,0 +1,54 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "topgroup.h"
18
19TopGroup::TopGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name)
20{
21 QHBoxLayout *layout = new QHBoxLayout(this, 0, -1, 0);
22
23 QPushButton *power = new QPushButton("Power",this,"power");
24 layout->addWidget(power);
25 connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
26 //power->setGeometry(5, 5,40, 20);
27
28 layout->addSpacing(5);
29
30 QPushButton *source = new QPushButton("Source",this,"source");
31 layout->addWidget(source);
32 connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
33 //source->setGeometry(50,5,40,20);
34
35 remotes = new QComboBox(false, this, "remotes");
36 connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) );
37 remotes->insertItem("Select Remote");
38 //remotes->setGeometry(135,5,95,20);
39
40 QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel");
41 //remoteLabel->setGeometry(90,5,40,20);
42 remoteLabel->setAlignment(AlignRight | AlignVCenter);
43
44 layout->addWidget(remoteLabel);
45 layout->addWidget(remotes);
46}
47
48void TopGroup::updateRemotes(Config *cfg)
49{
50 remotes->clear();
51 remotes->insertItem(QString("SelectRemote"));
52 cfg->setGroup("Remotes");
53 remotes->insertStringList(cfg->readListEntry("remoteList", ',') );
54}
diff --git a/noncore/tools/remote/topgroup.h b/noncore/tools/remote/topgroup.h
new file mode 100644
index 0000000..215292d
--- a/dev/null
+++ b/noncore/tools/remote/topgroup.h
@@ -0,0 +1,31 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C)
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qpe/config.h>
18#include <qwidget.h>
19#include <qpushbutton.h>
20#include <qcombobox.h>
21#include <qlabel.h>
22#include <qlayout.h>
23
24class TopGroup : public QWidget
25{
26public:
27 TopGroup(QWidget *parent=0, const char *name=0);
28 void updateRemotes(Config *cfg);
29private:
30 QComboBox *remotes;
31};
diff --git a/noncore/tools/remote/topgroupconf.cpp b/noncore/tools/remote/topgroupconf.cpp
new file mode 100644
index 0000000..eb071fb
--- a/dev/null
+++ b/noncore/tools/remote/topgroupconf.cpp
@@ -0,0 +1,70 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "topgroupconf.h"
18
19TopGroupConf::TopGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name)
20{
21 QHBoxLayout *layout = new QHBoxLayout(this);
22
23 QPushButton *power = new QPushButton("Power",this,"power");
24 layout->addWidget(power);
25 connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
26 //power->setGeometry(5, 5,40, 20);
27
28 layout->addSpacing(5);
29
30 QPushButton *source = new QPushButton("Source",this,"source");
31 layout->addWidget(source);
32 connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
33 //source->setGeometry(50,5,40,20);
34
35 remotes = new QComboBox(true, this, "remotes");
36 remotes->insertItem(QString("Remotes"));
37 layout->addWidget(remotes);
38 layout->setStretchFactor(remotes, 1);
39 connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) );
40
41
42 QPushButton *newrem = new QPushButton("New", this, "new");
43 layout->addWidget(newrem);
44 connect(newrem, SIGNAL(pressed()), this->parentWidget(), SLOT(newPressed()) );
45
46
47 /*remotes = new QComboBox(false, this, "remotes");
48 connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) );
49 remotes->insertItem("Select Remote");
50 //remotes->setGeometry(135,5,95,20);
51
52 QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel");
53 //remoteLabel->setGeometry(90,5,40,20);
54 remoteLabel->setAlignment(AlignRight | AlignVCenter);
55
56 layout->addWidget(remoteLabel);
57 layout->addWidget(remotes);
58*/
59}
60
61void TopGroupConf::updateRemotes(QStringList list)
62{
63 remotes->insertStringList(list);
64}
65
66QString TopGroupConf::getRemotesText()
67{
68 return remotes->currentText();
69}
70
diff --git a/noncore/tools/remote/topgroupconf.h b/noncore/tools/remote/topgroupconf.h
new file mode 100644
index 0000000..0142b69
--- a/dev/null
+++ b/noncore/tools/remote/topgroupconf.h
@@ -0,0 +1,34 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qpe/config.h>
18#include <qwidget.h>
19#include <qpushbutton.h>
20#include <qcombobox.h>
21#include <qlabel.h>
22#include <qlayout.h>
23#include <qstringlist.h>
24#include <qstring.h>
25
26class TopGroupConf : public QWidget
27{
28public:
29 TopGroupConf(QWidget *parent=0, const char *name=0);
30 void updateRemotes(QStringList list);
31 QString getRemotesText();
32private:
33 QComboBox *remotes;
34};
diff --git a/noncore/tools/remote/vcrgroup.cpp b/noncore/tools/remote/vcrgroup.cpp
new file mode 100644
index 0000000..4f07ca3
--- a/dev/null
+++ b/noncore/tools/remote/vcrgroup.cpp
@@ -0,0 +1,88 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public
7License as published by the Free Software Foundation; either version 2 of the
8License, or (at your option) any later
9version.
10
11This program is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the
13implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
15GNU General
16Public License for more details.
17
18You should have received a copy of the GNU General Public License along with
19this program; if not, write to the Free
20Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include "vcrgroup.h"
24
25VCRGroup::VCRGroup(QWidget *parent=0, const char *name=0) : QWidget(parent,
26name)
27{
28 QVBoxLayout *vlayout = new QVBoxLayout(this);
29
30 QHBoxLayout *hlayout1 = new QHBoxLayout(this);
31 QHBoxLayout *hlayout2 = new QHBoxLayout(this);
32
33 vlayout->addLayout(hlayout1);
34 vlayout->addSpacing(1);
35 vlayout->addLayout(hlayout2);
36
37 QPushButton *play = new
38QPushButton("Play",this, "play");
39 hlayout1->addWidget(play);
40 connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
41
42 hlayout1->addSpacing(5);
43
44 QPushButton *pause = new
45QPushButton("Pause",this, "pause");
46 hlayout1->addWidget(pause);
47 connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
48
49 hlayout1->addSpacing(5);
50
51 QPushButton *stop = new
52QPushButton("Stop",this, "stop");
53 hlayout1->addWidget(stop);
54 connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
55
56 hlayout1->addSpacing(5);
57
58 QPushButton *record = new
59QPushButton("Record",this, "record");
60 hlayout1->addWidget(record);
61 connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
62
63 QPushButton *back = new
64QPushButton("Back",this, "back");
65 hlayout2->addWidget(back);
66 connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
67
68 hlayout2->addSpacing(5);
69
70 QPushButton *rewind = new
71QPushButton("Rewind",this, "rewind");
72 hlayout2->addWidget(rewind);
73 connect(rewind, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
74
75 hlayout2->addSpacing(5);
76
77 QPushButton *ff = new
78QPushButton("FF",this, "ff");
79 hlayout2->addWidget(ff);
80 connect(ff, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
81
82 hlayout2->addSpacing(5);
83
84 QPushButton *next = new
85QPushButton("Next",this, "next");
86 hlayout2->addWidget(next);
87 connect(next, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
88}
diff --git a/noncore/tools/remote/vcrgroup.h b/noncore/tools/remote/vcrgroup.h
new file mode 100644
index 0000000..fe40e42
--- a/dev/null
+++ b/noncore/tools/remote/vcrgroup.h
@@ -0,0 +1,27 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qwidget.h>
18#include <qpushbutton.h>
19#include <qlayout.h>
20#include <qpe/resource.h>
21#include <qiconset.h>
22
23class VCRGroup : public QWidget
24{
25public:
26 VCRGroup(QWidget *parent=0, const char *name=0);
27};
diff --git a/noncore/tools/remote/vcrgroupconf.cpp b/noncore/tools/remote/vcrgroupconf.cpp
new file mode 100644
index 0000000..a50ed0a
--- a/dev/null
+++ b/noncore/tools/remote/vcrgroupconf.cpp
@@ -0,0 +1,73 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include "vcrgroupconf.h"
18
19VCRGroupConf::VCRGroupConf(QWidget *parent=0, const char *name=0) : QWidget(parent, name)
20{
21 QVBoxLayout *vlayout = new QVBoxLayout(this);
22
23 QHBoxLayout *hlayout1 = new QHBoxLayout(this);
24 QHBoxLayout *hlayout2 = new QHBoxLayout(this);
25
26 vlayout->addLayout(hlayout1);
27 vlayout->addSpacing(1);
28 vlayout->addLayout(hlayout2);
29
30 QPushButton *play = new QPushButton("Play",this, "play");
31 hlayout1->addWidget(play);
32 connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
33
34 hlayout1->addSpacing(5);
35
36 QPushButton *pause = new QPushButton("Pause",this, "pause");
37 hlayout1->addWidget(pause);
38 connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
39
40 hlayout1->addSpacing(5);
41
42 QPushButton *stop = new QPushButton("Stop",this, "stop");
43 hlayout1->addWidget(stop);
44 connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
45
46 hlayout1->addSpacing(5);
47
48 QPushButton *record = new QPushButton("Record",this, "record");
49 hlayout1->addWidget(record);
50 connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
51
52 QPushButton *back = new QPushButton("Back",this, "back");
53 hlayout2->addWidget(back);
54 connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
55
56 hlayout2->addSpacing(5);
57
58 QPushButton *rewind = new QPushButton("Rewind",this, "rewind");
59 hlayout2->addWidget(rewind);
60 connect(rewind, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
61
62 hlayout2->addSpacing(5);
63
64 QPushButton *ff = new QPushButton("FF",this, "ff");
65 hlayout2->addWidget(ff);
66 connect(ff, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
67
68 hlayout2->addSpacing(5);
69
70 QPushButton *next = new QPushButton("Next",this, "next");
71 hlayout2->addWidget(next);
72 connect(next, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
73}
diff --git a/noncore/tools/remote/vcrgroupconf.h b/noncore/tools/remote/vcrgroupconf.h
new file mode 100644
index 0000000..2fdce02
--- a/dev/null
+++ b/noncore/tools/remote/vcrgroupconf.h
@@ -0,0 +1,25 @@
1/*
2Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
3Copyright (C) 2002 Thomas Stephens
4
5This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7version.
8
9This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11Public License for more details.
12
13You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
14Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15*/
16
17#include <qwidget.h>
18#include <qpushbutton.h>
19#include <qlayout.h>
20
21class VCRGroupConf : public QWidget
22{
23public:
24 VCRGroupConf(QWidget *parent=0, const char *name=0);
25};