[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r4227: Stop using our custom dock icon implementation on OS X and j (in vidalia/trunk: . src/vidalia src/vidalia/res src/vidalia/res/128x128)
Author: edmanm
Date: 2010-02-24 23:03:32 -0500 (Wed, 24 Feb 2010)
New Revision: 4227
Added:
vidalia/trunk/src/vidalia/res/128x128/tor-off.png
vidalia/trunk/src/vidalia/res/128x128/tor-on.png
vidalia/trunk/src/vidalia/res/128x128/tor-starting.png
vidalia/trunk/src/vidalia/res/128x128/tor-stopping.png
Removed:
vidalia/trunk/src/vidalia/tray/
Modified:
vidalia/trunk/CHANGELOG
vidalia/trunk/src/vidalia/CMakeLists.txt
vidalia/trunk/src/vidalia/MainWindow.cpp
vidalia/trunk/src/vidalia/MainWindow.h
vidalia/trunk/src/vidalia/res/vidalia.qrc
Log:
Stop using our custom dock icon implementation on OS X and just use
QSystemTrayIcon everywhere. Fixes ticket #562. Also add some missing
changelog items and correct the release date for 0.2.7.
Modified: vidalia/trunk/CHANGELOG
===================================================================
--- vidalia/trunk/CHANGELOG 2010-02-24 18:51:51 UTC (rev 4226)
+++ vidalia/trunk/CHANGELOG 2010-02-25 04:03:32 UTC (rev 4227)
@@ -1,4 +1,17 @@
-0.2.7 25-Jan-2009
+0.2.8 xx-xxx-2010
+ o Stop using our custom dock icon implementation on OS X and just use
+ QSystemTrayIcon everywhere. Fixes the build on Snow Leopard.
+ (Ticket #562)
+ o Include a pre-configured qt.conf file in the Mac OS X bundles that
+ disable Qt plugin loading from the default directories. Otherwise,
+ users who have Qt installed in a system-wide location would end up
+ loading the libraries twice and crashing.
+ o Include libgcc_s_dw2-1.dll in the Windows installers, since Qt 4.6 now
+ depends on that DLL. (Ticket #555)
+ o Add Burmese and Thai UI translations.
+
+
+0.2.7 25-Jan-2010
o Remove the explicit palette set for the configuration dialog that
prevented the dialog from inheriting colors from the user's current
system theme. (Ticket #485. Patch from mkirk.)
Modified: vidalia/trunk/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/trunk/src/vidalia/CMakeLists.txt 2010-02-24 18:51:51 UTC (rev 4226)
+++ vidalia/trunk/src/vidalia/CMakeLists.txt 2010-02-25 04:03:32 UTC (rev 4227)
@@ -20,7 +20,6 @@
${CMAKE_CURRENT_SOURCE_DIR}/help/browser
${CMAKE_CURRENT_SOURCE_DIR}/log
${CMAKE_CURRENT_SOURCE_DIR}/network
- ${CMAKE_CURRENT_SOURCE_DIR}/tray
${MARBLE_INCLUDE_DIR}
)
@@ -224,18 +223,6 @@
)
endif(USE_MARBLE)
-## Choose the correct tray icon implementation for the current platform
-set(vidalia_SRCS ${vidalia_SRCS} tray/TrayIcon.cpp)
-qt4_wrap_cpp(vidalia_SRCS tray/TrayIcon.h)
-if(APPLE)
- set(vidalia_SRCS ${vidalia_SRCS} tray/TrayIconImpl_mac.cpp)
- qt4_wrap_cpp(vidalia_SRCS tray/TrayIconImpl_mac.h)
-else(APPLE)
- ## Use Qt's QSystemTrayIcon implementation
- set(vidalia_SRCS ${vidalia_SRCS} tray/TrayIconImpl_qt.cpp)
- qt4_wrap_cpp(vidalia_SRCS tray/TrayIconImpl_qt.h)
-endif(APPLE)
-
## Main Vidalia sources
set(vidalia_SRCS ${vidalia_SRCS}
main.cpp
Modified: vidalia/trunk/src/vidalia/MainWindow.cpp
===================================================================
--- vidalia/trunk/src/vidalia/MainWindow.cpp 2010-02-24 18:51:51 UTC (rev 4226)
+++ vidalia/trunk/src/vidalia/MainWindow.cpp 2010-02-25 04:03:32 UTC (rev 4227)
@@ -67,12 +67,13 @@
#define IMG_TOR_STARTING ":/images/16x16/tor-starting.png"
#define IMG_TOR_STOPPING ":/images/16x16/tor-stopping.png"
#elif defined(Q_WS_MAC)
-/* On Mac, we always go straight to Carbon to load our dock images
- * from .icns files */
-#define IMG_TOR_STOPPED "tor-off"
-#define IMG_TOR_RUNNING "tor-on"
-#define IMG_TOR_STARTING "tor-starting"
-#define IMG_TOR_STOPPING "tor-stopping"
+/* On Mac, the dock icons look best at 128x128, otherwise they get blurry
+ * if resized from a smaller image */
+#define IMG_TOR_STOPPED ":/images/128x128/tor-off.png"
+#define IMG_TOR_RUNNING ":/images/128x128/tor-on.png"
+#define IMG_TOR_STARTING ":/images/128x128/tor-starting.png"
+#define IMG_TOR_STOPPING ":/images/128x128/tor-stopping.png"
+void qt_mac_set_dock_menu(QMenu *menu);
#else
/* On X11, we just use always the 22x22 .png files */
#define IMG_TOR_STOPPED ":/images/22x22/tor-off.png"
@@ -92,7 +93,6 @@
#define STARTUP_PROGRESS_CIRCUITBUILD 75
#define STARTUP_PROGRESS_MAXIMUM (STARTUP_PROGRESS_BOOTSTRAPPING+100)
-
/** Default constructor. It installs an icon in the system tray area and
* creates the popup menu associated with that icon. */
MainWindow::MainWindow()
@@ -231,7 +231,7 @@
{
if (visible) {
/* In Gnome, will hide buttons if Vidalia is run on startup. */
- if (!TrayIcon::isTrayIconSupported()) {
+ if (!QSystemTrayIcon::isSystemTrayAvailable()) {
/* Don't let people hide the main window, since that's all they have. */
ui.chkShowOnStartup->hide();
ui.btnHide->hide();
@@ -470,11 +470,18 @@
void
MainWindow::createTrayIcon()
{
- /* Create the default menu bar (Mac) */
+ QMenu *menu = createTrayMenu();
+
+ /* Add the menu it to the tray icon */
+ _trayIcon.setContextMenu(menu);
+
+ connect(&_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
+ this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
+
+#if defined(Q_WS_MAC)
createMenuBar();
- /* Create a tray menu and add it to the tray icon */
- _trayIcon.setContextMenu(createTrayMenu());
- connect(&_trayIcon, SIGNAL(doubleClicked()), this, SLOT(show()));
+ qt_mac_set_dock_menu(menu);
+#endif
}
/** Creates a QMenu object that contains QActions which compose the system
@@ -559,6 +566,26 @@
#endif
}
+/** Sets the current tray or dock icon image to <b>iconFile</b>. */
+void
+MainWindow::setTrayIcon(const QString &iconFile)
+{
+#if defined(Q_WS_MAC)
+ QApplication::setWindowIcon(QPixmap(iconFile));
+#else
+ _trayIcon.setIcon(QIcon(iconFile));
+#endif
+}
+
+/** Respond to a double-click on the tray icon by opening the Control Panel
+ * window. */
+void
+MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
+{
+ if (reason == QSystemTrayIcon::DoubleClick)
+ setVisible(true);
+}
+
/** Start a web browser when given the directory containing the executable and profile */
void
MainWindow::launchBrowserFromDirectory()
@@ -910,7 +937,7 @@
/* Update the tray icon */
if (!trayIconFile.isEmpty()) {
- _trayIcon.setIcon(trayIconFile);
+ setTrayIcon(trayIconFile);
}
/* Update the status banner on the control panel */
if (!statusIconFile.isEmpty())
@@ -1718,8 +1745,8 @@
QTimer::singleShot(MIN_NEWIDENTITY_INTERVAL,
this, SLOT(enableNewIdentity()));
- if (TrayIcon::supportsBalloonMessages())
- _trayIcon.showBalloonMessage(title, message, TrayIcon::Information);
+ if (QSystemTrayIcon::supportsMessages())
+ _trayIcon.showMessage(title, message, QSystemTrayIcon::Information);
else
VMessageBox::information(this, title, message, VMessageBox::Ok);
} else {
Modified: vidalia/trunk/src/vidalia/MainWindow.h
===================================================================
--- vidalia/trunk/src/vidalia/MainWindow.h 2010-02-24 18:51:51 UTC (rev 4226)
+++ vidalia/trunk/src/vidalia/MainWindow.h 2010-02-25 04:03:32 UTC (rev 4227)
@@ -22,7 +22,6 @@
#include "VidaliaWindow.h"
#include "HelperProcess.h"
-#include "TrayIcon.h"
#include "AboutDialog.h"
#include "MessageLog.h"
#include "BandwidthGraph.h"
@@ -42,8 +41,8 @@
#include <QMainWindow>
#include <QTimer>
+#include <QSystemTrayIcon>
-
class MainWindow : public VidaliaWindow
{
Q_OBJECT
@@ -63,6 +62,9 @@
virtual void retranslateUi();
private slots:
+ /** Respond to a double-click on the tray icon by opening the Control Panel
+ * window. */
+ void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
/** Displays the help browser and displays the most recently viewed help
* topic. */
void showHelpDialog();
@@ -188,6 +190,8 @@
QMenu* createTrayMenu();
/** Creates a default menubar on Mac */
void createMenuBar();
+ /** Sets the current tray or dock icon image to <b>iconFile</b>. */
+ void setTrayIcon(const QString &iconFile);
/** Updates the UI to reflect Tor's current <b>status</b>. Returns the
* previously set TorStatus value. */
TorStatus updateTorStatus(TorStatus status);
@@ -252,7 +256,7 @@
* when authenticating to Tor. */
bool _useSavedPassword;
/** The Vidalia icon that sits in the tray. */
- TrayIcon _trayIcon;
+ QSystemTrayIcon _trayIcon;
#if defined(USE_AUTOUPDATE)
/** Timer used to remind us to check for software updates. */
Copied: vidalia/trunk/src/vidalia/res/128x128/tor-off.png (from rev 2507, vidalia/trunk/src/vidalia/res/128x128/tor-off.png)
===================================================================
(Binary files differ)
Copied: vidalia/trunk/src/vidalia/res/128x128/tor-on.png (from rev 2507, vidalia/trunk/src/vidalia/res/128x128/tor-on.png)
===================================================================
(Binary files differ)
Copied: vidalia/trunk/src/vidalia/res/128x128/tor-starting.png (from rev 2507, vidalia/trunk/src/vidalia/res/128x128/tor-starting.png)
===================================================================
(Binary files differ)
Copied: vidalia/trunk/src/vidalia/res/128x128/tor-stopping.png (from rev 2507, vidalia/trunk/src/vidalia/res/128x128/tor-stopping.png)
===================================================================
(Binary files differ)
Modified: vidalia/trunk/src/vidalia/res/vidalia.qrc
===================================================================
--- vidalia/trunk/src/vidalia/res/vidalia.qrc 2010-02-24 18:51:51 UTC (rev 4226)
+++ vidalia/trunk/src/vidalia/res/vidalia.qrc 2010-02-25 04:03:32 UTC (rev 4227)
@@ -113,6 +113,10 @@
</qresource>
<qresource prefix="/images">
<file>128x128/tor-logo.png</file>
+ <file>128x128/tor-off.png</file>
+ <file>128x128/tor-on.png</file>
+ <file>128x128/tor-starting.png</file>
+ <file>128x128/tor-stopping.png</file>
</qresource>
<qresource prefix="/images">
<file>icons/node-unresponsive.png</file>