Browse Source

Simplify m_creatorThread initialization

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
a4141fd151
  1. 14
      src/gui/torrentcreatordlg.cpp

14
src/gui/torrentcreatordlg.cpp

@ -66,7 +66,7 @@ namespace
TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath) TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::TorrentCreatorDlg) , m_ui(new Ui::TorrentCreatorDlg)
, m_creatorThread(nullptr) , m_creatorThread(new BitTorrent::TorrentCreatorThread(this))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
@ -78,6 +78,10 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath
connect(m_ui->addFolder_button, SIGNAL(clicked(bool)), SLOT(onAddFolderButtonClicked())); connect(m_ui->addFolder_button, SIGNAL(clicked(bool)), SLOT(onAddFolderButtonClicked()));
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(onCreateButtonClicked())); connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(onCreateButtonClicked()));
connect(m_creatorThread, SIGNAL(creationSuccess(QString, QString)), this, SLOT(handleCreationSuccess(QString, QString)));
connect(m_creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
connect(m_creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int)));
loadSettings(); loadSettings();
updateInputPath(defaultPath); updateInputPath(defaultPath);
@ -178,13 +182,7 @@ void TorrentCreatorDlg::onCreateButtonClicked()
QStringList urlSeeds = m_ui->URLSeeds_list->toPlainText().split("\n"); QStringList urlSeeds = m_ui->URLSeeds_list->toPlainText().split("\n");
QString comment = m_ui->txt_comment->toPlainText(); QString comment = m_ui->txt_comment->toPlainText();
// Create the creator thread // run the creator thread
if (!m_creatorThread) {
m_creatorThread = new BitTorrent::TorrentCreatorThread(this);
connect(m_creatorThread, SIGNAL(creationSuccess(QString, QString)), this, SLOT(handleCreationSuccess(QString, QString)));
connect(m_creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
connect(m_creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int)));
}
m_creatorThread->create(input, destination, trackers, urlSeeds, comment, m_ui->check_private->isChecked(), getPieceSize()); m_creatorThread->create(input, destination, trackers, urlSeeds, comment, m_ui->check_private->isChecked(), getPieceSize());
} }

Loading…
Cancel
Save