int MainWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: on_btnPause_clicked(); break; case 1: on_btnPlayPause_clicked(); break; case 2: on_btnSaveConfiguration_clicked(); break; case 3: on_sbHours_valueChanged((*reinterpret_cast< double(*)>(_a[1]))); break; case 4: on_sbHours_editingFinished(); break; case 5: on_cmbCompanies_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 6: on_cmbProjects_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 7: on_btnSave_clicked(); break; case 8: trayIconClicked((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break; case 9: gotProjects((*reinterpret_cast< QList<Project>(*)>(_a[1]))); break; case 10: gotPerson((*reinterpret_cast< Person(*)>(_a[1]))); break; case 11: updateTime(); break; default: ; } _id -= 12; } return _id; }
statusicon::statusicon() { connect( &m_trayIcon,SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), this,SLOT( trayIconClicked(QSystemTrayIcon::ActivationReason ) ) ) ; m_trayIcon.setContextMenu( &m_menu ) ; }
void tpMainWindow::createTrayIcon() { trayIconMenu = new QMenu(this); trayIconMenu->addAction(open); trayIconMenu->addSeparator(); trayIconMenu->addAction(close); trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayIconMenu); connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason))); }
void MainDialog::createTrayIcon() { trayIcon = new QSystemTrayIcon(this); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason)) ); }
void MainWindow::createTrayActions() { minimizeAction = new QAction(tr("Hide"), this); connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide())); restoreAction = new QAction(tr("Show"), this); connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal())); quitAction = new QAction(tr("Quit"), this); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(this, SIGNAL(trayIconClicked()), this, SLOT(showNormal())); }
QtTrayBackend::QtTrayBackend(MainWindow* parent): QObject(parent), TrayIconInterface(), m_mainWindow(parent), m_trayicon(new QSystemTrayIcon(this)) { m_trayicon->setIcon(QIcon::fromTheme("hotot_qt-inactive", QIcon("share/hotot/image/ic24_hotot_mono_dark.svg"))); m_trayicon->show(); connect(m_trayicon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason))); connect(m_trayicon, SIGNAL(messageClicked()), this, SLOT(messageClicked())); }
QtTrayBackend::QtTrayBackend(MainWindow* parent): QObject(parent), TrayIconInterface(), m_mainWindow(parent), m_trayicon(new QSystemTrayIcon(this)) { m_trayicon->setIcon(QIcon::fromTheme("twuner", QIcon("share/twuner/image/ic64_twuner.png"))); m_trayicon->show(); connect(m_trayicon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason))); connect(m_trayicon, SIGNAL(messageClicked()), this, SLOT(messageClicked())); }
void LeapMediaController::createTrayIcon() { trayIconMenu = new QMenu(this); trayIconMenu->addAction(open); trayIconMenu->addAction(toggleListening); trayIconMenu->addAction(toggleInfoDialog); trayIconMenu->addSeparator(); trayIconMenu->addAction(close); trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayIconMenu); connect( trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason)) ); }
void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) { switch (reason) { case QSystemTrayIcon::Trigger: case QSystemTrayIcon::DoubleClick: qDebug() << "TRAY::DoubleClick"; if(this->isHidden()) { emit trayIconClicked(); } else { this->close(); } break; case QSystemTrayIcon::MiddleClick: qDebug() << "TRAY::MiddleClick"; break; default: ; } }
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); QTextCodec *utfcodec = QTextCodec::codecForName("UTF-8"); //qt4 QTextCodec::setCodecForTr(utfcodec); QTextCodec::setCodecForCStrings(utfcodec); dozvilNaVyhid=0; m_tray_icon = new QSystemTrayIcon(QIcon(":/new/emulator.png"), this); QAction *another_action = new QAction( "Показати/Сховати", m_tray_icon ); another_action->setIcon(QIcon(":/new/emulator.png")); connect( another_action, SIGNAL(triggered()), this, SLOT(showHide()) ); QAction *set_action = new QAction( "Налаштування", m_tray_icon ); set_action->setIcon(QIcon(":/new/sett.png")); connect( set_action, SIGNAL(triggered()), this, SLOT(settigsDialog()) ); QAction *quit_action = new QAction( "Вихід", m_tray_icon ); quit_action->setIcon(QIcon(":/new/exit.png")); connect( quit_action, SIGNAL(triggered()), this, SLOT(dozvilNaclose()) ); QMenu *tray_icon_menu = new QMenu; tray_icon_menu->addAction( another_action ); tray_icon_menu->addAction( set_action ); tray_icon_menu->addAction( quit_action ); m_tray_icon->setContextMenu( tray_icon_menu ); connect( m_tray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason))); m_tray_icon->show(); myThreadTimer.setSingleShot(1); myThreadTimer.setInterval(3000); myUPS=new UPSMonThread(this); connect(myUPS, SIGNAL(vyvidDanyh(QStringList)), this, SLOT(vyvidDanyh(QStringList))); connect(myUPS, SIGNAL(vyvidMess(QString)), this, SLOT(vyvidPovidomlen(QString))); connect(myUPS, SIGNAL(vyvidBattStatus(QString)), this, SLOT(vyvidBattStatus(QString))); connect(myUPS, SIGNAL(terminated()), &myThreadTimer, SLOT(start())); connect(myUPS, SIGNAL(offcomp()), this, SLOT(dozvilNaclose())); connect(&myThreadTimer, SIGNAL(timeout()), this, SLOT(onTimerOut())); loadSett(); myUPS->changeBatAndWaitTime(waitTime, battVal); myThreadTimer.start(); // this->hide(); QTimer::singleShot(0, this, SLOT(showHide())); // connect(this, SIGNAL()) }
bool Application::pxAppInit() { QLocalSocket socket; socket.connectToServer(APP_NAME); if (socket.waitForConnected(500)) { qDebug() << "Application allready launched!"; return false; } _localServer = new QLocalServer(this); if (!_localServer->listen(APP_NAME)) { QLocalServer::removeServer(APP_NAME); _localServer->listen(APP_NAME); } QString homePath = QDir::homePath(); QString settingsFile = homePath + "/" + SETTINGS_FILE; _settings = new QSettings(settingsFile, QSettings::IniFormat, this); initLanguages(); _configWidget = new ConfigWidget(_settings, _languages); QObject::connect(_configWidget, SIGNAL(settingsChanged()), this, SLOT(setupHotkeys())); _configWidget->init(); //_shortcutScreenFull = new QxtGlobalShortcut; //_shortcutScreenPart = new QxtGlobalShortcut; //_shortcutTextShare = new QxtGlobalShortcut; connectDisconectHotkeys(true); connect(_configWidget, SIGNAL(showSignal(bool)), this, SLOT(connectDisconectHotkeys(bool))); _trayIconMenu = new QMenu; _trayIconMenu->addAction(tr("About"), this, SLOT(aboutDialog())); _trayIconMenu->addAction("", this, SLOT(processCodeShare())); _trayIconMenu->addAction("", this, SLOT(processScreenshotFull())); _trayIconMenu->addAction("", this, SLOT(processScreenshotPart())); _trayIconMenu->addAction(tr("Configure"), _configWidget, SLOT(show())); _trayIconMenu->addSeparator(); _trayIconMenu->addAction(tr("Exit"), this, SLOT(quit())); // Tray menu setupHotkeys(); _trayIcon = new QSystemTrayIcon(QIcon(":/icons/icon.png"), this); connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason))); _trayIcon->setContextMenu(_trayIconMenu); // Tray icon _network = new Network(_settings, this); connect(_network, SIGNAL(linkReceived(QString)), SLOT(linkAvaliable(QString))); // Network this->setQuitOnLastWindowClosed(false); _trayIcon->show(); QFile file(settingsFile); if (!file.exists()) _configWidget->show(); return true; }
void WebWidget::createTrayIcon(QString icon){ if(trayIcon == 0){ trayIcon = new QSystemTrayIcon(this); trayIconMenu = new QMenu(this); trayIcon->setIcon(QIcon(icon)); trayIcon->setContextMenu(trayIconMenu); trayIcon->show(); QObject::connect(trayIconMenu, SIGNAL(triggered(QAction*)), this, SLOT(trayIconMenuClicked(QAction*))); QObject::connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason))); }
MainWindow::MainWindow(Eros *eros, QWidget *parent ) : QMainWindow(parent) { QFontDatabase::addApplicationFont(":/font/NotoSans-Regular"); QFontDatabase::addApplicationFont(":/font/NotoSans-Bold"); QFontDatabase::addApplicationFont(":/font/NotoSans-Italic"); QFontDatabase::addApplicationFont(":/font/NotoSans-BoldItalic"); QFontDatabase::addApplicationFont(":/font/Gobold"); QFontDatabase::addApplicationFont(":/font/Gobold-bold"); QFontDatabase::addApplicationFont(":/font/Gobold-thin"); QFile version(":/data/version_info"); if(!version.open(QIODevice::ReadOnly)) { this->local_version_ = 1; } else { QByteArray data = version.readAll(); QStringList tokens = QString::fromUtf8(data).split('|'); this->local_version_ = tokens[0].toInt(); version.close(); } ui.setupUi(this); ui.centralWidget->setMouseTracking(true); this->setWindowTitle(tr("Alpha Version %1").arg(this->local_version_)); setUiEnabled(false); this->eros_ = eros; this->config_ = new Config(this); this->connection_timer_ = new QTimer(this); this->matchmaking_timer_ = new QTimer(this); this->matchmaking_timer_->setInterval(500); this->matchmaking_start_ = new QTime(); this->matchmaking_result_time_ = new QTime(); this->long_process_start_time_ = new QTime(); this->watcher_ = new DirectoryWatcher(this); this->watches_ = QList<DirectoryWatch*>(); this->update_checker_nam_ = new QNetworkAccessManager(this); this->update_timer_ = new QTimer(this); this->long_process_timer_ = new QTimer(this); this->tray_icon_ = new QSystemTrayIcon(this); this->tray_icon_menu_ = new QMenu(this); this->preview_loader_nam_ = new QNetworkAccessManager(this); this->preview_cache_ = QMap<QString, QPixmap*>(); this->upload_queue_ = QMap<QString, QTime*>(); this->upload_queue_timer_ = new QTimer(this); tray_icon_action_show_ = new QAction("Hide Eros", this); tray_icon_action_close_ = new QAction("Close Eros", this); QObject::connect(tray_icon_action_show_, SIGNAL(triggered()), this, SLOT(toggleWindow())); QObject::connect(tray_icon_action_close_, SIGNAL(triggered()), qApp, SLOT(quit())); QObject::connect(this->tray_icon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason))); this->tray_icon_->setIcon(QIcon(":/img/client/icons/icon_32x32")); this->tray_icon_menu_->addAction(tray_icon_action_show_); this->tray_icon_menu_->addAction(tray_icon_action_close_); this->tray_icon_->setContextMenu(this->tray_icon_menu_); #if !defined(Q_OS_MAC) title_bar_ = ErosTitleBar::addToLayout(this, ui.verticalLayout); title_bar_->setMenu(this->tray_icon_menu_); #endif // File watcher QObject::connect(this->watcher_, SIGNAL(added(const QString &, const QString &)), this, SLOT(fileAdded(const QString &, const QString&))); // Update checker QObject::connect(update_checker_nam_, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateCheckerFinished(QNetworkReply*))); QObject::connect(this->update_timer_, SIGNAL(timeout()), this, SLOT(updateCheckerTimerWorker())); //Preview loader QObject::connect(preview_loader_nam_, SIGNAL(finished(QNetworkReply*)), this, SLOT(previewDownloadFinished(QNetworkReply*))); // Set up Eros signals /// Eros Signals QObject::connect(eros_, SIGNAL(stateChanged(ErosState)), this, SLOT(erosStateChanged(ErosState))); QObject::connect(eros_, SIGNAL(connectionError(QAbstractSocket::SocketError, const QString)), this, SLOT(erosConnectionError(QAbstractSocket::SocketError, const QString))); QObject::connect(eros_, SIGNAL(connected()), this, SLOT(erosConnected())); QObject::connect(eros_, SIGNAL(disconnected()), this, SLOT(erosDisconnected())); QObject::connect(eros_, SIGNAL(authenticationFailed()), this, SLOT(erosAuthenticationFailed())); QObject::connect(eros_, SIGNAL(alreadyLoggedIn()), this, SLOT(erosAlreadyLoggedIn())); QObject::connect(eros_, SIGNAL(broadcastAlert(const QString, int)), this, SLOT(erosBroadcastAlert(const QString, int))); QObject::connect(eros_, SIGNAL(chatRoomAdded(ChatRoom*)), this, SLOT(erosChatRoomAdded(ChatRoom*))); QObject::connect(eros_, SIGNAL(chatRoomRemoved(ChatRoom*)), this, SLOT(erosChatRoomRemoved(ChatRoom*))); QObject::connect(eros_, SIGNAL(chatRoomJoined(ChatRoom*)), this, SLOT(erosChatRoomJoined(ChatRoom*))); QObject::connect(eros_, SIGNAL(chatRoomLeft(ChatRoom*)), this, SLOT(erosChatRoomLeft(ChatRoom*))); QObject::connect(eros_, SIGNAL(chatMessageReceieved(User*, const QString)), this, SLOT(erosChatMessageReceieved(User*, const QString))); QObject::connect(eros_, SIGNAL(localUserUpdated(LocalUser*)), this, SLOT(erosLocalUserUpdated(LocalUser*))); QObject::connect(eros_, SIGNAL(matchmakingStateChanged(ErosMatchmakingState)), this, SLOT(erosMatchmakingStateChanged(ErosMatchmakingState))); QObject::connect(eros_, SIGNAL(matchmakingMatchFound(MatchmakingMatch *)), this, SLOT(erosMatchmakingMatchFound(MatchmakingMatch *))); //QObject::connect(eros_, SIGNAL(regionStatsUpdated(ErosRegion, int)), this, SLOT(erosRegionStatsUpdated(ErosRegion, int))); QObject::connect(eros_, SIGNAL(statsUpdated(int, int)), this, SLOT(erosStatsUpdated(int, int))); QObject::connect(eros_, SIGNAL(replayUploadError(ErosError)), this, SLOT(erosReplayUploadError(ErosError))); QObject::connect(eros_, SIGNAL(replayUploaded()), this, SLOT(erosReplayUploaded())); QObject::connect(eros_, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(erosUploadProgress(qint64, qint64))); QObject::connect(eros_, SIGNAL(longProcessStateChanged(ErosLongProcessState)), this, SLOT(erosLongProcessStateChanged(ErosLongProcessState))); QObject::connect(eros_, SIGNAL(drawRequested()), this, SLOT(erosDrawRequested())); QObject::connect(eros_, SIGNAL(drawRequestFailed()), this, SLOT(erosDrawRequestFailed())); QObject::connect(eros_, SIGNAL(noShowRequested()), this, SLOT(erosNoShowRequested())); QObject::connect(eros_, SIGNAL(noShowRequestFailed()), this, SLOT(erosNoShowRequestFailed())); QObject::connect(eros_, SIGNAL(acknowledgeLongProcessFailed()), this, SLOT(erosAcknowledgeLongProcessFailed())); QObject::connect(eros_, SIGNAL(acknowledgedLongProcess()), this, SLOT(erosAcknowledgedLongProcess())); QObject::connect(eros_, SIGNAL(vetoesUpdated()), this, SLOT(erosVetoesUpdated())); QObject::connect(eros_, SIGNAL(toggleVetoFailed(Map*,ErosError)), this, SLOT(erosToggleVetoFailed(Map*,ErosError))); /// Eros Slots QObject::connect(this, SIGNAL(connectToEros(const QString, const QString, const QString)), eros_, SLOT(connectToEros(const QString, const QString, const QString))); QObject::connect(this, SIGNAL(disconnectFromEros()), eros_, SLOT(disconnectFromEros())); QObject::connect(ui.btnRefreshChats, SIGNAL(clicked()), eros_, SLOT(refreshChatRooms())); QObject::connect(this, SIGNAL(joinChatRoom(ChatRoom *, const QString)), eros_, SLOT(joinChatRoom(ChatRoom *, const QString))); QObject::connect(this, SIGNAL(leaveChatRoom(ChatRoom *)), eros_, SLOT(leaveChatRoom(ChatRoom *))); QObject::connect(this, SIGNAL(queueMatchmaking(ErosRegion, int)), eros_, SLOT(queueMatchmaking(ErosRegion, int))); QObject::connect(this, SIGNAL(queueMatchmaking(ErosRegionList, int)), eros_, SLOT(queueMatchmaking(ErosRegionList, int))); QObject::connect(this, SIGNAL(dequeueMatchmaking()), eros_, SLOT(dequeueMatchmaking())); QObject::connect(this, SIGNAL(forfeitMatchmaking()), eros_, SLOT(forfeitMatchmaking())); QObject::connect(this, SIGNAL(uploadReplay(QIODevice*)), eros_, SLOT(uploadReplay(QIODevice*))); QObject::connect(this, SIGNAL(uploadReplay(const QString)), eros_, SLOT(uploadReplay(const QString))); QObject::connect(this, SIGNAL(requestDraw()), eros_, SLOT(requestDraw())); QObject::connect(this, SIGNAL(requestNoShow()), eros_, SLOT(requestNoShow())); QObject::connect(this, SIGNAL(acknowledgeLongProcess(bool)), eros_, SLOT(acknowledgeLongProcess(bool))); QObject::connect(this, SIGNAL(toggleVeto(Map*)), eros_, SLOT(toggleVeto(Map*))); // timers QObject::connect(this->connection_timer_, SIGNAL(timeout()), this, SLOT(connectionTimerWorker())); QObject::connect(this->matchmaking_timer_, SIGNAL(timeout()), this, SLOT(matchmakingTimerWorker())); QObject::connect(this->long_process_timer_, SIGNAL(timeout()), this, SLOT(longProcessTimerWorker())); QObject::connect(this->upload_queue_timer_, SIGNAL(timeout()), this, SLOT(uploadTimerWorker())); this->long_process_timer_->setInterval(250); // UI Stuff settings_window_ = nullptr; bnetsettings_window_ = nullptr; // Remove the close box from the first 2 tabs. // On mac it's LeftSide. Assuming RightSide causes a nullptr. for (int i = 0; i < 3; i++) { QWidget *tab = ui.tabContainer->tabBar()->tabButton(i, QTabBar::RightSide); if (tab != nullptr) tab->resize(0, 0); tab = ui.tabContainer->tabBar()->tabButton(i, QTabBar::LeftSide); if (tab != nullptr) tab->resize(0, 0); } ui.tabContainer->tabBar()->setUsesScrollButtons(true); QObject::connect(ui.tabContainer, SIGNAL(tabCloseRequested(int)), this, SLOT(tabContainer_tabCloseRequested(int))); QObject::connect(ui.tabContainer, SIGNAL(currentChanged(int)), this, SLOT(tabContainer_currentChanged(int))); QObject::connect(ui.lblBottomMenu, SIGNAL(linkActivated(const QString &)), this, SLOT(label_linkActivated(const QString&))); QObject::connect(ui.btnJoinRoom, SIGNAL(clicked()), this, SLOT(btnJoinRoom_pressed())); QObject::connect(ui.lstChats, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(lstChats_currentItemChanged(QListWidgetItem *, QListWidgetItem *))); QObject::connect(ui.lstChats, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(lstChats_itemDoubleClicked(QListWidgetItem*))); QObject::connect(ui.cmbRegion, SIGNAL(currentIndexChanged(int)), this, SLOT(cmbRegion_currentIndexChanged(int))); QObject::connect(ui.cmbMapRegion, SIGNAL(currentIndexChanged(int)), this, SLOT(cmbMapRegion_currentIndexChanged(int))); QObject::connect(ui.btnQueue, SIGNAL(clicked()), this, SLOT(btnQueue_pressed())); QObject::connect(ui.btnDraw, SIGNAL(clicked()), this, SLOT(btnDraw_pressed())); QObject::connect(ui.btnNoShow, SIGNAL(clicked()), this, SLOT(btnNoShow_pressed())); QObject::connect(ui.lstMaps, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(lstMaps_currentItemChanged(QListWidgetItem *, QListWidgetItem *))); QObject::connect(ui.btnToggleVeto, SIGNAL(clicked()), this, SLOT(btnToggleVeto_clicked())); QObject::connect(ui.chkQueueRegion, SIGNAL(stateChanged(int)), this, SLOT(chkQueueRegion_stateChanged(int))); #if !defined(Q_OS_MAC) this->tray_icon_->show(); #endif // The user should be prevented from emptying invalid values in the settings dialog. if (this->config_->profiles().count() == 0) { QMessageBox::information(this, "Eros", tr("Welcome to Eros! You need to configure some settings in order to continue. The settings window will now open.")); openSettings(); } else { this->connection_timer_->setInterval(500); this->connection_timer_->start(); } QTimer::singleShot(0, this, SLOT(updateCheckerTimerWorker())); this->update_timer_->setInterval(1000 * 60 * 10); this->update_timer_->start(); notification_sound_ = new QSound(":/sound/notification", this); }