summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-12-16 21:44:06 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-12-16 23:54:41 +0900
commit9fb4112aefbb60987f637dec35cb09b80a8cd56d (patch)
tree7e9bda3e881702d051dace937192333fdb7035a5 /src
parent9a8675a84c665a02b80ff93c12dd0a466f079f50 (diff)
downloadkstreamripper-9fb4112aefbb60987f637dec35cb09b80a8cd56d.tar.gz
kstreamripper-9fb4112aefbb60987f637dec35cb09b80a8cd56d.zip
Added stream editing in a separate dialog box
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> Signed-off-by: ormorph <roma251078@mail.ru> (cherry picked from commit fb82c1b0089a7209a6e1ca6b20bf5dca3c0a56bb)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/kstreamripper.cpp109
-rw-r--r--src/kstreamripper.h7
-rw-r--r--src/kstreamripperbase.ui31
-rw-r--r--src/streampropertiesdlg.cpp (renamed from src/addnewstreamimpl.cpp)31
-rw-r--r--src/streampropertiesdlg.h (renamed from src/addnewstreamimpl.h)19
-rw-r--r--src/streampropertiesdlgbase.ui (renamed from src/addnewstream.ui)35
7 files changed, 132 insertions, 104 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7eacdcf..cb62c66 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,13 +17,13 @@ link_directories(
tde_add_executable( ${PROJECT_NAME} AUTOMOC
SOURCES
- addnewstreamimpl.cpp
- addnewstream.ui
kstreamripperbase.ui
kstreamripper.cpp
main.cpp
processcontroller.cpp
processlistviewitem.cpp
+ streampropertiesdlgbase.ui
+ streampropertiesdlg.cpp
LINK
tdecore-shared
tdeui-shared
diff --git a/src/kstreamripper.cpp b/src/kstreamripper.cpp
index 8d27d27..c1ef1af 100644
--- a/src/kstreamripper.cpp
+++ b/src/kstreamripper.cpp
@@ -43,7 +43,7 @@
#include <tdeversion.h>
#include "kstreamripper.h"
-#include "addnewstreamimpl.h"
+#include "streampropertiesdlg.h"
#include "processlistviewitem.h"
#include "processcontroller.h"
@@ -56,23 +56,23 @@ KStreamRipper::KStreamRipper( TQWidget* parent, const char* name )
#endif
{
m_destEdit->setText( TQDir::homeDirPath() );
-
+
m_streamsListView->addColumn( "Name" );
m_streamsListView->addColumn( "Status" );
m_streamsListView->addColumn( "Size" );
-
+
//app config
TDEConfig *appConfig = TDEGlobal::config();
-
+
m_destEdit->setText( appConfig->readEntry( "Destination" , "" ) );
m_timeEdit->setText( appConfig->readEntry( "Riptime", "0" ));
m_tuneInEdit->setText( appConfig->readEntry( "Command", "xmms <url>" ));
m_id3Checkbox->setChecked( appConfig->readBoolEntry( "Id3Tag", 1 ));
m_unicodeCheckbox->setChecked( appConfig->readBoolEntry( "Unicode", 1 ));
-
+
//listview entrys
TQStringList nameList,urlList,descList;
-
+
nameList = appConfig->readListEntry( "names" );
urlList = appConfig->readListEntry( "urls" );
descList = appConfig->readListEntry( "descs" );
@@ -80,21 +80,22 @@ KStreamRipper::KStreamRipper( TQWidget* parent, const char* name )
iter1 = nameList.begin();
iter2 = urlList.begin();
iter3 = descList.begin();
-
+
for( ; iter1 != nameList.end() && iter2 != urlList.end() && iter3 != descList.end(); ++iter1, ++iter2, ++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*)));
- }
-
+ {
+ 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
-
+
//clicks
connect(m_addStreamButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(addStreamButtonClicked()));
+ connect(m_editStreamButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(editStreamButtonClicked()));
connect(m_deleteStreamButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(deleteStreamButtonClicked()));
connect(m_tuneInButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(tuneInButtonClicked()));
connect(m_ripButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(ripButtonClicked()));
@@ -103,7 +104,7 @@ KStreamRipper::KStreamRipper( TQWidget* parent, const char* name )
connect(m_helpButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(helpButtonClicked()));
connect(m_aboutButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(aboutButtonClicked()));
connect(m_quitButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(quitButtonClicked()));
-
+
//other
connect( m_streamsListView, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT( selectedNewListItem()) );
connect( m_DescriptionEdit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT( descriptionChanged()) );
@@ -111,9 +112,9 @@ KStreamRipper::KStreamRipper( TQWidget* parent, const char* name )
// zeroconf
#if KDE_IS_VERSION(3,3,90)
- connect(&m_browser, TQT_SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)), this,
+ connect(&m_browser, TQT_SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)), this,
TQT_SLOT(serviceAdded(DNSSD::RemoteService::Ptr)));
- connect(&m_browser, TQT_SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr)), this,
+ connect(&m_browser, TQT_SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr)), this,
TQT_SLOT(serviceRemoved(DNSSD::RemoteService::Ptr)));
m_browser.startBrowse();
#endif
@@ -166,10 +167,23 @@ void KStreamRipper::closeEvent( TQCloseEvent *e )
//SLOTS
void KStreamRipper::addStreamButtonClicked()
{
- AddNewStreamImpl *test = new AddNewStreamImpl( this );
- connect( test, TQT_SIGNAL( finished( AddNewStreamImpl* )), this, TQT_SLOT( addStreamFinished( AddNewStreamImpl* )) );
-
- test->show();
+ StreamPropertiesDlg *dlg = new StreamPropertiesDlg(this);
+ connect( dlg, TQT_SIGNAL( finished( StreamPropertiesDlg* )), this, TQT_SLOT( addStreamFinished( StreamPropertiesDlg* )) );
+ dlg->setCaption("Add Stream...");
+ dlg->show();
+}
+
+void KStreamRipper::editStreamButtonClicked()
+{
+ ProcessListViewItem *ProcItem = (ProcessListViewItem*)m_streamsListView->currentItem();
+ StreamPropertiesDlg *dlg = new StreamPropertiesDlg(this);
+ connect( dlg, TQT_SIGNAL( finished( StreamPropertiesDlg* )), this, TQT_SLOT( editStreamFinished( StreamPropertiesDlg* )) );
+ dlg->setCaption("Edit Stream");
+ dlg->d_nameEdit->setText(ProcItem->text(0));
+ dlg->d_urlEdit->setText(ProcItem->getProcessController()->getUrl());
+ dlg->d_descEdit->setText(ProcItem->getProcessController()->getDescription());
+ dlg->show();
+
}
void KStreamRipper::deleteStreamButtonClicked()
@@ -184,12 +198,12 @@ void KStreamRipper::tuneInButtonClicked()
if( m_streamsListView->currentItem() )
{
TQString command = m_tuneInEdit->text().replace( "<url>", m_UrlEdit->text() );
-
+
TQStringList commands = TQStringList::split( " ", command );
-
+
TQProcess *process = new TQProcess( this );
process->setArguments( commands );
-
+
process->start();
}
else ;
@@ -208,13 +222,13 @@ void KStreamRipper::serviceAdded(DNSSD::RemoteService::Ptr srv)
void KStreamRipper::serviceRemoved(DNSSD::RemoteService::Ptr srv)
{
TQListViewItemIterator iter( m_streamsListView );
-
+
while( iter.current() ) {
ProcessListViewItem * ProcItem = (ProcessListViewItem*)iter.current();
- if (ProcItem->getProcessController()->getAutomatic() &&
- srv==ProcItem->getProcessController()->getService()) {
- delete ProcItem;
- return;
+ if (ProcItem->getProcessController()->getAutomatic() &&
+ srv==ProcItem->getProcessController()->getService()) {
+ delete ProcItem;
+ return;
}
++iter;
}
@@ -281,32 +295,29 @@ void KStreamRipper::quitButtonClicked()
void KStreamRipper::selectedNewListItem()
{
if ( !m_streamsListView->selectedItem() ) {
+ m_editStreamButton->setEnabled( false );
m_deleteStreamButton->setEnabled( false );
m_tuneInButton->setEnabled( false );
m_ripButton->setEnabled( false );
m_DescriptionEdit->setText( TQString() );
- m_DescriptionEdit->setEnabled(false);
- m_UrlEdit->setEnabled(false);
+ m_DescriptionEdit->setEnabled(false);
+ m_UrlEdit->setEnabled(false);
m_UrlEdit->setText( TQString() );
- return;
+ return;
}
ProcessController * ProcCtl = ((ProcessListViewItem*)m_streamsListView->currentItem())->getProcessController();
- // reconfigure what the user is allowed to do based on if this process is ripping
+ // reconfigure what the user is allowed to do based on if this process is ripping
m_ripButton->setEnabled( !ProcCtl->getStatus() );
m_stopRipButton->setEnabled( ProcCtl->getStatus() );
m_tuneInButton->setEnabled( true );
+ m_editStreamButton->setEnabled( !ProcCtl->getAutomatic() );
m_deleteStreamButton->setEnabled( !ProcCtl->getAutomatic() );
-
+
m_DescriptionEdit->setText(ProcCtl->getDescription());
m_DescriptionEdit->setEnabled(true);
m_UrlEdit->setText(ProcCtl->getUrl());
m_UrlEdit->setEnabled( !ProcCtl->getAutomatic() );
-
-
- // maybe these are more elegant than the next two functions, assuming the slots are implemented in ProcessController
- //connect(m_DescriptionEdit, TQT_SIGNAL(textChanged(const TQString&)), (ProcessListViewItem*)m_streamsListView->currentItem()->getProcessController(), TQT_SIGNAL(descriptionChanged(const TQString&))
- //connect(m_UrlEdit, TQT_SIGNAL(textChanged(const TQString&)), (ProcessListViewItem*)m_streamsListView->currentItem()->getProcessController(), TQT_SIGNAL(urlChanged(const TQString&))
}
void KStreamRipper::descriptionChanged()
@@ -323,8 +334,7 @@ void KStreamRipper::urlChanged()
ProcItem->getProcessController()->setUrl(m_UrlEdit->text());
}
-
-void KStreamRipper::addStreamFinished( AddNewStreamImpl *e )
+void KStreamRipper::addStreamFinished( StreamPropertiesDlg *e )
{
ProcessListViewItem *procItem = new ProcessListViewItem( m_streamsListView, e->d_nameEdit->text(), "", "");
ProcessController *pc = procItem->getProcessController();
@@ -333,4 +343,15 @@ void KStreamRipper::addStreamFinished( AddNewStreamImpl *e )
connect(pc, TQT_SIGNAL(stopRipSignal(ProcessController*)), this, TQT_SLOT(ripStopped(ProcessController*)));
}
+void KStreamRipper::editStreamFinished( StreamPropertiesDlg *e )
+{
+ ProcessListViewItem *procItem = (ProcessListViewItem*)m_streamsListView->currentItem();
+ ProcessController *pc = procItem->getProcessController();
+ procItem->setText(0, e->d_nameEdit->text());
+ pc->setUrl( e->d_urlEdit->text() );
+ pc->setDescription( e->d_descEdit->text() );
+ m_UrlEdit->setText( e->d_urlEdit->text() );
+ m_DescriptionEdit->setText( e->d_descEdit->text() );
+}
+
#include "kstreamripper.moc"
diff --git a/src/kstreamripper.h b/src/kstreamripper.h
index 7677e6f..43c955c 100644
--- a/src/kstreamripper.h
+++ b/src/kstreamripper.h
@@ -36,7 +36,7 @@ namespace DNSSD { namespace RemoteService { typedef int Ptr; } }
#endif
-class AddNewStreamImpl;
+class StreamPropertiesDlg;
class TQString;
class KStreamRipper : public KStreamRipperBase
@@ -57,6 +57,7 @@ public:
protected slots:
void addStreamButtonClicked();
+ void editStreamButtonClicked();
void deleteStreamButtonClicked();
void tuneInButtonClicked();
void ripButtonClicked();
@@ -71,7 +72,9 @@ protected slots:
void descriptionChanged();
void urlChanged();
- void addStreamFinished( AddNewStreamImpl* );
+ void addStreamFinished( StreamPropertiesDlg* );
+ void editStreamFinished( StreamPropertiesDlg* );
+
#if KDE_IS_VERSION(3,3,90)
void serviceAdded(DNSSD::RemoteService::Ptr srv);
void serviceRemoved(DNSSD::RemoteService::Ptr srv);
diff --git a/src/kstreamripperbase.ui b/src/kstreamripperbase.ui
index fb4e130..9eaf04d 100644
--- a/src/kstreamripperbase.ui
+++ b/src/kstreamripperbase.ui
@@ -116,30 +116,27 @@
</widget>
<widget class="TQPushButton" row="0" column="1">
<property name="name">
- <cstring>m_deleteStreamButton</cstring>
+ <cstring>m_editStreamButton</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
- <string>&amp;Delete Stream</string>
+ <string>&amp;Edit Stream</string>
</property>
</widget>
- <widget class="TQPushButton" row="0" column="4">
+ <widget class="TQPushButton" row="0" column="2">
<property name="name">
- <cstring>m_stopRipButton</cstring>
+ <cstring>m_deleteStreamButton</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
- <string>&amp;Stop Rip</string>
- </property>
- <property name="on">
- <bool>false</bool>
+ <string>&amp;Delete Stream</string>
</property>
</widget>
- <widget class="TQPushButton" row="0" column="2">
+ <widget class="TQPushButton" row="1" column="0">
<property name="name">
<cstring>m_tuneInButton</cstring>
</property>
@@ -150,7 +147,7 @@
<string>&amp;Tune in</string>
</property>
</widget>
- <widget class="TQPushButton" row="0" column="3">
+ <widget class="TQPushButton" row="1" column="1">
<property name="name">
<cstring>m_ripButton</cstring>
</property>
@@ -161,6 +158,20 @@
<string>&amp;Rip Stream</string>
</property>
</widget>
+ <widget class="TQPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>m_stopRipButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Stop Rip</string>
+ </property>
+ <property name="on">
+ <bool>false</bool>
+ </property>
+ </widget>
</grid>
</widget>
<widget class="TQListView" row="1" column="0" rowspan="1" colspan="2">
diff --git a/src/addnewstreamimpl.cpp b/src/streampropertiesdlg.cpp
index f10b547..7c77364 100644
--- a/src/addnewstreamimpl.cpp
+++ b/src/streampropertiesdlg.cpp
@@ -23,43 +23,42 @@
#include <tqpushbutton.h>
#include <tqlineedit.h>
-#include "addnewstreamimpl.h"
+#include "streampropertiesdlg.h"
-AddNewStreamImpl::AddNewStreamImpl( TQWidget* parent, const char* name )
- : AddNewStream( parent,name, true )
+StreamPropertiesDlg::StreamPropertiesDlg(TQWidget *parent, const char *name)
+ : StreamPropertiesDlgBase(parent, name, true)
{
connect( d_okButton, TQT_SIGNAL( clicked()), this, TQT_SLOT( okButtonClicked()) );
connect( d_cancelButton, TQT_SIGNAL( clicked()), this, TQT_SLOT( cancelButtonClicked()) );
}
-AddNewStreamImpl::~AddNewStreamImpl()
+StreamPropertiesDlg::~StreamPropertiesDlg()
{
}
//SLOTS
-
-void AddNewStreamImpl::okButtonClicked()
+void StreamPropertiesDlg::okButtonClicked()
{
if( d_nameEdit->text() != "" && d_urlEdit->text() != "")
- {
- emit finished( this );
- this->close();
- }
+ {
+ emit finished( this );
+ this->close();
+ }
else
- {
- KMessageBox::error( this, "You forgot to fill out one or more fields, please do it now.",
- "Missing Information" );
- }
+ {
+ KMessageBox::error( this, "You forgot to fill out one or more fields, please do it now.",
+ "Missing Information" );
+ }
}
-void AddNewStreamImpl::cancelButtonClicked()
+void StreamPropertiesDlg::cancelButtonClicked()
{
this->close();
}
-#include "addnewstreamimpl.moc"
+#include "streampropertiesdlg.moc"
diff --git a/src/addnewstreamimpl.h b/src/streampropertiesdlg.h
index 5683491..62c38b0 100644
--- a/src/addnewstreamimpl.h
+++ b/src/streampropertiesdlg.h
@@ -18,22 +18,20 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#ifndef ADDNEWSTREAMIMPL_H
-#define ADDNEWSTREAMIMPL_H
+#ifndef STREAM_PROPERTIES_DLG_BASE_H
+#define STREAM_PROPERTIES_DLG_BASE_H
-#include "addnewstream.h"
+#include "streampropertiesdlgbase.h"
-class AddNewStreamImpl : public AddNewStream
+
+class StreamPropertiesDlg : public StreamPropertiesDlgBase
{
TQ_OBJECT
-
public:
- AddNewStreamImpl( TQWidget* parent = 0, const char* name = 0 );
- ~AddNewStreamImpl();
-
-protected:
+ StreamPropertiesDlg(TQWidget *parent = nullptr, const char *name = nullptr);
+ ~StreamPropertiesDlg();
protected slots:
@@ -42,8 +40,7 @@ protected slots:
signals:
- void finished( AddNewStreamImpl* );
+ void finished( StreamPropertiesDlg* );
};
#endif
-
diff --git a/src/addnewstream.ui b/src/streampropertiesdlgbase.ui
index 9fcdb0e..50881c0 100644
--- a/src/addnewstream.ui
+++ b/src/streampropertiesdlgbase.ui
@@ -1,20 +1,17 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>AddNewStream</class>
+<class>StreamPropertiesDlgBase</class>
<widget class="TQDialog">
<property name="name">
- <cstring>AddNewStream</cstring>
+ <cstring>StreamPropertiesDlgBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>383</width>
- <height>287</height>
+ <width>450</width>
+ <height>200</height>
</rect>
</property>
- <property name="caption">
- <string>Add Stream....</string>
- </property>
<property name="focusPolicy">
<enum>TabFocus</enum>
</property>
@@ -44,30 +41,25 @@
<string>Name:</string>
</property>
</widget>
- <widget class="TQLabel" row="2" column="0">
- <property name="name">
- <cstring>d_descriptionLabel</cstring>
- </property>
- <property name="text">
- <string>Description:</string>
- </property>
- </widget>
<widget class="TQLineEdit" row="0" column="1">
<property name="name">
<cstring>d_nameEdit</cstring>
</property>
</widget>
- <widget class="TQLineEdit" row="1" column="1">
+ <widget class="TQLabel" row="1" column="0">
<property name="name">
- <cstring>d_urlEdit</cstring>
+ <cstring>d_descriptionLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Description:</string>
</property>
</widget>
- <widget class="TQLineEdit" row="2" column="1">
+ <widget class="TQLineEdit" row="1" column="1">
<property name="name">
<cstring>d_descEdit</cstring>
</property>
</widget>
- <widget class="TQLabel" row="1" column="0">
+ <widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>d_urlLabel</cstring>
</property>
@@ -75,6 +67,11 @@
<string>Url of Stream:</string>
</property>
</widget>
+ <widget class="TQLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>d_urlEdit</cstring>
+ </property>
+ </widget>
</grid>
</widget>
<widget class="TQPushButton" row="1" column="0">