Changeset 2354

Show
Ignore:
Timestamp:
02/23/08 23:02:19 (11 months ago)
Author:
edmanm
Message:

r129@lysithea: edmanm | 2008-02-23 23:02:10 -0500
Remove our tray icon implementation for X11 and Win32. We haven't used it
since we started requiring Qt >= 4.2.0 and part of the X11 implementation
is derived from another GPL'ed project. Removing it makes it easier to
add our OpenSSL license exception.

Location:
vidalia/trunk
Files:
4 removed
6 modified

Legend:

Unmodified
Added
Removed
  • vidalia/trunk/CMakeLists.txt

    r2335 r2354  
    55# 
    66#  Copyright (C) 2006-2007,  Matt Edman, Justin Hipple 
     7#  Copyright (C) 2008,  Matt Edman 
    78# 
    89#  This program is free software; you can redistribute it and/or 
     
    5758endif(APPLE) 
    5859 
    59 ## Check for QSystemTrayIcon 
     60## Check for QSslSocket 
    6061set(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 QSslSocket 
    6962check_include_file_cxx("qsslsocket.h" HAVE_QSSLSOCKET_H) 
    7063if (HAVE_QSSLSOCKET_H) 
  • vidalia/trunk/config.h.in

    r2320 r2354  
    1  
    2 #cmakedefine HAVE_QSYSTEMTRAYICON_H 
    3  
    4 #cmakedefine USE_QSYSTEMTRAYICON 
    51 
    62#cmakedefine HAVE_QSSLSOCKET_H 
  • vidalia/trunk/src/vidalia/CMakeLists.txt

    r2338 r2354  
    153153set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon.cpp) 
    154154qt4_wrap_cpp(vidalia_SRCS tray/trayicon.h) 
    155 if(USE_QSYSTEMTRAYICON AND NOT APPLE) 
     155if(APPLE) 
     156  set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_mac.cpp) 
     157  qt4_wrap_cpp(vidalia_SRCS tray/trayicon_mac.h) 
     158else(APPLE) 
    156159  ## Use Qt's QSystemTrayIcon implementation 
    157160  set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon_qt.cpp) 
    158161  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) 
     162endif(APPLE) 
    174163 
    175164## Main Vidalia sources 
  • vidalia/trunk/src/vidalia/mainwindow.cpp

    r2328 r2354  
    6868/* Decide which of our four sets of tray icons to use. */ 
    6969#if defined(Q_WS_WIN) 
    70 #if defined(USE_QSYSTEMTRAYICON) 
    7170/* QSystemTrayIcon on Windows wants 16x16 .png files */ 
    7271#define IMG_TOR_STOPPED  ":/images/16x16/tor-off.png" 
     
    7473#define IMG_TOR_STARTING ":/images/16x16/tor-starting.png" 
    7574#define IMG_TOR_STOPPING ":/images/16x16/tor-stopping.png" 
    76 #else 
    77 /* 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 #endif 
    8475#elif defined(Q_WS_MAC) 
    8576/* On Mac, we always go straight to Carbon to load our dock images  
  • vidalia/trunk/src/vidalia/tray/trayicon.cpp

    r2320 r2354  
    4040  : TrayIconImpl(parent) 
    4141{ 
    42   _contextMenu = 0; 
    4342} 
    4443 
     
    4847{ 
    4948  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  
    5849    case QEvent::MouseButtonDblClick: 
    5950      mouseButtonDblClick((QMouseEvent *)event); 
     
    6556  event->accept(); 
    6657  return true; 
    67 } 
    68  
    69 /** Responds to a single mouse button press. On X11, we display the menu when 
    70  * a mouse button is pressed. */ 
    71 void 
    72 TrayIcon::mouseButtonPress(QMouseEvent *event) 
    73 { 
    74 #if defined(Q_WS_X11) && !defined(USE_QSYSTEMTRAYICON) 
    75   if (_contextMenu) { 
    76     _contextMenu->popup(event->globalPos()); 
    77   } 
    78 #else 
    79   Q_UNUSED(event); 
    80 #endif 
    81 } 
    82  
    83 /** Responds to a single mouse button release. On Windows, we display the menu 
    84  * when a mouse button is released. */ 
    85 void 
    86 TrayIcon::mouseButtonRelease(QMouseEvent *event) 
    87 { 
    88 #if defined(Q_WS_WIN) 
    89   if (_contextMenu) { 
    90     /* This little activateWindow() dance is necessary to make menu closing 
    91      * work properly on Windows. */ 
    92     _contextMenu->activateWindow(); 
    93     _contextMenu->popup(event->globalPos()); 
    94     _contextMenu->activateWindow(); 
    95   } 
    96 #else 
    97   Q_UNUSED(event); 
    98 #endif 
    9958} 
    10059 
     
    153112#if defined(Q_WS_MAC) 
    154113  qt_mac_set_dock_menu(menu); 
    155 #elif defined(USE_QSYSTEMTRAYICON) 
     114#else 
    156115  TrayIconImpl::setContextMenu(menu); 
    157 #else 
    158   _contextMenu = menu; 
    159116#endif 
    160117} 
     
    165122                             BalloonMessageIcon balloonIcon) 
    166123{ 
    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 
    168129  QSystemTrayIcon::MessageIcon icon; 
    169130  switch (balloonIcon) { 
     
    174135  } 
    175136  TrayIconImpl::showMessage(title, message, icon); 
    176 #else 
    177   Q_UNUSED(title) 
    178   Q_UNUSED(message) 
    179   Q_UNUSED(balloonIcon) 
    180137#endif 
    181138} 
     
    189146  /* We always have a tray on Win32 or a dock on OS X */ 
    190147  return true; 
    191 #elif defined(USE_QSYSTEMTRAYICON) 
     148#else 
    192149  /* Ask Qt if there is a tray available */ 
    193150  return QSystemTrayIcon::isSystemTrayAvailable(); 
    194 #else 
    195   /* XXX:This is too optimistic, but we need to make our own tray icon 
    196    * implementation smart enough to detect a system tray on X11. */ 
    197   return true; 
    198151#endif 
    199152} 
     
    204157TrayIcon::supportsBalloonMessages() 
    205158{ 
    206 #if defined(USE_QSYSTEMTRAYICON) 
    207159#if defined(Q_WS_WIN) 
    208160  return (QSystemTrayIcon::supportsMessages() 
    209161            && QSysInfo::WindowsVersion > QSysInfo::WV_2000); 
     162#elif defined(Q_WS_MAC) 
     163  return false; 
    210164#else 
    211165  return QSystemTrayIcon::supportsMessages(); 
    212166#endif 
    213 #else 
    214   return false;     
    215 #endif 
    216167} 
    217168 
  • vidalia/trunk/src/vidalia/tray/trayicon.h

    r2320 r2354  
    3636 
    3737/* Include the correct tray icon implementation */ 
    38 #if defined(USE_QSYSTEMTRAYICON) 
     38#if defined(Q_WS_MAC) 
     39#include "trayicon_mac.h" 
     40#else 
    3941#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 #else 
    45 #include "trayicon_mac.h" 
    4642#endif 
    4743 
     
    9389  /** Override's QObject' event() method to catch mouse-related events. */ 
    9490  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); 
    9991  /** Respond to a mouse button being double-clicked. */ 
    10092  void mouseButtonDblClick(QMouseEvent *event); 
    101  
    102 private: 
    103   QMenu* _contextMenu; /**< Menu to display when the tray icon is clicked. */ 
    10493}; 
    10594