diff options
author | ormorph <roma251078@mail.ru> | 2023-12-08 21:22:21 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-12-08 21:23:22 +0900 |
commit | e1799206d95ffbe856dd9744111bca01b4b3835f (patch) | |
tree | 10f13eef4126278017636dc254479033534fe3fa /src | |
parent | 1801e3aacac299ed492dba8500bf5f78f6e3acbb (diff) | |
download | kstreamripper-e1799206d95ffbe856dd9744111bca01b4b3835f.tar.gz kstreamripper-e1799206d95ffbe856dd9744111bca01b4b3835f.zip |
Add unicode stream support
Signed-off-by: ormorph <roma251078@mail.ru>
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src')
-rw-r--r-- | src/kstreamripper.cpp | 5 | ||||
-rw-r--r-- | src/kstreamripperbase.ui | 22 | ||||
-rw-r--r-- | src/processcontroller.cpp | 21 | ||||
-rw-r--r-- | src/processcontroller.h | 3 |
4 files changed, 46 insertions, 5 deletions
diff --git a/src/kstreamripper.cpp b/src/kstreamripper.cpp index 9630c8f..c27e41c 100644 --- a/src/kstreamripper.cpp +++ b/src/kstreamripper.cpp @@ -68,6 +68,7 @@ KStreamRipper::KStreamRipper( TQWidget* parent, const char* name ) 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; @@ -132,6 +133,7 @@ void KStreamRipper::closeEvent( TQCloseEvent *e ) appConfig->writeEntry( "Riptime", m_timeEdit->text()); appConfig->writeEntry( "Command", m_tuneInEdit->text()); appConfig->writeEntry( "Id3Tag", m_id3Checkbox->isChecked()); + appConfig->writeEntry( "Unicode", m_unicodeCheckbox->isChecked()); //save the listview entrys TQStringList nameList,urlList,descList; @@ -224,7 +226,8 @@ void KStreamRipper::ripButtonClicked() { if (!(TDEStandardDirs::findExe("streamripper").isEmpty())) { ProcessListViewItem * ProcItem = (ProcessListViewItem*)m_streamsListView->currentItem(); - ProcItem->getProcessController()->startRip(m_destEdit->text(), m_timeEdit->text()); + ProcItem->getProcessController()->startRip(m_destEdit->text(), m_timeEdit->text(), + m_unicodeCheckbox->isChecked()); m_ripButton->setEnabled( false ); m_stopRipButton->setEnabled( true ); } else { diff --git a/src/kstreamripperbase.ui b/src/kstreamripperbase.ui index 8d2baa8..fb4e130 100644 --- a/src/kstreamripperbase.ui +++ b/src/kstreamripperbase.ui @@ -274,6 +274,28 @@ <string>Choose a directory</string> </property> </widget> + <widget class="TQLabel" row="1" column="3"> + <property name="name"> + <cstring>m_unicodeLabel</cstring> + </property> + <property name="text"> + <string>Unicode:</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="4"> + <property name="name"> + <cstring>m_unicodeCheckbox</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> </grid> </widget> <widget class="TQGroupBox" row="2" column="0" rowspan="1" colspan="2"> diff --git a/src/processcontroller.cpp b/src/processcontroller.cpp index a065ed6..da5e15c 100644 --- a/src/processcontroller.cpp +++ b/src/processcontroller.cpp @@ -23,7 +23,8 @@ #include "processlistviewitem.h" ProcessController::ProcessController(ProcessListViewItem * parent) - : TQObject(parent), myParent(parent), myStatus(false), myAutomatic(false), myProcess(new TQProcess(this)) + : TQObject(parent), myParent(parent), myStatus(false), myAutomatic(false), myUnicodeEnabled(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()) ); @@ -38,7 +39,15 @@ ProcessController::~ProcessController() void ProcessController::readStdout() { - TQString tempOutput = myProcess->readStdout(); + TQString tempOutput; + if (myUnicodeEnabled) + { + tempOutput = TQString::fromUtf8(myProcess->readStdout()); + } + else + { + tempOutput = TQString::fromLocal8Bit(myProcess->readStdout()); + } if( tempOutput.contains( "ripping..." )) { @@ -77,14 +86,20 @@ void ProcessController::processExited() emit stopRipSignal(this); } -void ProcessController::startRip(TQString destination, TQString time) +void ProcessController::startRip(TQString destination, TQString time, bool isUnicode) { + myUnicodeEnabled = isUnicode; myStatus = true; myParent->setText( 1, "Ripping" ); myProcess->clearArguments(); myProcess->addArgument( "streamripper" ); myProcess->addArgument( myUrl ); + if( isUnicode ) + { + myProcess->addArgument( "--codeset-filesys=UTF-8 " ); + myProcess->addArgument( "--codeset-metadata=UTF-8 " ); + } myProcess->addArgument( "-d " ); myProcess->addArgument( destination ); if( time.toInt() ) diff --git a/src/processcontroller.h b/src/processcontroller.h index 9405471..16b3358 100644 --- a/src/processcontroller.h +++ b/src/processcontroller.h @@ -51,7 +51,7 @@ public: void setDescription(TQString Description); TQString getUrl(); TQString getDescription(); - void startRip(TQString destination, TQString time); + void startRip(TQString destination, TQString time, bool isUnicode); void stopRip(); signals: @@ -65,6 +65,7 @@ private: ProcessListViewItem * myParent; bool myStatus; bool myAutomatic; + bool myUnicodeEnabled; #if KDE_IS_VERSION(3,3,90) DNSSD::RemoteService::Ptr myService; #endif |