Пример #1
0
void MainWindow::createConnections()
{
    connect(this, SIGNAL(windowWasShown()), this, SLOT(initUpdates()),
            Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection));

    connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT(currentWidget(QWidget *)));
    connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), _recorder, SLOT(currentWidget(QWidget *)));
    connect(_playlistTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *)));
    connect(_scheduleTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *)));
    connect(_showInfoTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *)));

    connect(ui->actionSupport, SIGNAL(triggered()), this, SLOT(support()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutTano()));
    connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(ui->actionLogoutExit, SIGNAL(triggered()), this, SLOT(exitLogout()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(exit()));

    connect(ui->actionTop, SIGNAL(triggered()), this, SLOT(top()));
    connect(ui->actionLite, SIGNAL(triggered()), this, SLOT(lite()));

    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openPlaylist()));
    connect(ui->actionOpenFile, SIGNAL(triggered()), _mediaPlayer, SLOT(openFile()));
    connect(ui->actionOpenUrl, SIGNAL(triggered()), _mediaPlayer, SLOT(openUrl()));

    connect(ui->actionSchedule, SIGNAL(triggered()), this, SLOT(showSchedule()));
    connect(ui->actionScheduleCurrent, SIGNAL(triggered()), this, SLOT(showScheduleCurrent()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
    connect(ui->actionSettingsShortcuts, SIGNAL(triggered()), this, SLOT(showSettingsShortcuts()));
    connect(ui->actionEditPlaylist, SIGNAL(triggered()), this, SLOT(showPlaylistEditor()));

    connect(ui->actionPlay, SIGNAL(triggered()), _mediaPlayer, SLOT(togglePause()));
    connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(stop()));
    connect(ui->actionPreview, SIGNAL(triggered(bool)), this, SLOT(preview(bool)));

    connect(_playlistTab->playlist(), SIGNAL(itemSelected(Channel *)), this, SLOT(playChannel(Channel *)));
    connect(_previewTimer, SIGNAL(timeout()), ui->actionNext, SLOT(trigger()));

    if (_trayIcon) {
        connect(_trayIcon, SIGNAL(restoreClick()), this, SLOT(tray()));
        connect(ui->actionTray, SIGNAL(triggered()), this, SLOT(tray()));
    }

    connect(ui->actionFullscreen, SIGNAL(triggered(bool)), this, SLOT(toggleFullscreen(bool)));

    connect(ui->actionMute, SIGNAL(toggled(bool)), _mediaPlayer->osd(), SLOT(mute(bool)));
    connect(ui->actionVolumeDown, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeDown()));
    connect(ui->actionVolumeUp, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeUp()));

#if defined(Q_OS_LINUX)
    if (_mediaPlayer->teletextEnabled()) {
        connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer->osd(), SLOT(teletext(bool)));
        connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer, SLOT(teletext(bool)));
        connect(_mediaPlayer->osd(), SIGNAL(teletextClicked()), ui->actionTeletext, SLOT(trigger()));
    }
Пример #2
0
PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent),
posInited(false), trayIcon(0), trayIconMenu(0), icon256(qsl(":/gui/art/icon256.png")), iconbig256(qsl(":/gui/art/iconbig256.png")), wndIcon(QPixmap::fromImage(iconbig256, Qt::ColorOnly)),
psLogout(0), psUndo(0), psRedo(0), psCut(0), psCopy(0), psPaste(0), psDelete(0), psSelectAll(0), psContacts(0), psAddContact(0), psNewGroup(0), psNewChannel(0), psShowTelegram(0) {
	QImage tray(qsl(":/gui/art/osxtray.png"));
	trayImg = tray.copy(0, cRetina() ? 0 : tray.width() / 2, tray.width() / (cRetina() ? 2 : 4), tray.width() / (cRetina() ? 2 : 4));
	trayImgSel = tray.copy(tray.width() / (cRetina() ? 2 : 4), cRetina() ? 0 : tray.width() / 2, tray.width() / (cRetina() ? 2 : 4), tray.width() / (cRetina() ? 2 : 4));
}
Пример #3
0
int main( int argc, char **argv )
{
    QApplication app( argc, argv );

    QMainWindow mw;
    app.setMainWidget( &mw );

    QPopupMenu menu2;
    menu2.insertItem( "Test 2" );
    TrayIcon tray2( QPixmap( (const char**)minimize_xpm ), "Minimize MainWindow", &menu2 );
    QObject::connect(&tray2,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showMinimized()));

    QPopupMenu menu;
    menu.insertItem( "Test 1" );
    menu.insertSeparator();
    menu.insertItem( "&Quit", &app, SLOT(quit()) );
    TrayIcon tray( QPixmap( (const char**)normalize_xpm ), "Show MainWindow", &menu );
    QObject::connect(&tray,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showNormal()));

    TrayIcon tray3( QPixmap( (const char**)maximize_xpm ), "Maximize MainWindow" );
    QObject::connect(&tray3,SIGNAL(clicked(const QPoint&)),&mw,SLOT(showMaximized()));

    mw.show();
    tray.show();
    tray2.show();
    tray3.show();

    return app.exec();
}
Пример #4
0
int main(int argc, char** argv){
    QApplication app(argc, argv);
    app.setOrganizationName("Lorentz83");
    app.setOrganizationDomain("https://github.com/Lorentz83");
    app.setApplicationName("JenkinsTray");
    app.setWindowIcon(QIcon(":/ico/appicon"));

    int waitSystray = -1;
    if ( argc > 1 && QStringLiteral("-w") == argv[1] ) {
        waitSystray = 0;
        if ( argc > 2 ) {
            waitSystray = QString(argv[2]).toInt();
        }
    }

    if (waitSystray >=0) {
        for (int n = 0 ; !QSystemTrayIcon::isSystemTrayAvailable() && ( waitSystray == 0 || n < waitSystray) ; n++) {
            qWarning() << "waiting for system tray";
            QThread::sleep(1);
        }
    }

    if (!QSystemTrayIcon::isSystemTrayAvailable()) {
        QMessageBox::critical(0, QObject::tr("Systray"), QObject::tr("Cannot detect any system tray."));
        return 1;
    }

    QApplication::setQuitOnLastWindowClosed(false);

    Configuration sharedConfig;

    ConfigurationWindow configuration(&sharedConfig);
    TrayIcon tray(&sharedConfig, &configuration);
    Backend backend(&sharedConfig);
    QTimer timer;

    tray.show();
    if ( sharedConfig.firstRun() )
        configuration.show();

    backend.refresh();
    timer.start(sharedConfig.refreshMillisec());

    app.connect(&timer, &QTimer::timeout, &backend, &Backend::refresh);
    app.connect(&tray, &TrayIcon::configure, &configuration, &ConfigurationWindow::show);
    app.connect(&tray, &TrayIcon::refresh, &backend, &Backend::refresh);
    app.connect(&backend, &Backend::statusUpdated, &tray, &TrayIcon::updateStatus);

    app.connect(&configuration, &ConfigurationWindow::accepted, [&](){
        timer.start(sharedConfig.refreshMillisec());
        backend.refresh();
    });

    return app.exec();
}
Пример #5
0
void MainWindow::single()
{
    if (isHidden()) {
        if (_trayIcon)
            tray();
        else
            show();
    }

    raise();
    activateWindow();
}
Пример #6
0
void MainWindow::closeEvent(QCloseEvent *event)
{
    qDebug() << "Event:" << "Close";

#if defined(Q_OS_MAC)
    hide();
    event->ignore();
#else
    if (_hideToTray) {
        tray();
        event->ignore();
    }
#endif
}
Пример #7
0
int main(int argc, char * argv[]) {
	QApplication app(argc, argv);
	RadarIconEngine *eng = new RadarIconEngine();
	QIcon i(eng);
	//QApplication::setWindowIcon(QIcon("/Users/wachs/Pictures/img003.jpg"));

	Radar r;
	r.setVisible(true);
	r.setWindowTitle("teste");

	QSystemTrayIcon tray(QIcon("/Users/wachs/Pictures/img003.jpg"));
	tray.setVisible(true);

	return app.exec();
}
Пример #8
0
int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(icons);

    QApplication a(argc, argv);

    if(!QSystemTrayIcon::isSystemTrayAvailable()) {
        qCritical("No system tray available!\n");
        return 1;
    }

    RFTray tray(QDBusConnection::sessionBus());

    QApplication::setQuitOnLastWindowClosed(false);
    
    return a.exec();
}