SFAbstractApplicationUI::SFAbstractApplicationUI(bb::cascades::Application *app) : QObject(app) { //register meta types for SF classes and enums sfRegisterMetaTypes(); //Setup SFDC connection info SFAccountManager::setClientId(SFRemoteAccessConsumerKey); SFAccountManager::setRedirectUri(SFOAuthRedirectURI); //In addition, you can set up scope for your token like below. /* QList<QString> scopes; scopes.append("api"); SFAccountManager::setScopes(scopes); */ //setup API objects SFRestAPI::instance()->setApiVersion(SFDefaultRestApiVersion); //Expose API objects to QML QDeclarativeEngine *engine = QmlDocument::defaultDeclarativeEngine(); QDeclarativeContext *context = engine ? engine->rootContext() : NULL; if (context) { context->setContextProperty("SFAccountManager", SFAccountManager::instance()); context->setContextProperty("SFAuthenticationManager", SFAuthenticationManager::instance()); context->setContextProperty("SFRestAPI", SFRestAPI::instance()); } else { sfWarning() << "[SFAbstractApplicationUI] Failed to grab shared QML declarative engine. SF APIs may not be accessible in QML."; } //connect some slots connect(app, SIGNAL(aboutToQuit()), SFAuthenticationManager::instance(), SLOT(onAboutToQuit())); connect(app, SIGNAL(fullscreen()), SFAuthenticationManager::instance(), SLOT(onAppStart())); }
MessageView* SessionTabWidget::openView(const QString& receiver) { MessageView* view = d.views.value(receiver.toLower()); if (!view) { view = new MessageView(d.handler.session(), this); view->setReceiver(receiver); connect(view, SIGNAL(alert(MessageView*, bool)), this, SLOT(alertTab(MessageView*, bool))); connect(view, SIGNAL(highlight(MessageView*, bool)), this, SLOT(highlightTab(MessageView*, bool))); connect(view, SIGNAL(query(QString)), this, SLOT(openView(QString))); connect(view, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); d.handler.addReceiver(receiver, view); d.views.insert(receiver.toLower(), view); addTab(view, receiver); }
BooksSaveTimer::BooksSaveTimer(QObject* aParent) : QObject(aParent), iInactivityTimer(new QTimer(this)), iMandatarySaveTimer(new QTimer(this)), iSaveRequested(false) { connect(qApp, SIGNAL(aboutToQuit()), SLOT(onAboutToQuit())); iInactivityTimer->setInterval(BOOKS_DEFAULT_INACTIVITY_TIMEOUT); iInactivityTimer->setSingleShot(true); connect(iInactivityTimer, SIGNAL(timeout()), SLOT(onTimeout())); iMandatarySaveTimer->setInterval(BOOKS_DEFAULT_MANDATORY_SAVE_TIMEOUT); iMandatarySaveTimer->setSingleShot(true); connect(iMandatarySaveTimer, SIGNAL(timeout()), SLOT(onTimeout())); }
SeafileApplet::SeafileApplet() : configurator_(new Configurator), account_mgr_(new AccountManager), daemon_mgr_(new DaemonManager), main_win_(NULL), rpc_client_(new SeafileRpcClient), message_listener_(new MessageListener), settings_dialog_(new SettingsDialog), settings_mgr_(new SettingsManager), certs_mgr_(new CertsManager), started_(false), in_exit_(false), is_pro_(false) { tray_icon_ = new SeafileTrayIcon(this); connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); }
bool OptionsManager::initConnections(IPluginManager *APluginManager, int &AInitOrder) { Q_UNUSED(AInitOrder); FPluginManager = APluginManager; connect(FPluginManager->instance(),SIGNAL(aboutToQuit()),SLOT(onAboutToQuit())); IPlugin *plugin = APluginManager->pluginInterface("IMainWindowPlugin").value(0,NULL); if (plugin) { FMainWindowPlugin = qobject_cast<IMainWindowPlugin *>(plugin->instance()); } plugin = APluginManager->pluginInterface("ITrayManager").value(0,NULL); if (plugin) { FTrayManager = qobject_cast<ITrayManager *>(plugin->instance()); } plugin = APluginManager->pluginInterface("IPrivateStorage").value(0,NULL); if (plugin) { FPrivateStorage = qobject_cast<IPrivateStorage *>(plugin->instance()); if (FPrivateStorage) { connect(FPrivateStorage->instance(),SIGNAL(storageOpened(const Jid &)),SLOT(onPrivateStorageOpened(const Jid &))); connect(FPrivateStorage->instance(),SIGNAL(dataLoaded(const QString &, const Jid &, const QDomElement &)), SLOT(onPrivateStorageDataLoaded(const QString &, const Jid &, const QDomElement &))); connect(FPrivateStorage->instance(),SIGNAL(dataChanged(const Jid &, const QString &, const QString &)), SLOT(onPrivateStorageDataChanged(const Jid &, const QString &, const QString &))); connect(FPrivateStorage->instance(),SIGNAL(storageAboutToClose(const Jid &)),SLOT(onPrivateStorageAboutToClose(const Jid &))); } } plugin = APluginManager->pluginInterface("ISystemIntegration").value(0,NULL); if (plugin) { FSystemIntegration = qobject_cast<ISystemIntegration *>(plugin->instance()); } connect(Options::instance(),SIGNAL(optionsChanged(const OptionsNode &)),SLOT(onOptionsChanged(const OptionsNode &))); return true; }
CuteChessApplication::CuteChessApplication(int& argc, char* argv[]) : QApplication(argc, argv), m_engineManager(nullptr), m_gameManager(nullptr), m_gameDatabaseManager(nullptr), m_gameDatabaseDialog(nullptr) { Mersenne::initialize(QTime(0,0,0).msecsTo(QTime::currentTime())); // Set the application icon QIcon icon; icon.addFile(":/icons/cutechess_512x512.png"); icon.addFile(":/icons/cutechess_256x256.png"); icon.addFile(":/icons/cutechess_128x128.png"); icon.addFile(":/icons/cutechess_64x64.png"); icon.addFile(":/icons/cutechess_32x32.png"); icon.addFile(":/icons/cutechess_24x24.png"); icon.addFile(":/icons/cutechess_16x16.png"); setWindowIcon(icon); setQuitOnLastWindowClosed(false); QCoreApplication::setOrganizationName("cutechess"); QCoreApplication::setOrganizationDomain("cutechess.org"); QCoreApplication::setApplicationName("cutechess"); QCoreApplication::setApplicationVersion(CUTECHESS_VERSION); // Use Ini format on all platforms QSettings::setDefaultFormat(QSettings::IniFormat); // Load the engines engineManager()->loadEngines(configPath() + QLatin1String("/engines.json")); // Read the game database state gameDatabaseManager()->readState(configPath() + QLatin1String("/gamedb.bin")); connect(this, SIGNAL(lastWindowClosed()), this, SLOT(onLastWindowClosed())); connect(this, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); }
void FormMain::createConnections() { // General connections. connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); connect(m_ui->m_actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(m_ui->m_actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(showUpdates())); connect(m_ui->m_actionAboutToolkit, SIGNAL(triggered()), this, SLOT(showAbout())); connect(m_ui->m_actionSettings, SIGNAL(triggered()), this, SLOT(showSettings())); connect(m_ui->m_actionHelp, SIGNAL(triggered()), this, SLOT(showHelp())); // View connections. connect(m_ui->m_actionViewSimulatorWindow, SIGNAL(toggled(bool)), this, SLOT(switchSimulatorWindow(bool))); connect(m_ui->m_actionStickSimulatorWindow, SIGNAL(toggled(bool)), m_simulatorWindow, SLOT(setIsSticked(bool))); // Extra simulator connections. connect(m_simulatorWindow, SIGNAL(closed()), this, SLOT(onSimulatorWindowClosed())); connect(m_simulatorWindow, SIGNAL(stopEnableChanged(bool)), m_ui->m_actionSimulatorStop, SLOT(setEnabled(bool))); connect(m_ui->m_actionSimulatorStop, SIGNAL(triggered()), m_simulatorWindow->m_ui->m_btnStopSimulation, SLOT(click())); connect(m_ui->m_actionSimulatorRun, SIGNAL(triggered()), this, SLOT(startSimulation())); connect(m_ui->m_actionSimulatorGoBack, SIGNAL(triggered()), this, SLOT(takeSimulationOneStepBack())); // Project connections. connect(m_ui->m_actionNewProject, SIGNAL(triggered()), this ,SLOT(openNewProjectDialog())); connect(m_ui->m_actionSaveProject, SIGNAL(triggered()), this ,SLOT(openSaveProjectDialog())); connect(m_ui->m_actionSaveProjectAs, SIGNAL(triggered()), this, SLOT(openSaveProjectAsDialog())); connect(m_ui->m_actionLoadProject, SIGNAL(triggered()), this ,SLOT(openLoadProjectDialog())); connect(m_ui->m_actionOpenOutputDirectory, SIGNAL(triggered()), this, SLOT(openOutputDirectory())); // Template system connections. connect(qApp->templateManager(), SIGNAL(newTemplateCoreCreated(TemplateCore*)), this, SLOT(setTemplateCore(TemplateCore*))); connect(qApp, SIGNAL(externalApplicationsRechecked()), this, SLOT(onExternalApplicationsChanged())); connect(m_ui->m_actionGenerateMobileApplication, SIGNAL(triggered()), this, SLOT(generateMobileApplication())); connect(m_ui->m_actionUploadApplicationToStore, SIGNAL(triggered()), this, SLOT(uploadMobileApplicationToStore())); connect(qApp->templateManager()->generator(), SIGNAL(generationStarted()), this, SLOT(onGenerationStarted())); connect(qApp->templateManager()->generator(), SIGNAL(generationFinished(TemplateCore::GenerationResult,QString)), this, SLOT(onGenerationDone(TemplateCore::GenerationResult,QString))); connect(qApp->templateManager()->generator(), SIGNAL(generationProgress(int,QString)), this, SLOT(onGenerationProgress(int,QString))); }
WebAppManager::~WebAppManager() { onAboutToQuit(); }
bool DiffAnalystWindow::initMenuBar() { bool ret=false; // //////////////////////////////////////////////////////////////////// // FILE m_pFileMenu = new QPopupMenu (this); if(m_pFileMenu == NULL) return false; menuBar ()->insertItem ("&File", m_pFileMenu); // New m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileNew)), "&New Session Wizard", this, SLOT (onFileNew ()), CTRL + Key_N); // Open m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileOpen)), "&Open", this, SLOT (onFileOpen ()), CTRL + Key_O); // ------------------- m_pFileMenu->insertSeparator (); // Save m_SaveId = m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileSave)), "&Save", this, SLOT (onFileSave ()), CTRL + Key_S); m_pFileMenu->setItemEnabled (m_SaveId, false); // Save As m_SaveAsId = m_pFileMenu->insertItem (QIconSet(QPixmap()), "Save &As", this, SLOT (onFileSaveAs ()), CTRL + Key_A); m_pFileMenu->setItemEnabled (m_SaveAsId, false); // ------------------- // m_pFileMenu->insertSeparator (); // export data // m_ExportDataId = m_pFileMenu->insertItem ("&Export...", this, // SLOT (onExportData ())); // m_pFileMenu->setItemEnabled (m_ExportDataId, false); // ------------------- m_pFileMenu->insertSeparator (); // Close m_CloseId = m_pFileMenu->insertItem ("&Close", this, SLOT (onFileClose ()), CTRL + Key_W); m_CloseAllId = m_pFileMenu->insertItem ("Close Al&l", this, SLOT (onCloseAllWindows ())); // Quit m_pFileMenu->insertItem ("&Quit", this, SLOT (close ()), CTRL + Key_Q); QObject::connect (qApp, SIGNAL (aboutToQuit ()), this, SLOT (onAboutToQuit ())); // //////////////////////////////////////////////////////////////////// // SETTINGS // m_pSettingsMenu = new QPopupMenu (this); // if(m_pSettingsMenu == NULL) return false; // menuBar ()->insertItem ("&Settings", m_pSettingsMenu); // ///////////////////////////////////////////////////////////////////// // TOOLS m_pToolsMenu = new QPopupMenu (this); if(m_pToolsMenu == NULL) return false; m_pToolsMenu->setCheckable (TRUE); connect (m_pToolsMenu, SIGNAL (aboutToShow ()), this, SLOT (toolsMenuAboutToShow ())); menuBar ()->insertItem ("&Tools", m_pToolsMenu); // ///////////////////////////////////////////////////////////////////// // VIEW m_pViewMenu = new QPopupMenu (this); if(m_pViewMenu == NULL) return false; menuBar ()->insertItem ("&View", m_pViewMenu); // View Management m_ViewManageId = m_pViewMenu->insertItem (QPixmap(viewconfig),"&View Management", this, SLOT (onViewManage ())); // ///////////////////////////////////////////////////////////////////// // WINDOWS m_pWindowsMenu = new QPopupMenu (this); if(m_pWindowsMenu == NULL) return false; connect (m_pWindowsMenu, SIGNAL (aboutToShow ()), this, SLOT (onWindowsMenuAboutToShow ())); menuBar ()->insertItem ("&Windows", m_pWindowsMenu); // ///////////////////////////////////////////////////////////////////// // HELPS m_pHelpMenu = new QPopupMenu (this); if(m_pHelpMenu == NULL) return false; menuBar ()->insertItem ("&Help", m_pHelpMenu); m_pHelpMenu->insertItem ("&About", this, SLOT (onHelpAbout ()), Key_F1); m_pHelpMenu->insertItem ("&Help", this, SLOT (onHelpContents ())); ret = true; return ret; }// DiffAnalystWindow::initMenuBar