") +
- QString::fromLatin1("
%3
").arg(highlightedBaseColor, highlightedBaseTextColor, article->title());
+ u"
" +
+ u"
%3
"_qs.arg(highlightedBaseColor, highlightedBaseTextColor, article->title());
if (article->date().isValid())
- html += QString::fromLatin1("
%2%3
").arg(alternateBaseColor, tr("Date: "), QLocale::system().toString(article->date().toLocalTime()));
+ html += u"
%2%3
"_qs.arg(alternateBaseColor, tr("Date: "), QLocale::system().toString(article->date().toLocalTime()));
if (!article->author().isEmpty())
- html += QString::fromLatin1("
%2%3
").arg(alternateBaseColor, tr("Author: "), article->author());
+ html += u"
%2%3
"_qs.arg(alternateBaseColor, tr("Author: "), article->author());
html += u"
"
u"
";
if (Qt::mightBeRichText(article->description()))
diff --git a/src/gui/search/pluginselectdialog.cpp b/src/gui/search/pluginselectdialog.cpp
index ca8b68862..0e9b39d50 100644
--- a/src/gui/search/pluginselectdialog.cpp
+++ b/src/gui/search/pluginselectdialog.cpp
@@ -139,7 +139,7 @@ void PluginSelectDialog::dragEnterEvent(QDragEnterEvent *event)
qDebug("mimeData: %s", qUtf8Printable(mime));
}
- if (event->mimeData()->hasFormat(QLatin1String("text/plain")) || event->mimeData()->hasFormat(QLatin1String("text/uri-list")))
+ if (event->mimeData()->hasFormat(u"text/plain"_qs) || event->mimeData()->hasFormat(u"text/uri-list"_qs))
{
event->acceptProposedAction();
}
@@ -382,8 +382,7 @@ void PluginSelectDialog::askForLocalPlugin()
{
const QStringList pathsList = QFileDialog::getOpenFileNames(
nullptr, tr("Select search plugins"), QDir::homePath(),
- tr("qBittorrent search plugin") + QLatin1String(" (*.py)")
- );
+ (tr("qBittorrent search plugin") + u" (*.py)"));
for (const QString &path : pathsList)
{
startAsyncOp();
@@ -414,7 +413,7 @@ void PluginSelectDialog::iconDownloadFinished(const Net::DownloadResult &result)
PluginInfo *plugin = m_pluginManager->pluginInfo(id);
if (!plugin) continue;
- const QString ext = result.url.endsWith(QLatin1String(".ico"), Qt::CaseInsensitive) ? QLatin1String(".ico") : QLatin1String(".png");
+ const QString ext = result.url.endsWith(u".ico", Qt::CaseInsensitive) ? u".ico"_qs : u".png"_qs;
const Path iconPath = SearchPluginManager::pluginsLocation() / Path(id + ext);
if (Utils::Fs::copyFile(filePath, iconPath))
{
diff --git a/src/gui/search/searchsortmodel.cpp b/src/gui/search/searchsortmodel.cpp
index 6ab343632..671b594eb 100644
--- a/src/gui/search/searchsortmodel.cpp
+++ b/src/gui/search/searchsortmodel.cpp
@@ -52,15 +52,10 @@ void SearchSortModel::enableNameFilter(const bool enabled)
void SearchSortModel::setNameFilter(const QString &searchTerm)
{
m_searchTerm = searchTerm;
- if ((searchTerm.length() > 2)
- && searchTerm.startsWith(QLatin1Char('"')) && searchTerm.endsWith(QLatin1Char('"')))
- {
+ if ((searchTerm.length() > 2) && searchTerm.startsWith(u'"') && searchTerm.endsWith(u'"'))
m_searchTermWords = QStringList(m_searchTerm.mid(1, m_searchTerm.length() - 2));
- }
else
- {
- m_searchTermWords = searchTerm.split(QLatin1Char(' '), Qt::SkipEmptyParts);
- }
+ m_searchTermWords = searchTerm.split(u' ', Qt::SkipEmptyParts);
}
void SearchSortModel::setSizeFilter(const qint64 minSize, const qint64 maxSize)
diff --git a/src/gui/search/searchwidget.cpp b/src/gui/search/searchwidget.cpp
index 0a5b10651..34fb88c91 100644
--- a/src/gui/search/searchwidget.cpp
+++ b/src/gui/search/searchwidget.cpp
@@ -64,20 +64,20 @@
namespace
{
- QString statusIconName(SearchJobWidget::Status st)
+ QString statusIconName(const SearchJobWidget::Status st)
{
switch (st)
{
case SearchJobWidget::Status::Ongoing:
- return QLatin1String("task-ongoing");
+ return u"task-ongoing"_qs;
case SearchJobWidget::Status::Finished:
- return QLatin1String("task-complete");
+ return u"task-complete"_qs;
case SearchJobWidget::Status::Aborted:
- return QLatin1String("task-reject");
+ return u"task-reject"_qs;
case SearchJobWidget::Status::Error:
- return QLatin1String("task-attention");
+ return u"task-attention"_qs;
case SearchJobWidget::Status::NoResults:
- return QLatin1String("task-attention");
+ return u"task-attention"_qs;
default:
return {};
}
diff --git a/src/gui/speedlimitdialog.cpp b/src/gui/speedlimitdialog.cpp
index ea7b68809..3a95bc95f 100644
--- a/src/gui/speedlimitdialog.cpp
+++ b/src/gui/speedlimitdialog.cpp
@@ -56,9 +56,9 @@ SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
{
m_ui->setupUi(this);
- m_ui->labelGlobalSpeedIcon->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("slow_off"))
+ m_ui->labelGlobalSpeedIcon->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(u"slow_off"_qs)
, this, Utils::Gui::mediumIconSize(this).height()));
- m_ui->labelAltGlobalSpeedIcon->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("slow"))
+ m_ui->labelAltGlobalSpeedIcon->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(u"slow"_qs)
, this, Utils::Gui::mediumIconSize(this).height()));
const auto initSlider = [](QSlider *slider, const int value, const int maximum)
diff --git a/src/gui/statsdialog.cpp b/src/gui/statsdialog.cpp
index 1e9fc12f1..a6dd64c24 100644
--- a/src/gui/statsdialog.cpp
+++ b/src/gui/statsdialog.cpp
@@ -90,9 +90,9 @@ void StatsDialog::update()
#ifndef QBT_USES_LIBTORRENT2
// Cache hits
const qreal readRatio = cs.readRatio;
- m_ui->labelCacheHits->setText(QString::fromLatin1("%1%").arg((readRatio > 0)
- ? Utils::String::fromDouble(100 * readRatio, 2)
- : QLatin1String("0")));
+ m_ui->labelCacheHits->setText(u"%1%"_qs.arg((readRatio > 0)
+ ? Utils::String::fromDouble((100 * readRatio), 2)
+ : u"0"_qs));
#endif
// Buffers size
m_ui->labelTotalBuf->setText(Utils::Misc::friendlyUnit(cs.totalUsedBuffers * 16 * 1024));
@@ -100,12 +100,12 @@ void StatsDialog::update()
// From lt manual: disk_write_queue and disk_read_queue are the number of peers currently waiting on a disk write or disk read
// to complete before it receives or sends any more data on the socket. It's a metric of how disk bound you are.
- m_ui->labelWriteStarve->setText(QString::fromLatin1("%1%").arg(((ss.diskWriteQueue > 0) && (ss.peersCount > 0))
+ m_ui->labelWriteStarve->setText(u"%1%"_qs.arg(((ss.diskWriteQueue > 0) && (ss.peersCount > 0))
? Utils::String::fromDouble((100. * ss.diskWriteQueue / ss.peersCount), 2)
- : QLatin1String("0")));
- m_ui->labelReadStarve->setText(QString::fromLatin1("%1%").arg(((ss.diskReadQueue > 0) && (ss.peersCount > 0))
+ : u"0"_qs));
+ m_ui->labelReadStarve->setText(u"%1%"_qs.arg(((ss.diskReadQueue > 0) && (ss.peersCount > 0))
? Utils::String::fromDouble((100. * ss.diskReadQueue / ss.peersCount), 2)
- : QLatin1String("0")));
+ : u"0"_qs));
// Disk queues
m_ui->labelQueuedJobs->setText(QString::number(cs.jobQueueLength));
diff --git a/src/gui/statusbar.cpp b/src/gui/statusbar.cpp
index 4710b48a4..bb287cce0 100644
--- a/src/gui/statusbar.cpp
+++ b/src/gui/statusbar.cpp
@@ -63,14 +63,13 @@ StatusBar::StatusBar(QWidget *parent)
m_connecStatusLblIcon->setFlat(true);
m_connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
- m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("firewalled")));
- m_connecStatusLblIcon->setToolTip(
- QString::fromLatin1("%1
%2").arg(tr("Connection status:")
- , tr("No direct connections. This may indicate network configuration problems.")));
+ m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"firewalled"_qs));
+ m_connecStatusLblIcon->setToolTip(u"%1
%2"_qs.arg(tr("Connection status:")
+ , tr("No direct connections. This may indicate network configuration problems.")));
connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked);
m_dlSpeedLbl = new QPushButton(this);
- m_dlSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("downloading_small")));
+ m_dlSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"downloading_small"_qs));
connect(m_dlSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capSpeed);
m_dlSpeedLbl->setFlat(true);
m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
@@ -79,7 +78,7 @@ StatusBar::StatusBar(QWidget *parent)
m_dlSpeedLbl->setMinimumWidth(200);
m_upSpeedLbl = new QPushButton(this);
- m_upSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("seeding")));
+ m_upSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"seeding"_qs));
connect(m_upSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capSpeed);
m_upSpeedLbl->setFlat(true);
m_upSpeedLbl->setFocusPolicy(Qt::NoFocus);
@@ -175,21 +174,24 @@ void StatusBar::updateConnectionStatus()
if (!BitTorrent::Session::instance()->isListening())
{
- m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("disconnected")));
- m_connecStatusLblIcon->setToolTip(QLatin1String("") + tr("Connection Status:") + QLatin1String("
") + tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));
+ m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"disconnected"_qs));
+ const QString tooltip = u"%1
%2"_qs.arg(tr("Connection Status:"), tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));
+ m_connecStatusLblIcon->setToolTip(tooltip);
}
else
{
if (sessionStatus.hasIncomingConnections)
{
// Connection OK
- m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("connected")));
- m_connecStatusLblIcon->setToolTip(QLatin1String("") + tr("Connection Status:") + QLatin1String("
") + tr("Online"));
+ m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"connected"_qs));
+ const QString tooltip = u"%1
%2"_qs.arg(tr("Connection Status:"), tr("Online"));
+ m_connecStatusLblIcon->setToolTip(tooltip);
}
else
{
- m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("firewalled")));
- m_connecStatusLblIcon->setToolTip(QLatin1String("") + tr("Connection status:") + QLatin1String("
") + QLatin1String("") + tr("No direct connections. This may indicate network configuration problems.") + QLatin1String(""));
+ m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(u"firewalled"_qs));
+ const QString tooltip = u"%1
%2"_qs.arg(tr("Connection Status:"), tr("No direct connections. This may indicate network configuration problems."));
+ m_connecStatusLblIcon->setToolTip(tooltip);
}
}
}
@@ -238,13 +240,13 @@ void StatusBar::updateAltSpeedsBtn(bool alternative)
{
if (alternative)
{
- m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("slow")));
+ m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(u"slow"_qs));
m_altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits"));
m_altSpeedsBtn->setDown(true);
}
else
{
- m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("slow_off")));
+ m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(u"slow_off"_qs));
m_altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits"));
m_altSpeedsBtn->setDown(false);
}
diff --git a/src/gui/tagfiltermodel.cpp b/src/gui/tagfiltermodel.cpp
index 8cdac0369..ce56328d9 100644
--- a/src/gui/tagfiltermodel.cpp
+++ b/src/gui/tagfiltermodel.cpp
@@ -41,14 +41,14 @@ namespace
{
QString getSpecialAllTag()
{
- const QString ALL_TAG = QLatin1String(" ");
+ const QString ALL_TAG = u" "_qs;
Q_ASSERT(!BitTorrent::Session::isValidTag(ALL_TAG));
return ALL_TAG;
}
QString getSpecialUntaggedTag()
{
- const QString UNTAGGED_TAG = QLatin1String(" ");
+ const QString UNTAGGED_TAG = u" "_qs;
Q_ASSERT(!BitTorrent::Session::isValidTag(UNTAGGED_TAG));
return UNTAGGED_TAG;
}
@@ -126,8 +126,7 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
case Qt::DecorationRole:
return UIThemeManager::instance()->getIcon(u"inode-directory"_qs);
case Qt::DisplayRole:
- return QString::fromLatin1("%1 (%2)")
- .arg(tagDisplayName(item.tag())).arg(item.torrentsCount());
+ return u"%1 (%2)"_qs.arg(tagDisplayName(item.tag())).arg(item.torrentsCount());
case Qt::UserRole:
return item.torrentsCount();
default:
@@ -324,7 +323,7 @@ QVector TagFilterModel::findItems(const TagSet &tags)
if (item)
items.push_back(item);
else
- qWarning() << QString::fromLatin1("Requested tag '%1' missing from the model.").arg(tag);
+ qWarning() << u"Requested tag '%1' missing from the model."_qs.arg(tag);
}
return items;
}
diff --git a/src/gui/torrentcategorydialog.cpp b/src/gui/torrentcategorydialog.cpp
index ef78db009..34cdce354 100644
--- a/src/gui/torrentcategorydialog.cpp
+++ b/src/gui/torrentcategorydialog.cpp
@@ -68,7 +68,7 @@ QString TorrentCategoryDialog::createCategory(QWidget *parent, const QString &pa
QString newCategoryName = parentCategoryName;
if (!newCategoryName.isEmpty())
- newCategoryName += QLatin1Char('/');
+ newCategoryName += u'/';
newCategoryName += tr("New Category");
TorrentCategoryDialog dialog {parent};
diff --git a/src/gui/torrentcontentmodel.cpp b/src/gui/torrentcontentmodel.cpp
index ffb9b36a4..0fe41bf24 100644
--- a/src/gui/torrentcontentmodel.cpp
+++ b/src/gui/torrentcontentmodel.cpp
@@ -151,13 +151,10 @@ namespace
*/
bool doesQFileIconProviderWork()
{
+ const QString PSEUDO_UNIQUE_FILE_NAME = u"/tmp/qBittorrent-test-QFileIconProvider-845eb448-7ad5-4cdb-b764-b3f322a266a9"_qs;
QFileIconProvider provider;
- const char PSEUDO_UNIQUE_FILE_NAME[] = "/tmp/qBittorrent-test-QFileIconProvider-845eb448-7ad5-4cdb-b764-b3f322a266a9";
- QIcon testIcon1 = provider.icon(QFileInfo(
- QLatin1String(PSEUDO_UNIQUE_FILE_NAME) + QLatin1String(".pdf")));
- QIcon testIcon2 = provider.icon(QFileInfo(
- QLatin1String(PSEUDO_UNIQUE_FILE_NAME) + QLatin1String(".png")));
-
+ const QIcon testIcon1 = provider.icon(QFileInfo(PSEUDO_UNIQUE_FILE_NAME + u".pdf"));
+ const QIcon testIcon2 = provider.icon(QFileInfo(PSEUDO_UNIQUE_FILE_NAME + u".png"));
return (!testIcon1.isNull() || !testIcon2.isNull());
}
diff --git a/src/gui/torrentcontentmodelitem.cpp b/src/gui/torrentcontentmodelitem.cpp
index 62731312a..ae14a2d60 100644
--- a/src/gui/torrentcontentmodelitem.cpp
+++ b/src/gui/torrentcontentmodelitem.cpp
@@ -127,8 +127,8 @@ QString TorrentContentModelItem::displayData(const int column) const
}
case COL_PROGRESS:
return (m_progress >= 1)
- ? QString::fromLatin1("100%")
- : (Utils::String::fromDouble((m_progress * 100), 1) + QLatin1Char('%'));
+ ? u"100%"_qs
+ : (Utils::String::fromDouble((m_progress * 100), 1) + u'%');
case COL_SIZE:
return Utils::Misc::friendlyUnit(m_size);
case COL_REMAINING:
@@ -140,9 +140,9 @@ QString TorrentContentModelItem::displayData(const int column) const
return tr("N/A");
const QString value = (avail >= 1)
- ? QString::fromLatin1("100")
+ ? u"100"_qs
: Utils::String::fromDouble((avail * 100), 1);
- return (value + C_THIN_SPACE + QLatin1Char('%'));
+ return (value + C_THIN_SPACE + u'%');
}
default:
Q_ASSERT(false);
diff --git a/src/gui/torrentcreatordialog.cpp b/src/gui/torrentcreatordialog.cpp
index d1b2213a5..0f822a345 100644
--- a/src/gui/torrentcreatordialog.cpp
+++ b/src/gui/torrentcreatordialog.cpp
@@ -184,7 +184,7 @@ void TorrentCreatorDialog::onCreateButtonClicked()
}
// get save path
- const Path savePath = m_storeLastSavePath.get(Utils::Fs::homePath() / Path(inputPath.filename() + QLatin1String(".torrent")));
+ const Path savePath = m_storeLastSavePath.get(Utils::Fs::homePath() / Path(inputPath.filename() + u".torrent"));
Path destPath {QFileDialog::getSaveFileName(this, tr("Select where to save the new torrent"), savePath.data(), tr("Torrent Files (*.torrent)"))};
if (destPath.isEmpty())
return;
@@ -255,7 +255,7 @@ void TorrentCreatorDialog::handleCreationSuccess(const Path &path, const Path &b
BitTorrent::Session::instance()->addTorrent(result.value(), params);
}
QMessageBox::information(this, tr("Torrent creator")
- , QString::fromLatin1("%1\n%2").arg(tr("Torrent created:"), path.toString()));
+ , u"%1\n%2"_qs.arg(tr("Torrent created:"), path.toString()));
setInteractionEnabled(true);
}
diff --git a/src/gui/torrentoptionsdialog.cpp b/src/gui/torrentoptionsdialog.cpp
index aee253172..ea5968865 100644
--- a/src/gui/torrentoptionsdialog.cpp
+++ b/src/gui/torrentoptionsdialog.cpp
@@ -63,7 +63,7 @@ TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVectorsetData(Qt::DisplayRole, tr("All (0)", "this is for the status filter"));
- all->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("filterall")));
+ all->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filterall"_qs));
auto *downloading = new QListWidgetItem(this);
downloading->setData(Qt::DisplayRole, tr("Downloading (0)"));
- downloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("downloading")));
+ downloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"downloading"_qs));
auto *seeding = new QListWidgetItem(this);
seeding->setData(Qt::DisplayRole, tr("Seeding (0)"));
- seeding->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("uploading")));
+ seeding->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"uploading"_qs));
auto *completed = new QListWidgetItem(this);
completed->setData(Qt::DisplayRole, tr("Completed (0)"));
- completed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("completed")));
+ completed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"completed"_qs));
auto *resumed = new QListWidgetItem(this);
resumed->setData(Qt::DisplayRole, tr("Resumed (0)"));
- resumed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("resumed")));
+ resumed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"resumed"_qs));
auto *paused = new QListWidgetItem(this);
paused->setData(Qt::DisplayRole, tr("Paused (0)"));
- paused->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("paused")));
+ paused->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"paused"_qs));
auto *active = new QListWidgetItem(this);
active->setData(Qt::DisplayRole, tr("Active (0)"));
- active->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("filteractive")));
+ active->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filteractive"_qs));
auto *inactive = new QListWidgetItem(this);
inactive->setData(Qt::DisplayRole, tr("Inactive (0)"));
- inactive->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("filterinactive")));
+ inactive->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filterinactive"_qs));
auto *stalled = new QListWidgetItem(this);
stalled->setData(Qt::DisplayRole, tr("Stalled (0)"));
- stalled->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("filterstalled")));
+ stalled->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filterstalled"_qs));
auto *stalledUploading = new QListWidgetItem(this);
stalledUploading->setData(Qt::DisplayRole, tr("Stalled Uploading (0)"));
- stalledUploading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("stalledUP")));
+ stalledUploading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"stalledUP"_qs));
auto *stalledDownloading = new QListWidgetItem(this);
stalledDownloading->setData(Qt::DisplayRole, tr("Stalled Downloading (0)"));
- stalledDownloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("stalledDL")));
+ stalledDownloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"stalledDL"_qs));
auto *checking = new QListWidgetItem(this);
checking->setData(Qt::DisplayRole, tr("Checking (0)"));
- checking->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("checking")));
+ checking->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"checking"_qs));
auto *errored = new QListWidgetItem(this);
errored->setData(Qt::DisplayRole, tr("Errored (0)"));
- errored->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("error")));
+ errored->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"error"_qs));
const Preferences *const pref = Preferences::instance();
setCurrentRow(pref->getTransSelFilter(), QItemSelectionModel::SelectCurrent);
@@ -410,7 +410,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const BitTorrent::Torre
trackerItem->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"network-server"_qs));
const QString scheme = getScheme(tracker);
- downloadFavicon(QString::fromLatin1("%1://%2/favicon.ico").arg((scheme.startsWith(u"http") ? scheme : u"http"_qs), host));
+ downloadFavicon(u"%1://%2/favicon.ico"_qs.arg((scheme.startsWith(u"http") ? scheme : u"http"_qs), host));
}
if (!trackerItem) return;
@@ -425,7 +425,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const BitTorrent::Torre
return;
}
- trackerItem->setText(QString::fromLatin1("%1 (%2)").arg(host, QString::number(torrentIDs.size())));
+ trackerItem->setText(u"%1 (%2)"_qs.arg(host, QString::number(torrentIDs.size())));
if (exists)
{
if (trackerFromRow(currentRow()) == host)
@@ -503,7 +503,7 @@ void TrackerFiltersList::removeItem(const QString &trackerURL, const BitTorrent:
}
if (trackerItem)
- trackerItem->setText(QString::fromLatin1("%1 (%2)").arg(host, QString::number(torrentIDs.size())));
+ trackerItem->setText(u"%1 (%2)"_qs.arg(host, QString::number(torrentIDs.size())));
}
else
{
diff --git a/src/gui/transferlistmodel.cpp b/src/gui/transferlistmodel.cpp
index 8b0511254..197d8f176 100644
--- a/src/gui/transferlistmodel.cpp
+++ b/src/gui/transferlistmodel.cpp
@@ -72,24 +72,24 @@ namespace
const TorrentStateColorDescriptor colorDescriptors[] =
{
- {BitTorrent::TorrentState::Downloading, QLatin1String("TransferList.Downloading")},
- {BitTorrent::TorrentState::StalledDownloading, QLatin1String("TransferList.StalledDownloading")},
- {BitTorrent::TorrentState::DownloadingMetadata, QLatin1String("TransferList.DownloadingMetadata")},
- {BitTorrent::TorrentState::ForcedDownloadingMetadata, QLatin1String("TransferList.ForcedDownloadingMetadata")},
- {BitTorrent::TorrentState::ForcedDownloading, QLatin1String("TransferList.ForcedDownloading")},
- {BitTorrent::TorrentState::Uploading, QLatin1String("TransferList.Uploading")},
- {BitTorrent::TorrentState::StalledUploading, QLatin1String("TransferList.StalledUploading")},
- {BitTorrent::TorrentState::ForcedUploading, QLatin1String("TransferList.ForcedUploading")},
- {BitTorrent::TorrentState::QueuedDownloading, QLatin1String("TransferList.QueuedDownloading")},
- {BitTorrent::TorrentState::QueuedUploading, QLatin1String("TransferList.QueuedUploading")},
- {BitTorrent::TorrentState::CheckingDownloading, QLatin1String("TransferList.CheckingDownloading")},
- {BitTorrent::TorrentState::CheckingUploading, QLatin1String("TransferList.CheckingUploading")},
- {BitTorrent::TorrentState::CheckingResumeData, QLatin1String("TransferList.CheckingResumeData")},
- {BitTorrent::TorrentState::PausedDownloading, QLatin1String("TransferList.PausedDownloading")},
- {BitTorrent::TorrentState::PausedUploading, QLatin1String("TransferList.PausedUploading")},
- {BitTorrent::TorrentState::Moving, QLatin1String("TransferList.Moving")},
- {BitTorrent::TorrentState::MissingFiles, QLatin1String("TransferList.MissingFiles")},
- {BitTorrent::TorrentState::Error, QLatin1String("TransferList.Error")}
+ {BitTorrent::TorrentState::Downloading, u"TransferList.Downloading"_qs},
+ {BitTorrent::TorrentState::StalledDownloading, u"TransferList.StalledDownloading"_qs},
+ {BitTorrent::TorrentState::DownloadingMetadata, u"TransferList.DownloadingMetadata"_qs},
+ {BitTorrent::TorrentState::ForcedDownloadingMetadata, u"TransferList.ForcedDownloadingMetadata"_qs},
+ {BitTorrent::TorrentState::ForcedDownloading, u"TransferList.ForcedDownloading"_qs},
+ {BitTorrent::TorrentState::Uploading, u"TransferList.Uploading"_qs},
+ {BitTorrent::TorrentState::StalledUploading, u"TransferList.StalledUploading"_qs},
+ {BitTorrent::TorrentState::ForcedUploading, u"TransferList.ForcedUploading"_qs},
+ {BitTorrent::TorrentState::QueuedDownloading, u"TransferList.QueuedDownloading"_qs},
+ {BitTorrent::TorrentState::QueuedUploading, u"TransferList.QueuedUploading"_qs},
+ {BitTorrent::TorrentState::CheckingDownloading, u"TransferList.CheckingDownloading"_qs},
+ {BitTorrent::TorrentState::CheckingUploading, u"TransferList.CheckingUploading"_qs},
+ {BitTorrent::TorrentState::CheckingResumeData, u"TransferList.CheckingResumeData"_qs},
+ {BitTorrent::TorrentState::PausedDownloading, u"TransferList.PausedDownloading"_qs},
+ {BitTorrent::TorrentState::PausedUploading, u"TransferList.PausedUploading"_qs},
+ {BitTorrent::TorrentState::Moving, u"TransferList.Moving"_qs},
+ {BitTorrent::TorrentState::MissingFiles, u"TransferList.MissingFiles"_qs},
+ {BitTorrent::TorrentState::Error, u"TransferList.Error"_qs}
};
QHash colors;
@@ -273,7 +273,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
{
if (hideValues && (value == 0) && (total == 0))
return {};
- return QString::fromLatin1("%1 (%2)").arg(QString::number(value), QString::number(total));
+ return u"%1 (%2)"_qs.arg(QString::number(value), QString::number(total));
};
const auto etaString = [hideValues](const qlonglong value) -> QString
@@ -294,7 +294,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
const auto queuePositionString = [](const qint64 value) -> QString
{
- return (value >= 0) ? QString::number(value + 1) : QLatin1String("*");
+ return (value >= 0) ? QString::number(value + 1) : u"*"_qs;
};
const auto lastActivityString = [hideValues](qint64 value) -> QString
@@ -328,8 +328,8 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
const auto progressString = [](const qreal progress) -> QString
{
return (progress >= 1)
- ? QString::fromLatin1("100%")
- : Utils::String::fromDouble((progress * 100), 1) + QLatin1Char('%');
+ ? u"100%"_qs
+ : (Utils::String::fromDouble((progress * 100), 1) + u'%');
};
const auto statusString = [this](const BitTorrent::TorrentState state, const QString &errorMessage) -> QString
@@ -368,7 +368,7 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
case TR_CATEGORY:
return torrent->category();
case TR_TAGS:
- return torrent->tags().join(QLatin1String(", "));
+ return torrent->tags().join(u", "_qs);
case TR_ADD_DATE:
return QLocale().toString(torrent->addedTime().toLocalTime(), QLocale::ShortFormat);
case TR_SEED_DATE:
@@ -754,55 +754,55 @@ QColor getDefaultColorByState(const BitTorrent::TorrentState state)
QIcon getPausedIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("paused"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"paused"_qs);
return cached;
}
QIcon getQueuedIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("queued"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"queued"_qs);
return cached;
}
QIcon getDownloadingIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("downloading"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"downloading"_qs);
return cached;
}
QIcon getStalledDownloadingIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("stalledDL"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"stalledDL"_qs);
return cached;
}
QIcon getUploadingIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("uploading"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"uploading"_qs);
return cached;
}
QIcon getStalledUploadingIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("stalledUP"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"stalledUP"_qs);
return cached;
}
QIcon getCompletedIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("completed"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"completed"_qs);
return cached;
}
QIcon getCheckingIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("checking"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"checking"_qs);
return cached;
}
QIcon getErrorIcon()
{
- static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("error"));
+ static QIcon cached = UIThemeManager::instance()->getIcon(u"error"_qs);
return cached;
}
diff --git a/src/gui/uithememanager.cpp b/src/gui/uithememanager.cpp
index a1c7ce6e1..4e8aa6933 100644
--- a/src/gui/uithememanager.cpp
+++ b/src/gui/uithememanager.cpp
@@ -46,23 +46,23 @@
namespace
{
const Path DEFAULT_ICONS_DIR {u":icons"_qs};
- const QString CONFIG_FILE_NAME {QStringLiteral("config.json")};
- const QString STYLESHEET_FILE_NAME {QStringLiteral("stylesheet.qss")};
+ const QString CONFIG_FILE_NAME = u"config.json"_qs;
+ const QString STYLESHEET_FILE_NAME = u"stylesheet.qss"_qs;
// Directory used by stylesheet to reference internal resources
// for example `icon: url(:/uitheme/file.svg)` will be expected to
// point to a file `file.svg` in root directory of CONFIG_FILE_NAME
- const QString STYLESHEET_RESOURCES_DIR {QStringLiteral(":/uitheme")};
+ const QString STYLESHEET_RESOURCES_DIR = u":/uitheme"_qs;
const Path THEME_ICONS_DIR {u"icons"_qs};
Path findIcon(const QString &iconId, const Path &dir)
{
- const Path pathSvg = dir / Path(iconId + QLatin1String(".svg"));
+ const Path pathSvg = dir / Path(iconId + u".svg");
if (pathSvg.exists())
return pathSvg;
- const Path pathPng = dir / Path(iconId + QLatin1String(".png"));
+ const Path pathPng = dir / Path(iconId + u".png");
if (pathPng.exists())
return pathPng;
@@ -142,8 +142,8 @@ namespace
if (themePath.filename() == CONFIG_FILE_NAME)
return std::make_unique(themePath);
- if ((themePath.hasExtension(QLatin1String(".qbtheme")))
- && QResource::registerResource(themePath.data(), QLatin1String("/uitheme")))
+ if ((themePath.hasExtension(u".qbtheme"_qs))
+ && QResource::registerResource(themePath.data(), u"/uitheme"_qs))
{
return std::make_unique();
}
@@ -231,7 +231,7 @@ QIcon UIThemeManager::getFlagIcon(const QString &countryIsoCode) const
if (iter != m_flagCache.end())
return *iter;
- const QIcon icon {QLatin1String(":/icons/flags/") + key + QLatin1String(".svg")};
+ const QIcon icon {u":/icons/flags/" + key + u".svg"};
m_flagCache[key] = icon;
return icon;
}
@@ -249,25 +249,25 @@ QIcon UIThemeManager::getSystrayIcon() const
{
#if defined(Q_OS_UNIX)
case TrayIcon::Style::Normal:
- return QIcon::fromTheme(QLatin1String("qbittorrent-tray"));
+ return QIcon::fromTheme(u"qbittorrent-tray"_qs);
case TrayIcon::Style::MonoDark:
- return QIcon::fromTheme(QLatin1String("qbittorrent-tray-dark"));
+ return QIcon::fromTheme(u"qbittorrent-tray-dark"_qs);
case TrayIcon::Style::MonoLight:
- return QIcon::fromTheme(QLatin1String("qbittorrent-tray-light"));
+ return QIcon::fromTheme(u"qbittorrent-tray-light"_qs);
#else
case TrayIcon::Style::Normal:
- return getIcon(QLatin1String("qbittorrent-tray"));
+ return getIcon(u"qbittorrent-tray"_qs);
case TrayIcon::Style::MonoDark:
- return getIcon(QLatin1String("qbittorrent-tray-dark"));
+ return getIcon(u"qbittorrent-tray-dark"_qs);
case TrayIcon::Style::MonoLight:
- return getIcon(QLatin1String("qbittorrent-tray-light"));
+ return getIcon(u"qbittorrent-tray-light"_qs);
#endif
default:
break;
}
// As a failsafe in case the enum is invalid
- return getIcon(QLatin1String("qbittorrent-tray"));
+ return getIcon(u"qbittorrent-tray"_qs);
}
#endif
@@ -276,7 +276,7 @@ Path UIThemeManager::getIconPath(const QString &iconId) const
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
if (m_useSystemTheme)
{
- Path path = Utils::Fs::tempPath() / Path(iconId + QLatin1String(".png"));
+ Path path = Utils::Fs::tempPath() / Path(iconId + u".png");
if (!path.exists())
{
const QIcon icon = QIcon::fromTheme(iconId);
@@ -354,31 +354,31 @@ void UIThemeManager::applyPalette() const
const ColorDescriptor paletteColorDescriptors[] =
{
- {QLatin1String("Palette.Window"), QPalette::Window, QPalette::Normal},
- {QLatin1String("Palette.WindowText"), QPalette::WindowText, QPalette::Normal},
- {QLatin1String("Palette.Base"), QPalette::Base, QPalette::Normal},
- {QLatin1String("Palette.AlternateBase"), QPalette::AlternateBase, QPalette::Normal},
- {QLatin1String("Palette.Text"), QPalette::Text, QPalette::Normal},
- {QLatin1String("Palette.ToolTipBase"), QPalette::ToolTipBase, QPalette::Normal},
- {QLatin1String("Palette.ToolTipText"), QPalette::ToolTipText, QPalette::Normal},
- {QLatin1String("Palette.BrightText"), QPalette::BrightText, QPalette::Normal},
- {QLatin1String("Palette.Highlight"), QPalette::Highlight, QPalette::Normal},
- {QLatin1String("Palette.HighlightedText"), QPalette::HighlightedText, QPalette::Normal},
- {QLatin1String("Palette.Button"), QPalette::Button, QPalette::Normal},
- {QLatin1String("Palette.ButtonText"), QPalette::ButtonText, QPalette::Normal},
- {QLatin1String("Palette.Link"), QPalette::Link, QPalette::Normal},
- {QLatin1String("Palette.LinkVisited"), QPalette::LinkVisited, QPalette::Normal},
- {QLatin1String("Palette.Light"), QPalette::Light, QPalette::Normal},
- {QLatin1String("Palette.Midlight"), QPalette::Midlight, QPalette::Normal},
- {QLatin1String("Palette.Mid"), QPalette::Mid, QPalette::Normal},
- {QLatin1String("Palette.Dark"), QPalette::Dark, QPalette::Normal},
- {QLatin1String("Palette.Shadow"), QPalette::Shadow, QPalette::Normal},
- {QLatin1String("Palette.WindowTextDisabled"), QPalette::WindowText, QPalette::Disabled},
- {QLatin1String("Palette.TextDisabled"), QPalette::Text, QPalette::Disabled},
- {QLatin1String("Palette.ToolTipTextDisabled"), QPalette::ToolTipText, QPalette::Disabled},
- {QLatin1String("Palette.BrightTextDisabled"), QPalette::BrightText, QPalette::Disabled},
- {QLatin1String("Palette.HighlightedTextDisabled"), QPalette::HighlightedText, QPalette::Disabled},
- {QLatin1String("Palette.ButtonTextDisabled"), QPalette::ButtonText, QPalette::Disabled}
+ {u"Palette.Window"_qs, QPalette::Window, QPalette::Normal},
+ {u"Palette.WindowText"_qs, QPalette::WindowText, QPalette::Normal},
+ {u"Palette.Base"_qs, QPalette::Base, QPalette::Normal},
+ {u"Palette.AlternateBase"_qs, QPalette::AlternateBase, QPalette::Normal},
+ {u"Palette.Text"_qs, QPalette::Text, QPalette::Normal},
+ {u"Palette.ToolTipBase"_qs, QPalette::ToolTipBase, QPalette::Normal},
+ {u"Palette.ToolTipText"_qs, QPalette::ToolTipText, QPalette::Normal},
+ {u"Palette.BrightText"_qs, QPalette::BrightText, QPalette::Normal},
+ {u"Palette.Highlight"_qs, QPalette::Highlight, QPalette::Normal},
+ {u"Palette.HighlightedText"_qs, QPalette::HighlightedText, QPalette::Normal},
+ {u"Palette.Button"_qs, QPalette::Button, QPalette::Normal},
+ {u"Palette.ButtonText"_qs, QPalette::ButtonText, QPalette::Normal},
+ {u"Palette.Link"_qs, QPalette::Link, QPalette::Normal},
+ {u"Palette.LinkVisited"_qs, QPalette::LinkVisited, QPalette::Normal},
+ {u"Palette.Light"_qs, QPalette::Light, QPalette::Normal},
+ {u"Palette.Midlight"_qs, QPalette::Midlight, QPalette::Normal},
+ {u"Palette.Mid"_qs, QPalette::Mid, QPalette::Normal},
+ {u"Palette.Dark"_qs, QPalette::Dark, QPalette::Normal},
+ {u"Palette.Shadow"_qs, QPalette::Shadow, QPalette::Normal},
+ {u"Palette.WindowTextDisabled"_qs, QPalette::WindowText, QPalette::Disabled},
+ {u"Palette.TextDisabled"_qs, QPalette::Text, QPalette::Disabled},
+ {u"Palette.ToolTipTextDisabled"_qs, QPalette::ToolTipText, QPalette::Disabled},
+ {u"Palette.BrightTextDisabled"_qs, QPalette::BrightText, QPalette::Disabled},
+ {u"Palette.HighlightedTextDisabled"_qs, QPalette::HighlightedText, QPalette::Disabled},
+ {u"Palette.ButtonTextDisabled"_qs, QPalette::ButtonText, QPalette::Disabled}
};
QPalette palette = qApp->palette();
diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp
index de5bedccd..82a19d904 100644
--- a/src/gui/utils.cpp
+++ b/src/gui/utils.cpp
@@ -143,7 +143,7 @@ void Utils::Gui::openPath(const Path &path)
{
// Hack to access samba shares with QDesktopServices::openUrl
if (path.data().startsWith(u"//"))
- QDesktopServices::openUrl(QUrl(QString::fromLatin1("file:") + path.toString()));
+ QDesktopServices::openUrl(QUrl(u"file:" + path.toString()));
else
QDesktopServices::openUrl(QUrl::fromLocalFile(path.data()));
}