unauthorizedAccept option
[dyskinesia.git] / src / keycmb.h
blobbbff075fcd1c2373578dd32d14082a3b5437f009
1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://sam.zoy.org/wtfpl/COPYING for more details.
9 */
10 #ifndef KEYCMB_H
11 #define KEYCMB_H
13 #include <QHash>
14 #include <QKeyEvent>
15 #include <QList>
16 #include <QMap>
17 #include <QSet>
18 #include <QShortcut>
19 #include <QString>
20 #include <QWidget>
23 ///////////////////////////////////////////////////////////////////////////////
24 class KeyComboList {
25 public:
26 KeyComboList ();
27 ~KeyComboList ();
29 void clear ();
31 bool bind (const QString &kn, const QString &cmd);
33 void reset ();
36 * result:
37 * "": not a combo;
38 * " ": in the middle
39 * " ?": bad combo-binding, error
40 * else: binding
42 QString process (QKeyEvent *keyev);
44 const QString &lastCombo () const { return mLastCombo; }
45 const QString &lastComboText () const { return mLastComboText; }
47 QStringList toString () const;
49 bool isProcessing () const;
51 void appendFrom (KeyComboList *kl);
53 public:
54 static QString event2Kbd (QKeyEvent *keyev);
55 static QString normalizeKbd (const QString &kbd, bool strictShift=false);
57 private:
58 QHash<QString, QString> mBinds;
59 QStringList mCombos;
60 // current combo
61 QString mCurCombo;
62 QString mCurComboText;
63 // last combo
64 QString mLastCombo;
65 QString mLastComboText;
69 #endif