Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

recorddialog.cpp

Go to the documentation of this file.
00001 /*
00002 Opie-Remote.  emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
00003 Copyright (C) 2002 Thomas Stephens
00004 
00005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
00006 License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
00007 version.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
00010 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00011 Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
00014 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00015 */
00016 
00017 #include "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 //              record->resume();
00072                 where = 1;
00073         }
00074 }
00075 
00076 void RecordDialog::incoming(OProcess *proc, char *buffer, int len)
00077 {
00078 //      output->setText(output->text() + QString(buffer).truncate(len-1));
00079         printf("RecordDialog::incoming: got text from irrecord\n");
00080 }
00081 
00082 void RecordDialog::done(OProcess *proc)
00083 {
00084 }

Generated on Sat Nov 5 16:18:03 2005 for OPIE by  doxygen 1.4.2