From 01b58441747ff2768f75caf4ea294078f26d4563 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 27 Mar 2011 08:34:51 +0000 Subject: [PATCH] - FEATURE: Added monochrome icon for light themes - BUGFIX: Change systray icon on the fly (no restart needed) --- Changelog | 4 ++ src/Icons/skin/qbittorrent_mono_light.png | Bin 0 -> 1637 bytes src/Info.plist | 2 +- src/icons.qrc | 1 + src/mainwindow.cpp | 12 +++- src/preferences/options.ui | 73 ++++++++++++++++------ src/preferences/options_imp.cpp | 13 ++-- src/preferences/preferences.h | 11 ++-- version.pri | 8 +-- 9 files changed, 88 insertions(+), 36 deletions(-) create mode 100644 src/Icons/skin/qbittorrent_mono_light.png diff --git a/Changelog b/Changelog index 9048c4326..56f4b48c1 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +* Unreleased - Christophe Dumez - v2.8.0 + - FEATURE: Added monochrome icon for light themes + - BUGFIX: Change systray icon on the fly (no restart needed) + * Sun Mar 20 2011 - Christophe Dumez - v2.7.0 - FEATURE: Added search field for torrent content - FEATURE: Added auto-shutdown confirmation dialog diff --git a/src/Icons/skin/qbittorrent_mono_light.png b/src/Icons/skin/qbittorrent_mono_light.png new file mode 100644 index 0000000000000000000000000000000000000000..6ee1bab515533846de45af80c7d77879b4337b8f GIT binary patch literal 1637 zcmV-r2AcVaP)#9WK~z|U#g~1IR96|sf6tkj!t9D#qLw9XY_SR{jV5Mmrf~19 z1Bu&AFk)#I64R!!TEq`Z{G%GH4Y9~A-p=@3Pe$~7}zLj12AwQq-J(f(w@o5 z$$Q7f#!mj%28M=))~9KDKk&8y{SDY_W`6))%;j<~Pft%@BI%vYW^<8qt^}+B7Pc9= z%X|N$i!u;J(E{K*l0Fuo!@#aaqj6w-e0*xI8I?+dB}y!YP()&sAb*}9c0SKiC-?e=~Gb@mAe`k9v<#@&TR#dw7piVJ^p6J zTahHm6TnUY=iFB%=^O)%Mq{&?T?QP@WHR@)6ATXz_e(mbT)kpsWF%86mEO{h&7VJi z2k=ibyEcyFbuC3^YK#7?H=ZQ2;zwDelEa~AS zNxlvc$MJW8jb^qAxJA-Bpda`x@HOxKlOgYmz*aN+)8fU8ud7rlO$U(8W+O>`z$wpJ=-N0Js+#cZFX11_%=8_(jbd#jVB|QpU4g5Hc3y7 zvn7yJ3}ZDoy)=lQan2RI_glR8Tg)s5-ap6cF94z>Np4M&~ zW}^UUnl76)07PM|0+?9=7?AYCYPEW_#a^q`ekbXnUg~D{J@5TX%xqq}fkpsZU$H+2 z1DAIpyrP$ZX0v%sm&vp^js+u^1$?62z_S7TP!M@OB(Lpa;3K^Z5bE3>EshqanY}A$ z9iKH|X1@w!0l<5|4>%%e!_d&ssuo!kMN7@>3%%4OZ7LRvvnGayhE|0}=J$aU=iK!{ z>tzU^V@baV@2p(0V#Pu;`+Koi{JfbxnWpLfIF5f}W@jXQlu*NNVP>xYqs3zJfSKi( zX-+1AJIpK{931S+=kp^WchBq!c<+A=JO|{Ra~lDYB&nupdOa`-+#qQUu*b|k*+u&` z;E$5l0{hHt7$^f{&bi2Y|8szRKEIBc!|K?fLx-M$wvMP+EZ$^h51ZM^{{H@J4<0;t zro}!uIG9_qWJy}7RGM)de;9Zg*yX+7(xVh^`SRu2BS((R{$t`ez7+T+GY8zZBuVa@ zEdjuyMT_=MOibJ@>B@S&zJr;*0GMemdM$gm2n|f<-*qQ5P3=qheE!=laP}OiR4Ps9 z+-HDkU_%_ow_J?qToJy49}nEOwXg0Q4x(zcIx6WN07(zLSrd{J$MH5`Yk;d3`u`m_a00000NkvXXu0mjflF%AN literal 0 HcmV?d00001 diff --git a/src/Info.plist b/src/Info.plist index b3aebebfd..d3f077614 100644 --- a/src/Info.plist +++ b/src/Info.plist @@ -47,7 +47,7 @@ CFBundlePackageType APPL CFBundleGetInfoString - 2.7.0 + 2.8.0 CFBundleSignature ???? CFBundleExecutable diff --git a/src/icons.qrc b/src/icons.qrc index a2a5511ca..c651e1159 100644 --- a/src/icons.qrc +++ b/src/icons.qrc @@ -9,6 +9,7 @@ Icons/magnet.png Icons/slow.png Icons/L.gif + Icons/skin/qbittorrent_mono_light.png Icons/skin/seeding.png Icons/skin/splash.png Icons/skin/tabs.gif diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 96319ed30..56485b5e3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -994,6 +994,10 @@ void MainWindow::loadPreferences(bool configure_session) { delete myTrayIconMenu; } } + // Reload systray icon + if(newSystrayIntegration && systrayIcon) { + systrayIcon->setIcon(getSystrayIcon()); + } // General if(pref.isToolbarDisplayed()) { toolBar->setVisible(true); @@ -1350,8 +1354,14 @@ void MainWindow::checkForActiveTorrents() QIcon MainWindow::getSystrayIcon() const { #if defined(Q_WS_X11) - if(Preferences().useMonochromeTrayIcon()) { + TrayIcon::Style style = Preferences().trayIconStyle(); + switch(style) { + case TrayIcon::MONO_DARK: return QIcon(":/Icons/skin/qbittorrent_mono_dark.png"); + case TrayIcon::MONO_LIGHT: + return QIcon(":/Icons/skin/qbittorrent_mono_light.png"); + default: + break; } #endif QIcon icon; diff --git a/src/preferences/options.ui b/src/preferences/options.ui index 5902f823a..0d4b362ad 100644 --- a/src/preferences/options.ui +++ b/src/preferences/options.ui @@ -171,8 +171,8 @@ 0 0 - 499 - 515 + 508 + 531 @@ -360,9 +360,6 @@ Desktop - - 0 - @@ -390,13 +387,6 @@ - - - - Use monochrome system tray icon (requires restart) - - - @@ -414,6 +404,49 @@ + + + + + + Tray icon style: + + + + + + + + Normal + + + + + Monochrome (Dark theme) + + + + + Monochrome (Light theme) + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -473,8 +506,8 @@ 0 - -330 - 499 + 0 + 453 744 @@ -924,7 +957,7 @@ QGroupBox { 0 0 - 447 + 480 457 @@ -1404,7 +1437,7 @@ QGroupBox { 0 0 - 404 + 403 334 @@ -1793,7 +1826,7 @@ QGroupBox { 0 0 - 542 + 589 422 @@ -2176,7 +2209,7 @@ QGroupBox { 0 0 - 378 + 380 255 @@ -2325,8 +2358,8 @@ QGroupBox { 0 0 - 517 - 414 + 64 + 18 diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index d669248ad..e0dd8c563 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -107,7 +107,8 @@ options_imp::options_imp(QWidget *parent): checkShowSystray->setEnabled(false); } #if !defined(Q_WS_X11) - checkUseMonoSystrayIcon->setVisible(false); + label_trayIconStyle->setVisible(false); + comboTrayIcon->setVisible(false); #endif // Connect signals / slots // General tab @@ -135,7 +136,7 @@ options_imp::options_imp(QWidget *parent): connect(checkShowSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkProgramExitConfirm, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkPreventFromSuspend, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); - connect(checkUseMonoSystrayIcon, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); + connect(comboTrayIcon, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); #if defined(Q_WS_X11) && !defined(QT_DBUS_LIB) checkPreventFromSuspend->setDisabled(true); #endif @@ -327,7 +328,7 @@ void options_imp::saveOptions(){ pref.setLocale(locale); pref.setAlternatingRowColors(checkAltRowColors->isChecked()); pref.setSystrayIntegration(systrayIntegration()); - pref.setUseMonochromeTrayIcon(checkUseMonoSystrayIcon->isChecked()); + pref.setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex())); pref.setCloseToTray(closeToTray()); pref.setMinimizeToTray(minimizeToTray()); pref.setStartMinimized(startMinimized()); @@ -476,8 +477,8 @@ void options_imp::loadOptions(){ checkCloseToSystray->setChecked(pref.closeToTray()); checkMinimizeToSysTray->setChecked(pref.minimizeToTray()); checkStartMinimized->setChecked(pref.startMinimized()); - checkUseMonoSystrayIcon->setChecked(pref.useMonochromeTrayIcon()); } + comboTrayIcon->setCurrentIndex(pref.trayIconStyle()); checkProgramExitConfirm->setChecked(pref.confirmOnExit()); checkPreventFromSuspend->setChecked(pref.preventFromSuspend()); // End General preferences @@ -854,13 +855,13 @@ void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){ void options_imp::enableSystrayOptions() { checkCloseToSystray->setEnabled(true); checkMinimizeToSysTray->setEnabled(true); - checkUseMonoSystrayIcon->setEnabled(true); + comboTrayIcon->setEnabled(true); } void options_imp::disableSystrayOptions() { checkCloseToSystray->setEnabled(false); checkMinimizeToSysTray->setEnabled(false); - checkUseMonoSystrayIcon->setEnabled(false); + comboTrayIcon->setEnabled(false); } void options_imp::setSystrayOptionsState(bool checked) { diff --git a/src/preferences/preferences.h b/src/preferences/preferences.h index ac9bcd621..fad81255d 100644 --- a/src/preferences/preferences.h +++ b/src/preferences/preferences.h @@ -58,6 +58,9 @@ enum maxRatioAction {PAUSE_ACTION, REMOVE_ACTION}; namespace Proxy { enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4, SOCKS4=5}; } +namespace TrayIcon { +enum Style { NORMAL = 0, MONO_DARK, MONO_LIGHT }; +} class Preferences : public QIniSettings { Q_DISABLE_COPY(Preferences); @@ -1033,11 +1036,11 @@ public: setValue(QString::fromUtf8("Preferences/Advanced/confirmTorrentDeletion"), enabled); } - bool useMonochromeTrayIcon() const { - return value(QString::fromUtf8("Preferences/Advanced/useMonochromeTrayIcon"), false).toBool(); + TrayIcon::Style trayIconStyle() const { + return TrayIcon::Style(value(QString::fromUtf8("Preferences/Advanced/TrayIconStyle"), TrayIcon::NORMAL).toInt()); } - void setUseMonochromeTrayIcon(bool use) { - setValue(QString::fromUtf8("Preferences/Advanced/useMonochromeTrayIcon"), use); + void setTrayIconStyle(TrayIcon::Style style) { + setValue(QString::fromUtf8("Preferences/Advanced/TrayIconStyle"), style); } }; diff --git a/version.pri b/version.pri index e1aee098e..355438678 100644 --- a/version.pri +++ b/version.pri @@ -1,11 +1,11 @@ os2 { - DEFINES += VERSION=\'\"v2.7.0\"\' + DEFINES += VERSION=\'\"v2.8.0alpha1\"\' } else { - DEFINES += VERSION=\\\"v2.7.0\\\" + DEFINES += VERSION=\\\"v2.8.0alpha1\\\" } DEFINES += VERSION_MAJOR=2 -DEFINES += VERSION_MINOR=7 +DEFINES += VERSION_MINOR=8 DEFINES += VERSION_BUGFIX=0 # NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL -DEFINES += VERSION_TYPE=NORMAL +DEFINES += VERSION_TYPE=ALPHA