Browse Source

Merge pull request #4051 from takiz/qblabels

"Set as default label" option
adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
8df192e8dd
  1. 10
      src/core/preferences.cpp
  2. 2
      src/core/preferences.h
  3. 10
      src/gui/addnewtorrentdialog.cpp
  4. 7
      src/gui/addnewtorrentdialog.ui

10
src/core/preferences.cpp

@ -1662,6 +1662,16 @@ void Preferences::removeTorrentLabel(const QString& label)
setValue("TransferListFilters/customLabels", labels); setValue("TransferListFilters/customLabels", labels);
} }
QString Preferences::getDefaultLabel() const
{
return value("Preferences/Downloads/DefaultLabel").toString();
}
void Preferences::setDefaultLabel(const QString &defaultLabel)
{
setValue("Preferences/Downloads/DefaultLabel", defaultLabel);
}
bool Preferences::recursiveDownloadDisabled() const bool Preferences::recursiveDownloadDisabled() const
{ {
return value("Preferences/Advanced/DisableRecursiveDownload", false).toBool(); return value("Preferences/Advanced/DisableRecursiveDownload", false).toBool();

2
src/core/preferences.h

@ -160,6 +160,8 @@ public:
void setTempPathEnabled(bool enabled); void setTempPathEnabled(bool enabled);
QString getTempPath() const; QString getTempPath() const;
void setTempPath(const QString &path); void setTempPath(const QString &path);
QString getDefaultLabel() const;
void setDefaultLabel(const QString &defaultLabel);
bool useIncompleteFilesExtension() const; bool useIncompleteFilesExtension() const;
void useIncompleteFilesExtension(bool enabled); void useIncompleteFilesExtension(bool enabled);
bool appendTorrentLabel() const; bool appendTorrentLabel() const;

10
src/gui/addnewtorrentdialog.cpp

@ -77,9 +77,16 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent)
// Load labels // Load labels
const QStringList customLabels = pref->getTorrentLabels(); const QStringList customLabels = pref->getTorrentLabels();
const QString defaultLabel = pref->getDefaultLabel();
if (!defaultLabel.isEmpty())
ui->label_combo->addItem(defaultLabel);
ui->label_combo->addItem(""); ui->label_combo->addItem("");
foreach (const QString& label, customLabels) foreach (const QString& label, customLabels)
if (label != defaultLabel)
ui->label_combo->addItem(label); ui->label_combo->addItem(label);
ui->label_combo->model()->sort(0); ui->label_combo->model()->sort(0);
ui->content_tree->header()->setSortIndicator(0, Qt::AscendingOrder); ui->content_tree->header()->setSortIndicator(0, Qt::AscendingOrder);
loadState(); loadState();
@ -587,6 +594,9 @@ void AddNewTorrentDialog::accept()
// Label // Label
params.label = ui->label_combo->currentText(); params.label = ui->label_combo->currentText();
if (ui->defaultLabel->isChecked())
pref->setDefaultLabel(params.label);
// Save file priorities // Save file priorities
if (m_contentModel) if (m_contentModel)
params.filePriorities = m_contentModel->model()->getFilePriorities(); params.filePriorities = m_contentModel->model()->getFilePriorities();

7
src/gui/addnewtorrentdialog.ui

@ -127,6 +127,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QCheckBox" name="defaultLabel">
<property name="text">
<string>Set as default label</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

Loading…
Cancel
Save