13 QObject(modeParent), _devParent(parentBoard), lastGlobalRemapTime(globalRemapTime), _map(keyMap),
14 _winLock(false), _needsUpdate(true), _needsSave(true) {
25 QObject(modeParent), _devParent(parentBoard), lastGlobalRemapTime(globalRemapTime), _bind(other._bind),
26 _winLock(false), _needsUpdate(true), _needsSave(true) {
30 QHash<QString, KeyAction*> newBind;
40 foreach(QString key, newBind.keys()) {
60 SGroup group(settings,
"Binding");
64 bool useReal = settings.
value(
"UseRealNames").toBool();
67 SGroup group(settings,
"Keys");
69 QString name = key.toLower();
72 QString bind = settings.
value(key).toString();
83 SGroup group(settings,
"Binding");
86 settings.
setValue(
"UseRealNames",
true);
88 SGroup group(settings,
"Keys");
107 QHashIterator<QString, QString> i(keyToActual);
110 if(i.key() != i.value())
129 settings.
setValue(i.key(), i.value());
167 QString act =
action(key);
204 cmd.write(
"rebind all notify all");
206 QHash<QString, KeyAction*> bind(
_bind);
207 if(!
_bind.contains(
"caps")) bind[
"caps"] = 0;
208 if(!
_bind.contains(
"lshift")) bind[
"lshift"] = 0;
209 if(!
_bind.contains(
"rshift")) bind[
"rshift"] = 0;
210 if(!
_bind.contains(
"lctrl")) bind[
"lctrl"] = 0;
211 if(!
_bind.contains(
"rctrl")) bind[
"rctrl"] = 0;
212 if(!
_bind.contains(
"lwin")) bind[
"lwin"] = 0;
213 if(!
_bind.contains(
"rwin")) bind[
"rwin"] = 0;
214 if(!
_bind.contains(
"lalt")) bind[
"lalt"] = 0;
215 if(!
_bind.contains(
"ralt")) bind[
"ralt"] = 0;
216 if(!
_bind.contains(
"fn")) bind[
"fn"] = 0;
217 QHashIterator<QString, KeyAction*> i(bind);
221 QString macros =
"\nmacro clear\n";
226 QString
key = i.key();
235 cmd.write(
" unbind ");
236 cmd.write(key.toLatin1());
241 macros.append(
"macro " + key.toLatin1() +
":" + act->
macroContent().toLatin1() +
"\n");
247 cmd.write(key.toLatin1());
249 cmd.write(value.toLatin1());
254 cmd.write(
" unbind lwin rwin");
258 cmd.write(macros.toLatin1());
292 }
else qDebug() << QString(
"No cmd or valid handle for notification found, macroNumber = %1, lastCmd = %2")
void load(CkbSettings &settings)
void setValue(const QString &key, const QVariant &value)
QStringList childKeys() const
QString getMacroPath()
getMacroPath returns the macroPath (e.g. /dev/input/ckb1/notify), which we have saved in the construc...
KbBind(KbMode *modeParent, Kb *devParent, const KeyMap &keyMap)
static QString globalRemap(const QString &key)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
int getMacroNumber()
For usage with macro definions, these two params must only be readable. So there are no setters...
QString friendlyName(bool os=true) const
static void setGlobalRemap(const QHash< QString, QString > keyToActual)
bool isValidMacro() const
isValidMacro checks whether a keyAction contains a valid macro. This is done easily: If the macro act...
Key key(const QString &name) const
QString fromStorage(const QString &storage)
QString friendlyActionName(const QString &key)
QString friendlyName(const QString &key)
void resetAction(const QString &key)
QString action(const QString &key)
void save(CkbSettings &settings)
QString defaultAction(const QString &key)
void update(QFile &cmd, bool force=false)
void keyEvent(const QString &key, bool down)
QString getMacroPath()
KbBind::getMacroPath.
void handleNotificationChannel(bool start)
handleNotificationChannel sends commands to ckb-daemon for (de-) activating the notify channel...
QString driverName() const
static QHash< QString, QString > _globalRemap
void noAction(const QString &key)
static void saveGlobalRemap()
QHash< QString, KeyAction * > _bind
quint64 lastGlobalRemapTime
QFile * lastCmd
lastCmd is a cache-hack. Because the QFile ist opened in Kb, and we need it in the macro processing f...
void setAction(const QString &key, const QString &action)
static quint64 globalRemapTime
static KeyMap fromName(const QString &name)
int getMacroNumber()
KbBind::getMacroNumber.
QString macroContent() const
macroContent returns the macro key definition only (the second part of the macro action).
static QString defaultAction(const QString &key, KeyMap::Model model)
KbMode * modeParent() const
KeyAction * bindAction(const QString &key)
void keyEvent(KbBind *bind, bool down)
static void loadGlobalRemap()