diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 20:34:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 20:34:15 +0000 |
commit | 1c1403293485f35fd53db45aaa77a01cdd9627e7 (patch) | |
tree | 38559cd68cd4f63023fb5f6375def9db3b8b491e /plugins/partfileimport | |
parent | 894f94545727610df22c4f73911d62d58266f695 (diff) | |
download | ktorrent-1c1403293485f35fd53db45aaa77a01cdd9627e7.tar.gz ktorrent-1c1403293485f35fd53db45aaa77a01cdd9627e7.zip |
TQt4 port ktorrent
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1238733 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'plugins/partfileimport')
-rw-r--r-- | plugins/partfileimport/importdialog.cpp | 64 | ||||
-rw-r--r-- | plugins/partfileimport/importdialog.h | 13 | ||||
-rw-r--r-- | plugins/partfileimport/importdlgbase.ui | 30 | ||||
-rw-r--r-- | plugins/partfileimport/partfileimportplugin.cpp | 8 | ||||
-rw-r--r-- | plugins/partfileimport/partfileimportplugin.h | 5 |
5 files changed, 61 insertions, 59 deletions
diff --git a/plugins/partfileimport/importdialog.cpp b/plugins/partfileimport/importdialog.cpp index 22f9a4b..158b4f8 100644 --- a/plugins/partfileimport/importdialog.cpp +++ b/plugins/partfileimport/importdialog.cpp @@ -42,8 +42,8 @@ using namespace bt; namespace kt { - ImportDialog::ImportDialog(CoreInterface* core,QWidget* parent, const char* name, bool modal, WFlags fl) - : ImportDlgBase(parent,name, modal,fl),DataCheckerListener(false),core(core) + ImportDialog::ImportDialog(CoreInterface* core,TQWidget* tqparent, const char* name, bool modal, WFlags fl) + : ImportDlgBase(tqparent,name, modal,fl),DataCheckerListener(false),core(core) { KURLRequester* r = m_torrent_url; r->setMode(KFile::File|KFile::LocalOnly); @@ -52,8 +52,8 @@ namespace kt r = m_data_url; r->setMode(KFile::File|KFile::Directory|KFile::LocalOnly); - connect(m_import_btn,SIGNAL(clicked()),this,SLOT(onImport())); - connect(m_cancel_btn,SIGNAL(clicked()),this,SLOT(reject())); + connect(m_import_btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(onImport())); + connect(m_cancel_btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(reject())); m_progress->setEnabled(false); } @@ -92,18 +92,18 @@ namespace kt try { dc->setListener(this); - dc->check(data_url.path(),tor,QString::null); + dc->check(data_url.path(),tor,TQString()); } catch (Error & e) { delete dc; - KMessageBox::error(this,i18n("Cannot verify data : %1").arg(e.toString()),i18n("Error")); + KMessageBox::error(this,i18n("Cannot verify data : %1").tqarg(e.toString()),i18n("Error")); reject(); return; } // find a new torrent dir and make it if necessary - QString tor_dir = core->findNewTorrentDir(); + TQString tor_dir = core->findNewTorrentDir(); if (!tor_dir.endsWith(bt::DirSeparator())) tor_dir += bt::DirSeparator(); @@ -123,11 +123,11 @@ namespace kt // make the cache if (tor.isMultiFile()) { - QValueList<Uint32> dnd_files; + TQValueList<Uint32> dnd_files; bool dnd = false; // first make tor_dir/cache/ - QString cache_dir = tor_dir + "cache" + bt::DirSeparator(); - QString dnd_dir = tor_dir + "dnd" + bt::DirSeparator(); + TQString cache_dir = tor_dir + "cache" + bt::DirSeparator(); + TQString dnd_dir = tor_dir + "dnd" + bt::DirSeparator(); if (!bt::Exists(cache_dir)) MakeDir(cache_dir); if (!bt::Exists(dnd_dir)) @@ -143,10 +143,10 @@ namespace kt dnd = false; } - QString durl = data_url.path(); + TQString durl = data_url.path(); if (durl.endsWith(bt::DirSeparator())) durl = durl.left(durl.length() - 1); - int ds = durl.findRev(bt::DirSeparator()); + int ds = durl.tqfindRev(bt::DirSeparator()); if (durl.mid(ds+1) == tor.getNameSuggestion()) { durl = durl.left(ds); @@ -162,8 +162,8 @@ namespace kt { // single file, just symlink the data_url to tor_dir/cache bt::SymLink(data_url.path(),tor_dir + "cache"); - QString durl = data_url.path(); - int ds = durl.findRev(bt::DirSeparator()); + TQString durl = data_url.path(); + int ds = durl.tqfindRev(bt::DirSeparator()); durl = durl.left(ds); saveStats(tor_dir + "stats",durl,imported,false); } @@ -204,7 +204,7 @@ namespace kt } catch (Error & e) { - KMessageBox::error(this,i18n("Cannot load the torrent file : %1").arg(e.toString()), + KMessageBox::error(this,i18n("Cannot load the torrent file : %1").tqarg(e.toString()), i18n("Error")); reject(); return; @@ -226,7 +226,7 @@ namespace kt { // download the torrent file KIO::StoredTransferJob* j = KIO::storedGet(tor_url); - connect(j,SIGNAL(result(KIO::Job* )),this,SLOT(onTorrentGetReult(KIO::Job*))); + connect(j,TQT_SIGNAL(result(KIO::Job* )),this,TQT_SLOT(onTorrentGetReult(KIO::Job*))); } else { @@ -240,7 +240,7 @@ namespace kt } catch (Error & e) { - KMessageBox::error(this,i18n("Cannot load the torrent file : %1").arg(e.toString()), + KMessageBox::error(this,i18n("Cannot load the torrent file : %1").tqarg(e.toString()), i18n("Error")); reject(); return; @@ -249,12 +249,12 @@ namespace kt } } - void ImportDialog::writeIndex(const QString & file,const BitSet & chunks) + void ImportDialog::writeIndex(const TQString & file,const BitSet & chunks) { // first try to open it File fptr; if (!fptr.open(file,"wb")) - throw Error(i18n("Cannot open %1 : %2").arg(file).arg(fptr.errorString())); + throw Error(i18n("Cannot open %1 : %2").tqarg(file).tqarg(fptr.errorString())); // write all chunks to the file for (Uint32 i = 0;i < chunks.getNumBits();i++) @@ -270,18 +270,18 @@ namespace kt } } - void ImportDialog::linkTorFile(const QString & cache_dir,const QString & dnd_dir, - const KURL & data_url,const QString & fpath,bool & dnd) + void ImportDialog::linkTorFile(const TQString & cache_dir,const TQString & dnd_dir, + const KURL & data_url,const TQString & fpath,bool & dnd) { - QStringList sl = QStringList::split(bt::DirSeparator(),fpath); + TQStringList sl = TQStringList::split(bt::DirSeparator(),fpath); // create all necessary subdirs - QString ctmp = cache_dir; - QString otmp = data_url.path(); + TQString ctmp = cache_dir; + TQString otmp = data_url.path(); if (!otmp.endsWith(bt::DirSeparator())) otmp += bt::DirSeparator(); - QString dtmp = dnd_dir; + TQString dtmp = dnd_dir; for (Uint32 i = 0;i < sl.count() - 1;i++) { otmp += sl[i]; @@ -300,7 +300,7 @@ namespace kt dtmp += bt::DirSeparator(); } - QString dfile = otmp + sl.last(); + TQString dfile = otmp + sl.last(); if (!bt::Exists(dfile)) { // when we start the torrent the user will be asked what to do @@ -315,16 +315,16 @@ namespace kt } } - void ImportDialog::saveStats(const QString & stats_file,const KURL & data_url,Uint64 imported,bool custom_output_name) + void ImportDialog::saveStats(const TQString & stats_file,const KURL & data_url,Uint64 imported,bool custom_output_name) { - QFile fptr(stats_file); + TQFile fptr(stats_file); if (!fptr.open(IO_WriteOnly)) { Out(SYS_PFI|LOG_IMPORTANT) << "Warning : can't create stats file" << endl; return; } - QTextStream out(&fptr); + TQTextStream out(&fptr); out << "OUTPUTDIR=" << data_url.path() << ::endl; out << "UPLOADED=0" << ::endl; out << "RUNNING_TIME_DL=0" << ::endl; @@ -332,8 +332,8 @@ namespace kt out << "PRIORITY=0" << ::endl; out << "AUTOSTART=1" << ::endl; if (core->getGlobalMaxShareRatio() > 0) - out << QString("MAX_RATIO=%1").arg(core->getGlobalMaxShareRatio(),0,'f',2) << ::endl; - out << QString("IMPORTED=%1").arg(imported) << ::endl; + out << TQString("MAX_RATIO=%1").tqarg(core->getGlobalMaxShareRatio(),0,'f',2) << ::endl; + out << TQString("IMPORTED=%1").tqarg(imported) << ::endl; if (custom_output_name) out << "CUSTOM_OUTPUT_NAME=1" << endl; } @@ -358,7 +358,7 @@ namespace kt return nb; } - void ImportDialog::saveFileInfo(const QString & file_info_file,QValueList<Uint32> & dnd) + void ImportDialog::saveFileInfo(const TQString & file_info_file,TQValueList<Uint32> & dnd) { // saves which TorrentFile's do not need to be downloaded File fptr; diff --git a/plugins/partfileimport/importdialog.h b/plugins/partfileimport/importdialog.h index b7617fc..9f7db9f 100644 --- a/plugins/partfileimport/importdialog.h +++ b/plugins/partfileimport/importdialog.h @@ -46,9 +46,10 @@ namespace kt class ImportDialog : public ImportDlgBase,public bt::DataCheckerListener { Q_OBJECT + TQ_OBJECT public: - ImportDialog(CoreInterface* core,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ImportDialog(CoreInterface* core,TQWidget* tqparent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); virtual ~ImportDialog(); public slots: @@ -56,12 +57,12 @@ namespace kt void onTorrentGetReult(KIO::Job* j); private: - void writeIndex(const QString & file,const bt::BitSet & chunks); - void linkTorFile(const QString & cache_dir,const QString & dnd_dir, - const KURL & data_url,const QString & fpath,bool & dnd); - void saveStats(const QString & stats_file,const KURL & data_url,bt::Uint64 imported,bool custom_output_name); + void writeIndex(const TQString & file,const bt::BitSet & chunks); + void linkTorFile(const TQString & cache_dir,const TQString & dnd_dir, + const KURL & data_url,const TQString & fpath,bool & dnd); + void saveStats(const TQString & stats_file,const KURL & data_url,bt::Uint64 imported,bool custom_output_name); bt::Uint64 calcImportedBytes(const bt::BitSet & chunks,const bt::Torrent & tor); - void saveFileInfo(const QString & file_info_file,QValueList<bt::Uint32> & dnd); + void saveFileInfo(const TQString & file_info_file,TQValueList<bt::Uint32> & dnd); virtual void progress(bt::Uint32 num,bt::Uint32 total); virtual void status(bt::Uint32 num_failed,bt::Uint32 num_downloaded); diff --git a/plugins/partfileimport/importdlgbase.ui b/plugins/partfileimport/importdlgbase.ui index e1cdd64..c14ceee 100644 --- a/plugins/partfileimport/importdlgbase.ui +++ b/plugins/partfileimport/importdlgbase.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>ImportDlgBase</class> -<widget class="QDialog"> +<widget class="TQDialog"> <property name="name"> <cstring>ImportDlgBase</cstring> </property> @@ -19,27 +19,27 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout6</cstring> + <cstring>tqlayout6</cstring> </property> <hbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout5</cstring> + <cstring>tqlayout5</cstring> </property> <vbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>textLabel1</cstring> </property> - <property name="minimumSize"> + <property name="tqminimumSize"> <size> <width>60</width> <height>0</height> @@ -49,11 +49,11 @@ <string>Torrent:</string> </property> </widget> - <widget class="QLabel"> + <widget class="TQLabel"> <property name="name"> <cstring>textLabel2</cstring> </property> - <property name="minimumSize"> + <property name="tqminimumSize"> <size> <width>60</width> <height>0</height> @@ -65,9 +65,9 @@ </widget> </vbox> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout4</cstring> + <cstring>tqlayout4</cstring> </property> <vbox> <property name="name"> @@ -100,9 +100,9 @@ <cstring>m_progress</cstring> </property> </widget> - <widget class="QLayoutWidget"> + <widget class="TQLayoutWidget"> <property name="name"> - <cstring>layout3</cstring> + <cstring>tqlayout3</cstring> </property> <hbox> <property name="name"> @@ -118,7 +118,7 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>61</width> <height>20</height> @@ -147,7 +147,7 @@ </widget> <customwidgets> </customwidgets> -<layoutdefaults spacing="6" margin="11"/> +<tqlayoutdefaults spacing="6" margin="11"/> <includehints> <includehint>kurlrequester.h</includehint> <includehint>klineedit.h</includehint> diff --git a/plugins/partfileimport/partfileimportplugin.cpp b/plugins/partfileimport/partfileimportplugin.cpp index c154478..04ef8fd 100644 --- a/plugins/partfileimport/partfileimportplugin.cpp +++ b/plugins/partfileimport/partfileimportplugin.cpp @@ -39,8 +39,8 @@ K_EXPORT_COMPONENT_FACTORY(ktpartfileimportplugin,KGenericFactory<kt::PartFileIm namespace kt { - PartFileImportPlugin::PartFileImportPlugin(QObject* parent, const char* name, const QStringList& args) - : Plugin(parent, name, args,NAME,i18n("Import"),AUTHOR,EMAIL,i18n("Imports partially or fully downloaded torrents from other clients"),"ktplugins") + PartFileImportPlugin::PartFileImportPlugin(TQObject* tqparent, const char* name, const TQStringList& args) + : Plugin(tqparent, name, args,NAME,i18n("Import"),AUTHOR,EMAIL,i18n("Imports partially or fully downloaded torrents from other clients"),"ktplugins") { setXMLFile("ktpartfileimportpluginui.rc"); import_action = 0; @@ -54,7 +54,7 @@ namespace kt void PartFileImportPlugin::load() { import_action = new KAction(i18n("Import existing download" ), 0, this, - SLOT(onImport()), actionCollection(), "partfileimport" ); + TQT_SLOT(onImport()), actionCollection(), "partfileimport" ); } void PartFileImportPlugin::unload() @@ -69,7 +69,7 @@ namespace kt dlg.exec(); } - bool PartFileImportPlugin::versionCheck(const QString & version) const + bool PartFileImportPlugin::versionCheck(const TQString & version) const { return version == KT_VERSION_MACRO; } diff --git a/plugins/partfileimport/partfileimportplugin.h b/plugins/partfileimport/partfileimportplugin.h index 31f2d3a..da2874e 100644 --- a/plugins/partfileimport/partfileimportplugin.h +++ b/plugins/partfileimport/partfileimportplugin.h @@ -33,13 +33,14 @@ namespace kt class PartFileImportPlugin : public Plugin { Q_OBJECT + TQ_OBJECT public: - PartFileImportPlugin(QObject* parent, const char* name, const QStringList& args); + PartFileImportPlugin(TQObject* tqparent, const char* name, const TQStringList& args); virtual ~PartFileImportPlugin(); virtual void load(); virtual void unload(); - virtual bool versionCheck(const QString& version) const; + virtual bool versionCheck(const TQString& version) const; public slots: void onImport(); |