Browse Source

Enable systray icon on Mac since it is supported by Qt

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
4013f9fefd
  1. 10
      src/GUI.cpp
  2. 2171
      src/options_imp.cpp

10
src/GUI.cpp

@ -922,7 +922,6 @@ void GUI::optionsSaved() {
// Load program preferences // Load program preferences
void GUI::loadPreferences(bool configure_session) { void GUI::loadPreferences(bool configure_session) {
BTSession->addConsoleMessage(tr("Options were saved successfully.")); BTSession->addConsoleMessage(tr("Options were saved successfully."));
#ifndef Q_WS_MAC
const bool newSystrayIntegration = Preferences::systrayIntegration(); const bool newSystrayIntegration = Preferences::systrayIntegration();
actionLock_qBittorrent->setEnabled(newSystrayIntegration); actionLock_qBittorrent->setEnabled(newSystrayIntegration);
if(newSystrayIntegration != (systrayIcon!=0)) { if(newSystrayIntegration != (systrayIcon!=0)) {
@ -947,7 +946,6 @@ void GUI::loadPreferences(bool configure_session) {
delete myTrayIconMenu; delete myTrayIconMenu;
} }
} }
#endif
// General // General
if(Preferences::isToolbarDisplayed()) { if(Preferences::isToolbarDisplayed()) {
toolBar->setVisible(true); toolBar->setVisible(true);
@ -1011,9 +1009,8 @@ void GUI::trackerAuthenticationRequired(QTorrentHandle& h) {
// Check connection status and display right icon // Check connection status and display right icon
void GUI::updateGUI() { void GUI::updateGUI() {
// update global informations // update global informations
#ifndef Q_WS_MAC
if(systrayIcon) { if(systrayIcon) {
#if defined(Q_WS_X11) #if defined(Q_WS_X11) || defined(Q_WS_MAC)
QString html = "<div style='background-color: #678db2; color: #fff;height: 18px; font-weight: bold; margin-bottom: 5px;'>"; QString html = "<div style='background-color: #678db2; color: #fff;height: 18px; font-weight: bold; margin-bottom: 5px;'>";
html += tr("qBittorrent"); html += tr("qBittorrent");
html += "</div>"; html += "</div>";
@ -1031,7 +1028,6 @@ void GUI::updateGUI() {
#endif #endif
systrayIcon->setToolTip(html); // tray icon systrayIcon->setToolTip(html); // tray icon
} }
#endif
if(displaySpeedInTitle) { if(displaySpeedInTitle) {
setWindowTitle(tr("qBittorrent %1 (Down: %2/s, Up: %3/s)", "%1 is qBittorrent version").arg(QString::fromUtf8(VERSION)).arg(misc::friendlyUnit(BTSession->getSessionStatus().payload_download_rate)).arg(misc::friendlyUnit(BTSession->getSessionStatus().payload_upload_rate))); setWindowTitle(tr("qBittorrent %1 (Down: %2/s, Up: %3/s)", "%1 is qBittorrent version").arg(QString::fromUtf8(VERSION)).arg(misc::friendlyUnit(BTSession->getSessionStatus().payload_download_rate)).arg(misc::friendlyUnit(BTSession->getSessionStatus().payload_upload_rate)));
} }
@ -1051,10 +1047,8 @@ void GUI::showNotificationBaloon(QString title, QString msg) const {
} }
} }
#endif #endif
#ifndef Q_WS_MAC
if(systrayIcon && QSystemTrayIcon::supportsMessages()) if(systrayIcon && QSystemTrayIcon::supportsMessages())
systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON); systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
#endif
} }
/***************************************************** /*****************************************************
@ -1091,7 +1085,6 @@ void GUI::downloadFromURLList(const QStringList& url_list) {
*****************************************************/ *****************************************************/
void GUI::createSystrayDelayed() { void GUI::createSystrayDelayed() {
#ifndef Q_WS_MAC
static int timeout = 20; static int timeout = 20;
if(QSystemTrayIcon::isSystemTrayAvailable()) { if(QSystemTrayIcon::isSystemTrayAvailable()) {
// Ok, systray integration is now supported // Ok, systray integration is now supported
@ -1112,7 +1105,6 @@ void GUI::createSystrayDelayed() {
Preferences::setSystrayIntegration(false); Preferences::setSystrayIntegration(false);
} }
} }
#endif
} }
void GUI::updateAltSpeedsBtn(bool alternative) { void GUI::updateAltSpeedsBtn(bool alternative) {

2171
src/options_imp.cpp

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save