Show message if failed to register global shortcut.

This commit is contained in:
Gres 2015-10-25 13:58:29 +03:00
parent 692ccc133b
commit 7db8cd2d19

View File

@ -142,25 +142,39 @@ void Manager::applySettings () {
QSettings settings; QSettings settings;
settings.beginGroup (settings_names::guiGroup); settings.beginGroup (settings_names::guiGroup);
QStringList globalActionsFailed;
Q_CHECK_PTR (captureAction_); Q_CHECK_PTR (captureAction_);
GlobalActionHelper::removeGlobal (captureAction_); GlobalActionHelper::removeGlobal (captureAction_);
captureAction_->setShortcut (GET (captureHotkey).toString ()); captureAction_->setShortcut (GET (captureHotkey).toString ());
GlobalActionHelper::makeGlobal (captureAction_); if (!GlobalActionHelper::makeGlobal (captureAction_)) {
globalActionsFailed << captureAction_->shortcut ().toString ();
}
Q_CHECK_PTR (repeatCaptureAction_); Q_CHECK_PTR (repeatCaptureAction_);
GlobalActionHelper::removeGlobal (repeatCaptureAction_); GlobalActionHelper::removeGlobal (repeatCaptureAction_);
repeatCaptureAction_->setShortcut (GET (repeatCaptureHotkey).toString ()); repeatCaptureAction_->setShortcut (GET (repeatCaptureHotkey).toString ());
GlobalActionHelper::makeGlobal (repeatCaptureAction_); if (!GlobalActionHelper::makeGlobal (repeatCaptureAction_)) {
globalActionsFailed << repeatCaptureAction_->shortcut ().toString ();
}
Q_CHECK_PTR (repeatAction_); Q_CHECK_PTR (repeatAction_);
GlobalActionHelper::removeGlobal (repeatAction_); GlobalActionHelper::removeGlobal (repeatAction_);
repeatAction_->setShortcut (GET (repeatHotkey).toString ()); repeatAction_->setShortcut (GET (repeatHotkey).toString ());
GlobalActionHelper::makeGlobal (repeatAction_); if (!GlobalActionHelper::makeGlobal (repeatAction_)) {
globalActionsFailed << repeatAction_->shortcut ().toString ();
}
Q_CHECK_PTR (clipboardAction_); Q_CHECK_PTR (clipboardAction_);
GlobalActionHelper::removeGlobal (clipboardAction_); GlobalActionHelper::removeGlobal (clipboardAction_);
clipboardAction_->setShortcut (GET (clipboardHotkey).toString ()); clipboardAction_->setShortcut (GET (clipboardHotkey).toString ());
GlobalActionHelper::makeGlobal (clipboardAction_); if (!GlobalActionHelper::makeGlobal (clipboardAction_)) {
globalActionsFailed << clipboardAction_->shortcut ().toString ();
}
if (!globalActionsFailed.isEmpty ()) {
showError (tr ("Failed to register global shortcuts:\n%1")
.arg (globalActionsFailed.join ("\n")));
}
// Depends on SettingsEditor button indexes. 1==dialog // Depends on SettingsEditor button indexes. 1==dialog
useResultDialog_ = GET (resultShowType).toBool (); useResultDialog_ = GET (resultShowType).toBool ();