mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-11 07:46:17 -07:00
Use QString literals
This patch covers src/gui and some leftovers from previous commit.
This commit is contained in:
parent
5341478036
commit
802ec5a14e
59 changed files with 912 additions and 902 deletions
|
@ -68,9 +68,9 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
|
|||
{
|
||||
m_ui->setupUi(this);
|
||||
// Icons
|
||||
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
|
||||
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-add"));
|
||||
m_ui->addCategoryBtn->setIcon(UIThemeManager::instance()->getIcon("list-add"));
|
||||
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-remove"_qs));
|
||||
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
|
||||
m_ui->addCategoryBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
|
||||
|
||||
// Ui Settings
|
||||
m_ui->listRules->setSortingEnabled(true);
|
||||
|
@ -86,17 +86,17 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
|
|||
connect(m_ui->checkRegex, &QAbstractButton::toggled, this, &AutomatedRssDownloader::updateFieldsToolTips);
|
||||
connect(m_ui->listRules, &QWidget::customContextMenuRequested, this, &AutomatedRssDownloader::displayRulesListMenu);
|
||||
|
||||
m_episodeRegex = new QRegularExpression("^(^\\d{1,4}x(\\d{1,4}(-(\\d{1,4})?)?;){1,}){1,1}"
|
||||
m_episodeRegex = new QRegularExpression(u"^(^\\d{1,4}x(\\d{1,4}(-(\\d{1,4})?)?;){1,}){1,1}"_qs
|
||||
, QRegularExpression::CaseInsensitiveOption);
|
||||
QString tip = "<p>" + tr("Matches articles based on episode filter.") + "</p><p><b>" + tr("Example: ")
|
||||
+ "1x2;8-15;5;30-;</b>" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + "</p>";
|
||||
tip += "<p>" + tr("Episode filter rules: ") + "</p><ul><li>" + tr("Season number is a mandatory non-zero value") + "</li>"
|
||||
+ "<li>" + tr("Episode number is a mandatory positive value") + "</li>"
|
||||
+ "<li>" + tr("Filter must end with semicolon") + "</li>"
|
||||
+ "<li>" + tr("Three range types for episodes are supported: ") + "</li>" + "<li><ul>"
|
||||
+ "<li>" + tr("Single number: <b>1x25;</b> matches episode 25 of season one") + "</li>"
|
||||
+ "<li>" + tr("Normal range: <b>1x25-40;</b> matches episodes 25 through 40 of season one") + "</li>"
|
||||
+ "<li>" + tr("Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one, and all episodes of later seasons") + "</li>" + "</ul></li></ul>";
|
||||
const QString tip = u"<p>" + tr("Matches articles based on episode filter.") + u"</p><p><b>" + tr("Example: ")
|
||||
+ u"1x2;8-15;5;30-;</b>" + tr(" will match 2, 5, 8 through 15, 30 and onward episodes of season one", "example X will match") + u"</p>"
|
||||
+ u"<p>" + tr("Episode filter rules: ") + u"</p><ul><li>" + tr("Season number is a mandatory non-zero value") + u"</li>"
|
||||
+ u"<li>" + tr("Episode number is a mandatory positive value") + u"</li>"
|
||||
+ u"<li>" + tr("Filter must end with semicolon") + u"</li>"
|
||||
+ u"<li>" + tr("Three range types for episodes are supported: ") + u"</li>" + u"<li><ul>"
|
||||
+ u"<li>" + tr("Single number: <b>1x25;</b> matches episode 25 of season one") + u"</li>"
|
||||
+ u"<li>" + tr("Normal range: <b>1x25-40;</b> matches episodes 25 through 40 of season one") + u"</li>"
|
||||
+ u"<li>" + tr("Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one, and all episodes of later seasons") + u"</li>" + u"</ul></li></ul>";
|
||||
m_ui->lineEFilter->setToolTip(tip);
|
||||
|
||||
initCategoryCombobox();
|
||||
|
@ -332,7 +332,7 @@ void AutomatedRssDownloader::initCategoryCombobox()
|
|||
// Load torrent categories
|
||||
QStringList categories = BitTorrent::Session::instance()->categories();
|
||||
std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
|
||||
m_ui->comboCategory->addItem("");
|
||||
m_ui->comboCategory->addItem(u""_qs);
|
||||
m_ui->comboCategory->addItems(categories);
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ void AutomatedRssDownloader::displayRulesListMenu()
|
|||
QMenu *menu = new QMenu(this);
|
||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add new rule...")
|
||||
menu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("Add new rule...")
|
||||
, this, &AutomatedRssDownloader::on_addRuleBtn_clicked);
|
||||
|
||||
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems();
|
||||
|
@ -513,20 +513,20 @@ void AutomatedRssDownloader::displayRulesListMenu()
|
|||
{
|
||||
if (selection.count() == 1)
|
||||
{
|
||||
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete rule")
|
||||
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Delete rule")
|
||||
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
|
||||
menu->addSeparator();
|
||||
menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename rule...")
|
||||
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename rule...")
|
||||
, this, &AutomatedRssDownloader::renameSelectedRule);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete selected rules")
|
||||
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Delete selected rules")
|
||||
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
menu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear downloaded episodes...")
|
||||
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Clear downloaded episodes...")
|
||||
, this, &AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList);
|
||||
}
|
||||
|
||||
|
@ -656,7 +656,7 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin
|
|||
QFont f = treeFeedItem->font(0);
|
||||
f.setBold(true);
|
||||
treeFeedItem->setFont(0, f);
|
||||
treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon("inode-directory"));
|
||||
treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"inode-directory"_qs));
|
||||
treeFeedItem->setData(0, Qt::UserRole, feed->url());
|
||||
m_ui->treeMatchingArticles->addTopLevelItem(treeFeedItem);
|
||||
}
|
||||
|
@ -685,28 +685,28 @@ void AutomatedRssDownloader::updateFieldsToolTips(bool regex)
|
|||
QString tip;
|
||||
if (regex)
|
||||
{
|
||||
tip = "<p>" + tr("Regex mode: use Perl-compatible regular expressions") + "</p>";
|
||||
tip = u"<p>" + tr("Regex mode: use Perl-compatible regular expressions") + u"</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
tip = "<p>" + tr("Wildcard mode: you can use") + "<ul>"
|
||||
+ "<li>" + tr("? to match any single character") + "</li>"
|
||||
+ "<li>" + tr("* to match zero or more of any characters") + "</li>"
|
||||
+ "<li>" + tr("Whitespaces count as AND operators (all words, any order)") + "</li>"
|
||||
+ "<li>" + tr("| is used as OR operator") + "</li></ul></p>"
|
||||
+ "<p>" + tr("If word order is important use * instead of whitespace.") + "</p>";
|
||||
tip = u"<p>" + tr("Wildcard mode: you can use") + u"<ul>"
|
||||
+ u"<li>" + tr("? to match any single character") + u"</li>"
|
||||
+ u"<li>" + tr("* to match zero or more of any characters") + u"</li>"
|
||||
+ u"<li>" + tr("Whitespaces count as AND operators (all words, any order)") + u"</li>"
|
||||
+ u"<li>" + tr("| is used as OR operator") + u"</li></ul></p>"
|
||||
+ u"<p>" + tr("If word order is important use * instead of whitespace.") + u"</p>";
|
||||
}
|
||||
|
||||
// Whether regex or wildcard, warn about a potential gotcha for users.
|
||||
// Explanatory string broken over multiple lines for readability (and multiple
|
||||
// statements to prevent uncrustify indenting excessively.
|
||||
tip += "<p>";
|
||||
tip += u"<p>";
|
||||
tip += tr("An expression with an empty %1 clause (e.g. %2)",
|
||||
"We talk about regex/wildcards in the RSS filters section here."
|
||||
" So a valid sentence would be: An expression with an empty | clause (e.g. expr|)"
|
||||
).arg("<tt>|</tt>", "<tt>expr|</tt>");
|
||||
m_ui->lineContains->setToolTip(tip + tr(" will match all articles.") + "</p>");
|
||||
m_ui->lineNotContains->setToolTip(tip + tr(" will exclude all articles.") + "</p>");
|
||||
).arg(u"<tt>|</tt>"_qs, u"<tt>expr|</tt>"_qs);
|
||||
m_ui->lineContains->setToolTip(tip + tr(" will match all articles.") + u"</p>");
|
||||
m_ui->lineNotContains->setToolTip(tip + tr(" will exclude all articles.") + u"</p>");
|
||||
}
|
||||
|
||||
void AutomatedRssDownloader::updateMustLineValidity()
|
||||
|
@ -725,7 +725,7 @@ void AutomatedRssDownloader::updateMustLineValidity()
|
|||
}
|
||||
else
|
||||
{
|
||||
for (const QString &token : asConst(text.split('|')))
|
||||
for (const QString &token : asConst(text.split(u'|')))
|
||||
tokens << Utils::String::wildcardToRegexPattern(token);
|
||||
}
|
||||
|
||||
|
@ -744,14 +744,14 @@ void AutomatedRssDownloader::updateMustLineValidity()
|
|||
|
||||
if (valid)
|
||||
{
|
||||
m_ui->lineContains->setStyleSheet("");
|
||||
m_ui->lineContains->setStyleSheet({});
|
||||
m_ui->labelMustStat->setPixmap(QPixmap());
|
||||
m_ui->labelMustStat->setToolTip("");
|
||||
m_ui->labelMustStat->setToolTip({});
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lineContains->setStyleSheet("QLineEdit { color: #ff0000; }");
|
||||
m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
|
||||
m_ui->lineContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
|
||||
m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon(u"task-attention"_qs).pixmap(16, 16));
|
||||
m_ui->labelMustStat->setToolTip(error);
|
||||
}
|
||||
}
|
||||
|
@ -772,7 +772,7 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
|
|||
}
|
||||
else
|
||||
{
|
||||
for (const QString &token : asConst(text.split('|')))
|
||||
for (const QString &token : asConst(text.split(u'|')))
|
||||
tokens << Utils::String::wildcardToRegexPattern(token);
|
||||
}
|
||||
|
||||
|
@ -791,14 +791,14 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
|
|||
|
||||
if (valid)
|
||||
{
|
||||
m_ui->lineNotContains->setStyleSheet("");
|
||||
m_ui->lineNotContains->setStyleSheet({});
|
||||
m_ui->labelMustNotStat->setPixmap(QPixmap());
|
||||
m_ui->labelMustNotStat->setToolTip("");
|
||||
m_ui->labelMustNotStat->setToolTip({});
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lineNotContains->setStyleSheet("QLineEdit { color: #ff0000; }");
|
||||
m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
|
||||
m_ui->lineNotContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
|
||||
m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon(u"task-attention"_qs).pixmap(16, 16));
|
||||
m_ui->labelMustNotStat->setToolTip(error);
|
||||
}
|
||||
}
|
||||
|
@ -810,13 +810,13 @@ void AutomatedRssDownloader::updateEpisodeFilterValidity()
|
|||
|
||||
if (valid)
|
||||
{
|
||||
m_ui->lineEFilter->setStyleSheet("");
|
||||
m_ui->labelEpFilterStat->setPixmap(QPixmap());
|
||||
m_ui->lineEFilter->setStyleSheet({});
|
||||
m_ui->labelEpFilterStat->setPixmap({});
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->lineEFilter->setStyleSheet("QLineEdit { color: #ff0000; }");
|
||||
m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
|
||||
m_ui->lineEFilter->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
|
||||
m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon(u"task-attention"_qs).pixmap(16, 16));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue