From c0effe456c6b43661f43d251c7923ebf3b953cba Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 5 Dec 2023 21:37:55 +0900 Subject: Avoid repeated connection of the same signal when ripping the same item multiple times Signed-off-by: Michele Calgaro --- src/kstreamripper.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/kstreamripper.cpp b/src/kstreamripper.cpp index 7a5d7cb..2abd249 100644 --- a/src/kstreamripper.cpp +++ b/src/kstreamripper.cpp @@ -82,10 +82,12 @@ KStreamRipper::KStreamRipper( TQWidget* parent, const char* name ) for( ; iter1 != nameList.end() && iter2 != urlList.end() && iter3 != descList.end(); ++iter1, ++iter2, ++iter3 ) { - ProcessListViewItem * proc = new ProcessListViewItem( m_streamsListView, *iter1, "", ""); - proc->setRenameEnabled(0, true); - proc->getProcessController()->setUrl( *iter2 ); - proc->getProcessController()->setDescription( *iter3 ); + ProcessListViewItem * procItem = new ProcessListViewItem( m_streamsListView, *iter1, "", ""); + procItem->setRenameEnabled(0, true); + ProcessController *pc = procItem->getProcessController(); + pc->setUrl( *iter2 ); + pc->setDescription( *iter3 ); + connect(pc, TQT_SIGNAL(stopRipSignal(ProcessController*)), this, TQT_SLOT(ripStopped(ProcessController*))); } //CONNECTS @@ -227,7 +229,6 @@ 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"); @@ -324,9 +325,11 @@ void KStreamRipper::urlChanged() void KStreamRipper::addStreamFinished( AddNewStreamImpl *e ) { - ProcessListViewItem * proc = new ProcessListViewItem( m_streamsListView, e->d_nameEdit->text(), "", ""); - proc->getProcessController()->setUrl( e->d_urlEdit->text() ); - proc->getProcessController()->setDescription( e->d_descEdit->text() ); + ProcessListViewItem *procItem = new ProcessListViewItem( m_streamsListView, e->d_nameEdit->text(), "", ""); + ProcessController *pc = procItem->getProcessController(); + pc->setUrl( e->d_urlEdit->text() ); + pc->setDescription( e->d_descEdit->text() ); + connect(pc, TQT_SIGNAL(stopRipSignal(ProcessController*)), this, TQT_SLOT(ripStopped(ProcessController*))); } #include "kstreamripper.moc" -- cgit v1.2.1