本文整理汇总了C++中QSessionManager类的典型用法代码示例。如果您正苦于以下问题:C++ QSessionManager类的具体用法?C++ QSessionManager怎么用?C++ QSessionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QSessionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveState
void Application::saveState (QSessionManager& sm)
{
if (Arguments_.contains ("-restart"))
sm.setRestartHint (QSessionManager::RestartImmediately);
sm.release ();
}
示例2: commitData
void Application::commitData (QSessionManager& sm)
{
if (Arguments_.contains ("-autorestart"))
sm.setRestartHint (QSessionManager::RestartImmediately);
sm.release ();
}
示例3: saveState
void Traverso::saveState( QSessionManager & manager)
{
manager.setRestartHint(QSessionManager::RestartIfRunning);
QStringList command;
command << "traverso" << "-session" << QApplication::sessionId();
manager.setRestartCommand(command);
}
示例4: commitData
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();
}
示例5: commitData
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();
}
示例6: commitData
/**
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();
}
}
示例7: commitData
void JavaScriptInterpreter::commitData(QSessionManager &manager)
{
if (manager.allowsInteraction()) {
if (!maybeSave())
manager.cancel();
}
else {
if (TextEdit_input->document()->isModified())
save();
}
}
示例8: saveState
bool saveState( QSessionManager&sm) {
QStringList restartCommand = sm.restartCommand();
if (has_noxft)
restartCommand.append("--noxft");
if (login_shell)
restartCommand.append("--ls");
if (full_script)
restartCommand.append("--script");
if (!auto_close)
restartCommand.append("--noclose");
if (fixed_size)
restartCommand.append("--noresize");
sm.setRestartCommand(restartCommand);
return true;
}
示例9: commitData
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();
}
}
示例10: onSaveState
void ClipboardServer::onSaveState(QSessionManager &sessionManager)
{
COPYQ_LOG("Got save state request from session manager.");
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "copyq", "copyq_no_session");
const auto sessionNameKey = "session_" + sessionManager.sessionId();
const auto sessionName = qApp->property("CopyQ_session_name").toString();
settings.setValue(sessionNameKey, sessionName);
const QString lastSessionIdPrefix = "last_session_id_for_";
const auto lastSessionIdKey = lastSessionIdPrefix + sessionName;
const auto lastSessionId = settings.value(lastSessionIdKey).toString();
const auto lastSessionNameKey = "session_" + lastSessionId;
settings.setValue(lastSessionIdKey, sessionNameKey);
// Remove no longer valid sessions from configuration.
QSet<QString> validSessions;
for (const QString &key : settings.childKeys()) {
if ( key.startsWith(lastSessionIdPrefix) )
validSessions.insert( settings.value(key).toString() );
}
for (const QString &key : settings.childKeys()) {
if ( !key.startsWith(lastSessionIdPrefix) && !validSessions.contains(key) )
settings.remove(key);
}
}
示例11: saveState
void MobileUiApplication::saveState(QSessionManager & manager) {
//qDebug() << QString("saving session state to id %1").arg(manager.sessionId());
AccountId activeCore = Client::currentCoreAccount().accountId(); // FIXME store this!
SessionSettings s(manager.sessionId());
s.setSessionAge(0);
QtUi::mainWindow()->saveStateToSettings(s);
}
示例12: commitData
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();
}
}
示例13: saveState
void Application::saveState(QSessionManager &sessionManager)
{
QString fileName = ticTacToe->saveState();
QStringList discardCommand;
discardCommand << "rm" << fileName;
sessionManager.setDiscardCommand(discardCommand);
}
示例14: onCommitData
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();
}
}
示例15: commitData
void commitData(QSessionManager &sm)
{
if(mainWidget()->isHidden())
{
sm.setRestartHint(QSessionManager::RestartNever);
return;
}
closed_by_sm = true;
KUniqueApplication::commitData(sm);
closed_by_sm = false;
}