mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-30 00:14:57 +00:00
Use helper function to construct QString
This is shorter and avoids the need of 2 constructors.
This commit is contained in:
parent
6c307774f1
commit
b7e7d8019c
@ -83,7 +83,7 @@ namespace
|
|||||||
QString envVarName() const
|
QString envVarName() const
|
||||||
{
|
{
|
||||||
return QLatin1String("QBT_")
|
return QLatin1String("QBT_")
|
||||||
+ QString(QLatin1String(m_name)).toUpper().replace(QLatin1Char('-'), QLatin1Char('_'));
|
+ QString::fromLatin1(m_name).toUpper().replace(QLatin1Char('-'), QLatin1Char('_'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -88,7 +88,7 @@ void ExecutionLogWidget::addLogMessage(const Log::Msg &msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QDateTime time = QDateTime::fromMSecsSinceEpoch(msg.timestamp);
|
const QDateTime time = QDateTime::fromMSecsSinceEpoch(msg.timestamp);
|
||||||
const QString text = QString(QLatin1String("<font color='grey'>%1</font> - <font color='%2'>%3</font>"))
|
const QString text = QString::fromLatin1("<font color='grey'>%1</font> - <font color='%2'>%3</font>")
|
||||||
.arg(time.toString(Qt::SystemLocaleShortDate), colorName, msg.message);
|
.arg(time.toString(Qt::SystemLocaleShortDate), colorName, msg.message);
|
||||||
m_msgList->appendLine(text, msg.type);
|
m_msgList->appendLine(text, msg.type);
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ void ExecutionLogWidget::addLogMessage(const Log::Msg &msg)
|
|||||||
void ExecutionLogWidget::addPeerMessage(const Log::Peer &peer)
|
void ExecutionLogWidget::addPeerMessage(const Log::Peer &peer)
|
||||||
{
|
{
|
||||||
const QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp);
|
const QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp);
|
||||||
const QString msg = QString(QLatin1String("<font color='grey'>%1</font> - <font color='red'>%2</font>"))
|
const QString msg = QString::fromLatin1("<font color='grey'>%1</font> - <font color='red'>%2</font>")
|
||||||
.arg(time.toString(Qt::SystemLocaleShortDate), peer.ip);
|
.arg(time.toString(Qt::SystemLocaleShortDate), peer.ip);
|
||||||
|
|
||||||
const QString text = peer.blocked
|
const QString text = peer.blocked
|
||||||
|
@ -1525,7 +1525,7 @@ void MainWindow::reloadSessionStats()
|
|||||||
#else
|
#else
|
||||||
if (m_systrayIcon) {
|
if (m_systrayIcon) {
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
const QString toolTip = QString(QLatin1String(
|
const QString toolTip = QString::fromLatin1(
|
||||||
"<div style='background-color: #678db2; color: #fff;height: 18px; font-weight: bold; margin-bottom: 5px;'>"
|
"<div style='background-color: #678db2; color: #fff;height: 18px; font-weight: bold; margin-bottom: 5px;'>"
|
||||||
"qBittorrent"
|
"qBittorrent"
|
||||||
"</div>"
|
"</div>"
|
||||||
@ -1534,7 +1534,7 @@ void MainWindow::reloadSessionStats()
|
|||||||
"</div>"
|
"</div>"
|
||||||
"<div style='vertical-align: baseline; height: 18px;'>"
|
"<div style='vertical-align: baseline; height: 18px;'>"
|
||||||
"<img src=':/icons/skin/seeding.svg' height='14'/> %2"
|
"<img src=':/icons/skin/seeding.svg' height='14'/> %2"
|
||||||
"</div>"))
|
"</div>")
|
||||||
.arg(tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true))
|
.arg(tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true))
|
||||||
, tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true)));
|
, tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true)));
|
||||||
#else
|
#else
|
||||||
|
@ -64,7 +64,7 @@ StatusBar::StatusBar(QWidget *parent)
|
|||||||
m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
|
m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
|
||||||
m_connecStatusLblIcon->setIcon(QIcon(":/icons/skin/firewalled.svg"));
|
m_connecStatusLblIcon->setIcon(QIcon(":/icons/skin/firewalled.svg"));
|
||||||
m_connecStatusLblIcon->setToolTip(
|
m_connecStatusLblIcon->setToolTip(
|
||||||
QString(QLatin1String("<b>%1</b><br><i>%2</i>")).arg(tr("Connection status:")
|
QString::fromLatin1("<b>%1</b><br><i>%2</i>").arg(tr("Connection status:")
|
||||||
, tr("No direct connections. This may indicate network configuration problems.")));
|
, tr("No direct connections. This may indicate network configuration problems.")));
|
||||||
connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked);
|
connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return UIThemeManager::instance()->getIcon("inode-directory");
|
return UIThemeManager::instance()->getIcon("inode-directory");
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return QString(QLatin1String("%1 (%2)"))
|
return QString::fromLatin1("%1 (%2)")
|
||||||
.arg(tagDisplayName(item.tag())).arg(item.torrentsCount());
|
.arg(tagDisplayName(item.tag())).arg(item.torrentsCount());
|
||||||
case Qt::UserRole:
|
case Qt::UserRole:
|
||||||
return item.torrentsCount();
|
return item.torrentsCount();
|
||||||
|
@ -292,7 +292,7 @@ QString TransferListModel::displayValue(const BitTorrent::TorrentHandle *torrent
|
|||||||
{
|
{
|
||||||
progress *= 100;
|
progress *= 100;
|
||||||
return (static_cast<int>(progress) == 100)
|
return (static_cast<int>(progress) == 100)
|
||||||
? QString {QLatin1String {"100%"}}
|
? QString::fromLatin1("100%")
|
||||||
: Utils::String::fromDouble(progress, 1) + '%';
|
: Utils::String::fromDouble(progress, 1) + '%';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ private:
|
|||||||
QHash<QString, QString> m_params;
|
QHash<QString, QString> m_params;
|
||||||
const QString m_cacheID;
|
const QString m_cacheID;
|
||||||
|
|
||||||
const QRegularExpression m_apiPathPattern {(QLatin1String("^/api/v2/(?<scope>[A-Za-z_][A-Za-z_0-9]*)/(?<action>[A-Za-z_][A-Za-z_0-9]*)$"))};
|
const QRegularExpression m_apiPathPattern {QLatin1String("^/api/v2/(?<scope>[A-Za-z_][A-Za-z_0-9]*)/(?<action>[A-Za-z_][A-Za-z_0-9]*)$")};
|
||||||
|
|
||||||
QHash<QString, APIController *> m_apiControllers;
|
QHash<QString, APIController *> m_apiControllers;
|
||||||
QSet<QString> m_publicAPIs;
|
QSet<QString> m_publicAPIs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user