void ApplicationCore::slotHandleUniqueApplicationConnection() { QLocalSocket *socket = m_uniqueApplicationServer.nextPendingConnection(); connect(socket, &QLocalSocket::readyRead, socket, [this, socket](){ if (!socket->canReadLine()) return; while (socket->canReadLine()) { const QByteArray data = socket->readLine().trimmed(); if (data.startsWith(StartTaskCommand)) { bool ok = true; const TaskId id = data.mid(StartTaskCommand.length()).toInt(&ok); if (ok) { m_timeTracker.slotStartEvent(id); } else { qWarning() << "Received invalid argument:" << data; } } else if (data.startsWith(RaiseWindowCommand)) { // nothing to do, see below } } socket->deleteLater(); showMainWindow(ApplicationCore::ShowMode::ShowAndRaise); }); }
void ClientApplication::start() { if (!parseCommandLine()) { QMessageBox::critical(NULL, applicationName(), trUtf8("Error in the command line arguments. Arguments:\n--host <h>\tConnect to the server on host <h>.\n--local\tRun client locally.\n--port <p>\tUse port <p> to connect to the server.")); quit(); return; } if (mode == mUnspecified) { ConnectDialog connectDialog; int code = connectDialog.exec(); if (code == QDialog::Rejected) { quit(); return; } if (connectDialog.local()) { mode = mLocal; } else { mode = mRemote; host = connectDialog.host(); port = connectDialog.port(); } } if (mode == mLocal) { theTrainer.reset(new Trainer()); showMainWindow(); } else { ProxyTrainer *trainer = new ProxyTrainer(); theTrainer.reset(trainer); connect(trainer, SIGNAL(socketConnected()), SLOT(showMainWindow())); connect(trainer, SIGNAL(socketDisconnected()), SLOT(socketDisconnected())); connect(trainer, SIGNAL(socketError(QString)), SLOT(socketError(QString))); trainer->socketConnectToHost(host, port); } }
void soundKonverter::showReplayGainScanner() { if( !replayGainScanner ) { replayGainScanner = new ReplayGainScanner( config, logger, !isVisible(), 0 ); connect( replayGainScanner.data(), SIGNAL(finished()), this, SLOT(replayGainScannerClosed()) ); connect( replayGainScanner.data(), SIGNAL(showMainWindow()), this, SLOT(showMainWindow()) ); } replayGainScanner.data()->setAttribute( Qt::WA_DeleteOnClose ); replayGainScanner.data()->show(); replayGainScanner.data()->raise(); replayGainScanner.data()->activateWindow(); }
void systemTrayIcon::systemTrayIconActivated(QSystemTrayIcon::ActivationReason enActivationReason) { if (Context == enActivationReason) { emit showMainMenu(); } else if (DoubleClick == enActivationReason) { if (!m_strID.isEmpty()) { emit showUserMessage(m_strID); } } else if (Trigger == enActivationReason) { if (!m_strID.isEmpty()) { emit showUserMessage(m_strID); } else { emit showMainWindow(); } } }
int main(int argc, char** argv) { /* Set locale via LC_ALL. */ setlocale(LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); rules = xkb_xorg_get_rules(); if (rules == NULL) { printf( _("X-Keyboard rules can't be loaded.\n" "Plase check that you have xkb-data installed.") ); return(EXIT_FAILURE); } user_prefs = xkb_preferences_load_from_env(); if (user_prefs == NULL) { printf( _("Keyboar user preferences can't be loaded.\n" "Plase check that you have setxkbmap installed.") ); return (EXIT_FAILURE); } showMainWindow(argc, argv); return (EXIT_SUCCESS); }
void SeafileTrayIcon::createActions() { disable_auto_sync_action_ = new QAction(tr("Disable auto sync"), this); connect(disable_auto_sync_action_, SIGNAL(triggered()), this, SLOT(disableAutoSync())); enable_auto_sync_action_ = new QAction(tr("Enable auto sync"), this); connect(enable_auto_sync_action_, SIGNAL(triggered()), this, SLOT(enableAutoSync())); view_unread_seahub_notifications_action_ = new QAction(tr("View unread notifications"), this); connect(view_unread_seahub_notifications_action_, SIGNAL(triggered()), this, SLOT(viewUnreadNotifications())); quit_action_ = new QAction(tr("&Quit"), this); connect(quit_action_, SIGNAL(triggered()), this, SLOT(quitSeafile())); show_main_window_action_ = new QAction(tr("Show main window"), this); connect(show_main_window_action_, SIGNAL(triggered()), this, SLOT(showMainWindow())); settings_action_ = new QAction(tr("Settings"), this); connect(settings_action_, SIGNAL(triggered()), this, SLOT(showSettingsWindow())); open_log_directory_action_ = new QAction(tr("Open &logs folder"), this); open_log_directory_action_->setStatusTip(tr("open seafile log directory")); connect(open_log_directory_action_, SIGNAL(triggered()), this, SLOT(openLogDirectory())); about_action_ = new QAction(tr("&About"), this); about_action_->setStatusTip(tr("Show the application's About box")); connect(about_action_, SIGNAL(triggered()), this, SLOT(about())); open_help_action_ = new QAction(tr("&Online help"), this); open_help_action_->setStatusTip(tr("open seafile online help")); connect(open_help_action_, SIGNAL(triggered()), this, SLOT(openHelp())); }
void MainWindowPlugin::onOptionsChanged(const OptionsNode &ANode) { if (ANode.path() == OPV_MAINWINDOW_STAYONTOP) { #ifdef Q_WS_MAC setWindowOntop(FMainWindow, ANode.value().toBool()); #else QWidget *widget = mainWindowTopWidget(); bool show = widget->isVisible(); if (ANode.value().toBool()) widget->setWindowFlags(widget->windowFlags() | Qt::WindowStaysOnTopHint); else widget->setWindowFlags(widget->windowFlags() & ~Qt::WindowStaysOnTopHint); if (show) showMainWindow(); #endif } else if (ANode.path() == OPV_MAINWINDOW_MINIMIZETOTRAY_W7) { if (isMinimizeToTray()) { Options::node(OPV_MAINWINDOW_MINIMIZENOTIFY_SHOWCOUNT).setValue(MINIMIZENOTIFY_MAX_SHOWCOUNT+1); } if (FMainWindowBorder) { FMainWindowBorder->setMinimizeOnClose(!isMinimizeToTray()); } if (!isMinimizeToTray() && !mainWindowTopWidget()->isVisible()) { hideMainWindow(); } } }
void CCESceneWindow::schedulePreload(float f) { bool end = true; for(int i=0; i<m_preloadFileNumPerFrame; ++i) { end = true; int ret = m_preloader->fetchNext(); if(ret < 0) break; if(ret == 0) { if(m_preloadCheckSize) m_preloader->dumpXMLToResDir(m_preloadXml->getCString()); cleanPreload(); showMainWindow(); break; } if(m_preloader->loadCurFile()!=0) break; if(!onPreloadProcess()) break; end = false; } if(end) { this->unschedule(schedule_selector(CCESceneWindow::schedulePreload)); } }
void MainWindowPlugin::onOptionsChanged(const OptionsNode &ANode) { QWidget * widget = FMainWindowBorder ? (QWidget*)FMainWindowBorder : (QWidget*)FMainWindow; if (ANode.path() == OPV_MAINWINDOW_STAYONTOP) { bool show = widget->isVisible(); if (ANode.value().toBool()) widget->setWindowFlags(widget->windowFlags() | Qt::WindowStaysOnTopHint); else widget->setWindowFlags(widget->windowFlags() & ~Qt::WindowStaysOnTopHint); if (show) showMainWindow(); } #ifdef Q_OS_WIN else if (ANode.path() == OPV_MAINWINDOW_MINIMIZETOTRAY_W7) { if (QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7) { bool minimize = ANode.value().toBool(); FMainWindowBorder->setMinimizeOnClose(!minimize); FMainWindowBorder->setShowInTaskBar(!minimize); if (minimize) disconnect(FMainWindowBorder ? (QObject*)FMainWindowBorder : (QObject*)FMainWindow, SIGNAL(closed()), this, SLOT(onMainWindowClosed())); else connect(FMainWindowBorder ? (QObject*)FMainWindowBorder : (QObject*)FMainWindow, SIGNAL(closed()), SLOT(onMainWindowClosed())); } else FMainWindowBorder->setShowInTaskBar(false); } #endif }
void SnakeNetworkClientDialog::connectServer() { okButton->setEnabled(false); okButton->setText(tr("&Connecting")); client = new SnakeNetworkClient(new QString(serverIpEdit->text()), new QString(usernameEdit->text())); connect(client, SIGNAL(getOK()), this, SLOT(showMainWindow())); connect(client, SIGNAL(getError()), this, SLOT(handleError())); }
void MainWindowPlugin::onTrayNotifyActivated(int ANotifyId, QSystemTrayIcon::ActivationReason AReason) { if (ANotifyId<0 && AReason==QSystemTrayIcon::DoubleClick) { if (FMainWindow->isActive() || qAbs(FActivationChanged.msecsTo(QTime::currentTime()))<qApp->doubleClickInterval()) hideMainWindow(); else showMainWindow(); } }
IndicatorService::~IndicatorService() { quitButton->hide(); delete quitButton; disconnect(indicateServer, SIGNAL(serverDisplay()), this, SLOT(showMainWindow())); disconnect(qutim_sdk_0_3::ChatLayer::instance(), SIGNAL(sessionCreated(qutim_sdk_0_3::ChatSession*)), this, SLOT(onSessionCreated(qutim_sdk_0_3::ChatSession*))); qDeleteAll(sessionIndicators); indicateServer->hide(); delete indicateServer; }
MainHelper::MainHelper(QObject *parent) : QObject(parent) { dialog = new BeforeWar(NULL); w = new MainWindow(NULL); w->setWindowState(Qt::WindowMaximized); QObject::connect(dialog,SIGNAL(accepted()),this,SLOT(showMainWindow())); dialog->show(); }
void SeafileTrayIcon::onActivated(QSystemTrayIcon::ActivationReason reason) { #if !defined(Q_OS_MAC) switch(reason) { case QSystemTrayIcon::Trigger: // single click case QSystemTrayIcon::MiddleClick: case QSystemTrayIcon::DoubleClick: showMainWindow(); break; default: return; } #endif }
void MainWindowPlugin::onOptionsOpened() { QWidget *widget = FMainWindowBorder ? (QWidget*)FMainWindowBorder : (QWidget*)FMainWindow; widget->resize(Options::node(OPV_MAINWINDOW_SIZE).value().toSize()); widget->move(Options::node(OPV_MAINWINDOW_POSITION).value().toPoint()); FOpenAction->setVisible(true); onOptionsChanged(Options::node(OPV_MAINWINDOW_STAYONTOP)); onOptionsChanged(Options::node(OPV_MAINWINDOW_MINIMIZETOTRAY_W7)); if (Options::node(OPV_MAINWINDOW_SHOW).value().toBool()) showMainWindow(); #ifdef Q_WS_WIN else if ((QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7) && !Options::node(OPV_MAINWINDOW_MINIMIZETOTRAY_W7).value().toBool()) widget->showMinimized(); #endif updateTitle(); }
void SeafileTrayIcon::createActions() { disable_auto_sync_action_ = new QAction(tr("Disable auto sync"), this); connect(disable_auto_sync_action_, SIGNAL(triggered()), this, SLOT(disableAutoSync())); enable_auto_sync_action_ = new QAction(tr("Enable auto sync"), this); connect(enable_auto_sync_action_, SIGNAL(triggered()), this, SLOT(enableAutoSync())); quit_action_ = new QAction(tr("&Quit"), this); connect(quit_action_, SIGNAL(triggered()), this, SLOT(quitSeafile())); show_main_window_action_ = new QAction(tr("Show main window"), this); connect(show_main_window_action_, SIGNAL(triggered()), this, SLOT(showMainWindow())); settings_action_ = new QAction(tr("Settings"), this); connect(settings_action_, SIGNAL(triggered()), this, SLOT(showSettingsWindow())); open_seafile_folder_action_ = new QAction(tr("Open %1 &folder").arg(getBrand()), this); open_seafile_folder_action_->setStatusTip(tr("open %1 folder").arg(getBrand())); connect(open_seafile_folder_action_, SIGNAL(triggered()), this, SLOT(openSeafileFolder())); #if defined(Q_OS_WIN32) shellext_fix_action_ = new QAction(tr("Repair explorer extension"), this); connect(shellext_fix_action_, SIGNAL(triggered()), this, SLOT(shellExtFix())); #endif open_log_directory_action_ = new QAction(tr("Open &logs folder"), this); open_log_directory_action_->setStatusTip(tr("open %1 log folder").arg(getBrand())); connect(open_log_directory_action_, SIGNAL(triggered()), this, SLOT(openLogDirectory())); upload_log_directory_action_ = new QAction(tr("Upload log files"), this); upload_log_directory_action_->setStatusTip(tr("upload %1 log files").arg(getBrand())); connect(upload_log_directory_action_, SIGNAL(triggered()), this, SLOT(uploadLogDirectory())); show_sync_errors_action_ = new QAction(tr("Show file sync errors"), this); show_sync_errors_action_->setStatusTip(tr("Show file sync errors")); connect(show_sync_errors_action_, SIGNAL(triggered()), this, SLOT(showSyncErrorsDialog())); about_action_ = new QAction(tr("&About"), this); about_action_->setStatusTip(tr("Show the application's About box")); connect(about_action_, SIGNAL(triggered()), this, SLOT(about())); open_help_action_ = new QAction(tr("&Online help"), this); open_help_action_->setStatusTip(tr("open %1 online help").arg(getBrand())); connect(open_help_action_, SIGNAL(triggered()), this, SLOT(openHelp())); }
void MainWindowPlugin::onTrayNotifyActivated(int ANotifyId, QSystemTrayIcon::ActivationReason AReason) { if (ANotifyId<0 && AReason==QSystemTrayIcon::DoubleClick) { QWidget * widget = FMainWindowBorder ? (QWidget*)FMainWindowBorder : (QWidget*)FMainWindow; if (FMainWindow->isActive() || qAbs(FActivationChanged.msecsTo(QTime::currentTime()))<qApp->doubleClickInterval()) { #ifdef Q_WS_WIN if ((QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7) && !Options::node(OPV_MAINWINDOW_MINIMIZETOTRAY_W7).value().toBool()) widget->hide(); else #endif widget->close(); } else showMainWindow(); } }
void MainApp::offlineMode() { if (m_iMode == APP_MODE::MODE_OFFLINE) return; if (m_bLoggedIn) logOut(false); closeMainForm(); { std::lock_guard<std::mutex> a(m_UserLock); gcString path = UTIL::OS::getAppDataPath(); if (g_pUserHandle) g_pUserHandle->destroy(); g_pUserHandle = (UserCore::UserI*)UserCore::FactoryBuilderUC(USERCORE); g_pUserHandle->init(path.c_str()); try { g_pUserHandle->getNeedCvarEvent() += delegate(this, &MainApp::onNeedCvar); g_pUserHandle->getItemManager()->loadItems(); } catch (gcException &) { g_pUserHandle->getNeedCvarEvent() -= delegate(this, &MainApp::onNeedCvar); g_pUserHandle->logOut(); g_pUserHandle->destroy(); throw; } } GetCVarManager()->loadUser(GetUserCore()->getUserId()); m_iMode = APP_MODE::MODE_OFFLINE; showMainWindow(); m_pInternalLink = new InternalLink(this); }
bool CCESceneWindow::initCCESceneWindow(const char* preloadListXml, bool cleanTextureCache, bool checkTextrueSize) { bool ret=false; do{ m_preloadCheckSize = checkTextrueSize; if(cleanTextureCache) { CCSpriteFrameCache::sharedSpriteFrameCache()->removeUnusedSpriteFrames(); CCTextureCache::sharedTextureCache()->removeUnusedTextures(); } if(preloadListXml) { m_preloadXml = new CCString(preloadListXml); m_preloader = new CCPreLoad(); if(!m_preloader || !m_preloader->initCCPreLoad(preloadListXml, m_preloadCheckSize)) break; m_preloader->getTotalBytes(); if(!beforePreloadWindow()) break; this->schedule(schedule_selector(CCESceneWindow::schedulePreload), 0.3, kCCRepeatForever, 0.5); } else { if(!showMainWindow()) break; } ret = true; }while(0); return ret; }
IndicatorService::IndicatorService() : desktopName( QUTIM_DESKTOP_FILE ), indicateServer(QIndicate::Server::defaultInstance()), quitButton(new QIndicate::Indicator) { indicateServer->setType("message.im"); indicateServer->setDesktopFile(desktopName); indicateServer->show(); connect(indicateServer, SIGNAL(serverDisplay()), SLOT(showMainWindow())); connect(qutim_sdk_0_3::ChatLayer::instance(), SIGNAL(sessionCreated(qutim_sdk_0_3::ChatSession*)), SLOT(onSessionCreated(qutim_sdk_0_3::ChatSession*))); //QImage icon = qutim_sdk_0_3::Icon("qutim").pixmap(64).toImage(); qApp->setQuitOnLastWindowClosed(false); /* Quit Button */ quitButton->setNameProperty(QT_TRANSLATE_NOOP("Plugin", "Close qutIM")); QImage icon = qutim_sdk_0_3::Icon("application-exit").pixmap(64).toImage(); connect(quitButton, SIGNAL(display(QIndicate::Indicator*)), qApp, SLOT(quit())); quitButton->setIconProperty(icon); quitButton->show(); foreach (qutim_sdk_0_3::ChatSession *session, qutim_sdk_0_3::ChatLayer::instance()->sessions()) onSessionCreated(session); }
void Mpris::Raise() { emit showMainWindow(); }
void MainWindowPlugin::onShowMainWindowByAction(bool) { showMainWindow(); }