|
|
|
@ -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"
|
|
|
|
|