Merge pull request #3165 from Chocobo1/rss_sort

Sort labels in RSS Downloader dialog
This commit is contained in:
sledgehammer999
2015-10-03 18:52:46 -05:00
4 changed files with 203 additions and 256 deletions

View File

@@ -43,6 +43,7 @@
#include "guiiconprovider.h"
#include "autoexpandabledialog.h"
#include "core/utils/fs.h"
#include "core/utils/string.h"
AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<RssManager>& manager, QWidget *parent) :
QDialog(parent),
@@ -262,9 +263,9 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
QDateTime dateTime = rule->lastMatch();
QString lMatch;
if (dateTime.isValid())
lMatch = tr("Last match: %1 days ago").arg(dateTime.daysTo(QDateTime::currentDateTime()));
lMatch = tr("Last Match: %1 days ago").arg(dateTime.daysTo(QDateTime::currentDateTime()));
else
lMatch = tr("Last match: Unknown");
lMatch = tr("Last Match: Unknown");
ui->lblLastMatch->setText(lMatch);
updateMustLineValidity();
updateMustNotLineValidity();
@@ -310,10 +311,10 @@ RssDownloadRulePtr AutomatedRssDownloader::getCurrentRule() const
void AutomatedRssDownloader::initLabelCombobox()
{
// Load custom labels
const QStringList customLabels = Preferences::instance()->getTorrentLabels();
foreach (const QString& label, customLabels) {
ui->comboLabel->addItem(label);
}
QStringList customLabels = Preferences::instance()->getTorrentLabels();
std::sort(customLabels.begin(), customLabels.end(), Utils::String::NaturalCompare());
foreach (const QString& l, customLabels)
ui->comboLabel->addItem(l);
}
void AutomatedRssDownloader::saveEditedRule()

View File

@@ -7,11 +7,11 @@
<x>0</x>
<y>0</y>
<width>816</width>
<height>494</height>
<height>537</height>
</rect>
</property>
<property name="windowTitle">
<string>Automated RSS Downloader</string>
<string>RSS Downloader</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
@@ -23,7 +23,7 @@
</font>
</property>
<property name="text">
<string>Enable the automated RSS downloader</string>
<string>Enable Automated RSS Downloader</string>
</property>
</widget>
</item>
@@ -45,31 +45,12 @@
</font>
</property>
<property name="text">
<string>Download rules</string>
<string>Download Rules</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="removeRuleBtn">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>24</width>
@@ -80,9 +61,6 @@
</item>
<item>
<widget class="QToolButton" name="addRuleBtn">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>24</width>
@@ -91,19 +69,6 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@@ -120,141 +85,78 @@
<item>
<widget class="QGroupBox" name="ruleDefBox">
<property name="title">
<string>Rule definition</string>
<string>Rule Definition</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="checkRegex">
<property name="text">
<string>Use regular expressions</string>
<string>Use Regular Expressions</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Must contain:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>Must Contain:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="lineContains"/>
</item>
<item>
<widget class="QLabel" name="lbl_must_stat">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Must not contain:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>Must Not Contain:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLineEdit" name="lineNotContains"/>
</item>
<item>
<widget class="QLabel" name="lbl_mustnot_stat">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLineEdit" name="lineEFilter"/>
</item>
<item>
<widget class="QLabel" name="lblEFilterStat">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblEFilter">
<property name="text">
<string>Episode filter:</string>
<string>Episode Filter:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="lblEFilterStat">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="lbl_mustnot_stat">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineContains"/>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEFilter"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lbl_must_stat">
<property name="maximumSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineNotContains"/>
</item>
</layout>
</item>
<item>
@@ -265,18 +167,21 @@
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Assign label:</string>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="text">
<string>Assign Label:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QComboBox" name="comboLabel">
<property name="editable">
<bool>true</bool>
@@ -288,13 +193,13 @@
<item>
<widget class="QCheckBox" name="saveDiffDir_check">
<property name="text">
<string>Save to a different directory</string>
<string>Save to a Different Directory</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_6">
<property name="enabled">
<bool>false</bool>
@@ -302,31 +207,24 @@
<property name="text">
<string>Save to:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineSavePath">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineSavePath">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="browseSP">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">...</string>
</property>
</widget>
</item>
</layout>
<item>
<widget class="QToolButton" name="browseSP">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">...</string>
</property>
</widget>
</item>
</layout>
</item>
@@ -335,23 +233,10 @@
<item>
<widget class="QLabel" name="lblIgnoreDays">
<property name="text">
<string comment="... X days">Ignore subsequent matches for (0 to disable)</string>
<string comment="... X days">Ignore Subsequent Matches for (0 to Disable)</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="spinIgnorePeriod">
<property name="enabled">
@@ -361,43 +246,32 @@
<string> days</string>
</property>
<property name="maximum">
<number>360</number>
<number>365</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="lblLastMatch">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
<widget class="QLabel" name="lblLastMatch">
<property name="enabled">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="lblAddPaused">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Add Paused:</string>
</property>
@@ -405,25 +279,19 @@
</item>
<item>
<widget class="QComboBox" name="comboAddPaused">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Use global setting</string>
<string>Use global settings</string>
</property>
</item>
<item>
<property name="text">
<string>Always add paused</string>
<string>Always</string>
</property>
</item>
<item>
<property name="text">
<string>Never add paused</string>
<string>Never</string>
</property>
</item>
</widget>
@@ -444,7 +312,7 @@
</font>
</property>
<property name="text">
<string>Apply rule to feeds:</string>
<string>Apply Rule to Feeds:</string>
</property>
</widget>
</item>
@@ -466,7 +334,7 @@
</font>
</property>
<property name="text">
<string>Matching RSS articles</string>
<string>Matching RSS Articles</string>
</property>
</widget>
</item>
@@ -491,35 +359,19 @@
<item>
<widget class="QPushButton" name="importBtn">
<property name="text">
<string>Import...</string>
<string>&amp;Import...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exportBtn">
<property name="text">
<string>Export...</string>
<string>&amp;Export...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>