Browse Source

Fix inconsistencies with hotkeying

tags/v5.0.0
ArsenArsen 5 years ago
parent
commit
13be43186b
  1. 4
      cropeditor/drawing/drawitem.hpp
  2. 8
      hotkeying.cpp
  3. 6
      main.cpp

4
cropeditor/drawing/drawitem.hpp

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

8
hotkeying.cpp

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

6
main.cpp

@ -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());
break;
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;
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;
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;
}
}

Loading…
Cancel
Save