Fix inconsistencies with hotkeying

This commit is contained in:
ArsenArsen 2017-04-29 11:29:50 +02:00
parent bde179df55
commit 13be43186b
3 changed files with 12 additions and 6 deletions

View File

@ -0,0 +1,4 @@
#ifndef DRAWITEM_HPP
#define DRAWITEM_HPP
#endif // DRAWITEM_HPP

View File

@ -25,8 +25,10 @@ void hotkeying::hotkey(QString seqName, QKeySequence seq, std::function<void()>
void hotkeying::load(QString seqName, std::function<void()> func) void hotkeying::load(QString seqName, std::function<void()> func)
{ {
QHotkey *h; QHotkey *h;
if (settings::settings().contains(seqName.prepend("hotkey_"))) QString name = seqName;
h = new QHotkey(QKeySequence(settings::settings().value(seqName).toString()), true); name.prepend("hotkey_");
if (settings::settings().contains(name))
h = new QHotkey(QKeySequence(settings::settings().value(name).toString()), true);
else else
h = new QHotkey; h = new QHotkey;
QObject::connect(h, &QHotkey::activated, func); QObject::connect(h, &QHotkey::activated, func);
@ -40,5 +42,5 @@ bool hotkeying::valid(QString seq)
QString hotkeying::sequence(QString seqName) QString hotkeying::sequence(QString seqName)
{ {
return hotkeys.contains(seqName.prepend("hotkey_")) ? hotkeys.value(seqName)->shortcut().toString() : ""; return hotkeys.contains(seqName) ? hotkeys.value(seqName)->shortcut().toString() : "";
} }

View File

@ -20,13 +20,13 @@ void handler(QtMsgType type, const QMessageLogContext &context, const QString &m
fprintf(stdout, "INFO %s:%s(%d): %s\n", context.file, context.function, context.line, localMsg.constData()); fprintf(stdout, "INFO %s:%s(%d): %s\n", context.file, context.function, context.line, localMsg.constData());
break; break;
case QtWarningMsg: case QtWarningMsg:
fprintf(stderr, "WARN %s:%s(%d): %s\n", context.file, context.function, context.line, localMsg.constData()); fprintf(stdout, "WARN %s:%s(%d): %s\n", context.file, context.function, context.line, localMsg.constData());
break; break;
case QtCriticalMsg: case QtCriticalMsg:
fprintf(stderr, "CRIT %s:%s(%d): %s\n", context.file, context.function, context.line, localMsg.constData()); fprintf(stdout, "CRIT %s:%s(%d): %s\n", context.file, context.function, context.line, localMsg.constData());
break; break;
case QtFatalMsg: case QtFatalMsg:
fprintf(stderr, "FATAL %s:%s(%d): %s\n", context.file, context.function, context.line, localMsg.constData()); fprintf(stdout, "FATAL %s:%s(%d): %s\n", context.file, context.function, context.line, localMsg.constData());
break; break;
} }
} }