2013-06-30 15:22:44 +02:00
|
|
|
#include "core/dynamicshortcuts.h"
|
2013-12-21 21:08:52 +01:00
|
|
|
|
2013-06-30 15:22:44 +02:00
|
|
|
#include "core/defs.h"
|
2013-12-21 21:08:52 +01:00
|
|
|
#include "core/settings.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
2013-06-30 15:22:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
DynamicShortcuts::DynamicShortcuts() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void DynamicShortcuts::save(const QList<QAction *> actions) {
|
2014-01-10 09:18:29 +01:00
|
|
|
Settings *settings = Settings::instance();
|
2013-08-30 17:40:17 +02:00
|
|
|
|
2013-06-30 15:22:44 +02:00
|
|
|
foreach (QAction *action, actions) {
|
2013-08-30 17:40:17 +02:00
|
|
|
settings->setValue(APP_CFG_CUTS,
|
|
|
|
action->objectName(),
|
|
|
|
action->shortcut().toString(QKeySequence::NativeText));
|
2013-06-30 15:22:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DynamicShortcuts::load(const QList<QAction *> actions) {
|
2014-01-10 09:18:29 +01:00
|
|
|
Settings *settings = Settings::instance();
|
2013-08-30 17:40:17 +02:00
|
|
|
|
2013-06-30 15:22:44 +02:00
|
|
|
foreach (QAction *action, actions) {
|
2013-08-30 17:40:17 +02:00
|
|
|
QString shortcut_for_action = settings->value(APP_CFG_CUTS,
|
|
|
|
action->objectName(),
|
|
|
|
action->shortcut().toString(QKeySequence::NativeText)).toString();
|
2013-06-30 15:22:44 +02:00
|
|
|
action->setShortcut(QKeySequence::fromString(shortcut_for_action,
|
|
|
|
QKeySequence::NativeText));
|
|
|
|
}
|
|
|
|
}
|