Merge pull request #7985 from Chocobo1/source

Add source field in Torrent creator
This commit is contained in:
Mike Tzou
2017-12-21 20:26:38 +08:00
committed by GitHub
5 changed files with 78 additions and 64 deletions

View File

@@ -60,6 +60,7 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath
, m_storeWebSeedList(SETTINGS_KEY("WebSeedList"))
, m_storeComments(SETTINGS_KEY("Comments"))
, m_storeLastSavePath(SETTINGS_KEY("LastSavePath"), QDir::homePath())
, m_storeSource(SETTINGS_KEY("Source"))
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
@@ -161,12 +162,15 @@ void TorrentCreatorDlg::onCreateButtonClicked()
setInteractionEnabled(false);
setCursor(QCursor(Qt::WaitCursor));
QStringList trackers = m_ui->trackersList->toPlainText().split("\n");
QStringList urlSeeds = m_ui->URLSeedsList->toPlainText().split("\n");
QString comment = m_ui->txtComment->toPlainText();
const QStringList trackers = m_ui->trackersList->toPlainText().trimmed()
.replace(QRegularExpression("\n\n[\n]+"), "\n\n").split('\n');
const QStringList urlSeeds = m_ui->URLSeedsList->toPlainText().split('\n', QString::SkipEmptyParts);
const QString comment = m_ui->txtComment->toPlainText();
const QString source = m_ui->lineEditSource->text();
// run the creator thread
m_creatorThread->create(input, destination, trackers, urlSeeds, comment, m_ui->checkPrivate->isChecked(), getPieceSize());
m_creatorThread->create({ m_ui->checkPrivate->isChecked(), getPieceSize()
, input, destination, comment, source, trackers, urlSeeds });
}
void TorrentCreatorDlg::handleCreationFailure(const QString &msg)
@@ -240,6 +244,7 @@ void TorrentCreatorDlg::saveSettings()
m_storeTrackerList = m_ui->trackersList->toPlainText();
m_storeWebSeedList = m_ui->URLSeedsList->toPlainText();
m_storeComments = m_ui->txtComment->toPlainText();
m_storeSource = m_ui->lineEditSource->text();
m_storeDialogSize = size();
}
@@ -257,6 +262,7 @@ void TorrentCreatorDlg::loadSettings()
m_ui->trackersList->setPlainText(m_storeTrackerList);
m_ui->URLSeedsList->setPlainText(m_storeWebSeedList);
m_ui->txtComment->setPlainText(m_storeComments);
m_ui->lineEditSource->setText(m_storeSource);
if (m_storeDialogSize.value().isValid())
resize(m_storeDialogSize);

View File

@@ -85,6 +85,7 @@ private:
CachedSettingValue<QString> m_storeWebSeedList;
CachedSettingValue<QString> m_storeComments;
CachedSettingValue<QString> m_storeLastSavePath;
CachedSettingValue<QString> m_storeSource;
};
#endif

View File

@@ -273,6 +273,16 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelSource">
<property name="text">
<string>Source:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditSource"/>
</item>
</layout>
</widget>
</item>