Esempio n. 1
0
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();
}	
Esempio n. 2
0
void Window::setupTrayIcon() {
	if (!trayIcon) {
		if (trayIcon) trayIcon->deleteLater();
		trayIcon = new QSystemTrayIcon(this);
#ifdef Q_OS_MAC
		QIcon icon(QPixmap::fromImage(psTrayIcon()));
		icon.addPixmap(QPixmap::fromImage(psTrayIcon(true)), QIcon::Selected);
#else
		QIcon icon(QPixmap::fromImage(iconLarge()));
#endif

		trayIcon->setIcon(icon);
		trayIcon->setToolTip(QString::fromStdWString(AppName));
		connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection);
		if (cPlatform() != dbipMac) {
			connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray()));
		}
		updateTrayMenu();
	}
	psUpdateCounter();

	trayIcon->show();
	psUpdateDelegate();
}
Esempio n. 3
0
void PsMainWindow::psSetupTrayIcon() {
    if (!trayIcon) {
        trayIcon = new QSystemTrayIcon(this);

        QIcon icon(QPixmap::fromImage(psTrayIcon(), Qt::ColorOnly));
        icon.addPixmap(QPixmap::fromImage(psTrayIcon(true), Qt::ColorOnly), QIcon::Selected);

        trayIcon->setIcon(icon);
        trayIcon->setToolTip(QString::fromStdWString(AppName));
        connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection);
        App::wnd()->updateTrayMenu();
    }
    psUpdateCounter();

    trayIcon->show();
}
Esempio n. 4
0
void PsMainWindow::psSetupTrayIcon() {
    if (noQtTrayIcon) {
        if (!cSupportTray()) return;
        psUpdateCounter();
    } else {
        if (!trayIcon) {
            trayIcon = new QSystemTrayIcon(this);

            QIcon icon(QPixmap::fromImage(App::wnd()->iconLarge(), Qt::ColorOnly));

            trayIcon->setIcon(icon);
            trayIcon->setToolTip(QString::fromStdWString(AppName));
            connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection);
            connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray()));
            App::wnd()->updateTrayMenu();
        }
        psUpdateCounter();

        trayIcon->show();
        psUpdateDelegate();
    }
}