[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2220: 'svk add' some files that were supposed to go with r2217. (in trunk: . src/vidalia/tray)
Author: edmanm
Date: 2007-12-16 13:54:04 -0500 (Sun, 16 Dec 2007)
New Revision: 2220
Added:
trunk/src/vidalia/tray/trayicon_qt.cpp
trunk/src/vidalia/tray/trayicon_qt.h
Modified:
trunk/
Log:
r2311@lysithea: edmanm | 2007-12-16 13:53:11 -0500
'svk add' some files that were supposed to go with r2217.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /local/vidalia/trunk [r2311] on 0108964c-5b0b-4c9e-969f-e2288315d100
Added: trunk/src/vidalia/tray/trayicon_qt.cpp
===================================================================
--- trunk/src/vidalia/tray/trayicon_qt.cpp (rev 0)
+++ trunk/src/vidalia/tray/trayicon_qt.cpp 2007-12-16 18:54:04 UTC (rev 2220)
@@ -0,0 +1,59 @@
+/****************************************************************
+ * Vidalia is distributed under the following license:
+ *
+ * Copyright (C) 2007, Matt Edman, Justin Hipple
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ ***************************************************************/
+
+/**
+ * \file trayicon_qt.cpp
+ * \version $Id$
+ * \brief Tray icon wrapper around Qt's QSystemTrayIcon implementation
+ */
+
+#include <QMouseEvent>
+#include "trayicon_qt.h"
+
+
+/** Default constructor. */
+TrayIconImpl::TrayIconImpl(QObject *parent)
+ : QSystemTrayIcon(parent)
+{
+ connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
+ this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
+}
+
+/** Modify the tray icon's image to <b>iconFile</b>. */
+void
+TrayIconImpl::setIcon(const QString &iconFile)
+{
+ QSystemTrayIcon::setIcon(QIcon(iconFile));
+}
+
+/** Called when the user interacts with the tray icon and propoagates
+ * double-click events to the parent object. */
+void
+TrayIconImpl::onActivated(QSystemTrayIcon::ActivationReason reason)
+{
+ if (reason == QSystemTrayIcon::DoubleClick) {
+ /* Propagate the double-click to the parent class's event handler */
+ event(new QMouseEvent(QEvent::MouseButtonDblClick, QPoint(),
+ Qt::LeftButton, Qt::LeftButton,
+ Qt::NoModifier));
+ }
+}
+
Property changes on: trunk/src/vidalia/tray/trayicon_qt.cpp
___________________________________________________________________
Name: svn:keywords:Id
+ trayicon_qt.h
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/src/vidalia/tray/trayicon_qt.h
===================================================================
--- trunk/src/vidalia/tray/trayicon_qt.h (rev 0)
+++ trunk/src/vidalia/tray/trayicon_qt.h 2007-12-16 18:54:04 UTC (rev 2220)
@@ -0,0 +1,52 @@
+/****************************************************************
+ * Vidalia is distributed under the following license:
+ *
+ * Copyright (C) 2007, Matt Edman, Justin Hipple
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ ***************************************************************/
+
+/**
+ * \file trayicon_qt.h
+ * \version $Id$
+ * \brief Tray icon wrapper around Qt's QSystemTrayIcon implementation
+ */
+
+#ifndef _TRAYICON_QT_H
+#define _TRAYICON_QT_H
+
+#include <QSystemTrayIcon>
+
+
+class TrayIconImpl : public QSystemTrayIcon
+{
+ Q_OBJECT
+
+protected:
+ /** Default constructor. */
+ TrayIconImpl(QObject *parent = 0);
+
+ /** Modify the tray icon's image to <b>iconFile</b>. */
+ void setIcon(const QString &iconFile);
+
+private slots:
+ /** Called when the user interacts with the tray icon and propagates
+ * double-click events to the parent object. */
+ void onActivated(QSystemTrayIcon::ActivationReason reason);
+};
+
+#endif
+
Property changes on: trunk/src/vidalia/tray/trayicon_qt.h
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native