mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 22:47:21 -06:00
Use cached SessionStatus and CacheStatus
This commit is contained in:
@@ -1319,7 +1319,7 @@ void MainWindow::trackerAuthenticationRequired(BitTorrent::TorrentHandle *const
|
||||
// Check connection status and display right icon
|
||||
void MainWindow::updateGUI()
|
||||
{
|
||||
BitTorrent::SessionStatus status = BitTorrent::Session::instance()->status();
|
||||
const BitTorrent::SessionStatus &status = BitTorrent::Session::instance()->status();
|
||||
|
||||
// update global informations
|
||||
if (m_systrayIcon) {
|
||||
@@ -1328,24 +1328,24 @@ void MainWindow::updateGUI()
|
||||
html += "qBittorrent";
|
||||
html += "</div>";
|
||||
html += "<div style='vertical-align: baseline; height: 18px;'>";
|
||||
html += "<img src=':/icons/skin/download.png' height='14'/> " + tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate(), true));
|
||||
html += "<img src=':/icons/skin/download.png' height='14'/> " + tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true));
|
||||
html += "</div>";
|
||||
html += "<div style='vertical-align: baseline; height: 18px;'>";
|
||||
html += "<img src=':/icons/skin/seeding.png' height='14'/> " + tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate(), true));
|
||||
html += "<img src=':/icons/skin/seeding.png' height='14'/> " + tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true));
|
||||
html += "</div>";
|
||||
#else
|
||||
// OSes such as Windows do not support html here
|
||||
QString html = tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate(), true));
|
||||
QString html = tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true));
|
||||
html += "\n";
|
||||
html += tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate(), true));
|
||||
html += tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true));
|
||||
#endif
|
||||
m_systrayIcon->setToolTip(html); // tray icon
|
||||
}
|
||||
|
||||
if (m_displaySpeedInTitle) {
|
||||
setWindowTitle(tr("[D: %1, U: %2] qBittorrent %3", "D = Download; U = Upload; %3 is qBittorrent version")
|
||||
.arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate(), true))
|
||||
.arg(Utils::Misc::friendlyUnit(status.payloadUploadRate(), true))
|
||||
.arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true))
|
||||
.arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true))
|
||||
.arg(QBT_VERSION));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user