Added event processing if the process has finished its work

Signed-off-by: ormorph <roma251078@mail.ru>
pull/9/head
ormorph 1 year ago committed by Michele Calgaro
parent bc6622cea7
commit 7bd4251db3
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -227,12 +227,23 @@ void KStreamRipper::ripButtonClicked()
ProcItem->getProcessController()->startRip(m_destEdit->text(), m_timeEdit->text());
m_ripButton->setEnabled( false );
m_stopRipButton->setEnabled( true );
connect(ProcItem->getProcessController(), TQT_SIGNAL(stopRipSignal(ProcessController*)), this, TQT_SLOT(ripStopped(ProcessController*)));
} else {
KMessageBox::error(this, "The streamripper executable wasn't found. Make sure "
"it's in your path.", "streamripper not found");
}
}
void KStreamRipper::ripStopped(ProcessController *curProc)
{
const ProcessController *proc = ((ProcessListViewItem*)m_streamsListView->currentItem())->getProcessController();
if (curProc == proc)
{
m_ripButton->setEnabled( true );
m_stopRipButton->setEnabled( false );
}
}
void KStreamRipper::stopRipButtonClicked()
{
ProcessListViewItem * ProcItem = (ProcessListViewItem*)m_streamsListView->currentItem();

@ -22,7 +22,10 @@
#define KSTREAMRIPPER_H
#include <tdeversion.h>
#include "kstreamripperbase.h"
#include "processcontroller.h"
#if KDE_IS_VERSION(3,3,90)
#include <dnssd/servicebrowser.h>
#include <dnssd/remoteservice.h>
@ -57,6 +60,7 @@ protected slots:
void deleteStreamButtonClicked();
void tuneInButtonClicked();
void ripButtonClicked();
void ripStopped(ProcessController*);
void stopRipButtonClicked();
void browseButtonClicked();
void helpButtonClicked();

@ -26,6 +26,7 @@ ProcessController::ProcessController(ProcessListViewItem * parent)
: TQObject((TQObject *)parent), myParent(parent), myStatus(false), myAutomatic(false), myProcess(new TQProcess(this))
{
connect (myProcess, TQT_SIGNAL( readyReadStdout() ), (ProcessController *) this, TQT_SLOT( readStdout()) );
connect (myProcess, TQT_SIGNAL(processExited() ), (ProcessController *) this, TQT_SLOT( processExited()) );
// connect (myProcess, TQT_SIGNAL( destroyed() ), myProcess, TQT_SLOT( kill()) );
// this should work, according to http://doc.trolltech.com/3.2/qobject.html#~TQObject but it doesn't
}
@ -68,6 +69,13 @@ void ProcessController::readStdout()
}
}
void ProcessController::processExited()
{
myStatus = false;
myParent->setText( 1, "" );
myParent->setText( 2, "" );
emit stopRipSignal(this);
}
void ProcessController::startRip(TQString destination, TQString time)
{

@ -54,8 +54,12 @@ public:
void startRip(TQString destination, TQString time);
void stopRip();
signals:
void stopRipSignal(ProcessController*);
protected slots:
void readStdout();
void processExited();
private:
ProcessListViewItem * myParent;

Loading…
Cancel
Save