From 1c1403293485f35fd53db45aaa77a01cdd9627e7 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 28 Jun 2011 20:34:15 +0000 Subject: 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 --- plugins/partfileimport/importdialog.cpp | 64 ++++++++++++------------- plugins/partfileimport/importdialog.h | 13 ++--- plugins/partfileimport/importdlgbase.ui | 30 ++++++------ plugins/partfileimport/partfileimportplugin.cpp | 8 ++-- plugins/partfileimport/partfileimportplugin.h | 5 +- 5 files changed, 61 insertions(+), 59 deletions(-) (limited to 'plugins/partfileimport') 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 dnd_files; + TQValueList 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 & dnd) + void ImportDialog::saveFileInfo(const TQString & file_info_file,TQValueList & 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 & dnd); + void saveFileInfo(const TQString & file_info_file,TQValueList & 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 @@ ImportDlgBase - + ImportDlgBase @@ -19,27 +19,27 @@ unnamed - + - layout6 + tqlayout6 unnamed - + - layout5 + tqlayout5 unnamed - + textLabel1 - + 60 0 @@ -49,11 +49,11 @@ Torrent: - + textLabel2 - + 60 0 @@ -65,9 +65,9 @@ - + - layout4 + tqlayout4 @@ -100,9 +100,9 @@ m_progress - + - layout3 + tqlayout3 @@ -118,7 +118,7 @@ Expanding - + 61 20 @@ -147,7 +147,7 @@ - + kurlrequester.h klineedit.h 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