Esempio n. 1
0
int main(int argv, char **args)
{
	QApplication app(argv, args);
	app.setApplicationName("Munt mt32emu-qt");
	app.setQuitOnLastWindowClosed(false);

	QProcessEnvironment::systemEnvironment().insert("PA_ALSA_PLUGHW", "1");

	Master *master = Master::getInstance();
	QSystemTrayIcon *trayIcon = NULL;
	if (QSystemTrayIcon::isSystemTrayAvailable()) {
		trayIcon = new QSystemTrayIcon(QIcon(":/images/note.gif"));
		trayIcon->setToolTip("Munt: MT-32 Emulator");
		trayIcon->show();
		master->setTrayIcon(trayIcon);
	}
	MainWindow mainWindow(master);
	if (trayIcon == NULL || !master->getSettings()->value("Master/startIconized", "0").toBool()) mainWindow.show();
	master->startPinnedSynthRoute();
	master->startMidiProcessing();
	master->processCommandLine(app.arguments());
	app.exec();
	master->setTrayIcon(NULL);
	delete trayIcon;
	return 0;
}
Esempio n. 2
0
// Testing get/set functions
void tst_QSystemTrayIcon::getSetCheck()
{
    QSystemTrayIcon icon;
    QCOMPARE(true, icon.toolTip().isEmpty());
    icon.setToolTip("testToolTip");
    QCOMPARE(true, "testToolTip" == icon.toolTip());

    QCOMPARE(true, icon.icon().isNull());
    icon.setIcon(QIcon("icons/icon.png"));
    QCOMPARE(false, icon.icon().isNull());

    QMenu menu;
    QCOMPARE(true, icon.contextMenu() == 0);
    icon.setContextMenu(&menu);
    QCOMPARE(false, icon.contextMenu() == 0);
}
Esempio n. 3
0
int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    KAboutData about("kdeconnect-cli",
                     i18n("KDE Connect Indicator"),
                     QStringLiteral(KDECONNECT_VERSION_STRING),
                     i18n("KDE Connect Indicator tool"),
                     KAboutLicense::GPL,
                     i18n("(C) 2016 Aleix Pol Gonzalez"));
    KAboutData::setApplicationData(about);

    DevicesModel model;
    model.setDisplayFilter(DevicesModel::Reachable | DevicesModel::Paired);

    QMenu menu;
    auto configure = menu.addAction(i18n("Configure..."));
    QObject::connect(configure, &QAction::triggered, configure, [](){
        QProcess::startDetached("kcmshell5", {"kdeconnect"});
    });

    QSystemTrayIcon systray;
    systray.setIcon(QIcon::fromTheme("kdeconnect"));
    systray.setContextMenu(&menu);
    systray.setVisible(true);

    QObject::connect(&model, &DevicesModel::rowsInserted, &model, [&menu, &model](const QModelIndex& /*parent*/, int first, int last) {
        for (int i=first; i<=last; ++i) {
            DeviceDbusInterface* device = model.getDevice(i);
            auto indicator = new DeviceIndicator(device);
            QObject::connect(device, &DeviceDbusInterface::destroyed, indicator, &QObject::deleteLater);

            menu.addMenu(indicator);
        }
    });

    QObject::connect(&model, &DevicesModel::rowsChanged, &model, [&systray, &model]() {
        systray.setToolTip(i18np("%1 device connected", "%1 devices connected", model.rowCount()));
    });

    return app.exec();
}
ADM_qtray::ADM_qtray(const void* parent) : ADM_tray(parent)
{
	_parent = parent;
	lastIcon = 0;
	maxIcons = 12;

	pixmap = new QIcon[maxIcons];
	pixmap[0] = QIcon(QPixmap(xpm_film1));
	pixmap[1] = QIcon(QPixmap(xpm_film3));
	pixmap[2] = QIcon(QPixmap(xpm_film5));
	pixmap[3] = QIcon(QPixmap(xpm_film7));
	pixmap[4] = QIcon(QPixmap(xpm_film9));
	pixmap[5] = QIcon(QPixmap(xpm_film11));
	pixmap[6] = QIcon(QPixmap(xpm_film13));
	pixmap[7] = QIcon(QPixmap(xpm_film15));
	pixmap[8] = QIcon(QPixmap(xpm_film17));
	pixmap[9] = QIcon(QPixmap(xpm_film19));
	pixmap[10] = QIcon(QPixmap(xpm_film21));
	pixmap[11] = QIcon(QPixmap(xpm_film23));

	signalReceiver = new ADM_qtray_signalReceiver();
	signalReceiver->parent = (QDialog*)parent;
	QSystemTrayIcon* trayIcon = new QSystemTrayIcon(pixmap[0], (QObject*)parent);

	sys = trayIcon;

	trayIcon->setToolTip("Avidemux");

	openAction = new QAction(QT_TR_NOOP("Open Avidemux"), (QObject*)parent);
	QObject::connect(openAction, SIGNAL(triggered()), signalReceiver, SLOT(restore()));
	QObject::connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), signalReceiver, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

	trayIconMenu = new QMenu((QWidget*)parent);
	trayIconMenu->addAction(openAction);

	trayIcon->setContextMenu(trayIconMenu);
	trayIcon->show();
}
Esempio n. 5
0
File: main.cpp Progetto: realnc/munt
int main(int argv, char **args) {
	QApplication app(argv, args);
	app.setApplicationName("Munt mt32emu-qt");
	app.setQuitOnLastWindowClosed(false);
	{
		Master master;
		QSystemTrayIcon *trayIcon = NULL;
		if (QSystemTrayIcon::isSystemTrayAvailable()) {
			trayIcon = new QSystemTrayIcon(QIcon(":/images/note.gif"));
			trayIcon->setToolTip("Munt: MT-32 Emulator");
			trayIcon->show();
			master.setTrayIcon(trayIcon);
		}
		MainWindow mainWindow(&master);
		if (trayIcon == NULL || !master.getSettings()->value("Master/startIconized", false).toBool()) mainWindow.show();
		if (argv > 1) master.processCommandLine(app.arguments());
		master.startPinnedSynthRoute();
		master.startMidiProcessing();
		app.exec();
		master.setTrayIcon(NULL);
		delete trayIcon;
	}
	return 0;
}
Esempio n. 6
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    const QString app_name("timecop");
    const QString app_version("1.1");
    const QString app_settings_dir(QDir::home().filePath(".timecop"));

    app.setOrganizationName("Daimler AG RD-DDA");
    app.setApplicationName(app_name);

    QSettings::setDefaultFormat(QSettings::IniFormat);
    QSettings::setPath(QSettings::IniFormat,
                       QSettings::UserScope,
                       app_settings_dir);

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    QObject *root = 0;
    QWidget *rootWindow = 0;
    SystrayHelper systrayHelper;
    engine.rootContext()->setContextProperty("systrayHelper", &systrayHelper);

    engine.rootContext()->setContextProperty("app_name",  app_name);
    engine.rootContext()->setContextProperty("app_version",  app_version);
    engine.rootContext()->setContextProperty("app_settings_dir",  app_settings_dir);


    if (engine.rootObjects().size() > 0)
    {
        root = engine.rootObjects().at(0);
        systrayHelper.setRootWindow(root);
        if(root->isWindowType()){
            rootWindow = qobject_cast<QWidget*>(root);

            QApplication::setQuitOnLastWindowClosed(false);

            QAction *minimizeAction = new QAction(QObject::tr("Mi&nimize"), rootWindow);
            rootWindow->connect(minimizeAction, SIGNAL(triggered()), root, SLOT(hide()));
            QAction *maximizeAction = new QAction(QObject::tr("Ma&ximize"), rootWindow);
            rootWindow->connect(maximizeAction, SIGNAL(triggered()), root, SLOT(showMaximized()));
            QAction *restoreAction = new QAction(QObject::tr("&Restore"), rootWindow);
            rootWindow->connect(restoreAction, SIGNAL(triggered()), root, SLOT(showNormal()));
            QAction *quitAction = new QAction(QObject::tr("&Quit"), rootWindow);
            rootWindow->connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

            QMenu *trayIconMenu = new QMenu(rootWindow);
            trayIconMenu->addAction(minimizeAction);
            trayIconMenu->addAction(maximizeAction);
            trayIconMenu->addAction(restoreAction);
            trayIconMenu->addSeparator();
            trayIconMenu->addAction(quitAction);

            QSystemTrayIcon *trayIcon = new QSystemTrayIcon(rootWindow);
            QIcon icon(":/trayicon.png");
            icon.setIsMask(true);
            //trayIcon->setContextMenu(trayIconMenu);
            trayIcon->setIcon(icon);
            trayIcon->setToolTip("Click to open");
            trayIcon->setVisible(true);
            systrayHelper.setTrayIcon(trayIcon);
            QObject::connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), &systrayHelper, SLOT(activatedSystray(QSystemTrayIcon::ActivationReason)));

            trayIcon->show();
        }

    }

    return app.exec();
}
Esempio n. 7
0
	inline void CNotificationManager::updateDeviceIcon(CUIDevice * uiDevice) {
		QSystemTrayIcon * trayIcon = m_UIDeviceIcons[uiDevice];
		trayIcon->setToolTip(shortSummary(uiDevice->device()));
		trayIcon->setIcon(QIcon(iconFile(uiDevice->device())));
	}