void Window::firstShow() { #ifdef Q_OS_WIN trayIconMenu = new ContextMenu(this); #else trayIconMenu = new QMenu(this); trayIconMenu->setFont(QFont("Tahoma")); #endif if (cPlatform() == dbipWindows || cPlatform() == dbipMac) { trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true); trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true); } else { trayIconMenu->addAction(lang(lng_open_from_tray), this, SLOT(showFromTray()))->setEnabled(true); trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true); trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true); } psFirstShow(); updateTrayMenu(); }
void Window::firstShow() { #ifdef Q_OS_WIN trayIconMenu = new ContextMenu(this); #else trayIconMenu = new QMenu(this); trayIconMenu->setFont(QFont("Tahoma")); #endif trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true); trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true); psFirstShow(); updateTrayMenu(); }
void Window::setupTrayIcon() { if (!trayIcon) { if (trayIconMenu) trayIconMenu->deleteLater(); trayIconMenu = new QMenu(this); trayIconMenu->setFont(QFont("Tahoma")); QAction *a; a = trayIconMenu->addAction(lang(lng_open_from_tray), this, SLOT(showFromTray())); a->setEnabled(true); a = trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray())); a->setEnabled(true); if (trayIcon) trayIcon->deleteLater(); trayIcon = new QSystemTrayIcon(this); trayIcon->setIcon(this->windowIcon()); trayIcon->setContextMenu(trayIconMenu); trayIcon->setToolTip(QString::fromStdWString(AppName)); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason))); connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray())); } psUpdateCounter(); trayIcon->show(); }