summaryrefslogtreecommitdiff
path: root/noncore/tools/remote/recorddialog.cpp
authorspiralman <spiralman>2002-07-23 22:34:51 (UTC)
committer spiralman <spiralman>2002-07-23 22:34:51 (UTC)
commit7b69ef59464072521adb20148d49f9c654c066ee (patch) (unidiff)
tree449ef1dbfeac19f18b1ded20b4865353fa71452c /noncore/tools/remote/recorddialog.cpp
parentc344a4f4d0a614cfeb75d1d935e1f519d473c068 (diff)
downloadopie-7b69ef59464072521adb20148d49f9c654c066ee.zip
opie-7b69ef59464072521adb20148d49f9c654c066ee.tar.gz
opie-7b69ef59464072521adb20148d49f9c654c066ee.tar.bz2
Added code for irrecord frontend, doesnt work yet.
Diffstat (limited to 'noncore/tools/remote/recorddialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/recorddialog.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/noncore/tools/remote/recorddialog.cpp b/noncore/tools/remote/recorddialog.cpp
new file mode 100644
index 0000000..642e99c
--- a/dev/null
+++ b/noncore/tools/remote/recorddialog.cpp
@@ -0,0 +1,81 @@
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 "recorddialog.h"
18
19RecordDialog::RecordDialog(QWidget *parent=0, const char *name=0):QDialog(parent, name)
20{
21 QVBoxLayout *layout = new QVBoxLayout(this);
22 QHBoxLayout *hlayout = new QHBoxLayout(this);
23
24 layout->insertSpacing(0,5);
25 output = new QTextView("Please enter the name of the new remote, and press Return\n", 0, this, "output");
26 layout->insertWidget(-1, output);
27 layout->insertSpacing(-1, 5);
28 layout->insertLayout(-1, hlayout);
29 layout->insertSpacing(-1, 5);
30
31 hlayout->insertSpacing(0, 5);
32 input = new QLineEdit(this, "input");
33 hlayout->insertWidget(-1, input, 1);
34 hlayout->insertSpacing(-1, 5);
35
36 QPushButton *ret = new QPushButton("Return", this, "return");
37 hlayout->insertWidget(-1, ret);
38 hlayout->insertSpacing(-1, 5);
39 connect(ret, SIGNAL(clicked()), this, SLOT(retPressed()) );
40 where = 0;
41
42 record = new OProcess;
43}
44
45void RecordDialog::retPressed()
46{
47 printf("RecordDialog::retPressed: ret pressed\n");
48
49 if(where == 0)
50 {
51 connect(record, SIGNAL(receivedStdout(OProcess *, char *, int)), this, SLOT(incoming(OProcess *, char *, int)) );
52 connect(record, SIGNAL(receivedStderr(OProcess *, char *, int)), this, SLOT(incoming(OProcess *, char *, int)) );
53 connect(record, SIGNAL(processExited(OProcess *)), this, SLOT(done(OProcess *)) );
54 printf("RecordDialog::retPressed: starting irrecord\n");
55 QString file = "/tmp/" + input->text();
56 *record<<"irrecord"<<file.latin1();
57 if(!record->start(OProcess::NotifyOnExit, OProcess::AllOutput))
58 {
59 QMessageBox *mb = new QMessageBox("Error!",
60 "Could not start irrecord. You must<br>use an lirc ipkg that includes<br>irrecord",
61 QMessageBox::NoIcon,
62 QMessageBox::Ok,
63 QMessageBox::NoButton,
64 QMessageBox::NoButton);
65 mb->exec();
66 return;
67 }
68 // record->resume();
69 where = 1;
70 }
71}
72
73void RecordDialog::incoming(OProcess *proc, char *buffer, int len)
74{
75 output->setText(output->text() + QString(buffer).truncate(len-1));
76 printf("RecordDialog::incoming: got text from irrecord\n");
77}
78
79void RecordDialog::done(OProcess *proc)
80{
81}