Browse Source

Fix unicode problem in torrent creator tool

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
ca10c0ab09
  1. 6
      src/bittorrent.h
  2. 8
      src/createtorrent_imp.cpp
  3. 4
      src/createtorrent_imp.h

6
src/bittorrent.h

@ -118,6 +118,9 @@ public: @@ -118,6 +118,9 @@ public:
bool useTemporaryFolder() const;
QString getDefaultSavePath() const;
ScanFoldersModel* getScanFoldersModel() const;
#if LIBTORRENT_VERSION_MINOR < 15
void saveDHTEntry();
#endif
public slots:
QTorrentHandle addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
@ -136,9 +139,6 @@ public slots: @@ -136,9 +139,6 @@ public slots:
void resumeTorrent(QString hash);
void resumeAllTorrents();
/* End Web UI */
#if LIBTORRENT_VERSION_MINOR < 15
void saveDHTEntry();
#endif
void preAllocateAllFiles(bool b);
void saveFastResumeData();
void enableIPFilter(QString filter);

8
src/createtorrent_imp.cpp

@ -68,7 +68,7 @@ createtorrent::createtorrent(QWidget *parent): QDialog(parent){ @@ -68,7 +68,7 @@ createtorrent::createtorrent(QWidget *parent): QDialog(parent){
setAttribute(Qt::WA_DeleteOnClose);
setModal(true);
creatorThread = new torrentCreatorThread(this);
connect(creatorThread, SIGNAL(creationSuccess(QString, const char*)), this, SLOT(handleCreationSuccess(QString, const char*)));
connect(creatorThread, SIGNAL(creationSuccess(QString, QString)), this, SLOT(handleCreationSuccess(QString, QString)));
connect(creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
connect(creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int)));
path::default_name_check(no_check);
@ -197,7 +197,7 @@ void createtorrent::handleCreationFailure(QString msg) { @@ -197,7 +197,7 @@ void createtorrent::handleCreationFailure(QString msg) {
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg));
}
void createtorrent::handleCreationSuccess(QString path, const char* branch_path) {
void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
if(checkStartSeeding->isChecked()) {
// Create save path temp data
boost::intrusive_ptr<torrent_info> t;
@ -208,7 +208,7 @@ void createtorrent::handleCreationSuccess(QString path, const char* branch_path) @@ -208,7 +208,7 @@ void createtorrent::handleCreationSuccess(QString path, const char* branch_path)
return;
}
QString hash = misc::toQString(t->info_hash());
TorrentTempData::setSavePath(hash, QString::fromLocal8Bit(branch_path));
TorrentTempData::setSavePath(hash, branch_path);
#if LIBTORRENT_VERSION_MINOR > 14
// Enable seeding mode (do not recheck the files)
TorrentTempData::setSeedingMode(hash, true);
@ -281,7 +281,7 @@ void torrentCreatorThread::run() { @@ -281,7 +281,7 @@ void torrentCreatorThread::run() {
ofstream out(complete(path((const char*)save_path.toLocal8Bit())), std::ios_base::binary);
bencode(std::ostream_iterator<char>(out), t.generate());
emit updateProgress(100);
emit creationSuccess(save_path, full_path.branch_path().string().c_str());
emit creationSuccess(save_path, QString::fromUtf8(full_path.branch_path().string().c_str()));
}
catch (std::exception& e){
emit creationFailure(QString::fromUtf8(e.what()));

4
src/createtorrent_imp.h

@ -64,7 +64,7 @@ class torrentCreatorThread : public QThread { @@ -64,7 +64,7 @@ class torrentCreatorThread : public QThread {
signals:
void creationFailure(QString msg);
void creationSuccess(QString path, const char* branch_path);
void creationSuccess(QString path, QString branch_path);
signals:
void updateProgress(int progress);
@ -97,7 +97,7 @@ class createtorrent : public QDialog, private Ui::createTorrentDialog{ @@ -97,7 +97,7 @@ class createtorrent : public QDialog, private Ui::createTorrentDialog{
void on_addURLSeed_button_clicked();
void on_removeURLSeed_button_clicked();
void handleCreationFailure(QString msg);
void handleCreationSuccess(QString path, const char* branch_path);
void handleCreationSuccess(QString path, QString branch_path);
};
#endif

Loading…
Cancel
Save