[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7285 - in gnunet-qt: pixmaps src/core src/plugins/about
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7285 - in gnunet-qt: pixmaps src/core src/plugins/about |
Date: |
Fri, 20 Jun 2008 08:56:40 -0600 (MDT) |
Author: moon
Date: 2008-06-20 08:56:40 -0600 (Fri, 20 Jun 2008)
New Revision: 7285
Modified:
gnunet-qt/pixmaps/pixmaps.qrc
gnunet-qt/src/core/wndMain.cc
gnunet-qt/src/core/wndMain.h
gnunet-qt/src/plugins/about/about.cc
Log:
add basic system tray icon features
correct my name ;-)
Modified: gnunet-qt/pixmaps/pixmaps.qrc
===================================================================
--- gnunet-qt/pixmaps/pixmaps.qrc 2008-06-20 14:31:56 UTC (rev 7284)
+++ gnunet-qt/pixmaps/pixmaps.qrc 2008-06-20 14:56:40 UTC (rev 7285)
@@ -11,10 +11,12 @@
<file>download.png</file>
<file>download_small.png</file>
<file>error.png</file>
+ <file>exit.png</file>
<file>fatal.png</file>
<file>fs.png</file>
<file>general.png</file>
<file>gnunet-logo-small.png</file>
+ <file>gnunet-qt.png</file>
<file>gnunet-qt-big.png</file>
<file>gnunet-qt-logo.png</file>
<file>info.png</file>
Modified: gnunet-qt/src/core/wndMain.cc
===================================================================
--- gnunet-qt/src/core/wndMain.cc 2008-06-20 14:31:56 UTC (rev 7284)
+++ gnunet-qt/src/core/wndMain.cc 2008-06-20 14:56:40 UTC (rev 7285)
@@ -47,9 +47,25 @@
GMainWindow::GMainWindow(QWidget *parent) : QMainWindow(parent)
{
QHBoxLayout *lay;
+ QMenu *trayMenu;
+ QAction *trayShow, *trayExit;
setupUi(this);
delete tabRoot;
+
+ trayIcon = new QSystemTrayIcon(QIcon(":/pixmaps/gnunet-qt.png"), this);
+ connect(trayShow, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
+ SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
+ trayMenu = new QMenu(this);
+ trayShow = trayMenu->addAction(tr("Show main window"));
+ trayShow->setCheckable(true);
+ trayShow->setChecked(true);
+ trayMenu->setDefaultAction(trayShow);
+ connect(trayShow, SIGNAL(triggered()), this, SLOT(showAndHide()));
+ trayExit = trayMenu->addAction(QIcon(":/pixmaps/exit.png"), tr("Exit"));
+ connect(trayExit, SIGNAL(triggered()), qApp, SLOT(quit()));
+ trayIcon->setContextMenu(trayMenu);
+ trayIcon->show();
QStatusBar *bar = statusBar();
if (bar)
@@ -91,6 +107,32 @@
dlg.exec();
}
+void GMainWindow::showAndHide()
+{
+ QAction *trayShow = (QAction *)sender();
+ this->setVisible(trayShow->isChecked());
+}
+
+void GMainWindow::trayActivated(QSystemTrayIcon::ActivationReason reason)
+{
+ if(reason == QSystemTrayIcon::Trigger)
+ {
+ QSystemTrayIcon *trayIcon = (QSystemTrayIcon *)sender();
+ QMenu *trayMenu = trayIcon->contextMenu();
+ QAction *trayShow = trayMenu->defaultAction();
+ if(trayShow->isChecked())
+ {
+ this->setVisible(false);
+ trayShow->setChecked(false);
+ }
+ else
+ {
+ this->setVisible(true);
+ trayShow->setChecked(true);
+ }
+ }
+}
+
void GMainWindow::addApplication(QWidget *wnd, const QIcon &icon, const
QString &label)
{
tabWidget->addTab(wnd, icon, label);
Modified: gnunet-qt/src/core/wndMain.h
===================================================================
--- gnunet-qt/src/core/wndMain.h 2008-06-20 14:31:56 UTC (rev 7284)
+++ gnunet-qt/src/core/wndMain.h 2008-06-20 14:56:40 UTC (rev 7285)
@@ -30,6 +30,7 @@
#include <QWidget>
#include <QMainWindow>
#include <QLabel>
+#include <QSystemTrayIcon>
#include "ui_wndMain.h"
#include "aboutDlg.h"
@@ -44,6 +45,7 @@
public:
QLabel statusIcon, statusText, networkIcon, networkText;
+ QSystemTrayIcon *trayIcon;
protected:
virtual bool event(QEvent *event);
public slots:
@@ -52,6 +54,8 @@
protected slots:
void contextHelp();
void about();
+ void showAndHide();
+ void trayActivated(QSystemTrayIcon::ActivationReason reason);
};
#endif /*WNDMAIN_H_*/
Modified: gnunet-qt/src/plugins/about/about.cc
===================================================================
--- gnunet-qt/src/plugins/about/about.cc 2008-06-20 14:31:56 UTC (rev
7284)
+++ gnunet-qt/src/plugins/about/about.cc 2008-06-20 14:56:40 UTC (rev
7285)
@@ -166,7 +166,7 @@
"<ul>"
"<li>Christian Grothoff</li>"
"<li>Nils Durner</li>"
- "<li>Milan Nali</li>"
+ "<li>Milan Bouchet-Valat</li>"
"<li>Michael John Wensley</li>"
"</ul>"
"</td>"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7285 - in gnunet-qt: pixmaps src/core src/plugins/about,
gnunet <=