00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "recorddialog.h"
00018
00019 using namespace Opie::Core;
00020 using namespace Opie::Core;
00021 RecordDialog::RecordDialog(QWidget *parent, const char *name)
00022 :QDialog(parent, name)
00023 {
00024 QVBoxLayout *layout = new QVBoxLayout(this);
00025 QHBoxLayout *hlayout = new QHBoxLayout(this);
00026
00027 layout->insertSpacing(0,5);
00028 output = new QTextView("Please enter the name of the new remote, and press Return\n", 0, this, "output");
00029 layout->insertWidget(-1, output);
00030 layout->insertSpacing(-1, 5);
00031 layout->insertLayout(-1, hlayout);
00032 layout->insertSpacing(-1, 5);
00033
00034 hlayout->insertSpacing(0, 5);
00035 input = new QLineEdit(this, "input");
00036 hlayout->insertWidget(-1, input, 1);
00037 hlayout->insertSpacing(-1, 5);
00038
00039 QPushButton *ret = new QPushButton("Return", this, "return");
00040 hlayout->insertWidget(-1, ret);
00041 hlayout->insertSpacing(-1, 5);
00042 connect(ret, SIGNAL(clicked()), this, SLOT(retPressed()) );
00043 where = 0;
00044
00045 record = new OProcess;
00046 }
00047
00048 void RecordDialog::retPressed()
00049 {
00050 printf("RecordDialog::retPressed: ret pressed\n");
00051
00052 if(where == 0)
00053 {
00054 connect(record, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), this, SLOT(incoming(Opie::Core::OProcess*,char*,int)) );
00055 connect(record, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT(incoming(Opie::Core::OProcess*,char*,int)) );
00056 connect(record, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT(done(Opie::Core::OProcess*)) );
00057 printf("RecordDialog::retPressed: starting irrecord\n");
00058 QString file = "/tmp/" + input->text();
00059 *record<<"irrecord"<<file.latin1();
00060 if(!record->start(OProcess::NotifyOnExit, OProcess::AllOutput))
00061 {
00062 QMessageBox *mb = new QMessageBox("Error!",
00063 "Could not start irrecord. You must<br>use an lirc ipkg that includes<br>irrecord",
00064 QMessageBox::NoIcon,
00065 QMessageBox::Ok,
00066 QMessageBox::NoButton,
00067 QMessageBox::NoButton);
00068 mb->exec();
00069 return;
00070 }
00071
00072 where = 1;
00073 }
00074 }
00075
00076 void RecordDialog::incoming(OProcess *proc, char *buffer, int len)
00077 {
00078
00079 printf("RecordDialog::incoming: got text from irrecord\n");
00080 }
00081
00082 void RecordDialog::done(OProcess *proc)
00083 {
00084 }