コード例 #1
0
ファイル: main.cpp プロジェクト: dafx/sonic-visualizer
 virtual void commitData(QSessionManager &manager) {
     if (!m_mainWindow) return;
     bool mayAskUser = manager.allowsInteraction();
     bool success = m_mainWindow->commitData(mayAskUser);
     manager.release();
     if (!success) manager.cancel();
 }
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: ChicoTeam/tiled
void MainWindow::commitData(QSessionManager &manager)
{
    // Play nice with session management and cancel shutdown process when user
    // requests this
    if (manager.allowsInteraction())
        if (!confirmAllSave())
            manager.cancel();
}
コード例 #3
0
/**
	reimplementing QApplication::commitData().
	This function deals with session management. It is invoked when the QSessionManager wants the application to commit all its data.
 */
void MyApplication::commitData(QSessionManager& manager)
{
	debugQt("MyApplication::commitData()");
	if (manager.allowsInteraction())
	{
		manager.release();
		emit quitMyApp();
	}
}
コード例 #4
0
void JavaScriptInterpreter::commitData(QSessionManager &manager)
{
	if (manager.allowsInteraction()) {
		if (!maybeSave())
			manager.cancel();
	}
	else {
		if (TextEdit_input->document()->isModified())
			save();
	}
}
コード例 #5
0
ファイル: application.cpp プロジェクト: EleVenPerfect/OTHERS
void Application::commitData(QSessionManager &sessionManager)
{
    if (ticTacToe->gameInProgress()
            && sessionManager.allowsInteraction()) {
        int ret = QMessageBox::warning(ticTacToe, tr("Tic-Tac-Toe"),
                     tr("The game hasn't finished.\n"
                        "Do you really want to quit?"),
                     QMessageBox::Yes | QMessageBox::Default,
                     QMessageBox::No | QMessageBox::Escape);
        if (ret == QMessageBox::Yes)
            sessionManager.release();
        else
            sessionManager.cancel();
    }
}
コード例 #6
0
void GUIApplication::commitData(QSessionManager &manager)
{
    if (manager.allowsInteraction()) {
        if (!Gui::getMainWindow()->close()) {
            // cancel the shutdown
            manager.release();
            manager.cancel();
        }
    }
    else {
        // no user interaction allowed, thus close all documents and
        // the main window
        App::GetApplication().closeAllDocuments();
        Gui::getMainWindow()->close();
    }
}
コード例 #7
0
ファイル: clipboardserver.cpp プロジェクト: hluk/CopyQ
void ClipboardServer::onCommitData(QSessionManager &sessionManager)
{
    COPYQ_LOG("Got commit data request from session manager.");

    const bool cancel = sessionManager.allowsInteraction() && !askToQuit();
    sessionManager.release();

    if (cancel) {
        sessionManager.cancel();
        startMonitoring();
    } else {
        m_wnd->saveTabs();

        // WORKAROUND: This is required to exit application from
        //             installer, otherwise main window is only
        //             minimized after this when tray is disabled.
        m_wnd->hide();
        exit();
    }
}