Changeset 2354
- Timestamp:
- 02/23/08 23:02:19 (11 months ago)
- Location:
- vidalia/trunk
- Files:
-
- 4 removed
- 6 modified
-
CMakeLists.txt (modified) (2 diffs)
-
config.h.in (modified) (1 diff)
-
src/vidalia/CMakeLists.txt (modified) (1 diff)
-
src/vidalia/mainwindow.cpp (modified) (2 diffs)
-
src/vidalia/tray/trayicon.cpp (modified) (8 diffs)
-
src/vidalia/tray/trayicon.h (modified) (2 diffs)
-
src/vidalia/tray/trayicon_win.cpp (deleted)
-
src/vidalia/tray/trayicon_win.h (deleted)
-
src/vidalia/tray/trayicon_x11.cpp (deleted)
-
src/vidalia/tray/trayicon_x11.h (deleted)
Legend:
- Unmodified
- Added
- Removed
-
vidalia/trunk/CMakeLists.txt
r2335 r2354 5 5 # 6 6 # Copyright (C) 2006-2007, Matt Edman, Justin Hipple 7 # Copyright (C) 2008, Matt Edman 7 8 # 8 9 # This program is free software; you can redistribute it and/or … … 57 58 endif(APPLE) 58 59 59 ## Check for QS ystemTrayIcon60 ## Check for QSslSocket 60 61 set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${QT_INCLUDES}) 61 if (NOT APPLE)62 check_include_file_cxx("qsystemtrayicon.h" HAVE_QSYSTEMTRAYICON_H)63 if (HAVE_QSYSTEMTRAYICON_H)64 option(USE_QSYSTEMTRAYICON "Use Qt's tray icon implementation." ON)65 endif(HAVE_QSYSTEMTRAYICON_H)66 endif(NOT APPLE)67 68 ## Check for QSslSocket69 62 check_include_file_cxx("qsslsocket.h" HAVE_QSSLSOCKET_H) 70 63 if (HAVE_QSSLSOCKET_H) -
vidalia/trunk/config.h.in
r2320 r2354 1 2 #cmakedefine HAVE_QSYSTEMTRAYICON_H3 4 #cmakedefine USE_QSYSTEMTRAYICON5 1 6 2 #cmakedefine HAVE_QSSLSOCKET_H -
vidalia/trunk/src/vidalia/CMakeLists.txt
r2338 r2354 153 153 set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon.cpp) 154 154 qt4_wrap_cpp(vidalia_SRCS tray/trayicon.h) 155 if(USE_QSYSTEMTRAYICON AND NOT APPLE) 155 if(APPLE) 156 set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_mac.cpp) 157 qt4_wrap_cpp(vidalia_SRCS tray/trayicon_mac.h) 158 else(APPLE) 156 159 ## Use Qt's QSystemTrayIcon implementation 157 160 set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_qt.cpp) 158 161 qt4_wrap_cpp(vidalia_SRCS tray/trayicon_qt.h) 159 else(USE_QSYSTEMTRAYICON AND NOT APPLE) 160 ## Use our custom tray icon implementation 161 if(WIN32) 162 set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_win.cpp) 163 qt4_wrap_cpp(vidalia_SRCS tray/trayicon_win.h) 164 else(WIN32) 165 if(APPLE) 166 set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_mac.cpp) 167 qt4_wrap_cpp(vidalia_SRCS tray/trayicon_mac.h) 168 else(APPLE) 169 set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_x11.cpp) 170 qt4_wrap_cpp(vidalia_SRCS tray/trayicon_x11.h) 171 endif(APPLE) 172 endif(WIN32) 173 endif(USE_QSYSTEMTRAYICON AND NOT APPLE) 162 endif(APPLE) 174 163 175 164 ## Main Vidalia sources -
vidalia/trunk/src/vidalia/mainwindow.cpp
r2328 r2354 68 68 /* Decide which of our four sets of tray icons to use. */ 69 69 #if defined(Q_WS_WIN) 70 #if defined(USE_QSYSTEMTRAYICON)71 70 /* QSystemTrayIcon on Windows wants 16x16 .png files */ 72 71 #define IMG_TOR_STOPPED ":/images/16x16/tor-off.png" … … 74 73 #define IMG_TOR_STARTING ":/images/16x16/tor-starting.png" 75 74 #define IMG_TOR_STOPPING ":/images/16x16/tor-stopping.png" 76 #else77 /* Use the .ico files */78 #include "res/vidalia_win.rc.h"79 #define IMG_TOR_STOPPED QString::number(IDI_TOR_OFF)80 #define IMG_TOR_RUNNING QString::number(IDI_TOR_ON)81 #define IMG_TOR_STARTING QString::number(IDI_TOR_STARTING)82 #define IMG_TOR_STOPPING QString::number(IDI_TOR_STOPPING)83 #endif84 75 #elif defined(Q_WS_MAC) 85 76 /* On Mac, we always go straight to Carbon to load our dock images -
vidalia/trunk/src/vidalia/tray/trayicon.cpp
r2320 r2354 40 40 : TrayIconImpl(parent) 41 41 { 42 _contextMenu = 0;43 42 } 44 43 … … 48 47 { 49 48 switch (event->type()) { 50 case QEvent::MouseButtonPress:51 mouseButtonPress((QMouseEvent *)event);52 break;53 54 case QEvent::MouseButtonRelease:55 mouseButtonRelease((QMouseEvent *)event);56 break;57 58 49 case QEvent::MouseButtonDblClick: 59 50 mouseButtonDblClick((QMouseEvent *)event); … … 65 56 event->accept(); 66 57 return true; 67 }68 69 /** Responds to a single mouse button press. On X11, we display the menu when70 * a mouse button is pressed. */71 void72 TrayIcon::mouseButtonPress(QMouseEvent *event)73 {74 #if defined(Q_WS_X11) && !defined(USE_QSYSTEMTRAYICON)75 if (_contextMenu) {76 _contextMenu->popup(event->globalPos());77 }78 #else79 Q_UNUSED(event);80 #endif81 }82 83 /** Responds to a single mouse button release. On Windows, we display the menu84 * when a mouse button is released. */85 void86 TrayIcon::mouseButtonRelease(QMouseEvent *event)87 {88 #if defined(Q_WS_WIN)89 if (_contextMenu) {90 /* This little activateWindow() dance is necessary to make menu closing91 * work properly on Windows. */92 _contextMenu->activateWindow();93 _contextMenu->popup(event->globalPos());94 _contextMenu->activateWindow();95 }96 #else97 Q_UNUSED(event);98 #endif99 58 } 100 59 … … 153 112 #if defined(Q_WS_MAC) 154 113 qt_mac_set_dock_menu(menu); 155 #el if defined(USE_QSYSTEMTRAYICON)114 #else 156 115 TrayIconImpl::setContextMenu(menu); 157 #else158 _contextMenu = menu;159 116 #endif 160 117 } … … 165 122 BalloonMessageIcon balloonIcon) 166 123 { 167 #if defined(USE_QSYSTEMTRAYICON) 124 #if defined(Q_WS_MAC) 125 Q_UNUSED(title) 126 Q_UNUSED(message) 127 Q_UNUSED(balloonIcon) 128 #else 168 129 QSystemTrayIcon::MessageIcon icon; 169 130 switch (balloonIcon) { … … 174 135 } 175 136 TrayIconImpl::showMessage(title, message, icon); 176 #else177 Q_UNUSED(title)178 Q_UNUSED(message)179 Q_UNUSED(balloonIcon)180 137 #endif 181 138 } … … 189 146 /* We always have a tray on Win32 or a dock on OS X */ 190 147 return true; 191 #el if defined(USE_QSYSTEMTRAYICON)148 #else 192 149 /* Ask Qt if there is a tray available */ 193 150 return QSystemTrayIcon::isSystemTrayAvailable(); 194 #else195 /* XXX:This is too optimistic, but we need to make our own tray icon196 * implementation smart enough to detect a system tray on X11. */197 return true;198 151 #endif 199 152 } … … 204 157 TrayIcon::supportsBalloonMessages() 205 158 { 206 #if defined(USE_QSYSTEMTRAYICON)207 159 #if defined(Q_WS_WIN) 208 160 return (QSystemTrayIcon::supportsMessages() 209 161 && QSysInfo::WindowsVersion > QSysInfo::WV_2000); 162 #elif defined(Q_WS_MAC) 163 return false; 210 164 #else 211 165 return QSystemTrayIcon::supportsMessages(); 212 166 #endif 213 #else214 return false;215 #endif216 167 } 217 168 -
vidalia/trunk/src/vidalia/tray/trayicon.h
r2320 r2354 36 36 37 37 /* Include the correct tray icon implementation */ 38 #if defined(USE_QSYSTEMTRAYICON) 38 #if defined(Q_WS_MAC) 39 #include "trayicon_mac.h" 40 #else 39 41 #include "trayicon_qt.h" 40 #elif defined(Q_WS_WIN)41 #include "trayicon_win.h"42 #elif defined(Q_WS_X11)43 #include "trayicon_x11.h"44 #else45 #include "trayicon_mac.h"46 42 #endif 47 43 … … 93 89 /** Override's QObject' event() method to catch mouse-related events. */ 94 90 bool event(QEvent *); 95 /** Respond to a mouse button being pressed. */96 void mouseButtonPress(QMouseEvent *event);97 /** Respond to a mouse button being released. */98 void mouseButtonRelease(QMouseEvent *event);99 91 /** Respond to a mouse button being double-clicked. */ 100 92 void mouseButtonDblClick(QMouseEvent *event); 101 102 private:103 QMenu* _contextMenu; /**< Menu to display when the tray icon is clicked. */104 93 }; 105 94
