You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
49 lines
1.4 KiB
14 years ago
|
#include "include/systemtray.h"
|
||
14 years ago
|
|
||
|
#include <QApplication>
|
||
|
|
||
|
void SystemTray::setup()
|
||
|
{
|
||
|
m_systemTrayIcon = new QSystemTrayIcon(0);
|
||
|
|
||
|
m_minimizeAction = new QAction(tr("Mi&nimize"), m_systemTrayIcon);
|
||
14 years ago
|
connect(m_minimizeAction, SIGNAL(triggered()), m_mainWindow,
|
||
|
SLOT(hide()));
|
||
14 years ago
|
|
||
|
m_maximizeAction = new QAction(tr("Ma&ximize"), m_systemTrayIcon);
|
||
14 years ago
|
connect(m_maximizeAction, SIGNAL(triggered()), m_mainWindow,
|
||
|
SLOT(showMaximized()));
|
||
14 years ago
|
|
||
|
m_restoreAction = new QAction(tr("&Restore"), m_systemTrayIcon);
|
||
14 years ago
|
connect(m_restoreAction, SIGNAL(triggered()), m_mainWindow,
|
||
|
SLOT(showNormal()));
|
||
14 years ago
|
|
||
|
m_quitAction = new QAction(tr("&Quit"), m_systemTrayIcon);
|
||
14 years ago
|
connect(m_quitAction, SIGNAL(triggered()), qApp,
|
||
|
SLOT(quit()));
|
||
14 years ago
|
|
||
|
m_trayIconMenu = new QMenu(this);
|
||
|
m_trayIconMenu->addAction(m_minimizeAction);
|
||
|
m_trayIconMenu->addAction(m_maximizeAction);
|
||
|
m_trayIconMenu->addAction(m_restoreAction);
|
||
|
m_trayIconMenu->addSeparator();
|
||
|
m_trayIconMenu->addAction(m_quitAction);
|
||
|
|
||
|
m_systemTrayIcon->setContextMenu(m_trayIconMenu);
|
||
|
|
||
14 years ago
|
m_icon = new QIcon(":/qtmindmap.svg");
|
||
|
m_systemTrayIcon->setIcon(QIcon(":/qtmindmap.svg"));
|
||
14 years ago
|
}
|
||
|
|
||
|
SystemTray::SystemTray(MainWindow *mainWindow, QWidget *parent) :
|
||
|
QWidget(parent),
|
||
|
m_mainWindow(mainWindow)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
void SystemTray::show()
|
||
|
{
|
||
|
m_systemTrayIcon->show();
|
||
|
}
|