[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1719: Hide the "Show on Startup" checkbox and "Hide" button on the (in trunk: . src/gui)
Author: edmanm
Date: 2007-04-20 23:21:11 -0400 (Fri, 20 Apr 2007)
New Revision: 1719
Modified:
trunk/
trunk/src/gui/mainwindow.cpp
trunk/src/gui/mainwindow.h
Log:
r1814@adrastea: edmanm | 2007-04-20 23:14:52 -0400
Hide the "Show on Startup" checkbox and "Hide" button on the main window if no
tray or dock is available. This really only affects Vidalia on X11 and
currently isn't very smart when built with Qt 4.1 on non-Win32/non-OSX.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /vidalia/local/trunk [r1814] on 54b3572a-7227-0410-958f-53ecd705b71a
Modified: trunk/src/gui/mainwindow.cpp
===================================================================
--- trunk/src/gui/mainwindow.cpp 2007-04-21 02:27:34 UTC (rev 1718)
+++ trunk/src/gui/mainwindow.cpp 2007-04-21 03:21:11 UTC (rev 1719)
@@ -148,14 +148,20 @@
/* If we're supposed to start Tor when Vidalia starts, then do it now */
start();
}
-
- /* Check if we are supposed to show our main window on startup */
- ui.chkShowOnStartup->setChecked(settings.showMainWindowAtStart());
- if (ui.chkShowOnStartup->isChecked())
- this->show();
-
- /* Make the tray icon visible */
- _trayIcon.show();
+
+ if (isTrayIconSupported()) {
+ /* Make the tray icon visible */
+ _trayIcon.show();
+ /* Check if we are supposed to show our main window on startup */
+ ui.chkShowOnStartup->setChecked(settings.showMainWindowAtStart());
+ if (ui.chkShowOnStartup->isChecked())
+ show();
+ } else {
+ /* Don't let people hide the main window, since that's all they have. */
+ ui.chkShowOnStartup->hide();
+ ui.btnHide->hide();
+ show();
+ }
}
/** Destructor. */
@@ -167,6 +173,23 @@
delete _bandwidthGraph;
}
+/** Returns true if we're running on a platform with tray icon support. */
+bool
+MainWindow::isTrayIconSupported()
+{
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
+ /* We always have a tray on Win32 or a dock on OS X */
+ return true;
+#elif defined(USE_QSYSTEMTRAYICON)
+ /* Ask Qt if there is a tray available */
+ return QSystemTrayIcon::isSystemTrayAvailable();
+#else
+ /* XXX: This is too optimistic, but we need to make our own tray icon
+ * implementation smart enough to detect a system tray on X11. */
+ return true;
+#endif
+}
+
/** Terminate the Tor process if it is being run under Vidalia, disconnect all
* TorControl signals, and exit Vidalia. */
void
Modified: trunk/src/gui/mainwindow.h
===================================================================
--- trunk/src/gui/mainwindow.h 2007-04-21 02:27:34 UTC (rev 1718)
+++ trunk/src/gui/mainwindow.h 2007-04-21 03:21:11 UTC (rev 1719)
@@ -123,7 +123,8 @@
QMenu* createTrayMenu();
/** Creates a default menubar on Mac */
void createMenuBar();
-
+ /** Returns true if we're running on a platform with tray icon support. */
+ bool isTrayIconSupported();
/** Updates the UI to reflect Tor's current <b>status</b>. */
void updateTorStatus(TorStatus status);