moved trayicon to own void function

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1846 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-11-24 20:17:13 +00:00
parent 10bc8e7a67
commit d7a052720a
2 changed files with 25 additions and 27 deletions

View File

@ -266,17 +266,31 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
/* Create the actions that will go in the tray menu */ /* Create the actions that will go in the tray menu */
createActions(); createActions();
/* Creates a tray icon with a context menu and adds it to the system's * notification area. */
createTrayIcon();
/****** QTimer *timer = new QTimer(this);
* This is an annoying warning I get all the time... timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
* (no help!) timer->start(1000);
* }
*
if (!QSystemTrayIcon::isSystemTrayAvailable())
QMessageBox::warning(0, tr("System tray is unavailable"),
tr("System tray unavailable"));
******/
/** Destructor. */
MainWindow::~MainWindow()
{
delete _bandwidthGraph;
delete _messengerwindowAct;
delete peerstatus;
delete dhtstatus;
delete natstatus;
delete ratesstatus;
delete _settings;
delete applicationWindow;
}
/** Creates a tray icon with a context menu and adds it to the system
* notification area. */
void MainWindow::createTrayIcon()
{
/** Tray icon Menu **/ /** Tray icon Menu **/
menu = new QMenu(this); menu = new QMenu(this);
QObject::connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); QObject::connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
@ -309,26 +323,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this,
SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason))); SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason)));
trayIcon->show(); trayIcon->show();
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000);
} }
/** Destructor. */
MainWindow::~MainWindow()
{
delete _bandwidthGraph;
delete _messengerwindowAct;
delete peerstatus;
delete dhtstatus;
delete natstatus;
delete ratesstatus;
delete _settings;
delete applicationWindow;
}
void MainWindow::displaySystrayMsg(const QString& title,const QString& msg) void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
{ {
trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, 3000); trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, 3000);

View File

@ -142,6 +142,8 @@ private:
/** Create the actions on the tray menu or menubar */ /** Create the actions on the tray menu or menubar */
void createActions(); void createActions();
void createTrayIcon();
/** Defines the actions for the tray menu */ /** Defines the actions for the tray menu */
QAction* _settingsAct; QAction* _settingsAct;
QAction* _bandwidthAct; QAction* _bandwidthAct;