1 #include <QStandardPaths>
12 bind(0), profile(0), macReader(0)
21 modKeys <<
"caps" <<
"lshift" <<
"rshift" <<
"lctrl" <<
"rctrl" <<
"lwin" <<
"rwin" <<
"lalt" <<
"ralt" <<
"rmenu" <<
"fn";
22 fnKeys <<
"esc" <<
"f1" <<
"f2" <<
"f3" <<
"f4" <<
"f5" <<
"f6" <<
"f7" <<
"f8" <<
"f9" <<
"f10" <<
"f11" <<
"f12" <<
"prtscn" <<
"scroll" <<
"pause" <<
"f13" <<
"f14" <<
"f15" <<
"f16" <<
"f17" <<
"f18" <<
"f19" <<
"f20" <<
"ins" <<
"del" <<
"home" <<
"end" <<
"pgup" <<
"pgdn" <<
"power" <<
"lightup" <<
"lightdn" <<
"up" <<
"down" <<
"left" <<
"right";
23 numKeys <<
"numlock" <<
"num0" <<
"num1" <<
"num2" <<
"num3" <<
"num4" <<
"num5" <<
"num6" <<
"num7" <<
"num8" <<
"num9" <<
"numslash" <<
"numstar" <<
"numminus" <<
"numplus" <<
"numdot" <<
"numenter";
24 mediaKeys <<
"stop" <<
"prev" <<
"play" <<
"next" <<
"volup" <<
"voldn" <<
"mute" <<
"eject";
25 mouseKeys <<
"mouse1" <<
"mouse2" <<
"mouse3";
26 mouseExtKeys <<
"mouse4" <<
"mouse5" <<
"mouse6" <<
"mouse7" <<
"mouse8";
31 foreach(
const QString& key,
fnKeys)
33 foreach(
const QString& key,
numKeys)
46 ui->
fnBox->setItemText(
fnKeys.indexOf(
"f13") + 1,
"F13 (Windows/Linux)");
47 ui->
fnBox->setItemText(
fnKeys.indexOf(
"f14") + 1,
"F14 (Windows/Linux)");
48 ui->
fnBox->setItemText(
fnKeys.indexOf(
"f15") + 1,
"F15 (Windows/Linux)");
53 ui->
progTipLabel->setText(
"<p style=\"line-height:150%\">Tip: use the <font face=\"monospace\">open</font> command to launch a file, directory, or app. For instance, to start Safari:<br /><font face=\"monospace\"> open /Applications/Safari.app</font></p>");
55 ui->
progTipLabel->setText(
"<p style=\"line-height:150%\">Tip: use <font face=\"monospace\">xdg-open</font> to launch a file or directory. For instance, to open your home folder:<br /><font face=\"monospace\"> xdg-open " + QStandardPaths::writableLocation(QStandardPaths::HomeLocation) +
"</font></p>");
74 foreach(
const QString& name, map.
byPosition()){
76 if(action.isNormal() && !
modKeys.contains(name) && !
fnKeys.contains(name) && !
numKeys.contains(name) && !
mediaKeys.contains(name) && name !=
"enter" && name !=
"tab" && name !=
"bspace"){
77 const Key& pos = map[name];
100 ui->
modeBox->addItem(QString(
"%1: %2").arg(idx++).arg(mode->
name()));
110 bool sniper = (i == 0);
112 QPoint dpi = perf->
dpi(i);
113 QString text = tr(sniper ?
"Sniper:\t%1 x %2" :
"%3:\t%1 x %2").arg(dpi.x()).arg(dpi.y());
114 if(!sniper) text = text.arg(i);
115 ui->
dpiBox->setItemText(boxIdx, text);
139 if(!
selection.isEmpty() && applyPrevious){
146 if(newSelection.isEmpty()){
152 bool hasAction =
false;
157 if(!action.isEmpty())
164 if(keyAction.isEmpty() || (hasAction && keyAction != action)){
167 }
else if(action.isEmpty()){
207 int value = act.
dpiInfo(custom);
211 if(value == KeyAction::DPI_CUSTOM){
227 QString onPress, onRelease;
263 bool onlyOnce =
false, stopOnRelease =
false;
264 QUuid
id = act.
animInfo(onlyOnce, stopOnRelease);
277 if(sAction ==
"mode"){
287 if(param >= 0 && param < ui->modeBox->count())
292 }
else if (sAction ==
"macro") {
305 qDebug(
"RebindWidget::setSelection found invalid macro definition.");
311 if(sAction ==
"light"){
319 if(param < 0 || param > 1)
325 if(sAction ==
"lock"){
326 if(param < 0 || param > 2)
337 else if(
ui->
modBox->currentIndex() > 0)
339 else if(
ui->
fnBox->currentIndex() > 0)
341 else if(
ui->
numBox->currentIndex() > 0)
345 else if(
ui->
mbBox->currentIndex() > 0)
347 else if(
ui->
mb2Box->currentIndex() > 0)
351 else if(
ui->
dpiBox->currentIndex() > 0)
359 else if(
ui->
animBox->currentIndex() > 0){
363 int kpStop = 0, krStop = 0;
398 mac =
ui->
pteMacroComment->toPlainText().replace(
":",
"&das_IST_31N_col0n;") +
":" + mac;
399 mac =
ui->
pteMacroText->toPlainText().replace(
":",
"&das_IST_31N_col0n;") +
":" + mac;
559 if(index == 1 || index == 2)
628 if(checked &&
ui->
modBox->currentIndex() == 0)
633 if(checked &&
ui->
fnBox->currentIndex() == 0)
638 if(checked &&
ui->
numBox->currentIndex() == 0)
643 if(checked &&
ui->
mediaBox->currentIndex() == 0)
648 if(checked &&
ui->
modeBox->currentIndex() == 0)
653 if(checked &&
ui->
lightBox->currentIndex() == 0)
658 if(checked &&
ui->
lockBox->currentIndex() == 0)
681 if(checked &&
ui->
mbBox->currentIndex() == 0)
686 if(checked &&
ui->
mb2Box->currentIndex() == 0)
691 if(checked &&
ui->
wheelBox->currentIndex() == 0)
696 if(checked &&
ui->
dpiBox->currentIndex() == 0)
711 if(checked &&
ui->
animBox->currentIndex() == 0)
785 ui->
lbl_macro->setText(
"Type in a macro name in the comment box and click start.");
788 ui->
lbl_macro->setText(
"Type your macro and click stop when finished.");
791 ui->
lbl_macro->setText(
"Click Apply or change values in Macro Key Actions in advance.");
794 ui->
lbl_macro->setText(QString(
"Oops: Some magic in RebindWidget::helpStatus (%1)").arg(status));
818 in.replace (QRegExp(
"\n"),
",");
819 in.replace (QRegExp(
"key "),
"");
820 in.replace (QRegExp(
",="),
"=");
828 in.replace(QRegExp(
"=\\d+,"),
",");
829 in.replace(QRegExp(
"=\\d+$"),
"");
832 in.replace(QRegExp(
"=\\d+,"),
"=0,");
833 in.replace(QRegExp(
"=\\d+$"),
"=0");
834 in.replace(QRegExp(
"([\\+\\-]\\w+),"),
"\\1=0,");
835 in.replace(QRegExp(
"([\\+\\-]\\w+)$"),
"\\1=0");
888 if (!macdef.contains(QRegExp(
"=\\d+,"))) {
892 if (macdef.contains(QRegExp(
"=\\d\\d+,"))) {
const ModeList & modes() const
static QString animAction(const QUuid &guid, bool onlyOnce, bool stopOnRelease)
QStringList byPosition() const
static QString macroAction(QString macroDef)
well documented in cpp file
static QString friendlyName(const QString &key, Layout layout=US)
static const int DPI_CUSTOM
static const int PROGRAM_PR_MULTI
const AnimList & animList()
The MacroReader class creates a worker thread object. It does a connect do delayed deletion of thread...
static const int PROGRAM_RE_MULTI
static QString dpiAction(int level, int customX=0, int customY=0)
QString friendlyName(bool os=true) const
QString specialInfo(int ¶meter) const
bool isValidMacro() const
isValidMacro checks whether a keyAction contains a valid macro. This is done easily: If the macro act...
const QString & name() const
static const int MODE_PREV
static QString programAction(const QString &onPress, const QString &onRelease, int stop)
QUuid animInfo(bool &onlyOnce, bool &stopOnRelease) const
QStringList macroLine() const
macroLine returns all interresting content for a macro definition.
static const int PROGRAM_RE_INDEF
static const int PROGRAM_RE_KPSTOP
static QString lockAction(int type=LOCK_TOGGLE)
void resetAction(const QString &key)
static const int MODE_PREV_WRAP
QPoint dpi(int index) const
QString action(const QString &key)
static bool isISO(Layout layout)
QString defaultAction(const QString &key)
static const int DPI_COUNT
static QString modeAction(int mode)
const QUuid & guid() const
static const int LIGHT_DOWN
static const int DPI_CYCLE_UP
int dpiInfo(QPoint &custom) const
QString getMacroPath()
KbBind::getMacroPath.
static QString lightAction(int type=LIGHT_UP_WRAP)
void handleNotificationChannel(bool start)
handleNotificationChannel sends commands to ckb-daemon for (de-) activating the notify channel...
static const int MODE_NEXT_WRAP
const QString & name() const
void noAction(const QString &key)
void macroDisplay()
Debug output for invalid macro Definitions.
QString macroTiming() const
macroTiming returns the macro key definition with original timing infos (the fifth and up to now last...
int programInfo(QString &onPress, QString &onRelease) const
static const int MODE_NEXT
void setAction(const QString &key, const QString &action)
int getMacroNumber()
KbBind::getMacroNumber.
static const int LIGHT_DOWN_WRAP
QString macroContent() const
macroContent returns the macro key definition only (the second part of the macro action).
static const int LIGHT_UP_WRAP
static const int LIGHT_UP
int findAnimIdx(const QUuid &guid) const