1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2024-12-23 01:06:11 +00:00

Clean code

This commit is contained in:
MatMoul 2016-10-30 01:03:14 +02:00
parent bcafbf8f62
commit 089ff25f3e
3 changed files with 1 additions and 63 deletions

View File

@ -155,23 +155,6 @@ bool Keyboard::getKeyAddress(Key key, KeyAddress &keyAddress) {
case Key::backspace: keyAddress.id = 0x2a; break;
case Key::tab: keyAddress.id = 0x2b; break;
case Key::space: keyAddress.id = 0x2c; break;
/*
case Key::apostrophe: keyAddress.id = 0x2d; break; // *
case Key::tilde: keyAddress.id = 0x2e; break;
case Key::open_bracket: keyAddress.id = 0x2f; break;
case Key::close_bracket: keyAddress.id = 0x30; break;
case Key::unknown: keyAddress.id = 0x31; break; // *
case Key::dollar: keyAddress.id = 0x32; break; // *
case Key::eaigu: keyAddress.id = 0x33; break; // *
case Key::semicolon: keyAddress.id = 0x33; break; // *
case Key::agrave: keyAddress.id = 0x34; break; // *
case Key::degree: keyAddress.id = 0x35; break; // *
case Key::comma: keyAddress.id = 0x36; break;
case Key::dot: keyAddress.id = 0x37; break;
case Key::minus: keyAddress.id = 0x38; break;
*/
case Key::minus: keyAddress.id = 0x2d; break; // *
case Key::equal: keyAddress.id = 0x2e; break;
case Key::open_bracket: keyAddress.id = 0x2f; break;
@ -184,7 +167,6 @@ bool Keyboard::getKeyAddress(Key key, KeyAddress &keyAddress) {
case Key::comma: keyAddress.id = 0x36; break;
case Key::period: keyAddress.id = 0x37; break;
case Key::slash: keyAddress.id = 0x38; break;
case Key::caps_lock: keyAddress.id = 0x39; break;
case Key::f1: keyAddress.id = 0x3a; break;
case Key::f2: keyAddress.id = 0x3b; break;
@ -228,9 +210,7 @@ bool Keyboard::getKeyAddress(Key key, KeyAddress &keyAddress) {
case Key::num_9: keyAddress.id = 0x61; break;
case Key::num_0: keyAddress.id = 0x62; break;
case Key::num_dot: keyAddress.id = 0x63; break;
case Key::intl_backslash: keyAddress.id = 0x64; break;
case Key::menu: keyAddress.id = 0x65; break;
case Key::ctrl_left: keyAddress.id = 0xe0; break;
case Key::shift_left: keyAddress.id = 0xe1; break;
@ -309,22 +289,6 @@ bool Keyboard::parseKey(std::string key, KeyAddress &keyAddress) {
else if (key == "back" || key == "backspace") parsedKey = Key::backspace;
else if (key == "tab") parsedKey = Key::tab;
else if (key == "space") parsedKey = Key::space;
/*
else if (key == "'" || key == "?") parsedKey = Key::apostrophe;
else if (key == "tilde" || key == "^" || key == "~") parsedKey = Key::tilde;
else if (key == "open_bracket" || key == "openbracket" || key == "è" || key == "ü") parsedKey = Key::open_bracket;
else if (key == "close_bracket" || key == "closebracket" || key == "¨" || key == "!") parsedKey = Key::close_bracket;
else if (key == "unknown") parsedKey = Key::unknown; // Not on my keyboard
else if (key == "$" || key == "dollar") parsedKey = Key::dollar;
else if (key == ";" || key == "semicolon" || key == "é" || key == "ö") parsedKey = Key::semicolon;
else if (key == "à" || key == "ä") parsedKey = Key::agrave;
else if (key == "§" || key == "°") parsedKey = Key::degree;
else if (key == "," || key == "comma") parsedKey = Key::comma;
else if (key == "." || key == "dot") parsedKey = Key::dot;
else if (key == "-" || key == "minus") parsedKey = Key::minus;
*/
else if (key == "tilde" || key == "~") parsedKey = Key::tilde;
else if (key == "minus" || key == "-") parsedKey = Key::minus;
else if (key == "equal" || key == "=") parsedKey = Key::equal;
@ -337,8 +301,6 @@ bool Keyboard::parseKey(std::string key, KeyAddress &keyAddress) {
else if (key == "comma" || key == ",") parsedKey = Key::comma;
else if (key == "period" || key == ".") parsedKey = Key::period;
else if (key == "slash" || key == "/") parsedKey = Key::slash;
else if (key == "caps_lock" || key == "capslock") parsedKey = Key::caps_lock;
else if (key == "f1") parsedKey = Key::f1;
else if (key == "f2") parsedKey = Key::f2;
@ -382,10 +344,7 @@ bool Keyboard::parseKey(std::string key, KeyAddress &keyAddress) {
else if (key == "num9") parsedKey = Key::num_9;
else if (key == "num0") parsedKey = Key::num_0;
else if (key == "num." || key == "num_period" || key == "numperiod") parsedKey = Key::num_dot;
//else if (key == "<" || key == ">" || key == "\\" || key == "backslash") parsedKey = Key::backslash;
else if (key == "intl_backslash" || key == "<") parsedKey = Key::intl_backslash;
else if (key == "menu") parsedKey = Key::menu;
else if (key == "ctrl_left" || key == "ctrlleft" || key == "ctrll") parsedKey = Key::ctrl_left;
else if (key == "shift_left" || key == "shiftleft" || key == "shiftl") parsedKey = Key::shift_left;

View File

@ -27,10 +27,6 @@ class Keyboard {
open_bracket, close_bracket, backslash,
semicolon, quote, dollar,
intl_backslash, comma, period, slash
/*
unknown, egrave, eaigu, semicolon, agrave, dollar, apostrophe, degree, backslash, // Need best names
comma, dot, minus, open_bracket, close_bracket, tilde
*/
};
enum class KeyGroup { logo, indicators, multimedia, fkeys, modifiers, arrows, numeric, functions, keys};

View File

@ -11,7 +11,7 @@
using namespace std;
int lg_pid; // = 0xc331; // g810 by default
int lg_pid;
void usage() {
string appname = "g810-led";
@ -135,23 +135,6 @@ void listkeys() {
cout<<" comma\n";
cout<<" period\n";
cout<<" slash\n";
/*
cout<<" \n";
cout<<" Keys EN-US FR-CH\n";
cout<<" k1 : tilde §\n";
cout<<" k2 : minus '\n";
cout<<" k3 : = plus ^\n";
cout<<" k4 : [ è\n";
cout<<" k5 : ] !\n";
cout<<" k6 : \\ unknown\n";
cout<<" k7 : ; é\n";
cout<<" k8 : ' à\n";
cout<<" k9 : unknown $\n";
cout<<" k10 : unknown <\n";
cout<<" k11 : , ,\n";
cout<<" k12 : . .\n";
cout<<" k13 : / -\n";
*/
}
int commit() {