From d919b288431dda23e3add9d7b4d052c3a5d542be Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Tue, 31 Jul 2018 13:51:20 +0200 Subject: [PATCH 01/47] razerdefault22: fill empty spots on numpad --- data/matrix_layouts/razerdefault22.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index 8b18b8e..4157e26 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -94,7 +94,8 @@ {"label": null}, {"label": "4", "matrix": [3, 18]}, {"label": "5", "matrix": [3, 19]}, - {"label": "6", "matrix": [3, 20]} + {"label": "6", "matrix": [3, 20]}, + {"label": "+", "disabled": true} ], "row4": [ {"label": "M4", "matrix": [4, 0]}, @@ -133,7 +134,8 @@ {"label": "\ud83e\udc3b", "matrix": [5, 16]}, {"label": "\ud83e\udc3a", "matrix": [5, 17]}, {"label": "0", "width": 126, "matrix": [5, 19]}, - {"label": ",", "matrix": [5, 20]} + {"label": ",", "matrix": [5, 20]}, + {"label": "enter", "disabled": true} ] } } From afe40acd3664c7cdef1979fa2daae2041db829c3 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Wed, 29 Aug 2018 15:16:36 +0200 Subject: [PATCH 02/47] Add fr_FR layout for Razer Blade Stealth (Late 2017) Fixes #21 --- data/matrix_layouts/razerblade16.json | 97 +++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/data/matrix_layouts/razerblade16.json b/data/matrix_layouts/razerblade16.json index 4a0852a..e9a211a 100644 --- a/data/matrix_layouts/razerblade16.json +++ b/data/matrix_layouts/razerblade16.json @@ -189,6 +189,103 @@ {"label": "\ud83e\udc3b", "width": 29, "matrix": [5, 14]}, {"label": "\ud83e\udc3a", "width": 50, "matrix": [5, 15]} ] + }, + + "fr_FR": { + "row0": [ + {"label": "esc", "matrix": [0, 1]}, + {"label": "F1", "matrix": [0, 2]}, + {"label": "F2", "matrix": [0, 3]}, + {"label": "F3", "matrix": [0, 4]}, + {"label": "F4", "matrix": [0, 5]}, + {"label": "F5", "matrix": [0, 6]}, + {"label": "F6", "matrix": [0, 7]}, + {"label": "F7", "matrix": [0, 8]}, + {"label": "F8", "matrix": [0, 9]}, + {"label": "F9", "matrix": [0, 10]}, + {"label": "F10", "matrix": [0, 11]}, + {"label": "F11", "matrix": [0, 12]}, + {"label": "F12", "matrix": [0, 13]}, + {"label": "ins", "matrix": [0, 14]}, + {"label": "sup", "matrix": [0, 15]} + ], + "row1": [ + {"label": "\u00b2", "matrix": [1, 1]}, + {"label": "\u0026\u0026", "matrix": [1, 2]}, + {"label": "é", "matrix": [1, 3]}, + {"label": "\"", "matrix": [1, 4]}, + {"label": "'", "matrix": [1, 5]}, + {"label": "(", "matrix": [1, 6]}, + {"label": "-", "matrix": [1, 7]}, + {"label": "è", "matrix": [1, 8]}, + {"label": "-", "matrix": [1, 9]}, + {"label": "ç", "matrix": [1, 10]}, + {"label": "à", "matrix": [1, 11]}, + {"label": ")", "matrix": [1, 12]}, + {"label": "=", "matrix": [1, 13]}, + {"label": "backspace", "width": 126, "matrix": [1, 15]} + ], + "row2": [ + {"label": "tab", "width": 94, "matrix": [2, 1]}, + {"label": "A", "matrix": [2, 2]}, + {"label": "Z", "matrix": [2, 3]}, + {"label": "E", "matrix": [2, 4]}, + {"label": "R", "matrix": [2, 5]}, + {"label": "T", "matrix": [2, 6]}, + {"label": "Y", "matrix": [2, 7]}, + {"label": "U", "matrix": [2, 8]}, + {"label": "I", "matrix": [2, 9]}, + {"label": "O", "matrix": [2, 10]}, + {"label": "P", "matrix": [2, 11]}, + {"label": "^", "matrix": [2, 12]}, + {"label": "$", "matrix": [2, 13]}, + {"label": "entrée", "width": 92, "matrix": [3, 15]} + ], + "row3": [ + {"label": "\u21e9", "width": 109, "matrix": [3, 1]}, + {"label": "Q", "matrix": [3, 2]}, + {"label": "S", "matrix": [3, 3]}, + {"label": "D", "matrix": [3, 4]}, + {"label": "F", "matrix": [3, 5]}, + {"label": "G", "matrix": [3, 6]}, + {"label": "H", "matrix": [3, 7]}, + {"label": "J", "matrix": [3, 8]}, + {"label": "K", "matrix": [3, 9]}, + {"label": "L", "matrix": [3, 10]}, + {"label": "M", "matrix": [3, 11]}, + {"label": "ù", "matrix": [3, 12]}, + {"label": "*", "matrix": [3, 13]}, + {"label": "entrée", "width": 77, "disabled": true} + ], + "row4": [ + {"label": "\u21e7", "width": 80, "matrix": [4, 1]}, + {"label": "<", "matrix": [4, 2]}, + {"label": "W", "matrix": [4, 3]}, + {"label": "X", "matrix": [4, 4]}, + {"label": "C", "matrix": [4, 5]}, + {"label": "V", "matrix": [4, 6]}, + {"label": "B", "matrix": [4, 7]}, + {"label": "N", "matrix": [4, 8]}, + {"label": ",", "matrix": [4, 9]}, + {"label": ";", "matrix": [4, 10]}, + {"label": ":", "matrix": [4, 11]}, + {"label": "!", "matrix": [4, 12]}, + {"label": "\u21e7", "width": 172, "matrix": [4, 15]} + ], + "row5": [ + {"label": "ctrl", "width": 80, "matrix": [5, 1]}, + {"label": "fn", "matrix": [5, 2]}, + {"label": "\ud83d\udc27", "matrix": [5, 3]}, + {"label": "alt", "matrix": [5, 4]}, + {"label": "space", "width": 324, "disabled": true}, + {"label": "alt gr", "matrix": [5, 9]}, + {"label": "fn", "matrix": [5, 10]}, + {"label": "ctrl", "matrix": [5, 11]}, + {"label": "\ud83e\udc38", "width": 50, "matrix": [5, 12]}, + {"label": "\ud83e\udc39", "width": 27, "matrix": [5, 13]}, + {"label": "\ud83e\udc3b", "width": 27, "matrix": [5, 14]}, + {"label": "\ud83e\udc3a", "width": 50, "matrix": [5, 15]} + ] } } From eecf213870126f10b8677e1a9447ad8e49502d68 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 2 Sep 2018 11:30:45 +0200 Subject: [PATCH 03/47] Fix qdoc config for Qt 5.11 Also add a kind-of working meson target that can be invoked with 'ninja src/libopenrazer/docs/html' --- src/libopenrazer/docs/config.qdocconf | 2 ++ src/libopenrazer/docs/libopenrazermodule.h | 2 ++ src/libopenrazer/docs/meson.build | 9 +++++++++ src/libopenrazer/meson.build | 2 ++ 4 files changed, 15 insertions(+) create mode 100644 src/libopenrazer/docs/libopenrazermodule.h create mode 100644 src/libopenrazer/docs/meson.build diff --git a/src/libopenrazer/docs/config.qdocconf b/src/libopenrazer/docs/config.qdocconf index 5358444..cd4c4e6 100644 --- a/src/libopenrazer/docs/config.qdocconf +++ b/src/libopenrazer/docs/config.qdocconf @@ -1,5 +1,7 @@ project = libopenrazer +moduleheader = libopenrazermodule.h + headerdirs = .. sources = libopenrazer.qdoc sourcedirs = .. diff --git a/src/libopenrazer/docs/libopenrazermodule.h b/src/libopenrazer/docs/libopenrazermodule.h new file mode 100644 index 0000000..3dfdd72 --- /dev/null +++ b/src/libopenrazer/docs/libopenrazermodule.h @@ -0,0 +1,2 @@ +#include "../libopenrazer.h" +#include "../razercapability.h" diff --git a/src/libopenrazer/docs/meson.build b/src/libopenrazer/docs/meson.build new file mode 100644 index 0000000..7087629 --- /dev/null +++ b/src/libopenrazer/docs/meson.build @@ -0,0 +1,9 @@ +qdoc = find_program('qdoc') + +# TODO Fix up includes to work automatically (especially the gcc include) +mytarget = custom_target('docs', + output: 'html', + input : 'config.qdocconf', + command: [qdoc, '@INPUT@', '-I', meson.current_source_dir(), + '-I/usr/include/qt', '-I/usr/include/qt/QtCore', '-I/usr/include/qt/QtGui', '-I/usr/include/qt/QtDBus', '-I/usr/include/qt/QtXml', + '-I/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include']) diff --git a/src/libopenrazer/meson.build b/src/libopenrazer/meson.build index f1a8b03..59e1ea3 100644 --- a/src/libopenrazer/meson.build +++ b/src/libopenrazer/meson.build @@ -1,3 +1,5 @@ +subdir('docs') + # The name automatically gets "lib" prepended to "openrazer" -> "libopenrazer.so" libopenrazer_sources = ['libopenrazer.cpp', 'razercapability.cpp'] libopenrazer = shared_library('openrazer', From 44c678e06027e4bbd77dfa1772b52f26d38bde0d Mon Sep 17 00:00:00 2001 From: Jeremy Bernhardt Date: Wed, 29 Aug 2018 10:43:54 -0600 Subject: [PATCH 04/47] razerdefault22: Add en_US keymap --- data/matrix_layouts/razerdefault22.json | 142 +++++++++++++++++++++++- 1 file changed, 136 insertions(+), 6 deletions(-) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index 4157e26..eae5b9a 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -1,5 +1,5 @@ { - "de_DE": { + "en_US": { "row0": [ {"label": null}, {"label": "esc", "matrix": [0, 1]}, @@ -17,13 +17,143 @@ {"label": "F10", "matrix": [0, 12]}, {"label": "F11", "matrix": [0, 13]}, {"label": "F12", "matrix": [0, 14]}, - {"label": "druck", "matrix": [0, 15]}, - {"label": "rollen", "matrix": [0, 16]}, - {"label": "pause", "matrix": [0, 17]}, + {"label": "prt sc", "matrix": [0, 15]}, + {"label": "scr\nlk", "matrix": [0, 16]}, + {"label": "pause", "matrix": [0, 17]} + ], + "row1": [ + {"label": "M1", "matrix": [1, 0]}, + {"label": "`", "matrix": [1, 1]}, + {"label": "1", "matrix": [1, 2]}, + {"label": "2", "matrix": [1, 3]}, + {"label": "3", "matrix": [1, 4]}, + {"label": "4", "matrix": [1, 5]}, + {"label": "5", "matrix": [1, 6]}, + {"label": "6", "matrix": [1, 7]}, + {"label": "7", "matrix": [1, 8]}, + {"label": "8", "matrix": [1, 9]}, + {"label": "9", "matrix": [1, 10]}, + {"label": "0", "matrix": [1, 11]}, + {"label": "-", "matrix": [1, 12]}, + {"label": "=", "matrix": [1, 13]}, + {"label": "backspace", "width": 126, "matrix": [1, 14]}, + {"label": "ins", "matrix": [1, 15]}, + {"label": "home", "matrix": [1, 16]}, + {"label": "page\nup", "matrix": [1, 17]}, + {"label": "num\nlk", "matrix": [1, 18]}, + {"label": "/", "matrix": [1, 19]}, + {"label": "*", "matrix": [1, 20]}, + {"label": "-", "matrix": [1, 21]} + ], + "row2": [ + {"label": "M2", "matrix": [2, 0]}, + {"label": "tab", "width": 94, "matrix": [2, 1]}, + {"label": "Q", "matrix": [2, 2]}, + {"label": "W", "matrix": [2, 3]}, + {"label": "E", "matrix": [2, 4]}, + {"label": "R", "matrix": [2, 5]}, + {"label": "T", "matrix": [2, 6]}, + {"label": "Y", "matrix": [2, 7]}, + {"label": "U", "matrix": [2, 8]}, + {"label": "I", "matrix": [2, 9]}, + {"label": "O", "matrix": [2, 10]}, + {"label": "P", "matrix": [2, 11]}, + {"label": "[", "matrix": [2, 12]}, + {"label": "]", "matrix": [2, 13]}, + {"label": "\\", "width": 92, "matrix": [2, 14]}, + {"label": "del", "matrix": [2, 15]}, + {"label": "end", "matrix": [2, 16]}, + {"label": "page\ndown", "matrix": [2, 17]}, + {"label": "7", "matrix": [2, 18]}, + {"label": "8", "matrix": [2, 19]}, + {"label": "9", "matrix": [2, 20]}, + {"label": "+", "height": 126, "matrix": [2, 21]} + ], + "row3": [ + {"label": "M3", "matrix": [3, 0]}, + {"label": "caps\nlk", "width": 109, "matrix": [3, 1]}, + {"label": "A", "matrix": [3, 2]}, + {"label": "S", "matrix": [3, 3]}, + {"label": "D", "matrix": [3, 4]}, + {"label": "F", "matrix": [3, 5]}, + {"label": "G", "matrix": [3, 6]}, + {"label": "H", "matrix": [3, 7]}, + {"label": "J", "matrix": [3, 8]}, + {"label": "K", "matrix": [3, 9]}, + {"label": "L", "matrix": [3, 10]}, + {"label": ";", "matrix": [3, 11]}, + {"label": "'", "matrix": [3, 12]}, + {"label": "enter", "width": 143, "matrix": [3, 14]}, {"label": null}, {"label": null}, {"label": null}, - {"label": null} + {"label": "4", "matrix": [3, 18]}, + {"label": "5", "matrix": [3, 19]}, + {"label": "6", "matrix": [3, 20]}, + {"label": "+", "disabled": true} + ], + "row4": [ + {"label": "M4", "matrix": [4, 0]}, + {"label": "shift", "width": 146, "matrix": [4, 1]}, + {"label": "Z", "matrix": [4, 3]}, + {"label": "X", "matrix": [4, 4]}, + {"label": "C", "matrix": [4, 5]}, + {"label": "V", "matrix": [4, 6]}, + {"label": "B", "matrix": [4, 7]}, + {"label": "N", "matrix": [4, 8]}, + {"label": "M", "matrix": [4, 9]}, + {"label": ",", "matrix": [4, 10]}, + {"label": ".", "matrix": [4, 11]}, + {"label": "/", "matrix": [4, 12]}, + {"label": "shift", "width": 172, "matrix": [4, 14]}, + {"label": null}, + {"label": "\ud83e\udc39", "matrix": [4, 16]}, + {"label": null}, + {"label": "1", "matrix": [4, 18]}, + {"label": "2", "matrix": [4, 19]}, + {"label": "3", "matrix": [4, 20]}, + {"label": "enter", "height": 126, "matrix": [4, 21]} + ], + "row5": [ + {"label": "M5", "matrix": [5, 0]}, + {"label": "ctrl", "width": 94, "matrix": [5, 1]}, + {"label": "\ud83d\udc27", "matrix": [5, 2]}, + {"label": "alt", "width": 94, "matrix": [5, 3]}, + {"label": "space", "width": 388}, + {"label": "alt", "width": 94, "matrix": [5, 11]}, + {"label": "fn"}, + {"label": "\u2630", "matrix": [5, 13]}, + {"label": "ctrl", "width": 92, "matrix": [5, 14]}, + {"label": "\ud83e\udc38", "matrix": [5, 15]}, + {"label": "\ud83e\udc3b", "matrix": [5, 16]}, + {"label": "\ud83e\udc3a", "matrix": [5, 17]}, + {"label": "0", "width": 126, "matrix": [5, 19]}, + {"label": ".", "matrix": [5, 20]}, + {"label": "enter", "disabled": true} + ] + }, + + "de_DE": { + "row0": [ + {"label": null}, + {"label": "esc", "matrix": [0, 1]}, + {"label": null}, + {"label": null}, + {"label": "F1", "matrix": [0, 3]}, + {"label": "F2", "matrix": [0, 4]}, + {"label": "F3", "matrix": [0, 5]}, + {"label": "F4", "matrix": [0, 6]}, + {"label": "F5", "matrix": [0, 7]}, + {"label": "F6", "matrix": [0, 8]}, + {"label": "F7", "matrix": [0, 9]}, + {"label": "F8", "matrix": [0, 10]}, + {"label": "F9", "matrix": [0, 11]}, + {"label": "F10", "matrix": [0, 12]}, + {"label": "F11", "matrix": [0, 13]}, + {"label": "F12", "matrix": [0, 14]}, + {"label": "druck", "matrix": [0, 15]}, + {"label": "rollen", "matrix": [0, 16]}, + {"label": "pause", "matrix": [0, 17]} ], "row1": [ {"label": "M1", "matrix": [1, 0]}, @@ -44,7 +174,7 @@ {"label": "einfg", "matrix": [1, 15]}, {"label": "pos 1", "matrix": [1, 16]}, {"label": "bild\u25b2", "matrix": [1, 17]}, - {"label": "num lk", "matrix": [1, 18]}, + {"label": "num\nlk", "matrix": [1, 18]}, {"label": "/", "matrix": [1, 19]}, {"label": "*", "matrix": [1, 20]}, {"label": "-", "matrix": [1, 21]} From 2666d24423f73a9ab29eb7acc30aa3c528ae6451 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Oct 2018 19:52:18 +0200 Subject: [PATCH 05/47] Release version 0.8 --- CMakeLists.txt | 2 +- data/xyz.z3ntu.razergenie.appdata.xml | 24 ++++++++++++++++++++++++ meson.build | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b351544..a0eb18e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra") -set(version 0.7) +set(version 0.8) set(datadir ${CMAKE_INSTALL_PREFIX}/share/razergenie) find_package(ECM REQUIRED NO_MODULE) diff --git a/data/xyz.z3ntu.razergenie.appdata.xml b/data/xyz.z3ntu.razergenie.appdata.xml index 73e1d07..79c8f33 100644 --- a/data/xyz.z3ntu.razergenie.appdata.xml +++ b/data/xyz.z3ntu.razergenie.appdata.xml @@ -19,6 +19,30 @@ https://github.com/z3ntu/RazerGenie/wiki/Translations + + +

RazerGenie:

+
    +
  • Implement backlight effects for Razer Naga Epic Chroma
  • +
  • Fix missing options on Razer Nostromo
  • +
  • Implement preferences to control downloading of device images
  • +
  • Fix alt-key mapping in razerblade25
  • +
  • Add en_US layout for Razer Blade Stealth (Late 2017)
  • +
  • Add fr_FR layout for Razer Blade Stealth (Late 2017)
  • +
  • razerdefault22: Add en_US keymap
  • +
  • razerdefault22: fill empty spots on numpad
  • +
  • Fix memory leaks
  • +
+

libopenrazer:

+
    +
  • Finish rename of namespace to libopenrazer
  • +
  • Implement backlight methods used by Razer Naga Epic Chroma
  • +
  • QColor where possible, rebrand LightingLocation
  • +
  • Document libopenrazer, can be built with qdoc
  • +
  • Fix memory leaks
  • +
+
+

RazerGenie:

diff --git a/meson.build b/meson.build index 533e653..3d78a52 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('razergenie', 'cpp', default_options : ['cpp_std=c++11']) -razergenie_version = '0.7' +razergenie_version = '0.8' libopenrazer_version = '0.0.1' qt5 = import('qt5') From 72d58d7d4210c3878a3d5545c0a7bd364a0af76e Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Oct 2018 20:05:30 +0200 Subject: [PATCH 06/47] Make qdoc dependency optional --- src/libopenrazer/docs/meson.build | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libopenrazer/docs/meson.build b/src/libopenrazer/docs/meson.build index 7087629..12f005c 100644 --- a/src/libopenrazer/docs/meson.build +++ b/src/libopenrazer/docs/meson.build @@ -1,9 +1,11 @@ -qdoc = find_program('qdoc') +qdoc = find_program('qdoc', required : false) -# TODO Fix up includes to work automatically (especially the gcc include) -mytarget = custom_target('docs', - output: 'html', - input : 'config.qdocconf', - command: [qdoc, '@INPUT@', '-I', meson.current_source_dir(), - '-I/usr/include/qt', '-I/usr/include/qt/QtCore', '-I/usr/include/qt/QtGui', '-I/usr/include/qt/QtDBus', '-I/usr/include/qt/QtXml', - '-I/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include']) +if qdoc.found() + # TODO Fix up includes to work automatically (especially the gcc include) + custom_target('docs', + output: 'html', + input : 'config.qdocconf', + command: [qdoc, '@INPUT@', '-I', meson.current_source_dir(), + '-I/usr/include/qt', '-I/usr/include/qt/QtCore', '-I/usr/include/qt/QtGui', '-I/usr/include/qt/QtDBus', '-I/usr/include/qt/QtXml', + '-I/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include']) +endif From 2f41ab4ac5079a703aff2070811967a2a1b3ce91 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Oct 2018 20:09:05 +0200 Subject: [PATCH 07/47] Release version 0.8.1 --- CMakeLists.txt | 2 +- data/xyz.z3ntu.razergenie.appdata.xml | 8 ++++++++ meson.build | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0eb18e..c789b88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra") -set(version 0.8) +set(version 0.8.1) set(datadir ${CMAKE_INSTALL_PREFIX}/share/razergenie) find_package(ECM REQUIRED NO_MODULE) diff --git a/data/xyz.z3ntu.razergenie.appdata.xml b/data/xyz.z3ntu.razergenie.appdata.xml index 79c8f33..7c065db 100644 --- a/data/xyz.z3ntu.razergenie.appdata.xml +++ b/data/xyz.z3ntu.razergenie.appdata.xml @@ -19,6 +19,14 @@ https://github.com/z3ntu/RazerGenie/wiki/Translations + + +

libopenrazer:

+
    +
  • Make qdoc dependency optional (used for docs)
  • +
+
+

RazerGenie:

diff --git a/meson.build b/meson.build index 3d78a52..588b4fa 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('razergenie', 'cpp', default_options : ['cpp_std=c++11']) -razergenie_version = '0.8' +razergenie_version = '0.8.1' libopenrazer_version = '0.0.1' qt5 = import('qt5') From 2b28b489c1661d97ecff3c5b13d4c254c870733d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 17 Nov 2018 17:46:26 -0500 Subject: [PATCH 08/47] razerdefault22: fix Space and FN keys --- data/matrix_layouts/razerdefault22.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index eae5b9a..c2ed62b 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -119,9 +119,9 @@ {"label": "ctrl", "width": 94, "matrix": [5, 1]}, {"label": "\ud83d\udc27", "matrix": [5, 2]}, {"label": "alt", "width": 94, "matrix": [5, 3]}, - {"label": "space", "width": 388}, + {"label": "space", "width": 388, "matrix": [5, 7]}, {"label": "alt", "width": 94, "matrix": [5, 11]}, - {"label": "fn"}, + {"label": "fn", "matrix": [5, 12]}, {"label": "\u2630", "matrix": [5, 13]}, {"label": "ctrl", "width": 92, "matrix": [5, 14]}, {"label": "\ud83e\udc38", "matrix": [5, 15]}, From 3b05ebabfdc109312d270f6651301a13a5ccf01c Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Fri, 18 Jan 2019 16:52:27 +0100 Subject: [PATCH 09/47] Update 'How to compile' section in README --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bc23566..43f4eb7 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,12 @@ If you are using a distribution not listed here please let me know and I'll try ## How to compile This is a quick and easy way to test the RazerGenie without installing it or to test the master branch. ``` -mkdir build && cd build -meson .. -# If you want to enable experimental (=unfinished) features -meson configure -Denable_experimental=true -ninja -./src/razergenie -# You could install it with 'ninja install' but that's not recommended as files get left in the filesystem (use a distribution package, if available!). +meson builddir +ninja -C builddir +./builddir/src/razergenie +# You could install it with 'ninja install' but that's not recommended +# as the installation prefix has to be adjusted and files can get left +# in the filesystem (use a distribution package, if available!). ``` ## Bugs From 6db3844a783cd4da4a7cd779fb02a292e6e394f6 Mon Sep 17 00:00:00 2001 From: nightsky30 <6024315+nightsky30@users.noreply.github.com> Date: Tue, 7 May 2019 21:00:42 -0500 Subject: [PATCH 10/47] Fix typo breaking setScrollBreathDual bool Device::setScrollBreathDual(QColor color, QColor color2) was creating a QBusMessage with: QDBusMessage m = prepareDeviceQDBusMessage("razer.device.lighting.scroll", "setScrollBreathSingle"); Changed it to: QDBusMessage m = prepareDeviceQDBusMessage("razer.device.lighting.scroll", "setScrollBreathDual"); --- src/libopenrazer/libopenrazer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libopenrazer/libopenrazer.cpp b/src/libopenrazer/libopenrazer.cpp index 6eb6f69..94d9c93 100644 --- a/src/libopenrazer/libopenrazer.cpp +++ b/src/libopenrazer/libopenrazer.cpp @@ -1796,7 +1796,7 @@ bool Device::setScrollBreathSingle(QColor color) */ bool Device::setScrollBreathDual(QColor color, QColor color2) { - QDBusMessage m = prepareDeviceQDBusMessage("razer.device.lighting.scroll", "setScrollBreathSingle"); + QDBusMessage m = prepareDeviceQDBusMessage("razer.device.lighting.scroll", "setScrollBreathDual"); QList args; args.append(color.red()); args.append(color.green()); From 1693ebb05bbd5c1e5f54b91a99a1badf46bedc98 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Jul 2019 18:35:44 +0200 Subject: [PATCH 11/47] libopenrazer: add availableDPI function --- src/libopenrazer/libopenrazer.cpp | 12 ++++++++++++ src/libopenrazer/libopenrazer.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/libopenrazer/libopenrazer.cpp b/src/libopenrazer/libopenrazer.cpp index 94d9c93..ce394de 100644 --- a/src/libopenrazer/libopenrazer.cpp +++ b/src/libopenrazer/libopenrazer.cpp @@ -467,6 +467,7 @@ void Device::setupCapabilities() capabilities.insert("firmware_version", true); capabilities.insert("serial", true); capabilities.insert("dpi", hasCapabilityInternal("razer.device.dpi", "setDPI")); + capabilities.insert("available_dpi", hasCapabilityInternal("razer.device.dpi", "availableDPI")); capabilities.insert("brightness", hasCapabilityInternal("razer.device.lighting.brightness")); capabilities.insert("get_brightness", hasCapabilityInternal("razer.device.lighting.brightness", "setBrightness")); capabilities.insert("battery", hasCapabilityInternal("razer.device.power")); @@ -894,6 +895,17 @@ int Device::maxDPI() return QDBusMessageToInt(m); } +/*! + * \fn QList libopenrazer::Device::availableDPI() + * + * Returns the DPI values that can be chosen. + */ +QList Device::availableDPI() +{ + QDBusMessage m = prepareDeviceQDBusMessage("razer.device.dpi", "availableDPI"); + return QDBusMessageToIntArray(m); +} + // BATTERY /*! * \fn bool libopenrazer::Device::isCharging() diff --git a/src/libopenrazer/libopenrazer.h b/src/libopenrazer/libopenrazer.h index 75cb7fc..4b3a7fb 100644 --- a/src/libopenrazer/libopenrazer.h +++ b/src/libopenrazer/libopenrazer.h @@ -172,6 +172,7 @@ class Device bool setDPI(int dpi_x, int dpi_y); QList getDPI(); int maxDPI(); + QList availableDPI(); // --- BATTERY ---- bool isCharging(); From 0b0ce04b626f215402c499ebbe224e0575b5635b Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Jul 2019 18:36:27 +0200 Subject: [PATCH 12/47] Use a combobox for DeathAdder 3.5G Previously, all devices supported setting any value as DPI you wanted, but the DeathAdder 3.5G only has 4 values available so add support for that. --- src/razergenie.cpp | 30 +++++++++++++++++++++++++++++- src/razergenie.h | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/razergenie.cpp b/src/razergenie.cpp index 7d7d984..2462dde 100644 --- a/src/razergenie.cpp +++ b/src/razergenie.cpp @@ -597,7 +597,7 @@ void RazerGenie::addDeviceToGui(const QString &serial) } /* DPI sliders */ - if(currentDevice->hasCapability("dpi")) { + if(currentDevice->hasCapability("dpi") && !currentDevice->hasCapability("available_dpi")) { // HBoxes QHBoxLayout *dpiXHBox = new QHBoxLayout(); QHBoxLayout *dpiYHBox = new QHBoxLayout(); @@ -681,6 +681,23 @@ void RazerGenie::addDeviceToGui(const QString &serial) verticalLayout->addLayout(dpiYHBox); } + /* DPI dropdown */ + if(currentDevice->hasCapability("dpi") && currentDevice->hasCapability("available_dpi")) { + QLabel *dpiHeader = new QLabel(tr("DPI"), widget); + dpiHeader->setFont(headerFont); + verticalLayout->addWidget(dpiHeader); + + QComboBox *dpiComboBox = new QComboBox; + QList availableDPI = currentDevice->availableDPI(); + foreach(int dpivalue, availableDPI) { + dpiComboBox->addItem(QString("%1 DPI").arg(dpivalue), dpivalue); + } + dpiComboBox->setCurrentText(QString("%1 DPI").arg(currentDevice->getDPI()[0])); + verticalLayout->addWidget(dpiComboBox); + + connect(dpiComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &RazerGenie::dpiComboChanged); + } + /* Poll rate */ if(currentDevice->hasCapability("poll_rate")) { QLabel *pollRateHeader = new QLabel(tr("Polling rate"), widget); @@ -1034,6 +1051,17 @@ void RazerGenie::dpiChanged(int orig_value) dpitextbox->setText(QString::number(value)); } +void RazerGenie::dpiComboChanged(int /* index */) +{ + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + QComboBox *sender = qobject_cast(QObject::sender()); + // Indicate that DPI-Y should not be used with -1 + dev->setDPI(sender->currentData().toInt(), -1); +} + void RazerGenie::applyEffectStandardLoc(QString identifier, libopenrazer::Device *device) { libopenrazer::Device::LightingLocation zone = libopenrazer::Device::Lighting; diff --git a/src/razergenie.h b/src/razergenie.h index b038b86..8774b9d 100644 --- a/src/razergenie.h +++ b/src/razergenie.h @@ -56,6 +56,7 @@ public slots: // DPI checkbox & slider void dpiChanged(int value); + void dpiComboChanged(int /* index */); void dpiSyncCheckbox(bool checked); // Poll combobox From 2c0496e1c239068ff764a3a5bc1cb1b878fdf62c Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Mon, 29 Jul 2019 14:55:05 +0200 Subject: [PATCH 13/47] UI: use 'preferences-system' icon and make it bigger The 'configure' icon is not a standard icon theme icon and probably only available in the Breeze theme, so the preferences button was basically invisible for many users. Fix this by using the 'preferences-system' icon; and also increase the size of the icon from 16x16 to 20x20 to make it more visible. Fixes #50 --- ui/razergenie.ui | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/razergenie.ui b/ui/razergenie.ui index 1be255b..3ad4c83 100644 --- a/ui/razergenie.ui +++ b/ui/razergenie.ui @@ -71,8 +71,13 @@ - - .. + + + + + 20 + 20 + true From 0df8624a1f7d9395ea61d4fdc153e2787fa5f71d Mon Sep 17 00:00:00 2001 From: Alexander Olofsson Date: Sun, 7 Oct 2018 18:46:45 +0200 Subject: [PATCH 14/47] razerdefault22: Add Nordic layout --- data/matrix_layouts/razerdefault22.json | 136 ++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index c2ed62b..53475e2 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -267,5 +267,141 @@ {"label": ",", "matrix": [5, 20]}, {"label": "enter", "disabled": true} ] + }, + + "Nordic": { + "row0": [ + {"label": null}, + {"label": "esc", "matrix": [0, 1]}, + {"label": null}, + {"label": null}, + {"label": "F1", "matrix": [0, 3]}, + {"label": "F2", "matrix": [0, 4]}, + {"label": "F3", "matrix": [0, 5]}, + {"label": "F4", "matrix": [0, 6]}, + {"label": "F5", "matrix": [0, 7]}, + {"label": "F6", "matrix": [0, 8]}, + {"label": "F7", "matrix": [0, 9]}, + {"label": "F8", "matrix": [0, 10]}, + {"label": "F9", "matrix": [0, 11]}, + {"label": "F10", "matrix": [0, 12]}, + {"label": "F11", "matrix": [0, 13]}, + {"label": "F12", "matrix": [0, 14]}, + {"label": "prt sc\nsys rq", "matrix": [0, 15]}, + {"label": "scr lk", "matrix": [0, 16]}, + {"label": "pause", "matrix": [0, 17]} + ], + "row1": [ + {"label": "M1", "matrix": [1, 0]}, + {"label": "§", "matrix": [1, 1]}, + {"label": "1", "matrix": [1, 2]}, + {"label": "2", "matrix": [1, 3]}, + {"label": "3", "matrix": [1, 4]}, + {"label": "4", "matrix": [1, 5]}, + {"label": "5", "matrix": [1, 6]}, + {"label": "6", "matrix": [1, 7]}, + {"label": "7", "matrix": [1, 8]}, + {"label": "8", "matrix": [1, 9]}, + {"label": "9", "matrix": [1, 10]}, + {"label": "0", "matrix": [1, 11]}, + {"label": "+", "matrix": [1, 12]}, + {"label": "\u00b4", "matrix": [1, 13]}, + {"label": "backspace", "width": 126, "matrix": [1, 14]}, + {"label": "ins", "matrix": [1, 15]}, + {"label": "home", "matrix": [1, 16]}, + {"label": "page\nup", "matrix": [1, 17]}, + {"label": "num\nlk", "matrix": [1, 18]}, + {"label": "/", "matrix": [1, 19]}, + {"label": "*", "matrix": [1, 20]}, + {"label": "-", "matrix": [1, 21]} + ], + "row2": [ + {"label": "M2", "matrix": [2, 0]}, + {"label": "tab", "width": 94, "matrix": [2, 1]}, + {"label": "Q", "matrix": [2, 2]}, + {"label": "W", "matrix": [2, 3]}, + {"label": "E", "matrix": [2, 4]}, + {"label": "R", "matrix": [2, 5]}, + {"label": "T", "matrix": [2, 6]}, + {"label": "Y", "matrix": [2, 7]}, + {"label": "U", "matrix": [2, 8]}, + {"label": "I", "matrix": [2, 9]}, + {"label": "O", "matrix": [2, 10]}, + {"label": "P", "matrix": [2, 11]}, + {"label": "\u00c5", "matrix": [2, 12]}, + {"label": "\u0308", "matrix": [2, 13]}, + {"label": "enter", "width": 92, "matrix": [3, 14]}, + {"label": "del", "matrix": [2, 15]}, + {"label": "end", "matrix": [2, 16]}, + {"label": "page\ndown", "matrix": [2, 17]}, + {"label": "7", "matrix": [2, 18]}, + {"label": "8", "matrix": [2, 19]}, + {"label": "9", "matrix": [2, 20]}, + {"label": "+", "height": 126, "matrix": [2, 21]} + ], + "row3": [ + {"label": "M3", "matrix": [3, 0]}, + {"label": "caps", "width": 109, "matrix": [3, 1]}, + {"label": "A", "matrix": [3, 2]}, + {"label": "S", "matrix": [3, 3]}, + {"label": "D", "matrix": [3, 4]}, + {"label": "F", "matrix": [3, 5]}, + {"label": "G", "matrix": [3, 6]}, + {"label": "H", "matrix": [3, 7]}, + {"label": "J", "matrix": [3, 8]}, + {"label": "K", "matrix": [3, 9]}, + {"label": "L", "matrix": [3, 10]}, + {"label": "\u00d6", "matrix": [3, 11]}, + {"label": "\u00c4", "matrix": [3, 12]}, + {"label": "'", "matrix": [3, 13]}, + {"label": "enter", "width": 77, "disabled": true}, + {"label": null}, + {"label": null}, + {"label": null}, + {"label": "4", "matrix": [3, 18]}, + {"label": "5", "matrix": [3, 19]}, + {"label": "6", "matrix": [3, 20]}, + {"label": "+", "disabled": true} + ], + "row4": [ + {"label": "M4", "matrix": [4, 0]}, + {"label": "shift", "width": 80, "matrix": [4, 1]}, + {"label": "<", "matrix": [4, 2]}, + {"label": "Z", "matrix": [4, 3]}, + {"label": "X", "matrix": [4, 4]}, + {"label": "C", "matrix": [4, 5]}, + {"label": "V", "matrix": [4, 6]}, + {"label": "B", "matrix": [4, 7]}, + {"label": "N", "matrix": [4, 8]}, + {"label": "M", "matrix": [4, 9]}, + {"label": ",", "matrix": [4, 10]}, + {"label": ".", "matrix": [4, 11]}, + {"label": "-", "matrix": [4, 12]}, + {"label": "shift", "width": 172, "matrix": [4, 14]}, + {"label": null}, + {"label": "\u2191", "matrix": [4, 16]}, + {"label": null}, + {"label": "1", "matrix": [4, 18]}, + {"label": "2", "matrix": [4, 19]}, + {"label": "3", "matrix": [4, 20]}, + {"label": "enter", "height": 126, "matrix": [4, 21]} + ], + "row5": [ + {"label": "M5", "matrix": [5, 0]}, + {"label": "ctrl", "width": 94, "matrix": [5, 1]}, + {"label": "\ud83d\udc27", "matrix": [5, 2]}, + {"label": "alt", "width": 94, "matrix": [5, 3]}, + {"label": "space", "width": 388}, + {"label": "alt gr", "width": 94, "matrix": [5, 11]}, + {"label": "fn"}, + {"label": "\u2630", "matrix": [5, 13]}, + {"label": "ctrl", "width": 92, "matrix": [5, 14]}, + {"label": "\u2190", "matrix": [5, 15]}, + {"label": "\u2193", "matrix": [5, 16]}, + {"label": "\u2192", "matrix": [5, 17]}, + {"label": "0", "width": 126, "matrix": [5, 19]}, + {"label": ",", "matrix": [5, 20]}, + {"label": "enter", "disabled": true} + ] } } From 02fe6c1da0bbbdd43c3354cffb0c5092651decb1 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Thu, 27 Dec 2018 13:06:42 +0100 Subject: [PATCH 15/47] razerdefault22: Add fr_FR keymap - 'space bar' matrix assigned to [5, 7] to support BlackWidow Chroma v2 RGB - still no 'razer logo' support for BlackWidow Chroma V2 --- data/matrix_layouts/razerdefault22.json | 136 ++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index 53475e2..305b789 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -403,5 +403,141 @@ {"label": ",", "matrix": [5, 20]}, {"label": "enter", "disabled": true} ] + }, + + "fr_FR": { + "row0": [ + {"label": null}, + {"label": "esc", "matrix": [0, 1]}, + {"label": null}, + {"label": null}, + {"label": "F1", "matrix": [0, 3]}, + {"label": "F2", "matrix": [0, 4]}, + {"label": "F3", "matrix": [0, 5]}, + {"label": "F4", "matrix": [0, 6]}, + {"label": "F5", "matrix": [0, 7]}, + {"label": "F6", "matrix": [0, 8]}, + {"label": "F7", "matrix": [0, 9]}, + {"label": "F8", "matrix": [0, 10]}, + {"label": "F9", "matrix": [0, 11]}, + {"label": "F10", "matrix": [0, 12]}, + {"label": "F11", "matrix": [0, 13]}, + {"label": "F12", "matrix": [0, 14]}, + {"label": "impr.", "matrix": [0, 15]}, + {"label": "arrêt", "matrix": [0, 16]}, + {"label": "pause", "matrix": [0, 17]} + ], + "row1": [ + {"label": "M1", "matrix": [1, 0]}, + {"label": "²", "matrix": [1, 1]}, + {"label": "1", "matrix": [1, 2]}, + {"label": "2", "matrix": [1, 3]}, + {"label": "3", "matrix": [1, 4]}, + {"label": "4", "matrix": [1, 5]}, + {"label": "5", "matrix": [1, 6]}, + {"label": "6", "matrix": [1, 7]}, + {"label": "7", "matrix": [1, 8]}, + {"label": "8", "matrix": [1, 9]}, + {"label": "9", "matrix": [1, 10]}, + {"label": "0", "matrix": [1, 11]}, + {"label": ")", "matrix": [1, 12]}, + {"label": "=", "matrix": [1, 13]}, + {"label": "retour", "width": 126, "matrix": [1, 14]}, + {"label": "inser", "matrix": [1, 15]}, + {"label": "\u2196", "matrix": [1, 16]}, + {"label": "pg \u25b2", "matrix": [1, 17]}, + {"label": "ver num", "matrix": [1, 18]}, + {"label": "/", "matrix": [1, 19]}, + {"label": "*", "matrix": [1, 20]}, + {"label": "-", "matrix": [1, 21]} + ], + "row2": [ + {"label": "M2", "matrix": [2, 0]}, + {"label": "tab", "width": 94, "matrix": [2, 1]}, + {"label": "A", "matrix": [2, 2]}, + {"label": "Z", "matrix": [2, 3]}, + {"label": "E", "matrix": [2, 4]}, + {"label": "R", "matrix": [2, 5]}, + {"label": "T", "matrix": [2, 6]}, + {"label": "Y", "matrix": [2, 7]}, + {"label": "U", "matrix": [2, 8]}, + {"label": "I", "matrix": [2, 9]}, + {"label": "O", "matrix": [2, 10]}, + {"label": "P", "matrix": [2, 11]}, + {"label": "^", "matrix": [2, 12]}, + {"label": "$", "matrix": [2, 13]}, + {"label": "entrée", "width": 92, "matrix": [3, 14]}, + {"label": "suppr", "matrix": [2, 15]}, + {"label": "fin", "matrix": [2, 16]}, + {"label": "pg \u25bc", "matrix": [2, 17]}, + {"label": "7", "matrix": [2, 18]}, + {"label": "8", "matrix": [2, 19]}, + {"label": "9", "matrix": [2, 20]}, + {"label": "+", "height": 126, "matrix": [2, 21]} + ], + "row3": [ + {"label": "M3", "matrix": [3, 0]}, + {"label": "verr. maj.", "width": 109, "matrix": [3, 1]}, + {"label": "Q", "matrix": [3, 2]}, + {"label": "S", "matrix": [3, 3]}, + {"label": "D", "matrix": [3, 4]}, + {"label": "F", "matrix": [3, 5]}, + {"label": "G", "matrix": [3, 6]}, + {"label": "H", "matrix": [3, 7]}, + {"label": "J", "matrix": [3, 8]}, + {"label": "K", "matrix": [3, 9]}, + {"label": "L", "matrix": [3, 10]}, + {"label": "M", "matrix": [3, 11]}, + {"label": "\u00D9", "matrix": [3, 12]}, + {"label": "*", "matrix": [3, 13]}, + {"label": "entrée", "width": 77, "disabled": true}, + {"label": null}, + {"label": null}, + {"label": null}, + {"label": "4", "matrix": [3, 18]}, + {"label": "5", "matrix": [3, 19]}, + {"label": "6", "matrix": [3, 20]}, + {"label": "+", "disabled": true} + ], + "row4": [ + {"label": "M4", "matrix": [4, 0]}, + {"label": "\u21e7", "width": 80, "matrix": [4, 1]}, + {"label": "<", "matrix": [4, 2]}, + {"label": "W", "matrix": [4, 3]}, + {"label": "X", "matrix": [4, 4]}, + {"label": "C", "matrix": [4, 5]}, + {"label": "V", "matrix": [4, 6]}, + {"label": "B", "matrix": [4, 7]}, + {"label": "N", "matrix": [4, 8]}, + {"label": ",", "matrix": [4, 9]}, + {"label": ";", "matrix": [4, 10]}, + {"label": ":", "matrix": [4, 11]}, + {"label": "!", "matrix": [4, 12]}, + {"label": "\u21e7", "width": 172, "matrix": [4, 14]}, + {"label": null}, + {"label": "\u2191", "matrix": [4, 16]}, + {"label": null}, + {"label": "1", "matrix": [4, 18]}, + {"label": "2", "matrix": [4, 19]}, + {"label": "3", "matrix": [4, 20]}, + {"label": "entrée", "height": 126, "matrix": [4, 21]} + ], + "row5": [ + {"label": "M5", "matrix": [5, 0]}, + {"label": "ctrl", "width": 94, "matrix": [5, 1]}, + {"label": "\ud83d\udc27", "matrix": [5, 2]}, + {"label": "alt", "width": 94, "matrix": [5, 3]}, + {"label": "espace", "width": 388, "matrix": [5, 7]}, + {"label": "alt gr", "width": 94, "matrix": [5, 11]}, + {"label": "fn"}, + {"label": "\u2630", "matrix": [5, 13]}, + {"label": "ctrl", "width": 92, "matrix": [5, 14]}, + {"label": "\u2190", "matrix": [5, 15]}, + {"label": "\u2193", "matrix": [5, 16]}, + {"label": "\u2192", "matrix": [5, 17]}, + {"label": "0", "width": 126, "matrix": [5, 19]}, + {"label": ".", "matrix": [5, 20]}, + {"label": "entrée", "disabled": true} + ] } } From 082908c5729a199f1bb016c3700d44e324519a99 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sat, 28 Sep 2019 11:59:28 +0200 Subject: [PATCH 16/47] translations/de: update line numbers --- data/translations/de.ts | 79 +++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/data/translations/de.ts b/data/translations/de.ts index dc048b2..b5fa32c 100644 --- a/data/translations/de.ts +++ b/data/translations/de.ts @@ -187,8 +187,8 @@ Wenn du RazerGenie als flatpak ausführst, musst du trotzdem OpenRazer außerhal - - + + Report issue Problem melden @@ -203,175 +203,176 @@ Wenn du RazerGenie als flatpak ausführst, musst du trotzdem OpenRazer außerhal Aktivieren - + Daemon version: %1 Daemon Version: %1 - + The D-Bus connection was re-established. Die D-Bus Verbindung wurde wiederhergestellt. - + The D-Bus connection was lost, which probably means that the daemon has crashed. Die D-Bus Verbindung wurde unterbrochen, was wahrscheinlich heißt, dass der Daemon abgestürzt ist. - - + + Lighting Beleuchtung - + Lighting Logo Beleuchtung Logo - + Lighting Scroll Beleuchtung Scroll - + Lighting Backlight Beleuchtung Hintergrund - + Brightness Helligkeit - + Brightness Logo Helligkeit Logo - + Brightness Scroll Helligkeit Scroll - + Brightness Backlight Helligkeit Hintergrund - + Left Links - + Right Rechts - + Set Logo Active Logo aktiv setzen - + Set Scroll Active Scroll aktiv setzen - + Set Backlight Active Hintergrund aktiv setzen - + Profile LED %1 Profil LED %1 - + + DPI DPI - + DPI X DPI X - + DPI Y DPI Y - + Lock X/Y X/Y sperren - + Polling rate Abfragerate - + Open custom editor Custom Editor öffnen - + Launch matrix discovery Matrix discovery öffnen - + Serial number: %1 Seriennummer: %1 - + Firmware version: %1 Firmware-Version: %1 - + No device was detected Kein Gerät wurde erkannt - + The OpenRazer daemon didn't detect a device that is supported. This could also be caused due to a misconfiguration of this PC. Der OpenRazer Daemon hat kein Gerät erkannt, welches unterstützt ist. Dies kann auch durch eine Fehlkonfiguration von diesem PC verursacht sein. - + Open supported devices Unterstützte Geräte öffnen - + The daemon didn't detect a device that is connected Der Daemon hat kein Geräte erkannt, welches verbunden ist - + Linux detected connected devices but the daemon didn't. This could be either due to a permission problem or a kernel module problem. Linux hat ein Gerät erkannt, aber der Daemon nicht. Dies kann entweder durch ein Berechtigungsproblem oder durch ein Kernel-Modul Problem verursacht sein. - + Open troubleshooting page Problemlösungs-Seite öffnen - + Error while syncing devices. Fehler beim Synchronisieren von Geräten. - + Error while toggling 'turn off on screensaver' Fehler beim umschalten von 'abschalten bei Bildschirmschoner' @@ -389,12 +390,12 @@ Dies kann auch durch eine Fehlkonfiguration von diesem PC verursacht sein.Einstellungen - + Sync devices Effekte synchronisieren - + Turn off on screensaver Beleuchtung bei Bildschirmschoner abdrehen From e6d0e669627698dcfeea587f34be920d02a39695 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Thu, 27 Dec 2018 14:07:59 +0100 Subject: [PATCH 17/47] Add French translations --- data/CMakeLists.txt | 2 +- data/meson.build | 2 +- data/translations/fr.ts | 420 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 422 insertions(+), 2 deletions(-) create mode 100644 data/translations/fr.ts diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 406db6d..871ae55 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -11,7 +11,7 @@ install(FILES xyz.z3ntu.razergenie.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) # Translations set(TRANSLATION_FILES - translations/de.ts) # add new languages here! + translations/de.ts translations/fr.ts) # add new languages here! qt5_add_translation(QM_FILES ${TRANSLATION_FILES}) add_custom_target(translations ALL DEPENDS ${QM_FILES}) # this is apparently needed that the .qm files are generated at all... diff --git a/data/meson.build b/data/meson.build index ec99303..5c288a2 100644 --- a/data/meson.build +++ b/data/meson.build @@ -12,7 +12,7 @@ install_data('xyz.z3ntu.razergenie.appdata.xml', install_dir: metadatadir) install_data('xyz.z3ntu.razergenie.desktop', install_dir : join_paths(get_option('datadir'), 'applications')) # Translations -languages = ['de'] # add new languages here! +languages = ['de', 'fr'] # add new languages here! translationsdir = join_paths(get_option('datadir'), 'razergenie/translations') lrelease = find_program(['lrelease-qt5', 'lrelease']) diff --git a/data/translations/fr.ts b/data/translations/fr.ts new file mode 100644 index 0000000..16681c8 --- /dev/null +++ b/data/translations/fr.ts @@ -0,0 +1,420 @@ + + + + + CustomEditor + + + RazerGenie - Custom Editor + RazerGenie - Éditeur personnalisé + + + + + Unknown matrix dimensions + Dimensions de la matrice inconnues + + + + + Please open an issue in the RazerGenie repository. Device name: %1 - matrix dimens: %2 %3 + Veuillez ouvrir un ticket dans le dépôt RazerGenie. Nom du périphérique : %1 - dimensions de la matrice : %2 %3 + + + + Device type not implemented! + Ce type de périphérique n'est pas implémenté ! + + + + Please open an issue in the RazerGenie repository. Device type: %1 + Veuillez ouvrir un ticket dans le dépôt RazerGenie. Type de périphérique : %1 + + + + Set + Appliquer + + + + Clear + Enlever + + + + Clear All + Tout enlever + + + + You are using a keyboard with a layout which is not known to the daemon. Please help us by visiting <a href='https://github.com/openrazer/openrazer/wiki/Keyboard-layouts'>https://github.com/openrazer/openrazer/wiki/Keyboard-layouts</a>. Using a fallback layout for now. + Vous utilisez un clavier dont la disposition n'est pas connue du daemon. Aidez-nous en visitant <a href='https://github.com/openrazer/openrazer/wiki/Keyboard-layouts'>https://github.com/openrazer/openrazer/wiki/Keyboard-layouts</a>. Pour l'instant, un dispositif générique sera utilisé. + + + + Your keyboard layout (%1) is not yet supported by RazerGenie for this keyboard. Please open an issue in the RazerGenie repository. + La disposition du clavier (%1) n'est pas encore supportée par RazerGenie pour ce clavier. Veuillez ouvrir un tricket dans le dépôt RazerGenie. + + + + Neither one of these layouts was found in the layout file: %1. Exiting. + Aucune de ces dispositions n'a été trouvée dans le fichier source : %1. L'éditeur va se fermer. + + + + Error loading %1.json! + Erreur lors du chargement de %1.json ! + + + + The file %1.json, used for the custom editor failed to load: %2 +The editor won't open now. + Le fichier %1.json, utilisé pour l'éditeur personnalisé, n'a pas pu être chargé : %2 +L'éditeur ne s'ouvrira pas pour l'instant. + + + + DeviceListWidget + + + Downloading image... + Téléchargement de l'image... + + + + No image + Pas d'image + + + + Preferences + + + + RazerGenie - Preferences + RazerGenie - Préférences + + + + About: + À propos : + + + + RazerGenie Version: %1 + Version de RazerGenie : %1 + + + + OpenRazer Daemon Version: %1 + Version du daemon OpenRazer : %1 + + + + General: + Général : + + + + For displaying device images, RazerGenie downloads the image behind the URL specified for a device in the OpenRazer daemon source code. This will only be done for devices that are connected to the PC and only once, as the images are cached locally. For reviewing, what information Razer might collect with these connections, please consult the Razer Privacy Policy (https://www.razer.com/legal/privacy-policy). + Pour afficher les images des préiphériques, RazerGenie télécharge l'image via l'URL spécifiée pour le périphérique dans le code source du daemon OpenRazer. Ceci ne sera fait que pour les périphériques connectés au PC et une fois seuelement, puisque les images sont stockées localement. Pour vérifier quelles informations Razer pourrait collecter avec ces connexions, veuillez consulter la politique de vie privée de Razer (https://www.razer.com/legal/privacy-policy). + + + + Download device images + Télécharger les images des périphériques + + + + QMessageBox + + + Error! + Erreur ! + + + + Information! + Information ! + + + + RazerGenie + + + The OpenRazer daemon is not started and you are not using systemd as your init system. +You have to either start the daemon manually every time you log in or set up another method of autostarting the daemon. + +Manually starting would be running "openrazer-daemon" in a terminal. + Le daemon OpenRazer n'est pas démarré et vous n'utilisez systemd comme système d'initialisation. Vous devez soit démarrer le daemon manuellement à chaque fois que vous vous connectez, ou prévoyez une autre façon de démarrer le daemon automatiquement. + +Vous pouvez manuellement lancer "openrazer-daemon" depuis un terminal. + + + + The OpenRazer daemon is not installed + Le daemon OpenRazer n'est pas installé + + + + The daemon is not installed or the version installed is too old. Please follow the installation instructions on the website! + +If you are running RazerGenie as a flatpak, you will still have to install OpenRazer outside of flatpak from a distribution package. + Le daemon n'est pas installé ou la version installée est trop ancienne. Veuillez suivre les instructions d'installation sur le site web ! + +Si vous utilisez RazerGenie depuis un flatpak, il faudra tout de même installer OpenRazer depuis un package propre à votre distribution. + + + + Open OpenRazer website + Ouvrir le site d'OpenRazer + + + + The OpenRazer daemon is not available. + Le daemon OpenRazer n'est pas disponible. + + + + The OpenRazer daemon is currently not available. The status output is below. + Le daemon OpenRazer n'est pas disponible pour l'instant. Le statut est rapporté ci-dessous. + + + + If you think, there's a bug, you can report an issue on GitHub: + Si vous pensez qu'il y a un bug, vous pouvez ouvrir un ticket sur GitHub : + + + + + + Report issue + Rapporter un problème + + + + The OpenRazer daemon is not set to auto-start. Click "Enable" to use the full potential of the daemon right after login. + Le daemon OpenRazer ne démarre pour l'instant pas automatiquement. Cliquez sur "Activer" pour utiliser tout le potentiel du daemon dès la connexion à la session. + + + + Enable + Activer + + + + Daemon version: %1 + Version du daemon : %1 + + + + The D-Bus connection was re-established. + La connexion D-Bus a été re-établie. + + + + The D-Bus connection was lost, which probably means that the daemon has crashed. + La connexion D-Bus a été perdue, ce qui signifie probablement que le daemon a rencontré une erreur. + + + + + Lighting + Éclairage + + + + Lighting Logo + Éclairage du logo + + + + Lighting Scroll + Éclairage de la molette + + + + Lighting Backlight + Rétro-éclairage + + + + Brightness + Luminosité + + + + Brightness Logo + Luminosité du logo + + + + Brightness Scroll + Luminosité de la molette + + + + Brightness Backlight + Luminosité du rétro-éclairage + + + + Left + Gauche + + + + Right + Droit + + + + Set Logo Active + Activer le logo + + + + Set Scroll Active + Activer la molette + + + + Set Backlight Active + Activer le rétro-éclairage + + + + Profile LED %1 + Profil LED %1 + + + + + DPI + DPI + + + + DPI X + DPI X + + + + DPI Y + DPI Y + + + + Lock X/Y + Verrouiller X/Y + + + + Polling rate + Fréquence des requêtes (polling) + + + + Open custom editor + Ouvrir l'éditeur personnalisé + + + + Launch matrix discovery + Lancer la découverte de matrice + + + + Serial number: %1 + Numéro de série : %1 + + + + Firmware version: %1 + Version du firmware : %1 + + + + No device was detected + Aucun périphérique détecté + + + + The OpenRazer daemon didn't detect a device that is supported. +This could also be caused due to a misconfiguration of this PC. + Le daemon OpenRazer n'a détecté aucun périphérique supporté. +Il est aussi possible que ce PC soit mal configuré. + + + + Open supported devices + Ouvir les périphériques supportés + + + + The daemon didn't detect a device that is connected + Le daemon n'a détecté aucun périphérique connecté + + + + Linux detected connected devices but the daemon didn't. This could be either due to a permission problem or a kernel module problem. + Linux a détecté des périphériques, mais pas le daemon. Il est possible que ce soit lié à un problème de permissions ou un problème dans un module du noyau (kernel). + + + + Open troubleshooting page + Ouvrir la page de diagnostic + + + + Error while syncing devices. + Erreur lors de la synchronisation des périphériques. + + + + Error while toggling 'turn off on screensaver' + Erreur lors de l'activation de 'désactiver l'économiseur d'écran' + + + + RazerGenieUi + + + RazerGenie + RazerGenie + + + + Preferences + Préférences + + + + Sync devices + Synchroniser les périphériques + + + + Turn off on screensaver + Désactiver l'économiseur d'écran + + + + RazerImageDownloader + + + Image download disabled + Téléchargement des images désactivé + + + + Image downloading is disabled. Visit the preferences to enable it. + Le téléchargement des images est désactivé. Vous pouvez l'activer dans les préférences. + + + + Network Error + Erreur de réseau + + + From 68af1e821bcde9b806c506ec262e4eca9e53e6c5 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 18 Apr 2020 03:10:25 +0200 Subject: [PATCH 18/47] =?UTF-8?q?=09-=20RazerGenie=20can=20now=20save=20ke?= =?UTF-8?q?yboard=20layout=20at=20least=20from=20the=20=09=20=20Matrix=20D?= =?UTF-8?q?iscovery=20=09modified=C2=A0:=20=20=20=20=20=20=20=20=20src/CMa?= =?UTF-8?q?keLists.txt=20=09modified=C2=A0:=20=20=20=20=20=20=20=20=20src/?= =?UTF-8?q?customeditor/customeditor.cpp=20=09modified=C2=A0:=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20src/customeditor/customeditor.h=20=09new=20file?= =?UTF-8?q?=C2=A0:=20=20=20=20=20=20=20=20=20src/customeditor/kbdlayout.cp?= =?UTF-8?q?p=20=09new=20file=C2=A0:=20=20=20=20=20=20=20=20=20src/customed?= =?UTF-8?q?itor/kbdlayout.h=20=09modified=C2=A0:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20src/customeditor/matrixpushbutton.cpp=20=09modified=C2=A0:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20src/customeditor/matrixpushbutton.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CMakeLists.txt | 3 +- src/customeditor/customeditor.cpp | 102 ++++++++++++++++++++++++-- src/customeditor/customeditor.h | 15 +++- src/customeditor/kbdlayout.cpp | 78 ++++++++++++++++++++ src/customeditor/kbdlayout.h | 41 +++++++++++ src/customeditor/matrixpushbutton.cpp | 5 ++ src/customeditor/matrixpushbutton.h | 2 + 7 files changed, 235 insertions(+), 11 deletions(-) create mode 100644 src/customeditor/kbdlayout.cpp create mode 100644 src/customeditor/kbdlayout.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 380e4f2..bdf55fa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,8 @@ set(razergenie_SRCS main.cpp util.cpp customeditor/customeditor.cpp customeditor/matrixpushbutton.cpp - preferences/preferences.cpp + customeditor/kbdlayout.cpp + preferences/preferences.cpp ) QT5_WRAP_UI(razergenie_SRCS ../ui/razergenie.ui) diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index c748b34..1a25b29 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -93,7 +93,7 @@ CustomEditor::CustomEditor(libopenrazer::Device* device, bool launchMatrixDiscov } // Set every LED to "off"/black - clearAll(); + // clearAll(); No. Definitively. } CustomEditor::~CustomEditor() @@ -123,17 +123,22 @@ QLayout* CustomEditor::generateMainControls() QPushButton *btnSet = new QPushButton(tr("Set")); QPushButton *btnClear = new QPushButton(tr("Clear")); QPushButton *btnClearAll = new QPushButton(tr("Clear All")); + QPushButton *btnLoadLayout = new QPushButton(tr("Load Keyboad Layout")); + QPushButton *btnSaveLayout = new QPushButton(tr("Save Keyboard Layout")); hbox->addWidget(btnColor); hbox->addWidget(btnSet); hbox->addWidget(btnClear); hbox->addWidget(btnClearAll); + hbox->addWidget(btnLoadLayout); + hbox->addWidget(btnSaveLayout); connect(btnColor, &QPushButton::clicked, this, &CustomEditor::colorButtonClicked); connect(btnSet, &QPushButton::clicked, this, &CustomEditor::setDrawStatusSet); connect(btnClear, &QPushButton::clicked, this, &CustomEditor::setDrawStatusClear); connect(btnClearAll, &QPushButton::clicked, this, &CustomEditor::clearAll); - + connect(btnLoadLayout, &QPushButton::clicked, this, &CustomEditor::loadLayout); + connect(btnSaveLayout, &QPushButton::clicked, this, &CustomEditor::saveLayout); return hbox; } @@ -154,7 +159,7 @@ QLayout* CustomEditor::generateKeyboard() closeWindow(); } QStringList langs; - langs << "de_DE" << "en_US" << "en_GB"; + langs << "de_DE" << "en_US" << "en_GB" << "fr_FR"; QString lang; foreach(lang, langs) { if(keyboardKeys.contains(lang)) { @@ -209,6 +214,7 @@ QLayout* CustomEditor::generateKeyboard() } vbox->addLayout(hbox); } + return vbox; } @@ -236,11 +242,30 @@ QLayout* CustomEditor::generateMouse() QLayout* CustomEditor::generateMatrixDiscovery() { + QJsonObject jsLang; + QJsonObject jsRow; + QVBoxLayout *vbox = new QVBoxLayout(); for(int i=0; imjsLabelStr, klay->mjsLabelStr + QString::number(i) + "_" + QString::number(j)); + jsKeysO.insert(klay->mjsMatrixStr, jsMatrixA); + jsKeysO.insert(klay->mjsColorsStr, "#000000"); + jsKeysA.append(jsKeysO); + btn->setMatrixPos(i, j); connect(btn, &QPushButton::clicked, this, &CustomEditor::onMatrixPushButtonClicked); @@ -248,16 +273,27 @@ QLayout* CustomEditor::generateMatrixDiscovery() hbox->addWidget(btn); matrixPushButtons.append(btn); } + + jsRow.insert(klay->mjsRowStr + QString::number(i), jsKeysA); + vbox->addLayout(hbox); } + + klay->setKbdLayRows(jsRow); + + jsLang.insert(klay->mjsLangStr, jsRow); + + klay->setKbdLayout(jsLang); + return vbox; } bool CustomEditor::parseKeyboardJSON(QString jsonname) { QFile *file; // Pointer to file object to use - QFile file_devel("../../data/matrix_layouts/"+jsonname+".json"); // File during developemnt - QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/"+jsonname+".json"); // File for production + QFile file_devel("../../data/matrix_layouts/"+jsonname+".jsn"); // File during developemnt + QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/"+jsonname+".jsn"); // File for production + QFile file_sel; // Try to open the dev file (higher priority) if(file_devel.open(QIODevice::ReadOnly)) { @@ -271,7 +307,14 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) file = &file_prod; } else { QMessageBox::information(0, tr("Error loading %1.json!").arg(jsonname), tr("The file %1.json, used for the custom editor failed to load: %2\nThe editor won't open now.").arg(jsonname).arg(file_prod.errorString())); - return false; + QString filename = QFileDialog::getOpenFileName(this, "Select Keyboard Layout file","" , KbdFileFilter, &KbdFileFilter ); + file_sel.setFileName(filename); + if(file_sel.open(QIODevice::ReadOnly)) + { + file = &file_sel; + } else { + return false; + } } } @@ -286,8 +329,34 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) return true; } -bool CustomEditor::updateKeyrow(int row) +bool CustomEditor::updateKeyrow(int row, bool fromfile) { + QJsonObject rowsO = klay->getKbdLayRows(); + QJsonArray keysA = QJsonValue(rowsO.take(klay->mjsRowStr+QString::number(row))).toArray(); + QJsonObject keysO; + + //qDebug() << __PRETTY_FUNCTION__ << " : Grabbed parameters of row[" << row << "] => " << keysA << endl; + + for(int i=0; i < dimens[1]; i++) + { + keysO = QJsonValue(keysA.at(i)).toObject(); + + if(fromfile == true) + { + colors[row][i] = QColor(keysO.value(klay->mjsColorsStr).toString()); + } + else + { + keysO.remove(klay->mjsColorsStr); + keysO.insert(klay->mjsColorsStr, colors[row][i].name()); + keysA.replace(i, keysO); + } + } + + rowsO.insert(klay->mjsRowStr+QString::number(row), keysA); + + klay->setKbdLayRows(rowsO); + return device->setKeyRow(row, 0, dimens[1]-1, colors[row]) && device->setCustom(); } @@ -319,6 +388,23 @@ void CustomEditor::clearAll() } } +void CustomEditor::loadLayout() +{ + QString file = QFileDialog::getOpenFileName(this, "Open Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + klay->openKbdLayout(file); + //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout() << endl; + for(int i = 0; i < 6; i++) + { + updateKeyrow(i, true); + } +} + +void CustomEditor::saveLayout() +{ + QString file = QFileDialog::getSaveFileName(this, "Save Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + klay->saveKbdLayout(file); +} + void CustomEditor::colorButtonClicked() { QPushButton *sender = qobject_cast(QObject::sender()); @@ -361,7 +447,7 @@ void CustomEditor::onMatrixPushButtonClicked() qDebug() << "RazerGenie: Unhandled DrawStatus: " << drawStatus; } // Set color on device - updateKeyrow(pos.first); + updateKeyrow(pos.first, false); } void CustomEditor::setDrawStatusSet() diff --git a/src/customeditor/customeditor.h b/src/customeditor/customeditor.h index 74e7dc8..a9f3dfd 100644 --- a/src/customeditor/customeditor.h +++ b/src/customeditor/customeditor.h @@ -20,15 +20,18 @@ #define CUSTOMEDITOR_H #include +#include +#include #include #include #include "matrixpushbutton.h" +#include "kbdlayout.h" enum DrawStatus { set, clear }; -class CustomEditor : public QDialog +class CustomEditor : public QDialog, public KbdLayout { Q_OBJECT public: @@ -42,11 +45,19 @@ class CustomEditor : public QDialog QLayout* generateMouse(); QLayout* generateMatrixDiscovery(); + bool parseKeyboardJSON(QString jsonname); - bool updateKeyrow(int row); + bool updateKeyrow(int row, bool fromfile); void clearAll(); + + void loadLayout(); + void saveLayout(); + QJsonDocument keyboardLayout; + KbdLayout *klay = new KbdLayout; + QString KbdFileFilter = tr("JSON File (*.json)"); QJsonObject keyboardKeys; + QJsonObject keyboardKeysColors; QVector matrixPushButtons; libopenrazer::Device *device; QList dimens; diff --git a/src/customeditor/kbdlayout.cpp b/src/customeditor/kbdlayout.cpp new file mode 100644 index 0000000..d62792d --- /dev/null +++ b/src/customeditor/kbdlayout.cpp @@ -0,0 +1,78 @@ +#include "kbdlayout.h" +#include + +KbdLayout::KbdLayout() +{ + +} + +KbdLayout::~KbdLayout() +{ + +} + + +void KbdLayout::setKbdLayout(const QJsonObject &langs) +{ + this->mjsKbdLayoutDoc.setObject(langs); +} + +void KbdLayout::setKbdLayLangs(const QJsonObject &rows) +{ + QJsonObject newlang; + newlang.insert(this->mjsLangStr, rows); + this->mjsLangs = newlang; +} + +void KbdLayout::setKbdLayRows(const QJsonObject &row) +{ + QJsonObject newrows; + newrows.insert(this->mjsRowStr, row); + this->mjsRows = row; +} + +void KbdLayout::initLayout() +{ + this->mjsLangs = this->mjsKbdLayoutDoc.object(); + this->mjsRows = this->mjsLangs.value(this->mjsLangStr).toObject(); +} + +void KbdLayout::updateLayout() +{ + this->setKbdLayLangs(this->mjsRows); + this->setKbdLayout(this->mjsLangs); +} + +void KbdLayout::openKbdLayout(const QString &filename) +{ + QFile file(filename); + file.open(QIODevice::ReadOnly); + this->mjsKbdLayoutDoc = QJsonDocument::fromJson(file.readAll()); + file.close(); + this->initLayout(); +} + +void KbdLayout::saveKbdLayout(const QString &filename) +{ + this->updateLayout(); + QFile file(filename); + file.open(QIODevice::WriteOnly | QIODevice::Text); + qDebug() << "JSON to write : " << this->mjsKbdLayoutDoc; + file.write(this->mjsKbdLayoutDoc.toJson()); + file.close(); +} + +QJsonDocument KbdLayout::getKbdLayout() +{ + return this->mjsKbdLayoutDoc; +} + +QJsonObject KbdLayout::getKbdLayLangs() +{ + return this->mjsLangs; +} + +QJsonObject KbdLayout::getKbdLayRows() +{ + return this->mjsRows; +} diff --git a/src/customeditor/kbdlayout.h b/src/customeditor/kbdlayout.h new file mode 100644 index 0000000..3902b46 --- /dev/null +++ b/src/customeditor/kbdlayout.h @@ -0,0 +1,41 @@ +#ifndef KBDLAYOUT_H +#define KBDLAYOUT_H + +#include +#include +#include +#include + +class KbdLayout +{ +public: + QString mjsLangStr = "fr_FR"; + QString mjsRowStr = "row"; + QString mjsLabelStr = "label"; + QString mjsMatrixStr = "matrix"; + QString mjsColorsStr = "colors"; + + KbdLayout(); + ~KbdLayout(); + + void setKbdLayout(const QJsonObject &langs); + void setKbdLayLangs(const QJsonObject &rows); + void setKbdLayRows(const QJsonObject &row); + + void initLayout(); + void updateLayout(); + + void openKbdLayout(const QString &filename); + void saveKbdLayout(const QString &filename); + + QJsonDocument getKbdLayout(); + QJsonObject getKbdLayLangs(); + QJsonObject getKbdLayRows(); + +private: + QJsonDocument mjsKbdLayoutDoc; + QJsonObject mjsLangs; + QJsonObject mjsRows; +}; + +#endif // KBDLAYOUT_H diff --git a/src/customeditor/matrixpushbutton.cpp b/src/customeditor/matrixpushbutton.cpp index d803f72..9bf83a4 100644 --- a/src/customeditor/matrixpushbutton.cpp +++ b/src/customeditor/matrixpushbutton.cpp @@ -52,3 +52,8 @@ void MatrixPushButton::resetButtonColor() { this->setPalette(this->style()->standardPalette()); } + +void saveLayoutButton(QJsonDocument kbdlayout) +{ + qDebug() << "JSON Document contents : " << kbdlayout; +} diff --git a/src/customeditor/matrixpushbutton.h b/src/customeditor/matrixpushbutton.h index c7fd104..51670e6 100644 --- a/src/customeditor/matrixpushbutton.h +++ b/src/customeditor/matrixpushbutton.h @@ -19,6 +19,7 @@ #define MATRIXPUSHBUTTON_H #include +#include class MatrixPushButton : public QPushButton { @@ -28,6 +29,7 @@ class MatrixPushButton : public QPushButton QPair matrixPos(); void setButtonColor(QColor color); void resetButtonColor(); + void saveLayoutButton(QJsonDocument kbdlayout); private: QString mLabel; QPair mMatrixPos; From ed9df82e8f3f3d4e7d3c97b8b76b4ec025dc4216 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 18 Apr 2020 05:28:03 +0200 Subject: [PATCH 19/47] =?UTF-8?q?=20Now=20Restore=20button=20colors=20also?= =?UTF-8?q?=20after=20loaded=20JSON=20layout=20file=20=09modified=C2=A0:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20src/customeditor/customeditor.cpp=20?= =?UTF-8?q?=09modified=C2=A0:=20=20=20=20=20=20=20=20=20src/customeditor/m?= =?UTF-8?q?atrixpushbutton.cpp=20=09modified=C2=A0:=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20src/customeditor/matrixpushbutton.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/customeditor/customeditor.cpp | 10 ++++++---- src/customeditor/matrixpushbutton.cpp | 5 +++++ src/customeditor/matrixpushbutton.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index 1a25b29..ea4b767 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -261,7 +261,7 @@ QLayout* CustomEditor::generateMatrixDiscovery() jsMatrixA.append(i); jsMatrixA.append(j); - jsKeysO.insert(klay->mjsLabelStr, klay->mjsLabelStr + QString::number(i) + "_" + QString::number(j)); + jsKeysO.insert(klay->mjsLabelStr, QString::number(i) + "_" + QString::number(j)); jsKeysO.insert(klay->mjsMatrixStr, jsMatrixA); jsKeysO.insert(klay->mjsColorsStr, "#000000"); jsKeysA.append(jsKeysO); @@ -330,13 +330,11 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) } bool CustomEditor::updateKeyrow(int row, bool fromfile) -{ +{ QJsonObject rowsO = klay->getKbdLayRows(); QJsonArray keysA = QJsonValue(rowsO.take(klay->mjsRowStr+QString::number(row))).toArray(); QJsonObject keysO; - //qDebug() << __PRETTY_FUNCTION__ << " : Grabbed parameters of row[" << row << "] => " << keysA << endl; - for(int i=0; i < dimens[1]; i++) { keysO = QJsonValue(keysA.at(i)).toObject(); @@ -344,6 +342,10 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) if(fromfile == true) { colors[row][i] = QColor(keysO.value(klay->mjsColorsStr).toString()); + int butn = i+(row * dimens[1]); + //qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); + matrixPushButtons.at(butn)->setButtonColor(colors[row][i]); + } else { diff --git a/src/customeditor/matrixpushbutton.cpp b/src/customeditor/matrixpushbutton.cpp index 9bf83a4..29e5c7b 100644 --- a/src/customeditor/matrixpushbutton.cpp +++ b/src/customeditor/matrixpushbutton.cpp @@ -57,3 +57,8 @@ void saveLayoutButton(QJsonDocument kbdlayout) { qDebug() << "JSON Document contents : " << kbdlayout; } + +QString MatrixPushButton::getLabel() +{ + return this->mLabel; +} diff --git a/src/customeditor/matrixpushbutton.h b/src/customeditor/matrixpushbutton.h index 51670e6..d554434 100644 --- a/src/customeditor/matrixpushbutton.h +++ b/src/customeditor/matrixpushbutton.h @@ -30,6 +30,7 @@ class MatrixPushButton : public QPushButton void setButtonColor(QColor color); void resetButtonColor(); void saveLayoutButton(QJsonDocument kbdlayout); + QString getLabel(); private: QString mLabel; QPair mMatrixPos; From 14ba358555afe73b31b2b744fbb31c022c1d5cb1 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 18 Apr 2020 20:48:32 +0200 Subject: [PATCH 20/47] .git/msg --- src/customeditor/customeditor.cpp | 104 ++++++++++++++++++++++++------ src/customeditor/kbdlayout.cpp | 19 ++++-- src/customeditor/kbdlayout.h | 3 + 3 files changed, 103 insertions(+), 23 deletions(-) diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index ea4b767..b368b10 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -23,6 +23,7 @@ #include #include #include +#include CustomEditor::CustomEditor(libopenrazer::Device* device, bool launchMatrixDiscovery, QWidget *parent) : QDialog(parent) { @@ -93,7 +94,7 @@ CustomEditor::CustomEditor(libopenrazer::Device* device, bool launchMatrixDiscov } // Set every LED to "off"/black - // clearAll(); No. Definitively. + // clearAll(); // No. Definitively. } CustomEditor::~CustomEditor() @@ -147,6 +148,7 @@ QLayout* CustomEditor::generateKeyboard() //TODO: Add missing logo button QVBoxLayout *vbox = new QVBoxLayout(); QJsonObject keyboardLayout; + QJsonObject cloneobj; bool found = false; QString kbdLayout = device->getKeyboardLayout(); if(kbdLayout != "unknown" && keyboardKeys.contains(kbdLayout)) { @@ -164,12 +166,13 @@ QLayout* CustomEditor::generateKeyboard() foreach(lang, langs) { if(keyboardKeys.contains(lang)) { keyboardLayout = keyboardKeys[lang].toObject(); + klay->mjsLangStr = lang; found = true; break; } } if(!found) { - util::showInfo(tr("Neither one of these layouts was found in the layout file: %1. Exiting.").arg("de_DE, en_US, en_GB")); + util::showInfo(tr("Neither one of these layouts was found in the layout file: %1. Exiting.").arg("de_DE, en_US, en_GB, fr_FR")); closeWindow(); } } @@ -177,32 +180,57 @@ QLayout* CustomEditor::generateKeyboard() // Iterate over rows in the object QJsonObject::const_iterator it; for(it = keyboardLayout.constBegin(); it != keyboardLayout.constEnd(); ++it) { + int i = 0; QJsonArray row = (*it).toArray(); + QJsonArray arr; QHBoxLayout *hbox = new QHBoxLayout(); hbox->setAlignment(Qt::AlignLeft); // Iterate over keys in row QJsonArray::const_iterator jt; + QJsonObject obj; for(jt = row.constBegin(); jt != row.constEnd(); ++jt) { - QJsonObject obj = (*jt).toObject(); + obj = (*jt).toObject(); - if(!obj["label"].isNull()) { - MatrixPushButton *btn = new MatrixPushButton(obj["label"].toString()); - int width = obj.contains("width") ? obj.value("width").toInt() : 60; + if(!obj[klay->mjsLabelStr].isNull()) + { + MatrixPushButton *btn = new MatrixPushButton(obj[klay->mjsLabelStr].toString()); + + int width = obj.contains(klay->mjsWidth) ? obj.value(klay->mjsWidth).toInt() : 60; int height = /*obj.contains("height") ? obj.value("height").toInt() : */63; btn->setFixedSize(width, height); - if(obj.contains("matrix")) { - QJsonArray arr = obj["matrix"].toArray(); + + bool color = false; + + if( ! obj.value(klay->mjsLabelStr).isNull() ) + color = true; + + if(obj.contains(klay->mjsMatrixStr)) { + QJsonArray arr = obj[klay->mjsMatrixStr].toArray(); btn->setMatrixPos(arr[0].toInt(), arr[1].toInt()); } - if(obj.contains("disabled")) { + + if(obj.contains(klay->mjsDisabled)) { btn->setEnabled(false); + color = false; } + /*if(obj["cut"] == "enter") { QPixmap pixmap("../../data/de_DE_mask.png"); btn->setMask(pixmap.mask()); }*/ + + //qDebug() << __PRETTY_FUNCTION__ << " : obj => " << obj << endl; + + if( ! obj.contains(klay->mjsColorsStr) && color == true ) + { + obj.insert(klay->mjsColorsStr, klay->mjsDefColor);; + } + + if(color == true) + btn->setButtonColor(obj[klay->mjsColorsStr].toString() ); + connect(btn, &QPushButton::clicked, this, &CustomEditor::onMatrixPushButtonClicked); hbox->addWidget(btn); @@ -211,10 +239,27 @@ QLayout* CustomEditor::generateKeyboard() QSpacerItem *spacer = new QSpacerItem(66, 69, QSizePolicy::Fixed, QSizePolicy::Fixed); hbox->addItem(spacer); } + + //qDebug() << __PRETTY_FUNCTION__ << " obj => " << obj; + + arr.append(obj); + } + vbox->addLayout(hbox); + + //qDebug() << __PRETTY_FUNCTION__ << " row => " << arr; + + cloneobj.insert(klay->mjsRowStr+QString::number(i), arr); + + i++; } - + + klay->setKbdLayRows(cloneobj); + klay->updateLayout(); + + //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout(); + return vbox; } @@ -263,7 +308,7 @@ QLayout* CustomEditor::generateMatrixDiscovery() jsKeysO.insert(klay->mjsLabelStr, QString::number(i) + "_" + QString::number(j)); jsKeysO.insert(klay->mjsMatrixStr, jsMatrixA); - jsKeysO.insert(klay->mjsColorsStr, "#000000"); + jsKeysO.insert(klay->mjsColorsStr, klay->mjsDefColor); jsKeysA.append(jsKeysO); btn->setMatrixPos(i, j); @@ -291,8 +336,8 @@ QLayout* CustomEditor::generateMatrixDiscovery() bool CustomEditor::parseKeyboardJSON(QString jsonname) { QFile *file; // Pointer to file object to use - QFile file_devel("../../data/matrix_layouts/"+jsonname+".jsn"); // File during developemnt - QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/"+jsonname+".jsn"); // File for production + QFile file_devel("../../data/matrix_layouts/"+jsonname+".json"); // File during developemnt + QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/"+jsonname+".json"); // File for production QFile file_sel; // Try to open the dev file (higher priority) @@ -339,16 +384,27 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) { keysO = QJsonValue(keysA.at(i)).toObject(); - if(fromfile == true) + QColor col = keysO.value(klay->mjsColorsStr).toString(); + + if(fromfile == true && col.isValid() == true) { + //qDebug () << __PRETTY_FUNCTION__ << " : Color => " << col; colors[row][i] = QColor(keysO.value(klay->mjsColorsStr).toString()); int butn = i+(row * dimens[1]); - //qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); - matrixPushButtons.at(butn)->setButtonColor(colors[row][i]); - + if(butn < matrixPushButtons.count()) + { + //Avoid the segfault... check this manually + qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); + if(colors[row][i] == klay->mjsDefColor) + { + colors[row][i] = QColor(Qt::black); + } + matrixPushButtons.at(butn)->setButtonColor(colors[row][i]); + } } else { + //qDebug() << __PRETTY_FUNCTION__ << " : No color parameter found, adding default color param&value" << endl; keysO.remove(klay->mjsColorsStr); keysO.insert(klay->mjsColorsStr, colors[row][i].name()); keysA.replace(i, keysO); @@ -356,9 +412,11 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) } rowsO.insert(klay->mjsRowStr+QString::number(row), keysA); - + klay->setKbdLayRows(rowsO); + //qDebug() << __PRETTY_FUNCTION__ << " : Colors => " << colors[row] << endl; + return device->setKeyRow(row, 0, dimens[1]-1, colors[row]) && device->setCustom(); } @@ -393,8 +451,15 @@ void CustomEditor::clearAll() void CustomEditor::loadLayout() { QString file = QFileDialog::getOpenFileName(this, "Open Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + if( ! QFile::exists(file) ) + return; + else + qDebug() << __PRETTY_FUNCTION__ << " : Opened layout file : " << file << " successfully"; + klay->openKbdLayout(file); + //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout() << endl; + for(int i = 0; i < 6; i++) { updateKeyrow(i, true); @@ -404,6 +469,9 @@ void CustomEditor::loadLayout() void CustomEditor::saveLayout() { QString file = QFileDialog::getSaveFileName(this, "Save Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + + qDebug() << __PRETTY_FUNCTION__ << " : Created new layout file : " << file; + klay->saveKbdLayout(file); } diff --git a/src/customeditor/kbdlayout.cpp b/src/customeditor/kbdlayout.cpp index d62792d..c4228d2 100644 --- a/src/customeditor/kbdlayout.cpp +++ b/src/customeditor/kbdlayout.cpp @@ -3,12 +3,12 @@ KbdLayout::KbdLayout() { - + qDebug() << __PRETTY_FUNCTION__ << " : Constructed()" << endl; } KbdLayout::~KbdLayout() { - + qDebug() << __PRETTY_FUNCTION__ << " : Destroyed()" << endl; } @@ -33,8 +33,16 @@ void KbdLayout::setKbdLayRows(const QJsonObject &row) void KbdLayout::initLayout() { - this->mjsLangs = this->mjsKbdLayoutDoc.object(); - this->mjsRows = this->mjsLangs.value(this->mjsLangStr).toObject(); + this->mjsLangs = this->mjsKbdLayoutDoc[this->mjsLangStr].toObject(); + + //qDebug() << __PRETTY_FUNCTION__ << " : Rows => " << this->mjsRows; + + for(int i = 0; i < 6; i++) + { + this->mjsRows.insert(this->mjsRowStr+QString::number(i), this->mjsLangs.value(this->mjsRowStr+QString::number(i)) ); + } + //qDebug() << __PRETTY_FUNCTION__ << " : Lang contents => " << this->mjsLangs << endl; + //qDebug() << __PRETTY_FUNCTION__ << " : Rows contents => " << this->mjsRows << endl; } void KbdLayout::updateLayout() @@ -48,6 +56,7 @@ void KbdLayout::openKbdLayout(const QString &filename) QFile file(filename); file.open(QIODevice::ReadOnly); this->mjsKbdLayoutDoc = QJsonDocument::fromJson(file.readAll()); + //qDebug() << __PRETTY_FUNCTION__ << " : File content => " << this->mjsKbdLayoutDoc << endl; file.close(); this->initLayout(); } @@ -57,7 +66,7 @@ void KbdLayout::saveKbdLayout(const QString &filename) this->updateLayout(); QFile file(filename); file.open(QIODevice::WriteOnly | QIODevice::Text); - qDebug() << "JSON to write : " << this->mjsKbdLayoutDoc; + //qDebug() << "JSON datas to write : " << this->mjsKbdLayoutDoc; file.write(this->mjsKbdLayoutDoc.toJson()); file.close(); } diff --git a/src/customeditor/kbdlayout.h b/src/customeditor/kbdlayout.h index 3902b46..a59f29b 100644 --- a/src/customeditor/kbdlayout.h +++ b/src/customeditor/kbdlayout.h @@ -14,6 +14,9 @@ class KbdLayout QString mjsLabelStr = "label"; QString mjsMatrixStr = "matrix"; QString mjsColorsStr = "colors"; + QString mjsWidth = "width"; + QString mjsDisabled = "disabled"; + QString mjsDefColor = "#000000"; KbdLayout(); ~KbdLayout(); From 80b42e8c90ad6095e48745d7f2d8ab2898252f70 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 18 Apr 2020 20:59:30 +0200 Subject: [PATCH 21/47] Commented some qDebug() and added sample generated from discovery matrix --- .../discoverysave.example.22.json | 1072 +++++++++++++++++ src/customeditor/customeditor.cpp | 2 +- src/customeditor/kbdlayout.cpp | 4 +- 3 files changed, 1075 insertions(+), 3 deletions(-) create mode 100644 data/matrix_layouts/discoverysave.example.22.json diff --git a/data/matrix_layouts/discoverysave.example.22.json b/data/matrix_layouts/discoverysave.example.22.json new file mode 100644 index 0000000..0b75897 --- /dev/null +++ b/data/matrix_layouts/discoverysave.example.22.json @@ -0,0 +1,1072 @@ +{ + "fr_FR": { + "row0": [ + { + "colors": "#000000", + "label": "label0_0", + "matrix": [ + 0, + 0 + ] + }, + { + "colors": "#ff0000", + "label": "label0_1", + "matrix": [ + 0, + 1 + ] + }, + { + "colors": "#000000", + "label": "label0_2", + "matrix": [ + 0, + 2 + ] + }, + { + "colors": "#00007f", + "label": "label0_3", + "matrix": [ + 0, + 3 + ] + }, + { + "colors": "#00007f", + "label": "label0_4", + "matrix": [ + 0, + 4 + ] + }, + { + "colors": "#00007f", + "label": "label0_5", + "matrix": [ + 0, + 5 + ] + }, + { + "colors": "#00007f", + "label": "label0_6", + "matrix": [ + 0, + 6 + ] + }, + { + "colors": "#00007f", + "label": "label0_7", + "matrix": [ + 0, + 7 + ] + }, + { + "colors": "#00007f", + "label": "label0_8", + "matrix": [ + 0, + 8 + ] + }, + { + "colors": "#00007f", + "label": "label0_9", + "matrix": [ + 0, + 9 + ] + }, + { + "colors": "#00007f", + "label": "label0_10", + "matrix": [ + 0, + 10 + ] + }, + { + "colors": "#00007f", + "label": "label0_11", + "matrix": [ + 0, + 11 + ] + }, + { + "colors": "#00007f", + "label": "label0_12", + "matrix": [ + 0, + 12 + ] + }, + { + "colors": "#00007f", + "label": "label0_13", + "matrix": [ + 0, + 13 + ] + }, + { + "colors": "#00007f", + "label": "label0_14", + "matrix": [ + 0, + 14 + ] + }, + { + "colors": "#ff0000", + "label": "label0_15", + "matrix": [ + 0, + 15 + ] + }, + { + "colors": "#00007f", + "label": "label0_16", + "matrix": [ + 0, + 16 + ] + }, + { + "colors": "#00007f", + "label": "label0_17", + "matrix": [ + 0, + 17 + ] + }, + { + "colors": "#000000", + "label": "label0_18", + "matrix": [ + 0, + 18 + ] + }, + { + "colors": "#000000", + "label": "label0_19", + "matrix": [ + 0, + 19 + ] + }, + { + "colors": "#000000", + "label": "label0_20", + "matrix": [ + 0, + 20 + ] + }, + { + "colors": "#000000", + "label": "label0_21", + "matrix": [ + 0, + 21 + ] + } + ], + "row1": [ + { + "colors": "#00007f", + "label": "label1_0", + "matrix": [ + 1, + 0 + ] + }, + { + "colors": "#00ffff", + "label": "label1_1", + "matrix": [ + 1, + 1 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_2", + "matrix": [ + 1, + 2 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_3", + "matrix": [ + 1, + 3 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_4", + "matrix": [ + 1, + 4 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_5", + "matrix": [ + 1, + 5 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_6", + "matrix": [ + 1, + 6 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_7", + "matrix": [ + 1, + 7 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_8", + "matrix": [ + 1, + 8 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_9", + "matrix": [ + 1, + 9 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_10", + "matrix": [ + 1, + 10 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_11", + "matrix": [ + 1, + 11 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_12", + "matrix": [ + 1, + 12 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_13", + "matrix": [ + 1, + 13 + ] + }, + { + "colors": "#00ffff", + "label": "label1_14", + "matrix": [ + 1, + 14 + ] + }, + { + "colors": "#005500", + "label": "label1_15", + "matrix": [ + 1, + 15 + ] + }, + { + "colors": "#00ffff", + "label": "label1_16", + "matrix": [ + 1, + 16 + ] + }, + { + "colors": "#00ffff", + "label": "label1_17", + "matrix": [ + 1, + 17 + ] + }, + { + "colors": "#ff0000", + "label": "label1_18", + "matrix": [ + 1, + 18 + ] + }, + { + "colors": "#ff007f", + "label": "label1_19", + "matrix": [ + 1, + 19 + ] + }, + { + "colors": "#ff007f", + "label": "label1_20", + "matrix": [ + 1, + 20 + ] + }, + { + "colors": "#ff007f", + "label": "label1_21", + "matrix": [ + 1, + 21 + ] + } + ], + "row2": [ + { + "colors": "#00007f", + "label": "label2_0", + "matrix": [ + 2, + 0 + ] + }, + { + "colors": "#00ffff", + "label": "label2_1", + "matrix": [ + 2, + 1 + ] + }, + { + "colors": "#00ff00", + "label": "label2_2", + "matrix": [ + 2, + 2 + ] + }, + { + "colors": "#00ff00", + "label": "label2_3", + "matrix": [ + 2, + 3 + ] + }, + { + "colors": "#00ff00", + "label": "label2_4", + "matrix": [ + 2, + 4 + ] + }, + { + "colors": "#00ff00", + "label": "label2_5", + "matrix": [ + 2, + 5 + ] + }, + { + "colors": "#00ff00", + "label": "label2_6", + "matrix": [ + 2, + 6 + ] + }, + { + "colors": "#00ff00", + "label": "label2_7", + "matrix": [ + 2, + 7 + ] + }, + { + "colors": "#00ff00", + "label": "label2_8", + "matrix": [ + 2, + 8 + ] + }, + { + "colors": "#00ff00", + "label": "label2_9", + "matrix": [ + 2, + 9 + ] + }, + { + "colors": "#00ff00", + "label": "label2_10", + "matrix": [ + 2, + 10 + ] + }, + { + "colors": "#00ff00", + "label": "label2_11", + "matrix": [ + 2, + 11 + ] + }, + { + "colors": "#ff00ff", + "label": "label2_12", + "matrix": [ + 2, + 12 + ] + }, + { + "colors": "#ff00ff", + "label": "label2_13", + "matrix": [ + 2, + 13 + ] + }, + { + "colors": "#000000", + "label": "label2_14", + "matrix": [ + 2, + 14 + ] + }, + { + "colors": "#ff0000", + "label": "label2_15", + "matrix": [ + 2, + 15 + ] + }, + { + "colors": "#00ffff", + "label": "label2_16", + "matrix": [ + 2, + 16 + ] + }, + { + "colors": "#00ffff", + "label": "label2_17", + "matrix": [ + 2, + 17 + ] + }, + { + "colors": "#ffaa00", + "label": "label2_18", + "matrix": [ + 2, + 18 + ] + }, + { + "colors": "#ffaa00", + "label": "label2_19", + "matrix": [ + 2, + 19 + ] + }, + { + "colors": "#ffaa00", + "label": "label2_20", + "matrix": [ + 2, + 20 + ] + }, + { + "colors": "#ff007f", + "label": "label2_21", + "matrix": [ + 2, + 21 + ] + } + ], + "row3": [ + { + "colors": "#00007f", + "label": "label3_0", + "matrix": [ + 3, + 0 + ] + }, + { + "colors": "#00ffff", + "label": "label3_1", + "matrix": [ + 3, + 1 + ] + }, + { + "colors": "#00ff00", + "label": "label3_2", + "matrix": [ + 3, + 2 + ] + }, + { + "colors": "#00ff00", + "label": "label3_3", + "matrix": [ + 3, + 3 + ] + }, + { + "colors": "#00ff00", + "label": "label3_4", + "matrix": [ + 3, + 4 + ] + }, + { + "colors": "#00ff00", + "label": "label3_5", + "matrix": [ + 3, + 5 + ] + }, + { + "colors": "#00ff00", + "label": "label3_6", + "matrix": [ + 3, + 6 + ] + }, + { + "colors": "#00ff00", + "label": "label3_7", + "matrix": [ + 3, + 7 + ] + }, + { + "colors": "#00ff00", + "label": "label3_8", + "matrix": [ + 3, + 8 + ] + }, + { + "colors": "#00ff00", + "label": "label3_9", + "matrix": [ + 3, + 9 + ] + }, + { + "colors": "#00ff00", + "label": "label3_10", + "matrix": [ + 3, + 10 + ] + }, + { + "colors": "#00ff00", + "label": "label3_11", + "matrix": [ + 3, + 11 + ] + }, + { + "colors": "#ff00ff", + "label": "label3_12", + "matrix": [ + 3, + 12 + ] + }, + { + "colors": "#ff00ff", + "label": "label3_13", + "matrix": [ + 3, + 13 + ] + }, + { + "colors": "#00ffff", + "label": "label3_14", + "matrix": [ + 3, + 14 + ] + }, + { + "colors": "#000000", + "label": "label3_15", + "matrix": [ + 3, + 15 + ] + }, + { + "colors": "#000000", + "label": "label3_16", + "matrix": [ + 3, + 16 + ] + }, + { + "colors": "#000000", + "label": "label3_17", + "matrix": [ + 3, + 17 + ] + }, + { + "colors": "#ffaa00", + "label": "label3_18", + "matrix": [ + 3, + 18 + ] + }, + { + "colors": "#ffaa00", + "label": "label3_19", + "matrix": [ + 3, + 19 + ] + }, + { + "colors": "#ffaa00", + "label": "label3_20", + "matrix": [ + 3, + 20 + ] + }, + { + "colors": "#000000", + "label": "label3_21", + "matrix": [ + 3, + 21 + ] + } + ], + "row4": [ + { + "colors": "#00007f", + "label": "label4_0", + "matrix": [ + 4, + 0 + ] + }, + { + "colors": "#00ffff", + "label": "label4_1", + "matrix": [ + 4, + 1 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_2", + "matrix": [ + 4, + 2 + ] + }, + { + "colors": "#00ff00", + "label": "label4_3", + "matrix": [ + 4, + 3 + ] + }, + { + "colors": "#00ff00", + "label": "label4_4", + "matrix": [ + 4, + 4 + ] + }, + { + "colors": "#00ff00", + "label": "label4_5", + "matrix": [ + 4, + 5 + ] + }, + { + "colors": "#00ff00", + "label": "label4_6", + "matrix": [ + 4, + 6 + ] + }, + { + "colors": "#00ff00", + "label": "label4_7", + "matrix": [ + 4, + 7 + ] + }, + { + "colors": "#00ff00", + "label": "label4_8", + "matrix": [ + 4, + 8 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_9", + "matrix": [ + 4, + 9 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_10", + "matrix": [ + 4, + 10 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_11", + "matrix": [ + 4, + 11 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_12", + "matrix": [ + 4, + 12 + ] + }, + { + "colors": "#000000", + "label": "label4_13", + "matrix": [ + 4, + 13 + ] + }, + { + "colors": "#00ffff", + "label": "label4_14", + "matrix": [ + 4, + 14 + ] + }, + { + "colors": "#000000", + "label": "label4_15", + "matrix": [ + 4, + 15 + ] + }, + { + "colors": "#55007f", + "label": "label4_16", + "matrix": [ + 4, + 16 + ] + }, + { + "colors": "#000000", + "label": "label4_17", + "matrix": [ + 4, + 17 + ] + }, + { + "colors": "#ffaa00", + "label": "label4_18", + "matrix": [ + 4, + 18 + ] + }, + { + "colors": "#ffaa00", + "label": "label4_19", + "matrix": [ + 4, + 19 + ] + }, + { + "colors": "#ffaa00", + "label": "label4_20", + "matrix": [ + 4, + 20 + ] + }, + { + "colors": "#00ffff", + "label": "label4_21", + "matrix": [ + 4, + 21 + ] + } + ], + "row5": [ + { + "colors": "#00007f", + "label": "label5_0", + "matrix": [ + 5, + 0 + ] + }, + { + "colors": "#ff0000", + "label": "label5_1", + "matrix": [ + 5, + 1 + ] + }, + { + "colors": "#ff5500", + "label": "label5_2", + "matrix": [ + 5, + 2 + ] + }, + { + "colors": "#ff0000", + "label": "label5_3", + "matrix": [ + 5, + 3 + ] + }, + { + "colors": "#000000", + "label": "label5_4", + "matrix": [ + 5, + 4 + ] + }, + { + "colors": "#000000", + "label": "label5_5", + "matrix": [ + 5, + 5 + ] + }, + { + "colors": "#000000", + "label": "label5_6", + "matrix": [ + 5, + 6 + ] + }, + { + "colors": "#00ffff", + "label": "label5_7", + "matrix": [ + 5, + 7 + ] + }, + { + "colors": "#000000", + "label": "label5_8", + "matrix": [ + 5, + 8 + ] + }, + { + "colors": "#000000", + "label": "label5_9", + "matrix": [ + 5, + 9 + ] + }, + { + "colors": "#000000", + "label": "label5_10", + "matrix": [ + 5, + 10 + ] + }, + { + "colors": "#ff0000", + "label": "label5_11", + "matrix": [ + 5, + 11 + ] + }, + { + "colors": "#ffff00", + "label": "label5_12", + "matrix": [ + 5, + 12 + ] + }, + { + "colors": "#ff5500", + "label": "label5_13", + "matrix": [ + 5, + 13 + ] + }, + { + "colors": "#ff0000", + "label": "label5_14", + "matrix": [ + 5, + 14 + ] + }, + { + "colors": "#55007f", + "label": "label5_15", + "matrix": [ + 5, + 15 + ] + }, + { + "colors": "#55007f", + "label": "label5_16", + "matrix": [ + 5, + 16 + ] + }, + { + "colors": "#55007f", + "label": "label5_17", + "matrix": [ + 5, + 17 + ] + }, + { + "colors": "#000000", + "label": "label5_18", + "matrix": [ + 5, + 18 + ] + }, + { + "colors": "#ffaa00", + "label": "label5_19", + "matrix": [ + 5, + 19 + ] + }, + { + "colors": "#ff0000", + "label": "label5_20", + "matrix": [ + 5, + 20 + ] + }, + { + "colors": "#000000", + "label": "label5_21", + "matrix": [ + 5, + 21 + ] + } + ] + } +} diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index b368b10..554bf2f 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -394,7 +394,7 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) if(butn < matrixPushButtons.count()) { //Avoid the segfault... check this manually - qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); + //qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); if(colors[row][i] == klay->mjsDefColor) { colors[row][i] = QColor(Qt::black); diff --git a/src/customeditor/kbdlayout.cpp b/src/customeditor/kbdlayout.cpp index c4228d2..1507bea 100644 --- a/src/customeditor/kbdlayout.cpp +++ b/src/customeditor/kbdlayout.cpp @@ -3,12 +3,12 @@ KbdLayout::KbdLayout() { - qDebug() << __PRETTY_FUNCTION__ << " : Constructed()" << endl; + //qDebug() << __PRETTY_FUNCTION__ << " : Constructed()" << endl; } KbdLayout::~KbdLayout() { - qDebug() << __PRETTY_FUNCTION__ << " : Destroyed()" << endl; + //qDebug() << __PRETTY_FUNCTION__ << " : Destroyed()" << endl; } From 6cb5d0b48f82c134184e843ccfcc10b9bebbf323 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Tue, 21 Apr 2020 02:47:25 +0200 Subject: [PATCH 22/47] Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere --- .../discoverysave.example.22.json | 266 +++++++++--------- data/matrix_layouts/razerdefault22.json | 6 +- src/customeditor/customeditor.cpp | 126 +++++---- src/customeditor/customeditor.h | 2 +- src/customeditor/kbdlayout.cpp | 26 +- src/customeditor/kbdlayout.h | 18 +- src/customeditor/matrixpushbutton.cpp | 29 +- src/customeditor/matrixpushbutton.h | 2 - src/razergenie.cpp | 2 +- 9 files changed, 261 insertions(+), 216 deletions(-) diff --git a/data/matrix_layouts/discoverysave.example.22.json b/data/matrix_layouts/discoverysave.example.22.json index 0b75897..7850ccd 100644 --- a/data/matrix_layouts/discoverysave.example.22.json +++ b/data/matrix_layouts/discoverysave.example.22.json @@ -1,9 +1,9 @@ { - "fr_FR": { + "en_US": { "row0": [ { "colors": "#000000", - "label": "label0_0", + "label": "0_0", "matrix": [ 0, 0 @@ -11,7 +11,7 @@ }, { "colors": "#ff0000", - "label": "label0_1", + "label": "0_1", "matrix": [ 0, 1 @@ -19,7 +19,7 @@ }, { "colors": "#000000", - "label": "label0_2", + "label": "0_2", "matrix": [ 0, 2 @@ -27,7 +27,7 @@ }, { "colors": "#00007f", - "label": "label0_3", + "label": "0_3", "matrix": [ 0, 3 @@ -35,7 +35,7 @@ }, { "colors": "#00007f", - "label": "label0_4", + "label": "0_4", "matrix": [ 0, 4 @@ -43,7 +43,7 @@ }, { "colors": "#00007f", - "label": "label0_5", + "label": "0_5", "matrix": [ 0, 5 @@ -51,7 +51,7 @@ }, { "colors": "#00007f", - "label": "label0_6", + "label": "0_6", "matrix": [ 0, 6 @@ -59,7 +59,7 @@ }, { "colors": "#00007f", - "label": "label0_7", + "label": "0_7", "matrix": [ 0, 7 @@ -67,7 +67,7 @@ }, { "colors": "#00007f", - "label": "label0_8", + "label": "0_8", "matrix": [ 0, 8 @@ -75,7 +75,7 @@ }, { "colors": "#00007f", - "label": "label0_9", + "label": "0_9", "matrix": [ 0, 9 @@ -83,7 +83,7 @@ }, { "colors": "#00007f", - "label": "label0_10", + "label": "0_10", "matrix": [ 0, 10 @@ -91,7 +91,7 @@ }, { "colors": "#00007f", - "label": "label0_11", + "label": "0_11", "matrix": [ 0, 11 @@ -99,7 +99,7 @@ }, { "colors": "#00007f", - "label": "label0_12", + "label": "0_12", "matrix": [ 0, 12 @@ -107,7 +107,7 @@ }, { "colors": "#00007f", - "label": "label0_13", + "label": "0_13", "matrix": [ 0, 13 @@ -115,7 +115,7 @@ }, { "colors": "#00007f", - "label": "label0_14", + "label": "0_14", "matrix": [ 0, 14 @@ -123,7 +123,7 @@ }, { "colors": "#ff0000", - "label": "label0_15", + "label": "0_15", "matrix": [ 0, 15 @@ -131,7 +131,7 @@ }, { "colors": "#00007f", - "label": "label0_16", + "label": "0_16", "matrix": [ 0, 16 @@ -139,7 +139,7 @@ }, { "colors": "#00007f", - "label": "label0_17", + "label": "0_17", "matrix": [ 0, 17 @@ -147,7 +147,7 @@ }, { "colors": "#000000", - "label": "label0_18", + "label": "0_18", "matrix": [ 0, 18 @@ -155,7 +155,7 @@ }, { "colors": "#000000", - "label": "label0_19", + "label": "0_19", "matrix": [ 0, 19 @@ -163,7 +163,7 @@ }, { "colors": "#000000", - "label": "label0_20", + "label": "0_20", "matrix": [ 0, 20 @@ -171,7 +171,7 @@ }, { "colors": "#000000", - "label": "label0_21", + "label": "0_21", "matrix": [ 0, 21 @@ -181,7 +181,7 @@ "row1": [ { "colors": "#00007f", - "label": "label1_0", + "label": "1_0", "matrix": [ 1, 0 @@ -189,7 +189,7 @@ }, { "colors": "#00ffff", - "label": "label1_1", + "label": "1_1", "matrix": [ 1, 1 @@ -197,7 +197,7 @@ }, { "colors": "#ff00ff", - "label": "label1_2", + "label": "1_2", "matrix": [ 1, 2 @@ -205,7 +205,7 @@ }, { "colors": "#ff00ff", - "label": "label1_3", + "label": "1_3", "matrix": [ 1, 3 @@ -213,7 +213,7 @@ }, { "colors": "#ff00ff", - "label": "label1_4", + "label": "1_4", "matrix": [ 1, 4 @@ -221,7 +221,7 @@ }, { "colors": "#ff00ff", - "label": "label1_5", + "label": "1_5", "matrix": [ 1, 5 @@ -229,7 +229,7 @@ }, { "colors": "#ff00ff", - "label": "label1_6", + "label": "1_6", "matrix": [ 1, 6 @@ -237,7 +237,7 @@ }, { "colors": "#ff00ff", - "label": "label1_7", + "label": "1_7", "matrix": [ 1, 7 @@ -245,7 +245,7 @@ }, { "colors": "#ff00ff", - "label": "label1_8", + "label": "1_8", "matrix": [ 1, 8 @@ -253,7 +253,7 @@ }, { "colors": "#ff00ff", - "label": "label1_9", + "label": "1_9", "matrix": [ 1, 9 @@ -261,7 +261,7 @@ }, { "colors": "#ff00ff", - "label": "label1_10", + "label": "1_10", "matrix": [ 1, 10 @@ -269,7 +269,7 @@ }, { "colors": "#ff00ff", - "label": "label1_11", + "label": "1_11", "matrix": [ 1, 11 @@ -277,7 +277,7 @@ }, { "colors": "#ff00ff", - "label": "label1_12", + "label": "1_12", "matrix": [ 1, 12 @@ -285,7 +285,7 @@ }, { "colors": "#ff00ff", - "label": "label1_13", + "label": "1_13", "matrix": [ 1, 13 @@ -293,7 +293,7 @@ }, { "colors": "#00ffff", - "label": "label1_14", + "label": "1_14", "matrix": [ 1, 14 @@ -301,7 +301,7 @@ }, { "colors": "#005500", - "label": "label1_15", + "label": "1_15", "matrix": [ 1, 15 @@ -309,7 +309,7 @@ }, { "colors": "#00ffff", - "label": "label1_16", + "label": "1_16", "matrix": [ 1, 16 @@ -317,7 +317,7 @@ }, { "colors": "#00ffff", - "label": "label1_17", + "label": "1_17", "matrix": [ 1, 17 @@ -325,7 +325,7 @@ }, { "colors": "#ff0000", - "label": "label1_18", + "label": "1_18", "matrix": [ 1, 18 @@ -333,7 +333,7 @@ }, { "colors": "#ff007f", - "label": "label1_19", + "label": "1_19", "matrix": [ 1, 19 @@ -341,7 +341,7 @@ }, { "colors": "#ff007f", - "label": "label1_20", + "label": "1_20", "matrix": [ 1, 20 @@ -349,7 +349,7 @@ }, { "colors": "#ff007f", - "label": "label1_21", + "label": "1_21", "matrix": [ 1, 21 @@ -359,7 +359,7 @@ "row2": [ { "colors": "#00007f", - "label": "label2_0", + "label": "2_0", "matrix": [ 2, 0 @@ -367,7 +367,7 @@ }, { "colors": "#00ffff", - "label": "label2_1", + "label": "2_1", "matrix": [ 2, 1 @@ -375,7 +375,7 @@ }, { "colors": "#00ff00", - "label": "label2_2", + "label": "2_2", "matrix": [ 2, 2 @@ -383,7 +383,7 @@ }, { "colors": "#00ff00", - "label": "label2_3", + "label": "2_3", "matrix": [ 2, 3 @@ -391,7 +391,7 @@ }, { "colors": "#00ff00", - "label": "label2_4", + "label": "2_4", "matrix": [ 2, 4 @@ -399,7 +399,7 @@ }, { "colors": "#00ff00", - "label": "label2_5", + "label": "2_5", "matrix": [ 2, 5 @@ -407,7 +407,7 @@ }, { "colors": "#00ff00", - "label": "label2_6", + "label": "2_6", "matrix": [ 2, 6 @@ -415,7 +415,7 @@ }, { "colors": "#00ff00", - "label": "label2_7", + "label": "2_7", "matrix": [ 2, 7 @@ -423,7 +423,7 @@ }, { "colors": "#00ff00", - "label": "label2_8", + "label": "2_8", "matrix": [ 2, 8 @@ -431,7 +431,7 @@ }, { "colors": "#00ff00", - "label": "label2_9", + "label": "2_9", "matrix": [ 2, 9 @@ -439,7 +439,7 @@ }, { "colors": "#00ff00", - "label": "label2_10", + "label": "2_10", "matrix": [ 2, 10 @@ -447,7 +447,7 @@ }, { "colors": "#00ff00", - "label": "label2_11", + "label": "2_11", "matrix": [ 2, 11 @@ -455,7 +455,7 @@ }, { "colors": "#ff00ff", - "label": "label2_12", + "label": "2_12", "matrix": [ 2, 12 @@ -463,7 +463,7 @@ }, { "colors": "#ff00ff", - "label": "label2_13", + "label": "2_13", "matrix": [ 2, 13 @@ -471,7 +471,7 @@ }, { "colors": "#000000", - "label": "label2_14", + "label": "2_14", "matrix": [ 2, 14 @@ -479,7 +479,7 @@ }, { "colors": "#ff0000", - "label": "label2_15", + "label": "2_15", "matrix": [ 2, 15 @@ -487,7 +487,7 @@ }, { "colors": "#00ffff", - "label": "label2_16", + "label": "2_16", "matrix": [ 2, 16 @@ -495,7 +495,7 @@ }, { "colors": "#00ffff", - "label": "label2_17", + "label": "2_17", "matrix": [ 2, 17 @@ -503,7 +503,7 @@ }, { "colors": "#ffaa00", - "label": "label2_18", + "label": "2_18", "matrix": [ 2, 18 @@ -511,7 +511,7 @@ }, { "colors": "#ffaa00", - "label": "label2_19", + "label": "2_19", "matrix": [ 2, 19 @@ -519,7 +519,7 @@ }, { "colors": "#ffaa00", - "label": "label2_20", + "label": "2_20", "matrix": [ 2, 20 @@ -527,7 +527,7 @@ }, { "colors": "#ff007f", - "label": "label2_21", + "label": "2_21", "matrix": [ 2, 21 @@ -537,7 +537,7 @@ "row3": [ { "colors": "#00007f", - "label": "label3_0", + "label": "3_0", "matrix": [ 3, 0 @@ -545,7 +545,7 @@ }, { "colors": "#00ffff", - "label": "label3_1", + "label": "3_1", "matrix": [ 3, 1 @@ -553,7 +553,7 @@ }, { "colors": "#00ff00", - "label": "label3_2", + "label": "3_2", "matrix": [ 3, 2 @@ -561,7 +561,7 @@ }, { "colors": "#00ff00", - "label": "label3_3", + "label": "3_3", "matrix": [ 3, 3 @@ -569,7 +569,7 @@ }, { "colors": "#00ff00", - "label": "label3_4", + "label": "3_4", "matrix": [ 3, 4 @@ -577,7 +577,7 @@ }, { "colors": "#00ff00", - "label": "label3_5", + "label": "3_5", "matrix": [ 3, 5 @@ -585,7 +585,7 @@ }, { "colors": "#00ff00", - "label": "label3_6", + "label": "3_6", "matrix": [ 3, 6 @@ -593,7 +593,7 @@ }, { "colors": "#00ff00", - "label": "label3_7", + "label": "3_7", "matrix": [ 3, 7 @@ -601,7 +601,7 @@ }, { "colors": "#00ff00", - "label": "label3_8", + "label": "3_8", "matrix": [ 3, 8 @@ -609,7 +609,7 @@ }, { "colors": "#00ff00", - "label": "label3_9", + "label": "3_9", "matrix": [ 3, 9 @@ -617,7 +617,7 @@ }, { "colors": "#00ff00", - "label": "label3_10", + "label": "3_10", "matrix": [ 3, 10 @@ -625,7 +625,7 @@ }, { "colors": "#00ff00", - "label": "label3_11", + "label": "3_11", "matrix": [ 3, 11 @@ -633,7 +633,7 @@ }, { "colors": "#ff00ff", - "label": "label3_12", + "label": "3_12", "matrix": [ 3, 12 @@ -641,7 +641,7 @@ }, { "colors": "#ff00ff", - "label": "label3_13", + "label": "3_13", "matrix": [ 3, 13 @@ -649,7 +649,7 @@ }, { "colors": "#00ffff", - "label": "label3_14", + "label": "3_14", "matrix": [ 3, 14 @@ -657,7 +657,7 @@ }, { "colors": "#000000", - "label": "label3_15", + "label": "3_15", "matrix": [ 3, 15 @@ -665,7 +665,7 @@ }, { "colors": "#000000", - "label": "label3_16", + "label": "3_16", "matrix": [ 3, 16 @@ -673,7 +673,7 @@ }, { "colors": "#000000", - "label": "label3_17", + "label": "3_17", "matrix": [ 3, 17 @@ -681,7 +681,7 @@ }, { "colors": "#ffaa00", - "label": "label3_18", + "label": "3_18", "matrix": [ 3, 18 @@ -689,7 +689,7 @@ }, { "colors": "#ffaa00", - "label": "label3_19", + "label": "3_19", "matrix": [ 3, 19 @@ -697,7 +697,7 @@ }, { "colors": "#ffaa00", - "label": "label3_20", + "label": "3_20", "matrix": [ 3, 20 @@ -705,7 +705,7 @@ }, { "colors": "#000000", - "label": "label3_21", + "label": "3_21", "matrix": [ 3, 21 @@ -715,7 +715,7 @@ "row4": [ { "colors": "#00007f", - "label": "label4_0", + "label": "4_0", "matrix": [ 4, 0 @@ -723,7 +723,7 @@ }, { "colors": "#00ffff", - "label": "label4_1", + "label": "4_1", "matrix": [ 4, 1 @@ -731,7 +731,7 @@ }, { "colors": "#ff00ff", - "label": "label4_2", + "label": "4_2", "matrix": [ 4, 2 @@ -739,7 +739,7 @@ }, { "colors": "#00ff00", - "label": "label4_3", + "label": "4_3", "matrix": [ 4, 3 @@ -747,7 +747,7 @@ }, { "colors": "#00ff00", - "label": "label4_4", + "label": "4_4", "matrix": [ 4, 4 @@ -755,7 +755,7 @@ }, { "colors": "#00ff00", - "label": "label4_5", + "label": "4_5", "matrix": [ 4, 5 @@ -763,7 +763,7 @@ }, { "colors": "#00ff00", - "label": "label4_6", + "label": "4_6", "matrix": [ 4, 6 @@ -771,7 +771,7 @@ }, { "colors": "#00ff00", - "label": "label4_7", + "label": "4_7", "matrix": [ 4, 7 @@ -779,7 +779,7 @@ }, { "colors": "#00ff00", - "label": "label4_8", + "label": "4_8", "matrix": [ 4, 8 @@ -787,7 +787,7 @@ }, { "colors": "#ff00ff", - "label": "label4_9", + "label": "4_9", "matrix": [ 4, 9 @@ -795,7 +795,7 @@ }, { "colors": "#ff00ff", - "label": "label4_10", + "label": "4_10", "matrix": [ 4, 10 @@ -803,7 +803,7 @@ }, { "colors": "#ff00ff", - "label": "label4_11", + "label": "4_11", "matrix": [ 4, 11 @@ -811,7 +811,7 @@ }, { "colors": "#ff00ff", - "label": "label4_12", + "label": "4_12", "matrix": [ 4, 12 @@ -819,7 +819,7 @@ }, { "colors": "#000000", - "label": "label4_13", + "label": "4_13", "matrix": [ 4, 13 @@ -827,7 +827,7 @@ }, { "colors": "#00ffff", - "label": "label4_14", + "label": "4_14", "matrix": [ 4, 14 @@ -835,7 +835,7 @@ }, { "colors": "#000000", - "label": "label4_15", + "label": "4_15", "matrix": [ 4, 15 @@ -843,7 +843,7 @@ }, { "colors": "#55007f", - "label": "label4_16", + "label": "4_16", "matrix": [ 4, 16 @@ -851,7 +851,7 @@ }, { "colors": "#000000", - "label": "label4_17", + "label": "4_17", "matrix": [ 4, 17 @@ -859,7 +859,7 @@ }, { "colors": "#ffaa00", - "label": "label4_18", + "label": "4_18", "matrix": [ 4, 18 @@ -867,7 +867,7 @@ }, { "colors": "#ffaa00", - "label": "label4_19", + "label": "4_19", "matrix": [ 4, 19 @@ -875,7 +875,7 @@ }, { "colors": "#ffaa00", - "label": "label4_20", + "label": "4_20", "matrix": [ 4, 20 @@ -883,7 +883,7 @@ }, { "colors": "#00ffff", - "label": "label4_21", + "label": "4_21", "matrix": [ 4, 21 @@ -893,7 +893,7 @@ "row5": [ { "colors": "#00007f", - "label": "label5_0", + "label": "5_0", "matrix": [ 5, 0 @@ -901,7 +901,7 @@ }, { "colors": "#ff0000", - "label": "label5_1", + "label": "5_1", "matrix": [ 5, 1 @@ -909,7 +909,7 @@ }, { "colors": "#ff5500", - "label": "label5_2", + "label": "5_2", "matrix": [ 5, 2 @@ -917,7 +917,7 @@ }, { "colors": "#ff0000", - "label": "label5_3", + "label": "5_3", "matrix": [ 5, 3 @@ -925,7 +925,7 @@ }, { "colors": "#000000", - "label": "label5_4", + "label": "5_4", "matrix": [ 5, 4 @@ -933,7 +933,7 @@ }, { "colors": "#000000", - "label": "label5_5", + "label": "5_5", "matrix": [ 5, 5 @@ -941,7 +941,7 @@ }, { "colors": "#000000", - "label": "label5_6", + "label": "5_6", "matrix": [ 5, 6 @@ -949,7 +949,7 @@ }, { "colors": "#00ffff", - "label": "label5_7", + "label": "5_7", "matrix": [ 5, 7 @@ -957,7 +957,7 @@ }, { "colors": "#000000", - "label": "label5_8", + "label": "5_8", "matrix": [ 5, 8 @@ -965,7 +965,7 @@ }, { "colors": "#000000", - "label": "label5_9", + "label": "5_9", "matrix": [ 5, 9 @@ -973,7 +973,7 @@ }, { "colors": "#000000", - "label": "label5_10", + "label": "5_10", "matrix": [ 5, 10 @@ -981,7 +981,7 @@ }, { "colors": "#ff0000", - "label": "label5_11", + "label": "5_11", "matrix": [ 5, 11 @@ -989,7 +989,7 @@ }, { "colors": "#ffff00", - "label": "label5_12", + "label": "5_12", "matrix": [ 5, 12 @@ -997,7 +997,7 @@ }, { "colors": "#ff5500", - "label": "label5_13", + "label": "5_13", "matrix": [ 5, 13 @@ -1005,7 +1005,7 @@ }, { "colors": "#ff0000", - "label": "label5_14", + "label": "5_14", "matrix": [ 5, 14 @@ -1013,7 +1013,7 @@ }, { "colors": "#55007f", - "label": "label5_15", + "label": "5_15", "matrix": [ 5, 15 @@ -1021,7 +1021,7 @@ }, { "colors": "#55007f", - "label": "label5_16", + "label": "5_16", "matrix": [ 5, 16 @@ -1029,7 +1029,7 @@ }, { "colors": "#55007f", - "label": "label5_17", + "label": "5_17", "matrix": [ 5, 17 @@ -1037,7 +1037,7 @@ }, { "colors": "#000000", - "label": "label5_18", + "label": "5_18", "matrix": [ 5, 18 @@ -1045,7 +1045,7 @@ }, { "colors": "#ffaa00", - "label": "label5_19", + "label": "5_19", "matrix": [ 5, 19 @@ -1053,7 +1053,7 @@ }, { "colors": "#ff0000", - "label": "label5_20", + "label": "5_20", "matrix": [ 5, 20 @@ -1061,7 +1061,7 @@ }, { "colors": "#000000", - "label": "label5_21", + "label": "5_21", "matrix": [ 5, 21 diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index 305b789..cd8abb4 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -257,7 +257,7 @@ {"label": "alt", "width": 94, "matrix": [5, 3]}, {"label": "space", "width": 388}, {"label": "alt gr", "width": 94, "matrix": [5, 11]}, - {"label": "fn"}, + {"label": "fn", "matrix": [5, 12]}, {"label": "\u2630", "matrix": [5, 13]}, {"label": "strg", "width": 92, "matrix": [5, 14]}, {"label": "\ud83e\udc38", "matrix": [5, 15]}, @@ -393,7 +393,7 @@ {"label": "alt", "width": 94, "matrix": [5, 3]}, {"label": "space", "width": 388}, {"label": "alt gr", "width": 94, "matrix": [5, 11]}, - {"label": "fn"}, + {"label": "fn", "matrix": [5, 12]}, {"label": "\u2630", "matrix": [5, 13]}, {"label": "ctrl", "width": 92, "matrix": [5, 14]}, {"label": "\u2190", "matrix": [5, 15]}, @@ -529,7 +529,7 @@ {"label": "alt", "width": 94, "matrix": [5, 3]}, {"label": "espace", "width": 388, "matrix": [5, 7]}, {"label": "alt gr", "width": 94, "matrix": [5, 11]}, - {"label": "fn"}, + {"label": "fn", "matrix": [5, 12]}, {"label": "\u2630", "matrix": [5, 13]}, {"label": "ctrl", "width": 92, "matrix": [5, 14]}, {"label": "\u2190", "matrix": [5, 15]}, diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index 554bf2f..ea54361 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -179,10 +179,12 @@ QLayout* CustomEditor::generateKeyboard() // Iterate over rows in the object QJsonObject::const_iterator it; + QJsonObject clonelay; + int i = 0; + int j = 0; for(it = keyboardLayout.constBegin(); it != keyboardLayout.constEnd(); ++it) { - int i = 0; QJsonArray row = (*it).toArray(); - QJsonArray arr; + QJsonArray clonerow; QHBoxLayout *hbox = new QHBoxLayout(); hbox->setAlignment(Qt::AlignLeft); @@ -190,28 +192,28 @@ QLayout* CustomEditor::generateKeyboard() // Iterate over keys in row QJsonArray::const_iterator jt; QJsonObject obj; - for(jt = row.constBegin(); jt != row.constEnd(); ++jt) { + for(jt = row.constBegin(); jt != row.constEnd(); ++jt) + { obj = (*jt).toObject(); if(!obj[klay->mjsLabelStr].isNull()) { MatrixPushButton *btn = new MatrixPushButton(obj[klay->mjsLabelStr].toString()); - int width = obj.contains(klay->mjsWidth) ? obj.value(klay->mjsWidth).toInt() : 60; + int width = obj.contains(klay->mjsWidthStr) ? obj.value(klay->mjsWidthStr).toInt() : 60; int height = /*obj.contains("height") ? obj.value("height").toInt() : */63; btn->setFixedSize(width, height); bool color = false; - if( ! obj.value(klay->mjsLabelStr).isNull() ) - color = true; + color = true; if(obj.contains(klay->mjsMatrixStr)) { QJsonArray arr = obj[klay->mjsMatrixStr].toArray(); btn->setMatrixPos(arr[0].toInt(), arr[1].toInt()); } - if(obj.contains(klay->mjsDisabled)) { + if(obj.contains(klay->mjsDisabledStr)) { btn->setEnabled(false); color = false; } @@ -220,14 +222,14 @@ QLayout* CustomEditor::generateKeyboard() QPixmap pixmap("../../data/de_DE_mask.png"); btn->setMask(pixmap.mask()); }*/ - - //qDebug() << __PRETTY_FUNCTION__ << " : obj => " << obj << endl; if( ! obj.contains(klay->mjsColorsStr) && color == true ) { obj.insert(klay->mjsColorsStr, klay->mjsDefColor);; } + //qDebug() << __FUNCTION__ << " : obj => " << obj; + if(color == true) btn->setButtonColor(obj[klay->mjsColorsStr].toString() ); @@ -238,27 +240,23 @@ QLayout* CustomEditor::generateKeyboard() } else { QSpacerItem *spacer = new QSpacerItem(66, 69, QSizePolicy::Fixed, QSizePolicy::Fixed); hbox->addItem(spacer); + obj.insert(klay->mjsLabelStr, QJsonValue::Null); } - - //qDebug() << __PRETTY_FUNCTION__ << " obj => " << obj; - - arr.append(obj); - + clonerow.append(obj); + i++; } - vbox->addLayout(hbox); - - //qDebug() << __PRETTY_FUNCTION__ << " row => " << arr; + //qDebug() << __FUNCTION__ << " : clonerow => " << clonerow; - cloneobj.insert(klay->mjsRowStr+QString::number(i), arr); + clonelay.insert(klay->mjsRowStr+QString::number(j), clonerow); + j++; - i++; + vbox->addLayout(hbox); } - klay->setKbdLayRows(cloneobj); - klay->updateLayout(); + //qDebug() << __FUNCTION__ << " : clonelay => " << clonelay; - //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout(); + klay->setKbdLayRows(clonelay); return vbox; } @@ -374,48 +372,83 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) return true; } -bool CustomEditor::updateKeyrow(int row, bool fromfile) +bool CustomEditor::updateKeyrow(int row, const bool fromfile) { QJsonObject rowsO = klay->getKbdLayRows(); + //qDebug() << __FUNCTION__ << " : rowsO => " << rowsO; QJsonArray keysA = QJsonValue(rowsO.take(klay->mjsRowStr+QString::number(row))).toArray(); + //qDebug() << __FUNCTION__ << " : rowsO => " << rowsO; + //qDebug() << __FUNCTION__ << " : KeyA => " << keysA; QJsonObject keysO; for(int i=0; i < dimens[1]; i++) { keysO = QJsonValue(keysA.at(i)).toObject(); - QColor col = keysO.value(klay->mjsColorsStr).toString(); + //qDebug() << __FUNCTION__ << " : KeysO => " << keysO; + + if(keysO.isEmpty() == true) + break; + + QColor colour = keysO.value(klay->mjsColorsStr).toString(); - if(fromfile == true && col.isValid() == true) + if(fromfile == true && + colour.isValid() == true && + keysO.value(klay->mjsLabelStr).isNull() == false && + keysO.value(klay->mjsDisabledStr).isBool() == false ) { - //qDebug () << __PRETTY_FUNCTION__ << " : Color => " << col; - colors[row][i] = QColor(keysO.value(klay->mjsColorsStr).toString()); - int butn = i+(row * dimens[1]); - if(butn < matrixPushButtons.count()) + //qDebug () << __FUNCTION__ << " : Color => " << colour; + colors[row][i] = colour; + + int j = 0; + + QStringList discovery = keysO.value(klay->mjsLabelStr).toString().split("_"); + + for(; j < matrixPushButtons.count(); j++) { - //Avoid the segfault... check this manually - //qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); - if(colors[row][i] == klay->mjsDefColor) - { - colors[row][i] = QColor(Qt::black); - } - matrixPushButtons.at(butn)->setButtonColor(colors[row][i]); + if(keysO.value(klay->mjsLabelStr).toString() == matrixPushButtons.at(j)->getLabel() ) + break; + } + + if(discovery.isEmpty() == true ) + { + j = i+(row * dimens[1]); + } + + /* + qDebug() << __FUNCTION__ << ": JSon Label => " << keysO.value(klay->mjsLabelStr).toString() + << ": JSon Color => " << colour + << ": Butn index => " << j; + */ + // Threat the out of range if matrix discovery file loaded from the standart matrix layout files + if(j < matrixPushButtons.count() ) + { + matrixPushButtons.at(j)->setButtonColor(colors[row][i]); + qDebug() << __FUNCTION__ << ": Set color for button n°" << i << " which is labeled " << matrixPushButtons.at(j)->getLabel(); } } else { - //qDebug() << __PRETTY_FUNCTION__ << " : No color parameter found, adding default color param&value" << endl; - keysO.remove(klay->mjsColorsStr); - keysO.insert(klay->mjsColorsStr, colors[row][i].name()); - keysA.replace(i, keysO); + if(keysO.value(klay->mjsLabelStr).isNull() == false && + keysO.value(klay->mjsDisabledStr).isBool() == false) + { + if(keysO.contains(klay->mjsColorsStr)) + keysO.remove(klay->mjsColorsStr); + keysO.insert(klay->mjsColorsStr, colors[row][i].name()); + keysA.replace(i, keysO); + //qDebug() << __FUNCTION__ << " : Prepared row => " << keysO << endl << " Color prepared => " << keysA; + } + else { + qDebug() << __FUNCTION__ << ": Null / Disabled key found "; + } } } rowsO.insert(klay->mjsRowStr+QString::number(row), keysA); - klay->setKbdLayRows(rowsO); + //qDebug() << __FUNCTION__ << " Built of rowsO => " << rowsO; - //qDebug() << __PRETTY_FUNCTION__ << " : Colors => " << colors[row] << endl; + klay->setKbdLayRows(rowsO); return device->setKeyRow(row, 0, dimens[1]-1, colors[row]) && device->setCustom(); } @@ -453,12 +486,12 @@ void CustomEditor::loadLayout() QString file = QFileDialog::getOpenFileName(this, "Open Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); if( ! QFile::exists(file) ) return; - else - qDebug() << __PRETTY_FUNCTION__ << " : Opened layout file : " << file << " successfully"; + + qDebug() << __FUNCTION__ << " : Opened layout file : " << file << " successfully"; klay->openKbdLayout(file); - //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout() << endl; + //qDebug() << __FUNCTION__ << " : JSON contents => " << klay->getKbdLayout() << endl; for(int i = 0; i < 6; i++) { @@ -470,7 +503,7 @@ void CustomEditor::saveLayout() { QString file = QFileDialog::getSaveFileName(this, "Save Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); - qDebug() << __PRETTY_FUNCTION__ << " : Created new layout file : " << file; + qDebug() << __FUNCTION__ << " : Created new layout file : " << file; klay->saveKbdLayout(file); } @@ -508,7 +541,6 @@ void CustomEditor::onMatrixPushButtonClicked() // Set color in view sender->setButtonColor(selectedColor); } else if(drawStatus == DrawStatus::clear) { - qDebug() << "Clearing color."; // Set color in model colors[pos.first][pos.second] = QColor(Qt::black); // Set color in view diff --git a/src/customeditor/customeditor.h b/src/customeditor/customeditor.h index a9f3dfd..e32e8b5 100644 --- a/src/customeditor/customeditor.h +++ b/src/customeditor/customeditor.h @@ -47,7 +47,7 @@ class CustomEditor : public QDialog, public KbdLayout bool parseKeyboardJSON(QString jsonname); - bool updateKeyrow(int row, bool fromfile); + bool updateKeyrow(int row, const bool fromfile); void clearAll(); void loadLayout(); diff --git a/src/customeditor/kbdlayout.cpp b/src/customeditor/kbdlayout.cpp index 1507bea..ec7407c 100644 --- a/src/customeditor/kbdlayout.cpp +++ b/src/customeditor/kbdlayout.cpp @@ -3,18 +3,18 @@ KbdLayout::KbdLayout() { - //qDebug() << __PRETTY_FUNCTION__ << " : Constructed()" << endl; + //qDebug() << __FUNCTION__ << " : Constructed()" << endl; } KbdLayout::~KbdLayout() { - //qDebug() << __PRETTY_FUNCTION__ << " : Destroyed()" << endl; + //qDebug() << __FUNCTION__ << " : Destroyed()" << endl; } - void KbdLayout::setKbdLayout(const QJsonObject &langs) { this->mjsKbdLayoutDoc.setObject(langs); + qDebug() << __FUNCTION__ << ": JSON keyboard layout document created"; } void KbdLayout::setKbdLayLangs(const QJsonObject &rows) @@ -22,6 +22,7 @@ void KbdLayout::setKbdLayLangs(const QJsonObject &rows) QJsonObject newlang; newlang.insert(this->mjsLangStr, rows); this->mjsLangs = newlang; + qDebug() << __FUNCTION__ << ": JSON keyboard lang layout container filled"; } void KbdLayout::setKbdLayRows(const QJsonObject &row) @@ -29,26 +30,34 @@ void KbdLayout::setKbdLayRows(const QJsonObject &row) QJsonObject newrows; newrows.insert(this->mjsRowStr, row); this->mjsRows = row; + qDebug() << __FUNCTION__ << ": JSON keyboard row inserted into rowS container"; +} + +void KbdLayout::setParsedKeys(const QJsonObject &keys) +{ + this->mjsKeys = keys; } void KbdLayout::initLayout() { this->mjsLangs = this->mjsKbdLayoutDoc[this->mjsLangStr].toObject(); - //qDebug() << __PRETTY_FUNCTION__ << " : Rows => " << this->mjsRows; + //qDebug() << __FUNCTION__ << " : Rows => " << this->mjsRows; for(int i = 0; i < 6; i++) { this->mjsRows.insert(this->mjsRowStr+QString::number(i), this->mjsLangs.value(this->mjsRowStr+QString::number(i)) ); } - //qDebug() << __PRETTY_FUNCTION__ << " : Lang contents => " << this->mjsLangs << endl; - //qDebug() << __PRETTY_FUNCTION__ << " : Rows contents => " << this->mjsRows << endl; + //qDebug() << __FUNCTION__ << " : Lang contents => " << this->mjsLangs << endl; + //qDebug() << __FUNCTION__ << " : Rows contents => " << this->mjsRows << endl; + qDebug() << __FUNCTION__ << ": JSON keyboard layout document Initialised"; } void KbdLayout::updateLayout() { this->setKbdLayLangs(this->mjsRows); this->setKbdLayout(this->mjsLangs); + qDebug() << __FUNCTION__ << ": JSON Keyboard layout document updated"; } void KbdLayout::openKbdLayout(const QString &filename) @@ -56,9 +65,10 @@ void KbdLayout::openKbdLayout(const QString &filename) QFile file(filename); file.open(QIODevice::ReadOnly); this->mjsKbdLayoutDoc = QJsonDocument::fromJson(file.readAll()); - //qDebug() << __PRETTY_FUNCTION__ << " : File content => " << this->mjsKbdLayoutDoc << endl; + //qDebug() << __FUNCTION__ << " : File content => " << this->mjsKbdLayoutDoc << endl; file.close(); this->initLayout(); + qDebug() << __FUNCTION__ << ": Grabbed successfully JSON datas from file : " << filename; } void KbdLayout::saveKbdLayout(const QString &filename) @@ -66,9 +76,9 @@ void KbdLayout::saveKbdLayout(const QString &filename) this->updateLayout(); QFile file(filename); file.open(QIODevice::WriteOnly | QIODevice::Text); - //qDebug() << "JSON datas to write : " << this->mjsKbdLayoutDoc; file.write(this->mjsKbdLayoutDoc.toJson()); file.close(); + qDebug() << __FUNCTION__ << ": Saved successfully JSON datas to file : " << filename; } QJsonDocument KbdLayout::getKbdLayout() diff --git a/src/customeditor/kbdlayout.h b/src/customeditor/kbdlayout.h index a59f29b..812bf32 100644 --- a/src/customeditor/kbdlayout.h +++ b/src/customeditor/kbdlayout.h @@ -9,14 +9,14 @@ class KbdLayout { public: - QString mjsLangStr = "fr_FR"; - QString mjsRowStr = "row"; - QString mjsLabelStr = "label"; - QString mjsMatrixStr = "matrix"; - QString mjsColorsStr = "colors"; - QString mjsWidth = "width"; - QString mjsDisabled = "disabled"; - QString mjsDefColor = "#000000"; + QString mjsLangStr = "en_US"; + const QString mjsRowStr = "row"; + const QString mjsLabelStr = "label"; + const QString mjsMatrixStr = "matrix"; + const QString mjsColorsStr = "colors"; + const QString mjsWidthStr = "width"; + const QString mjsDisabledStr = "disabled"; + const QString mjsDefColor = "#000000"; KbdLayout(); ~KbdLayout(); @@ -24,6 +24,7 @@ class KbdLayout void setKbdLayout(const QJsonObject &langs); void setKbdLayLangs(const QJsonObject &rows); void setKbdLayRows(const QJsonObject &row); + void setParsedKeys(const QJsonObject &keys); void initLayout(); void updateLayout(); @@ -39,6 +40,7 @@ class KbdLayout QJsonDocument mjsKbdLayoutDoc; QJsonObject mjsLangs; QJsonObject mjsRows; + QJsonObject mjsKeys; }; #endif // KBDLAYOUT_H diff --git a/src/customeditor/matrixpushbutton.cpp b/src/customeditor/matrixpushbutton.cpp index 29e5c7b..02bc422 100644 --- a/src/customeditor/matrixpushbutton.cpp +++ b/src/customeditor/matrixpushbutton.cpp @@ -37,15 +37,23 @@ QPair MatrixPushButton::matrixPos() void MatrixPushButton::setButtonColor(QColor color) { - // Calculate "the perfect font color" - from https://24ways.org/2010/calculating-color-contrast/ - double yiq = ((color.red()*299)+(color.green()*587)+(color.blue()*114))/1000; - QString fontcolor = (yiq >= 128) ? "black" : "white"; + // Do not handle black color... + if(color == QColor(Qt::black)) + { + this->resetButtonColor(); + } + else + { + // Calculate "the perfect font color" - from https://24ways.org/2010/calculating-color-contrast/ + double yiq = ((color.red()*299)+(color.green()*587)+(color.blue()*114))/1000; + QString fontcolor = (yiq >= 128) ? "black" : "white"; - // Construct QPalette with the wanted color - QPalette p = QPalette(color); - // Set the font color to the previously calculated value - p.setColor(QPalette::ButtonText, fontcolor); - this->setPalette(p); + // Construct QPalette with the wanted color + QPalette p = QPalette(color); + // Set the font color to the previously calculated value + p.setColor(QPalette::ButtonText, fontcolor); + this->setPalette(p); + } } void MatrixPushButton::resetButtonColor() @@ -53,11 +61,6 @@ void MatrixPushButton::resetButtonColor() this->setPalette(this->style()->standardPalette()); } -void saveLayoutButton(QJsonDocument kbdlayout) -{ - qDebug() << "JSON Document contents : " << kbdlayout; -} - QString MatrixPushButton::getLabel() { return this->mLabel; diff --git a/src/customeditor/matrixpushbutton.h b/src/customeditor/matrixpushbutton.h index d554434..3386409 100644 --- a/src/customeditor/matrixpushbutton.h +++ b/src/customeditor/matrixpushbutton.h @@ -19,7 +19,6 @@ #define MATRIXPUSHBUTTON_H #include -#include class MatrixPushButton : public QPushButton { @@ -29,7 +28,6 @@ class MatrixPushButton : public QPushButton QPair matrixPos(); void setButtonColor(QColor color); void resetButtonColor(); - void saveLayoutButton(QJsonDocument kbdlayout); QString getLabel(); private: QString mLabel; diff --git a/src/razergenie.cpp b/src/razergenie.cpp index 2462dde..5540cfb 100644 --- a/src/razergenie.cpp +++ b/src/razergenie.cpp @@ -404,7 +404,7 @@ void RazerGenie::addDeviceToGui(const QString &serial) brightnessLabel = new QLabel(tr("Brightness")); brightnessSlider = new QSlider(Qt::Horizontal, widget); if(currentDevice->hasCapability("get_brightness")) { - qDebug() << "Brightness:" << currentDevice->getBrightness(); + //qDebug() << "Brightness:" << currentDevice->getBrightness(); brightnessSlider->setValue(currentDevice->getBrightness()); } else { // Set the slider to 100 by default as it's more likely it's 100 than 0... From de3e62cfb293c316fcece3150a67b43714256e8c Mon Sep 17 00:00:00 2001 From: Tikeri Date: Tue, 21 Apr 2020 12:35:38 +0200 Subject: [PATCH 23/47] Removed unused stuff, removed the null label which leads in improper layout values.. this wasted my time btw. --- data/matrix_layouts/razerdefault22.json | 1 - src/customeditor/customeditor.cpp | 29 +++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index cd8abb4..c90c191 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -410,7 +410,6 @@ {"label": null}, {"label": "esc", "matrix": [0, 1]}, {"label": null}, - {"label": null}, {"label": "F1", "matrix": [0, 3]}, {"label": "F2", "matrix": [0, 4]}, {"label": "F3", "matrix": [0, 5]}, diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index ea54361..973f496 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -176,6 +176,8 @@ QLayout* CustomEditor::generateKeyboard() closeWindow(); } } + + qDebug() << __FUNCTION__ << ": Selected language is " << klay->mjsLangStr; // Iterate over rows in the object QJsonObject::const_iterator it; @@ -384,7 +386,6 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) for(int i=0; i < dimens[1]; i++) { keysO = QJsonValue(keysA.at(i)).toObject(); - //qDebug() << __FUNCTION__ << " : KeysO => " << keysO; if(keysO.isEmpty() == true) @@ -401,20 +402,13 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) colors[row][i] = colour; int j = 0; - - QStringList discovery = keysO.value(klay->mjsLabelStr).toString().split("_"); - + for(; j < matrixPushButtons.count(); j++) { if(keysO.value(klay->mjsLabelStr).toString() == matrixPushButtons.at(j)->getLabel() ) break; } - if(discovery.isEmpty() == true ) - { - j = i+(row * dimens[1]); - } - /* qDebug() << __FUNCTION__ << ": JSon Label => " << keysO.value(klay->mjsLabelStr).toString() << ": JSon Color => " << colour @@ -424,7 +418,9 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) if(j < matrixPushButtons.count() ) { matrixPushButtons.at(j)->setButtonColor(colors[row][i]); - qDebug() << __FUNCTION__ << ": Set color for button n°" << i << " which is labeled " << matrixPushButtons.at(j)->getLabel(); + qDebug() << __FUNCTION__ << ": Set color " << colors[row][i] + << " for button n°" << i + << " which is labeled " << matrixPushButtons.at(j)->getLabel(); } } else @@ -436,7 +432,7 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) keysO.remove(klay->mjsColorsStr); keysO.insert(klay->mjsColorsStr, colors[row][i].name()); keysA.replace(i, keysO); - //qDebug() << __FUNCTION__ << " : Prepared row => " << keysO << endl << " Color prepared => " << keysA; + //qDebug() << __FUNCTION__ << ": Prepared row => " << keysO << endl << " Color prepared => " << keysA; } else { qDebug() << __FUNCTION__ << ": Null / Disabled key found "; @@ -445,7 +441,6 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) } rowsO.insert(klay->mjsRowStr+QString::number(row), keysA); - //qDebug() << __FUNCTION__ << " Built of rowsO => " << rowsO; klay->setKbdLayRows(rowsO); @@ -461,13 +456,14 @@ void CustomEditor::clearAll() blankColors << QColor(Qt::black); } + /* // Send one request per row for(int i=0; isetKeyRow(i, 0, dimens[1]-1, blankColors); } - device->setCustom(); - + */ + // Reset view for(int i=0; iresetButtonColor(); @@ -479,6 +475,11 @@ void CustomEditor::clearAll() colors[i][j] = QColor(Qt::black); } } + + for(int i=0; i < dimens[0]; i++) + { + this->updateKeyrow(i, false); + } } void CustomEditor::loadLayout() From f0f2811ebc2c4ea0c77cc2fbdd8ca6ad53bf948f Mon Sep 17 00:00:00 2001 From: Tikeri Date: Tue, 21 Apr 2020 15:03:13 +0200 Subject: [PATCH 24/47] Razerlogo LED added into fr_FR kayboard layout, should be the same for others keyboards ? --- data/matrix_layouts/razerdefault22.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index c90c191..ca219b5 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -424,7 +424,9 @@ {"label": "F12", "matrix": [0, 14]}, {"label": "impr.", "matrix": [0, 15]}, {"label": "arrêt", "matrix": [0, 16]}, - {"label": "pause", "matrix": [0, 17]} + {"label": "pause", "matrix": [0, 17]}, + {"label": null}, + {"label": "Triskel", "width": 180, "matrix": [0, 20]} ], "row1": [ {"label": "M1", "matrix": [1, 0]}, From e970b3baf7ee3a3da64cffe8936d46562b62cbcf Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Wed, 29 Aug 2018 15:16:36 +0200 Subject: [PATCH 25/47] Add fr_FR layout for Razer Blade Stealth (Late 2017) Fixes #21 --- data/matrix_layouts/razerblade16.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/matrix_layouts/razerblade16.json b/data/matrix_layouts/razerblade16.json index a270189..32970cb 100644 --- a/data/matrix_layouts/razerblade16.json +++ b/data/matrix_layouts/razerblade16.json @@ -191,7 +191,11 @@ ] }, +<<<<<<< HEAD "French": { +======= + "fr_FR": { +>>>>>>> afe40ac... Add fr_FR layout for Razer Blade Stealth (Late 2017) "row0": [ {"label": "esc", "matrix": [0, 1]}, {"label": "F1", "matrix": [0, 2]}, From 45c015d32b27c484d3ac2a89e9bd81bfef308612 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 2 Sep 2018 11:30:45 +0200 Subject: [PATCH 26/47] Fix qdoc config for Qt 5.11 Also add a kind-of working meson target that can be invoked with 'ninja src/libopenrazer/docs/html' --- src/libopenrazer/docs/libopenrazermodule.h | 2 ++ src/libopenrazer/docs/meson.build | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 src/libopenrazer/docs/libopenrazermodule.h create mode 100644 src/libopenrazer/docs/meson.build diff --git a/src/libopenrazer/docs/libopenrazermodule.h b/src/libopenrazer/docs/libopenrazermodule.h new file mode 100644 index 0000000..3dfdd72 --- /dev/null +++ b/src/libopenrazer/docs/libopenrazermodule.h @@ -0,0 +1,2 @@ +#include "../libopenrazer.h" +#include "../razercapability.h" diff --git a/src/libopenrazer/docs/meson.build b/src/libopenrazer/docs/meson.build new file mode 100644 index 0000000..7087629 --- /dev/null +++ b/src/libopenrazer/docs/meson.build @@ -0,0 +1,9 @@ +qdoc = find_program('qdoc') + +# TODO Fix up includes to work automatically (especially the gcc include) +mytarget = custom_target('docs', + output: 'html', + input : 'config.qdocconf', + command: [qdoc, '@INPUT@', '-I', meson.current_source_dir(), + '-I/usr/include/qt', '-I/usr/include/qt/QtCore', '-I/usr/include/qt/QtGui', '-I/usr/include/qt/QtDBus', '-I/usr/include/qt/QtXml', + '-I/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include']) From f33a47288b0ca6f9d946823cdf62e7ed2a4ca2f4 Mon Sep 17 00:00:00 2001 From: Jeremy Bernhardt Date: Wed, 29 Aug 2018 10:43:54 -0600 Subject: [PATCH 27/47] razerdefault22: Add en_US keymap --- data/matrix_layouts/razerdefault22.json | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index 97fbea7..f2dc72c 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -1,5 +1,9 @@ { +<<<<<<< HEAD "US": { +======= + "en_US": { +>>>>>>> 44c678e... razerdefault22: Add en_US keymap "row0": [ {"label": null}, {"label": "esc", "matrix": [0, 1]}, @@ -119,9 +123,15 @@ {"label": "ctrl", "width": 94, "matrix": [5, 1]}, {"label": "\ud83d\udc27", "matrix": [5, 2]}, {"label": "alt", "width": 94, "matrix": [5, 3]}, +<<<<<<< HEAD {"label": "space", "width": 388, "matrix": [5, 7]}, {"label": "alt", "width": 94, "matrix": [5, 11]}, {"label": "fn", "matrix": [5, 12]}, +======= + {"label": "space", "width": 388}, + {"label": "alt", "width": 94, "matrix": [5, 11]}, + {"label": "fn"}, +>>>>>>> 44c678e... razerdefault22: Add en_US keymap {"label": "\u2630", "matrix": [5, 13]}, {"label": "ctrl", "width": 92, "matrix": [5, 14]}, {"label": "\ud83e\udc38", "matrix": [5, 15]}, @@ -133,7 +143,11 @@ ] }, +<<<<<<< HEAD "German": { +======= + "de_DE": { +>>>>>>> 44c678e... razerdefault22: Add en_US keymap "row0": [ {"label": null}, {"label": "esc", "matrix": [0, 1]}, @@ -529,7 +543,7 @@ {"label": "alt", "width": 94, "matrix": [5, 3]}, {"label": "espace", "width": 388, "matrix": [5, 7]}, {"label": "alt gr", "width": 94, "matrix": [5, 11]}, - {"label": "fn"}, + {"label": "fn", "matrix": [5, 12]}, {"label": "\u2630", "matrix": [5, 13]}, {"label": "ctrl", "width": 92, "matrix": [5, 14]}, {"label": "\u2190", "matrix": [5, 15]}, From adbba46b5db4e0ca97e6236f5f4ca549276df5e3 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Oct 2018 19:52:18 +0200 Subject: [PATCH 28/47] Release version 0.8 --- data/xyz.z3ntu.razergenie.appdata.xml | 3 +++ meson.build | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/data/xyz.z3ntu.razergenie.appdata.xml b/data/xyz.z3ntu.razergenie.appdata.xml index 7c065db..30c804b 100644 --- a/data/xyz.z3ntu.razergenie.appdata.xml +++ b/data/xyz.z3ntu.razergenie.appdata.xml @@ -19,6 +19,7 @@ https://github.com/z3ntu/RazerGenie/wiki/Translations +<<<<<<< HEAD

libopenrazer:

@@ -27,6 +28,8 @@
+======= +>>>>>>> 2666d24... Release version 0.8

RazerGenie:

diff --git a/meson.build b/meson.build index dba330f..c28c019 100644 --- a/meson.build +++ b/meson.build @@ -3,6 +3,12 @@ project('razergenie', 'cpp', meson_version : '>=0.44.0', default_options : ['cpp_std=c++11']) +<<<<<<< HEAD +======= +razergenie_version = '0.8' +libopenrazer_version = '0.0.1' + +>>>>>>> 2666d24... Release version 0.8 qt5 = import('qt5') qt5_dep = dependency('qt5', modules: ['Core', 'DBus', 'Gui', 'Network', 'Widgets']) From 7e11d77384d7ebb387874ea25645e92392e9686a Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Oct 2018 20:05:30 +0200 Subject: [PATCH 29/47] Make qdoc dependency optional --- src/libopenrazer/docs/meson.build | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libopenrazer/docs/meson.build b/src/libopenrazer/docs/meson.build index 7087629..12f005c 100644 --- a/src/libopenrazer/docs/meson.build +++ b/src/libopenrazer/docs/meson.build @@ -1,9 +1,11 @@ -qdoc = find_program('qdoc') +qdoc = find_program('qdoc', required : false) -# TODO Fix up includes to work automatically (especially the gcc include) -mytarget = custom_target('docs', - output: 'html', - input : 'config.qdocconf', - command: [qdoc, '@INPUT@', '-I', meson.current_source_dir(), - '-I/usr/include/qt', '-I/usr/include/qt/QtCore', '-I/usr/include/qt/QtGui', '-I/usr/include/qt/QtDBus', '-I/usr/include/qt/QtXml', - '-I/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include']) +if qdoc.found() + # TODO Fix up includes to work automatically (especially the gcc include) + custom_target('docs', + output: 'html', + input : 'config.qdocconf', + command: [qdoc, '@INPUT@', '-I', meson.current_source_dir(), + '-I/usr/include/qt', '-I/usr/include/qt/QtCore', '-I/usr/include/qt/QtGui', '-I/usr/include/qt/QtDBus', '-I/usr/include/qt/QtXml', + '-I/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include']) +endif From f5692d7eb4304390b16f55c0b3f0771e804ff184 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Oct 2018 20:09:05 +0200 Subject: [PATCH 30/47] Release version 0.8.1 --- data/xyz.z3ntu.razergenie.appdata.xml | 6 ++++++ meson.build | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/data/xyz.z3ntu.razergenie.appdata.xml b/data/xyz.z3ntu.razergenie.appdata.xml index 30c804b..4440bf6 100644 --- a/data/xyz.z3ntu.razergenie.appdata.xml +++ b/data/xyz.z3ntu.razergenie.appdata.xml @@ -20,6 +20,9 @@ <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 2f41ab4... Release version 0.8.1

libopenrazer:

@@ -28,8 +31,11 @@
+<<<<<<< HEAD ======= >>>>>>> 2666d24... Release version 0.8 +======= +>>>>>>> 2f41ab4... Release version 0.8.1

RazerGenie:

diff --git a/meson.build b/meson.build index c28c019..8f8b6a0 100644 --- a/meson.build +++ b/meson.build @@ -3,9 +3,13 @@ project('razergenie', 'cpp', meson_version : '>=0.44.0', default_options : ['cpp_std=c++11']) +<<<<<<< HEAD <<<<<<< HEAD ======= razergenie_version = '0.8' +======= +razergenie_version = '0.8.1' +>>>>>>> 2f41ab4... Release version 0.8.1 libopenrazer_version = '0.0.1' >>>>>>> 2666d24... Release version 0.8 From d68af47535c2248bc6923540c0ecb3b8f6f2bd1d Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 21 Jul 2019 18:36:27 +0200 Subject: [PATCH 31/47] Use a combobox for DeathAdder 3.5G Previously, all devices supported setting any value as DPI you wanted, but the DeathAdder 3.5G only has 4 values available so add support for that. --- src/razergenie.cpp | 665 +++++++++++++++++++++++++++++++++++++++++++++ src/razergenie.h | 41 +++ 2 files changed, 706 insertions(+) diff --git a/src/razergenie.cpp b/src/razergenie.cpp index 45fb39b..2ab2ad9 100644 --- a/src/razergenie.cpp +++ b/src/razergenie.cpp @@ -328,8 +328,207 @@ void RazerGenie::addDeviceToGui(const QDBusObjectPath &devicePath) // Set the main widget as child of the scrollArea scrollArea->setWidget(widget); +<<<<<<< HEAD // Add the new widget to the stacked widget ui_main.stackedWidget->addWidget(scrollArea); +======= + /* 'Set Scroll Active' checkbox */ + if(currentLocation == libopenrazer::Device::LightingScroll) { + // Show if the device has 'setActive' but not 'setNone' as it would be basically a duplicate action + if(currentDevice->hasCapability("lighting_scroll_active") && !currentDevice->hasCapability("lighting_scroll_none")) { + QCheckBox *activeCheckbox = new QCheckBox(tr("Set Scroll Active"), widget); + activeCheckbox->setChecked(currentDevice->getScrollActive()); + verticalLayout->addWidget(activeCheckbox); + connect(activeCheckbox, &QCheckBox::clicked, this, &RazerGenie::scrollActiveCheckbox); + } + } + + /* 'Set Backlight Active' checkbox */ + if(currentLocation == libopenrazer::Device::LightingBacklight) { + // Show if the device has 'setActive' but not 'setNone' as it would be basically a duplicate action + if(currentDevice->hasCapability("lighting_backlight_active") && !currentDevice->hasCapability("lighting_backlight_none")) { + QCheckBox *activeCheckbox = new QCheckBox(tr("Set Backlight Active"), widget); + activeCheckbox->setChecked(currentDevice->getBacklightActive()); + verticalLayout->addWidget(activeCheckbox); + connect(activeCheckbox, &QCheckBox::clicked, this, &RazerGenie::backlightActiveCheckbox); + } + } + + /* Profile LED checkboxes */ + if(currentLocation == libopenrazer::Device::Lighting) { + if(currentDevice->hasCapability("lighting_profile_leds")) { + for(int i=1; i<=3; ++i) { + QString i_str = QString::number(i); + QCheckBox *profileLedCheckbox = new QCheckBox(tr("Profile LED %1").arg(i_str), widget); + bool enabled = false; + if(i == 1) enabled = currentDevice->getRedLED(); + else if(i == 2) enabled = currentDevice->getGreenLED(); + else if(i == 3) enabled = currentDevice->getBlueLED(); + profileLedCheckbox->setChecked(enabled); + profileLedCheckbox->setObjectName(i_str); + verticalLayout->addWidget(profileLedCheckbox); + connect(profileLedCheckbox, &QCheckBox::clicked, this, &RazerGenie::profileLedCheckbox); + } + } + } + + /* Brightness sliders */ + if(brightnessLabel != NULL && brightnessSlider != NULL) { // only if brightness capability exists + verticalLayout->addWidget(brightnessLabel); + QHBoxLayout *hboxSlider = new QHBoxLayout(); + QLabel *brightnessSliderValue = new QLabel; + hboxSlider->addWidget(brightnessSlider); + hboxSlider->addWidget(brightnessSliderValue); + verticalLayout->addLayout(hboxSlider); + } + } + + /* DPI sliders */ + if(currentDevice->hasCapability("dpi") && !currentDevice->hasCapability("available_dpi")) { + // HBoxes + QHBoxLayout *dpiXHBox = new QHBoxLayout(); + QHBoxLayout *dpiYHBox = new QHBoxLayout(); + QHBoxLayout *dpiHeaderHBox = new QHBoxLayout(); + + // Header + QLabel *dpiHeader = new QLabel(tr("DPI"), widget); + dpiHeader->setFont(headerFont); + dpiHeaderHBox->addWidget(dpiHeader); + + verticalLayout->addLayout(dpiHeaderHBox); + + // Labels + QLabel *dpiXLabel = new QLabel(tr("DPI X")); + QLabel *dpiYLabel = new QLabel(tr("DPI Y")); + + // Read-only textboxes + QTextEdit *dpiXText = new QTextEdit(widget); + QTextEdit *dpiYText = new QTextEdit(widget); + dpiXText->setMaximumWidth(60); + dpiYText->setMaximumWidth(60); + dpiXText->setMaximumHeight(30); + dpiYText->setMaximumHeight(30); + dpiXText->setObjectName("dpiXText"); + dpiYText->setObjectName("dpiYText"); + dpiXText->setEnabled(false); + dpiYText->setEnabled(false); + + // Sliders + QSlider *dpiXSlider = new QSlider(Qt::Horizontal, widget); + QSlider *dpiYSlider = new QSlider(Qt::Horizontal, widget); + dpiXSlider->setObjectName("dpiX"); + dpiYSlider->setObjectName("dpiY"); + + // Sync checkbox + QLabel *dpiSyncLabel = new QLabel(tr("Lock X/Y"), widget); + QCheckBox *dpiSyncCheckbox = new QCheckBox(widget); + + // Get the current DPI and set the slider&text + QList currDPI = currentDevice->getDPI(); + qDebug() << "currDPI:" << currDPI; + if(currDPI.count() == 2) { + dpiXSlider->setValue(currDPI[0]/100); + dpiYSlider->setValue(currDPI[1]/100); + dpiXText->setText(QString::number(currDPI[0])); + dpiYText->setText(QString::number(currDPI[1])); + } else { + qWarning() << "RazerGenie: Skipping dpi because return value of getDPI() is wrong. Probably the broken fake driver."; + } + + int maxDPI = currentDevice->maxDPI(); + qDebug() << "maxDPI:" << maxDPI; + dpiXSlider->setMaximum(maxDPI/100); + dpiYSlider->setMaximum(maxDPI/100); + + dpiXSlider->setTickInterval(10); + dpiYSlider->setTickInterval(10); + dpiXSlider->setTickPosition(QSlider::TickPosition::TicksBelow); + dpiYSlider->setTickPosition(QSlider::TickPosition::TicksBelow); + + dpiSyncCheckbox->setChecked(syncDpi); // set enabled by default + + dpiXHBox->addWidget(dpiXLabel); + dpiXHBox->addWidget(dpiXText); + dpiXHBox->addWidget(dpiXSlider); + + dpiYHBox->addWidget(dpiYLabel); + dpiYHBox->addWidget(dpiYText); + dpiYHBox->addWidget(dpiYSlider); + + dpiHeaderHBox->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); + dpiHeaderHBox->addWidget(dpiSyncLabel); + // TODO Better solution/location for 'Sync' checkbox + dpiHeaderHBox->addWidget(dpiSyncCheckbox); + + connect(dpiXSlider, &QSlider::valueChanged, this, &RazerGenie::dpiChanged); + connect(dpiYSlider, &QSlider::valueChanged, this, &RazerGenie::dpiChanged); + connect(dpiSyncCheckbox, &QCheckBox::clicked, this, &RazerGenie::dpiSyncCheckbox); + + verticalLayout->addLayout(dpiXHBox); + verticalLayout->addLayout(dpiYHBox); + } + + /* DPI dropdown */ + if(currentDevice->hasCapability("dpi") && currentDevice->hasCapability("available_dpi")) { + QLabel *dpiHeader = new QLabel(tr("DPI"), widget); + dpiHeader->setFont(headerFont); + verticalLayout->addWidget(dpiHeader); + + QComboBox *dpiComboBox = new QComboBox; + QList availableDPI = currentDevice->availableDPI(); + foreach(int dpivalue, availableDPI) { + dpiComboBox->addItem(QString("%1 DPI").arg(dpivalue), dpivalue); + } + dpiComboBox->setCurrentText(QString("%1 DPI").arg(currentDevice->getDPI()[0])); + verticalLayout->addWidget(dpiComboBox); + + connect(dpiComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &RazerGenie::dpiComboChanged); + } + + /* Poll rate */ + if(currentDevice->hasCapability("poll_rate")) { + QLabel *pollRateHeader = new QLabel(tr("Polling rate"), widget); + pollRateHeader->setFont(headerFont); + verticalLayout->addWidget(pollRateHeader); + + QComboBox *pollComboBox = new QComboBox; + pollComboBox->addItem("125 Hz", libopenrazer::POLL_125HZ); + pollComboBox->addItem("500 Hz", libopenrazer::POLL_500HZ); + pollComboBox->addItem("1000 Hz", libopenrazer::POLL_1000HZ); + pollComboBox->setCurrentText(QString::number(currentDevice->getPollRate()) + " Hz"); + verticalLayout->addWidget(pollComboBox); + + connect(pollComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &RazerGenie::pollCombo); + } + + /* Custom lighting */ + if(currentDevice->hasCapability("lighting_led_matrix")) { + QPushButton *button = new QPushButton(widget); + button->setText(tr("Open custom editor")); + verticalLayout->addWidget(button); + connect(button, &QPushButton::clicked, this, &RazerGenie::openCustomEditor); +#ifdef INCLUDE_MATRIX_DISCOVERY + QPushButton *buttonD = new QPushButton(widget); + buttonD->setText(tr("Launch matrix discovery")); + verticalLayout->addWidget(buttonD); + connect(buttonD, &QPushButton::clicked, this, &RazerGenie::openMatrixDiscovery); +#endif + } + + /* Spacer to bottom */ + QSpacerItem *spacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + verticalLayout->addItem(spacer); + + /* Serial and firmware version labels */ + QLabel *serialLabel = new QLabel(tr("Serial number: %1").arg(serial)); + verticalLayout->addWidget(serialLabel); + + QLabel *fwVerLabel = new QLabel(tr("Firmware version: %1").arg(currentDevice->getFirmwareVersion())); + verticalLayout->addWidget(fwVerLabel); + + ui_main.stackedWidget->addWidget(widget); +// qDebug() << "Stacked widget count:" << ui_main.stackedWidget->count(); +>>>>>>> 0b0ce04... Use a combobox for DeathAdder 3.5G } bool RazerGenie::removeDeviceFromGui(const QDBusObjectPath &devicePath) @@ -443,6 +642,472 @@ void RazerGenie::toggleOffOnScreesaver(bool on) util::showError(tr("Error while toggling 'turn off on screensaver'")); } +<<<<<<< HEAD +======= +void RazerGenie::colorButtonClicked() +{ + qDebug() << "color dialog"; + + QPushButton *sender = qobject_cast(QObject::sender()); + qDebug() << sender->objectName(); + + QPalette pal(sender->palette()); + + QColor oldColor = pal.color(QPalette::Button); + + QColor color = QColorDialog::getColor(oldColor); + if(color.isValid()) { + qDebug() << color.name(); + pal.setColor(QPalette::Button, color); + sender->setPalette(pal); + } else { + qInfo() << "User cancelled the dialog."; + } + // objectName is location(int)_colorbuttonNR(1-3) + // TODO: We shouldn't assume the world to be perfect! + applyEffect(static_cast(sender->objectName().split("_")[0].toInt())); +} + +QPair RazerGenie::commonCombo(int index) +{ + QComboBox *sender = qobject_cast(QObject::sender()); + libopenrazer::RazerCapability capability = sender->itemData(index).value(); + QString identifier = capability.getIdentifier(); + + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + // Show/hide the color buttons + if(capability.getNumColors() == 0) { // hide all + for(int i=1; i<=3; i++) + item->findChild(sender->objectName() + "_colorbutton" + QString::number(i))->hide(); + } else { + for(int i=1; i<=3; i++) { + if(capability.getNumColors() < i) + item->findChild(sender->objectName() + "_colorbutton" + QString::number(i))->hide(); + else + item->findChild(sender->objectName() + "_colorbutton" + QString::number(i))->show(); + } + } + + // Show/hide the wave radiobuttons + if(capability.isWave() == 0) { + item->findChild(sender->objectName() + "_radiobutton1")->hide(); + item->findChild(sender->objectName() + "_radiobutton2")->hide(); + } else { + item->findChild(sender->objectName() + "_radiobutton1")->show(); + item->findChild(sender->objectName() + "_radiobutton2")->show(); + } + + return qMakePair(dev, identifier); +} + +void RazerGenie::standardCombo(int index) +{ + QPair tuple = commonCombo(index); + libopenrazer::Device *dev = tuple.first; + QString identifier = tuple.second; + + qDebug() << tuple; + + applyEffectStandardLoc(identifier, dev); +} + +void RazerGenie::scrollCombo(int index) +{ + QPair tuple = commonCombo(index); + libopenrazer::Device *dev = tuple.first; + QString identifier = tuple.second; + + qDebug() << tuple; + + applyEffectScrollLoc(identifier, dev); +} + +void RazerGenie::logoCombo(int index) +{ + QPair tuple = commonCombo(index); + libopenrazer::Device *dev = tuple.first; + QString identifier = tuple.second; + + qDebug() << tuple; + + applyEffectLogoLoc(identifier, dev); +} + +void RazerGenie::backlightCombo(int index) +{ + QPair tuple = commonCombo(index); + libopenrazer::Device *dev = tuple.first; + QString identifier = tuple.second; + + qDebug() << tuple; + + applyEffectBacklightLoc(identifier, dev); +} + +QColor RazerGenie::getColorForButton(int num, libopenrazer::Device::LightingLocation location) +{ + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + QPalette pal = item->findChild(QString::number(location) + "_colorbutton" + QString::number(num))->palette(); + return pal.color(QPalette::Button); +} + +libopenrazer::WaveDirection RazerGenie::getWaveDirection(libopenrazer::Device::LightingLocation location) +{ + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + + return item->findChild(QString::number(location) + "_radiobutton1")->isChecked() ? libopenrazer::WAVE_LEFT : libopenrazer::WAVE_RIGHT; +} + +void RazerGenie::brightnessChanged(int value) +{ + qDebug() << value; + + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + dev->setBrightness(value); +} + +void RazerGenie::scrollBrightnessChanged(int value) +{ + qDebug() << value; + + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + dev->setScrollBrightness(value); +} + +void RazerGenie::logoBrightnessChanged(int value) +{ + qDebug() << value; + + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + dev->setLogoBrightness(value); +} + +void RazerGenie::backlightBrightnessChanged(int value) +{ + qDebug() << value; + + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + dev->setBacklightBrightness(value); +} + +void RazerGenie::dpiChanged(int orig_value) +{ + int value = orig_value * 100; + + QSlider *sender = qobject_cast(QObject::sender()); + + qDebug() << value; + qDebug() << sender->objectName(); + + // if DPI should be synced + if(syncDpi) { + if(sender->objectName() == "dpiX") { + // set the other slider + QSlider *slider = sender->parentWidget()->findChild("dpiY"); + slider->setValue(orig_value); + + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + // set DPI + dev->setDPI(value, value); // set for both X & Y + } else { + // just set the slider (as the rest was done already or will be done) + QSlider *slider = sender->parentWidget()->findChild("dpiX"); + slider->setValue(orig_value); + } + } /* if DPI should NOT be synced */ else { + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + // set DPI (with value from other slider) + if(sender->objectName() == "dpiX") { + QSlider *slider = sender->parentWidget()->findChild("dpiY"); + dev->setDPI(value, slider->value()*100); + } else { + QSlider *slider = sender->parentWidget()->findChild("dpiX"); + dev->setDPI(slider->value()*100, value); + } + } + // Update textbox with new value + QTextEdit *dpitextbox = sender->parentWidget()->findChild(sender->objectName() + "Text"); + dpitextbox->setText(QString::number(value)); +} + +void RazerGenie::dpiComboChanged(int /* index */) +{ + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + QComboBox *sender = qobject_cast(QObject::sender()); + // Indicate that DPI-Y should not be used with -1 + dev->setDPI(sender->currentData().toInt(), -1); +} + +void RazerGenie::applyEffectStandardLoc(QString identifier, libopenrazer::Device *device) +{ + libopenrazer::Device::LightingLocation zone = libopenrazer::Device::Lighting; + + if(identifier == "lighting_breath_single") { + QColor c = getColorForButton(1, zone); + device->setBreathSingle(c); + } else if(identifier == "lighting_breath_dual") { + QColor c1 = getColorForButton(1, zone); + QColor c2 = getColorForButton(2, zone); + device->setBreathDual(c1, c2); + } else if(identifier == "lighting_breath_triple") { + QColor c1 = getColorForButton(1, zone); + QColor c2 = getColorForButton(2, zone); + QColor c3 = getColorForButton(3, zone); + device->setBreathTriple(c1, c2, c3); + } else if(identifier == "lighting_breath_random") { + device->setBreathRandom(); + } else if(identifier == "lighting_wave") { + device->setWave(getWaveDirection(zone)); + } else if(identifier == "lighting_reactive") { + QColor c = getColorForButton(1, zone); + device->setReactive(c, libopenrazer::REACTIVE_500MS); // TODO Configure speed? + } else if(identifier == "lighting_none") { + device->setNone(); + } else if(identifier == "lighting_spectrum") { + device->setSpectrum(); + } else if(identifier == "lighting_static") { + QColor c = getColorForButton(1, zone); + device->setStatic(c); + } else if(identifier == "lighting_ripple") { + QColor c = getColorForButton(1, zone); + device->setRipple(c, libopenrazer::RIPPLE_REFRESH_RATE); //TODO Configure refreshrate? + } else if(identifier == "lighting_ripple_random") { + device->setRippleRandomColor(libopenrazer::RIPPLE_REFRESH_RATE); //TODO Configure refreshrate? + } else if(identifier == "lighting_static_bw2013") { + device->setStatic_bw2013(); + } else if(identifier == "lighting_pulsate") { + device->setPulsate(); + } else { + qWarning() << identifier << " is not implemented yet!"; + } +} + +void RazerGenie::applyEffectLogoLoc(QString identifier, libopenrazer::Device *device) +{ + libopenrazer::Device::LightingLocation zone = libopenrazer::Device::LightingLogo; + + if(identifier == "lighting_logo_blinking") { + QColor c = getColorForButton(1, zone); + device->setLogoBlinking(c); + } else if(identifier == "lighting_logo_pulsate") { + QColor c = getColorForButton(1, zone); + device->setLogoPulsate(c); + } else if(identifier == "lighting_logo_spectrum") { + device->setLogoSpectrum(); + } else if(identifier == "lighting_logo_static") { + QColor c = getColorForButton(1, zone); + device->setLogoStatic(c); + } else if(identifier == "lighting_logo_none") { + device->setLogoNone(); + } else if(identifier == "lighting_logo_reactive") { + QColor c = getColorForButton(1, zone); + device->setLogoReactive(c, libopenrazer::REACTIVE_500MS); // TODO Configure speed? + } else if(identifier == "lighting_logo_breath_single") { + QColor c = getColorForButton(1, zone); + device->setLogoBreathSingle(c); + } else if(identifier == "lighting_logo_breath_dual") { + QColor c1 = getColorForButton(1, zone); + QColor c2 = getColorForButton(2, zone); + device->setLogoBreathDual(c1, c2); + } else if(identifier == "lighting_logo_breath_random") { + device->setLogoBreathRandom(); + } else { + qWarning() << identifier << " is not implemented yet!"; + } +} + +void RazerGenie::applyEffectScrollLoc(QString identifier, libopenrazer::Device *device) +{ + libopenrazer::Device::LightingLocation zone = libopenrazer::Device::LightingScroll; + + if(identifier == "lighting_scroll_blinking") { + QColor c = getColorForButton(1, zone); + device->setScrollBlinking(c); + } else if(identifier == "lighting_scroll_pulsate") { + QColor c = getColorForButton(1, zone); + device->setScrollPulsate(c); + } else if(identifier == "lighting_scroll_spectrum") { + device->setScrollSpectrum(); + } else if(identifier == "lighting_scroll_static") { + QColor c = getColorForButton(1, zone); + device->setScrollStatic(c); + } else if(identifier == "lighting_scroll_none") { + device->setScrollNone(); + } else if(identifier == "lighting_scroll_reactive") { + QColor c = getColorForButton(1, zone); + device->setScrollReactive(c, libopenrazer::REACTIVE_500MS); // TODO Configure speed? + } else if(identifier == "lighting_scroll_breath_single") { + QColor c = getColorForButton(1, zone); + device->setScrollBreathSingle(c); + } else if(identifier == "lighting_scroll_breath_dual") { + QColor c1 = getColorForButton(1, zone); + QColor c2 = getColorForButton(2, zone); + device->setScrollBreathDual(c1, c2); + } else if(identifier == "lighting_scroll_breath_random") { + device->setScrollBreathRandom(); + } else { + qWarning() << identifier << " is not implemented yet!"; + } +} + +void RazerGenie::applyEffectBacklightLoc(QString identifier, libopenrazer::Device *device) +{ + libopenrazer::Device::LightingLocation zone = libopenrazer::Device::LightingBacklight; + + if(identifier == "lighting_backlight_spectrum") { + device->setBacklightSpectrum(); + } else if(identifier == "lighting_backlight_static") { + QColor c = getColorForButton(1, zone); + device->setBacklightStatic(c); + } else { + qWarning() << identifier << " is not implemented yet!"; + } +} + + +void RazerGenie::applyEffect(libopenrazer::Device::LightingLocation loc) +{ + qDebug() << "applyEffect()"; + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + QComboBox *combobox = item->findChild(QString::number(loc)); + + libopenrazer::RazerCapability capability = combobox->itemData(combobox->currentIndex()).value(); + QString identifier = capability.getIdentifier(); + + libopenrazer::Device *dev = devices.value(item->getSerial()); + + if(loc == libopenrazer::Device::Lighting) { + applyEffectStandardLoc(identifier, dev); + } else if(loc == libopenrazer::Device::LightingLogo) { + applyEffectLogoLoc(identifier, dev); + } else if(loc == libopenrazer::Device::LightingScroll) { + applyEffectScrollLoc(identifier, dev); + } else if(loc == libopenrazer::Device::LightingBacklight) { + applyEffectBacklightLoc(identifier, dev); + } else { + util::showError("Unhandled lighting location in applyEffect()"); + } +} + +void RazerGenie::waveRadioButtonStandard(bool enabled) +{ + if(enabled) + applyEffect(libopenrazer::Device::Lighting); +} + +void RazerGenie::waveRadioButtonLogo(bool enabled) +{ + if(enabled) + applyEffect(libopenrazer::Device::LightingLogo); +} + +void RazerGenie::waveRadioButtonScroll(bool enabled) +{ + if(enabled) + applyEffect(libopenrazer::Device::LightingScroll); +} + +void RazerGenie::dpiSyncCheckbox(bool checked) +{ + // TODO Sync DPI right here? Or just at next change (current behaviour)? + syncDpi = checked; +} + +void RazerGenie::pollCombo(int /* index */) +{ + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + QComboBox *sender = qobject_cast(QObject::sender()); + dev->setPollRate(sender->currentData().value()); +} + +void RazerGenie::logoActiveCheckbox(bool checked) +{ + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + dev->setLogoActive(checked); + qDebug() << checked; +} + +void RazerGenie::scrollActiveCheckbox(bool checked) +{ + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + dev->setScrollActive(checked); + qDebug() << checked; +} + +void RazerGenie::backlightActiveCheckbox(bool checked) +{ + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + dev->setBacklightActive(checked); + qDebug() << checked; +} + +void RazerGenie::profileLedCheckbox(bool checked) +{ + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + QCheckBox *sender = qobject_cast(QObject::sender()); + + if(sender->objectName() == "1") { + dev->setRedLED(checked); + } else if(sender->objectName() == "2") { + dev->setGreenLED(checked); + } else if(sender->objectName() == "3") { + dev->setBlueLED(checked); + } +} + +void RazerGenie::openCustomEditor() +{ + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + CustomEditor *cust = new CustomEditor(dev); + cust->setAttribute(Qt::WA_DeleteOnClose); + cust->show(); +} + +#ifdef INCLUDE_MATRIX_DISCOVERY +void RazerGenie::openMatrixDiscovery() +{ + // get device pointer + RazerDeviceWidget *item = dynamic_cast(ui_main.stackedWidget->currentWidget()); + libopenrazer::Device *dev = devices.value(item->getSerial()); + + CustomEditor *cust = new CustomEditor(dev, true); + cust->setAttribute(Qt::WA_DeleteOnClose); + cust->show(); +} +#endif + +>>>>>>> 0b0ce04... Use a combobox for DeathAdder 3.5G void RazerGenie::openPreferences() { auto *prefs = new Preferences(manager, this); diff --git a/src/razergenie.h b/src/razergenie.h index 9271dad..5dedc24 100644 --- a/src/razergenie.h +++ b/src/razergenie.h @@ -35,6 +35,47 @@ public slots: void toggleSync(bool); void toggleOffOnScreesaver(bool on); +<<<<<<< HEAD +======= + // Color buttons + void colorButtonClicked(); + + // Effect comboboxes + void standardCombo(int index); + void scrollCombo(int index); + void logoCombo(int index); + void backlightCombo(int index); + + // Brightness sliders + void brightnessChanged(int value); + void scrollBrightnessChanged(int value); + void logoBrightnessChanged(int value); + void backlightBrightnessChanged(int value); + + void waveRadioButtonStandard(bool enabled); + void waveRadioButtonLogo(bool enabled); + void waveRadioButtonScroll(bool enabled); + + // DPI checkbox & slider + void dpiChanged(int value); + void dpiComboChanged(int /* index */); + void dpiSyncCheckbox(bool checked); + + // Poll combobox + void pollCombo(int /* index */); + + // 'Set active' checkbox + void logoActiveCheckbox(bool checked); + void scrollActiveCheckbox(bool checked); + void backlightActiveCheckbox(bool checked); + + void profileLedCheckbox(bool checked); + + void openCustomEditor(); +#ifdef INCLUDE_MATRIX_DISCOVERY + void openMatrixDiscovery(); +#endif +>>>>>>> 0b0ce04... Use a combobox for DeathAdder 3.5G void openPreferences(); void dbusServiceRegistered(const QString &serviceName); From c27f7168eb423bbb386430a05c46966bdc0af6b3 Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Thu, 27 Dec 2018 13:06:42 +0100 Subject: [PATCH 32/47] razerdefault22: Add fr_FR keymap - 'space bar' matrix assigned to [5, 7] to support BlackWidow Chroma v2 RGB - still no 'razer logo' support for BlackWidow Chroma V2 --- data/matrix_layouts/razerdefault22.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index f2dc72c..837b60e 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -419,7 +419,11 @@ ] }, +<<<<<<< HEAD "French": { +======= + "fr_FR": { +>>>>>>> 02fe6c1... razerdefault22: Add fr_FR keymap "row0": [ {"label": null}, {"label": "esc", "matrix": [0, 1]}, @@ -553,6 +557,7 @@ {"label": ".", "matrix": [5, 20]}, {"label": "entrée", "disabled": true} ] +<<<<<<< HEAD }, "Portuguese": { @@ -690,5 +695,7 @@ {"label": ".", "matrix": [5, 20]}, {"label": "enter", "disabled": true} ] +======= +>>>>>>> 02fe6c1... razerdefault22: Add fr_FR keymap } } From d7ef7288fe0589926e52703f164772d259216af4 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sat, 28 Sep 2019 11:59:28 +0200 Subject: [PATCH 33/47] translations/de: update line numbers --- data/translations/de.ts | 161 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 159 insertions(+), 2 deletions(-) diff --git a/data/translations/de.ts b/data/translations/de.ts index 62f03b4..932bcf8 100644 --- a/data/translations/de.ts +++ b/data/translations/de.ts @@ -208,9 +208,15 @@ Wenn du RazerGenie als flatpak ausführst, musst du trotzdem OpenRazer außerhal Wenn du glaubst, dass ein Problem existiert, kannst du dies auf GitHub melden: +<<<<<<< HEAD +======= + + + +>>>>>>> 082908c... translations/de: update line numbers Report issue Problem melden @@ -225,109 +231,260 @@ Wenn du RazerGenie als flatpak ausführst, musst du trotzdem OpenRazer außerhal Aktivieren +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Daemon version: %1 Daemon Version: %1 +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers The D-Bus connection was re-established. Die D-Bus Verbindung wurde wiederhergestellt. +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers The D-Bus connection was lost, which probably means that the daemon has crashed. Die D-Bus Verbindung wurde unterbrochen, was wahrscheinlich heißt, dass der Daemon abgestürzt ist. +<<<<<<< HEAD +======= + + +>>>>>>> 082908c... translations/de: update line numbers Lighting Beleuchtung +<<<<<<< HEAD +======= + + Lighting Logo + Beleuchtung Logo + + + + Lighting Scroll + Beleuchtung Scroll + + + + Lighting Backlight + Beleuchtung Hintergrund + + + + Brightness + Helligkeit + + + + Brightness Logo + Helligkeit Logo + + + + Brightness Scroll + Helligkeit Scroll + + + + Brightness Backlight + Helligkeit Hintergrund + + + + Left + Links + + + + Right + Rechts + + + + Set Logo Active + Logo aktiv setzen + + + + Set Scroll Active + Scroll aktiv setzen + + + + Set Backlight Active + Hintergrund aktiv setzen + + + + Profile LED %1 + Profil LED %1 + + + + +>>>>>>> 082908c... translations/de: update line numbers DPI DPI +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers DPI X DPI X +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers DPI Y DPI Y +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Lock X/Y X/Y sperren +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Polling rate Abfragerate +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Open custom editor Custom Editor öffnen +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Launch matrix discovery Matrix discovery öffnen +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Serial number: %1 Seriennummer: %1 +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Firmware version: %1 Firmware-Version: %1 +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers No device was detected Kein Gerät wurde erkannt +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers The OpenRazer daemon didn't detect a device that is supported. This could also be caused due to a misconfiguration of this PC. Der OpenRazer Daemon hat kein Gerät erkannt, welches unterstützt ist. Dies kann auch durch eine Fehlkonfiguration von diesem PC verursacht sein. +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Open supported devices Unterstützte Geräte öffnen +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers The daemon didn't detect a device that is connected Der Daemon hat kein Geräte erkannt, welches verbunden ist +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Linux detected connected devices but the daemon didn't. This could be either due to a permission problem or a kernel module problem. Linux hat ein Gerät erkannt, aber der Daemon nicht. Dies kann entweder durch ein Berechtigungsproblem oder durch ein Kernel-Modul Problem verursacht sein. +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Open troubleshooting page Problemlösungs-Seite öffnen +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Error while syncing devices. Fehler beim Synchronisieren von Geräten. +<<<<<<< HEAD +======= + +>>>>>>> 082908c... translations/de: update line numbers Error while toggling 'turn off on screensaver' Fehler beim umschalten von 'abschalten bei Bildschirmschoner' @@ -345,12 +502,12 @@ Dies kann auch durch eine Fehlkonfiguration von diesem PC verursacht sein.Einstellungen - + Sync devices Effekte synchronisieren - + Turn off on screensaver Beleuchtung bei Bildschirmschoner abdrehen From 6378af913c317bb15d3adebdcddbc9e61ff2e6ae Mon Sep 17 00:00:00 2001 From: vankasteelj Date: Thu, 27 Dec 2018 14:07:59 +0100 Subject: [PATCH 34/47] Add French translations --- data/meson.build | 15 -- data/translations/fr.ts | 420 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 420 insertions(+), 15 deletions(-) delete mode 100644 data/meson.build create mode 100644 data/translations/fr.ts diff --git a/data/meson.build b/data/meson.build deleted file mode 100644 index 2b7c1d8..0000000 --- a/data/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -# Matrix Layouts -install_data('matrix_layouts/razerblade16.json', - 'matrix_layouts/razerdefault22.json', - 'matrix_layouts/razerblade25.json', - install_dir : join_paths(get_option('datadir'), 'razergenie/matrix_layouts')) - -# Appstream XML -install_data('xyz.z3ntu.razergenie.appdata.xml', - install_dir : join_paths(get_option('datadir'), 'metainfo')) - -# Desktop file -install_data('xyz.z3ntu.razergenie.desktop', - install_dir : join_paths(get_option('datadir'), 'applications')) - -subdir('translations') diff --git a/data/translations/fr.ts b/data/translations/fr.ts new file mode 100644 index 0000000..16681c8 --- /dev/null +++ b/data/translations/fr.ts @@ -0,0 +1,420 @@ + + + + + CustomEditor + + + RazerGenie - Custom Editor + RazerGenie - Éditeur personnalisé + + + + + Unknown matrix dimensions + Dimensions de la matrice inconnues + + + + + Please open an issue in the RazerGenie repository. Device name: %1 - matrix dimens: %2 %3 + Veuillez ouvrir un ticket dans le dépôt RazerGenie. Nom du périphérique : %1 - dimensions de la matrice : %2 %3 + + + + Device type not implemented! + Ce type de périphérique n'est pas implémenté ! + + + + Please open an issue in the RazerGenie repository. Device type: %1 + Veuillez ouvrir un ticket dans le dépôt RazerGenie. Type de périphérique : %1 + + + + Set + Appliquer + + + + Clear + Enlever + + + + Clear All + Tout enlever + + + + You are using a keyboard with a layout which is not known to the daemon. Please help us by visiting <a href='https://github.com/openrazer/openrazer/wiki/Keyboard-layouts'>https://github.com/openrazer/openrazer/wiki/Keyboard-layouts</a>. Using a fallback layout for now. + Vous utilisez un clavier dont la disposition n'est pas connue du daemon. Aidez-nous en visitant <a href='https://github.com/openrazer/openrazer/wiki/Keyboard-layouts'>https://github.com/openrazer/openrazer/wiki/Keyboard-layouts</a>. Pour l'instant, un dispositif générique sera utilisé. + + + + Your keyboard layout (%1) is not yet supported by RazerGenie for this keyboard. Please open an issue in the RazerGenie repository. + La disposition du clavier (%1) n'est pas encore supportée par RazerGenie pour ce clavier. Veuillez ouvrir un tricket dans le dépôt RazerGenie. + + + + Neither one of these layouts was found in the layout file: %1. Exiting. + Aucune de ces dispositions n'a été trouvée dans le fichier source : %1. L'éditeur va se fermer. + + + + Error loading %1.json! + Erreur lors du chargement de %1.json ! + + + + The file %1.json, used for the custom editor failed to load: %2 +The editor won't open now. + Le fichier %1.json, utilisé pour l'éditeur personnalisé, n'a pas pu être chargé : %2 +L'éditeur ne s'ouvrira pas pour l'instant. + + + + DeviceListWidget + + + Downloading image... + Téléchargement de l'image... + + + + No image + Pas d'image + + + + Preferences + + + + RazerGenie - Preferences + RazerGenie - Préférences + + + + About: + À propos : + + + + RazerGenie Version: %1 + Version de RazerGenie : %1 + + + + OpenRazer Daemon Version: %1 + Version du daemon OpenRazer : %1 + + + + General: + Général : + + + + For displaying device images, RazerGenie downloads the image behind the URL specified for a device in the OpenRazer daemon source code. This will only be done for devices that are connected to the PC and only once, as the images are cached locally. For reviewing, what information Razer might collect with these connections, please consult the Razer Privacy Policy (https://www.razer.com/legal/privacy-policy). + Pour afficher les images des préiphériques, RazerGenie télécharge l'image via l'URL spécifiée pour le périphérique dans le code source du daemon OpenRazer. Ceci ne sera fait que pour les périphériques connectés au PC et une fois seuelement, puisque les images sont stockées localement. Pour vérifier quelles informations Razer pourrait collecter avec ces connexions, veuillez consulter la politique de vie privée de Razer (https://www.razer.com/legal/privacy-policy). + + + + Download device images + Télécharger les images des périphériques + + + + QMessageBox + + + Error! + Erreur ! + + + + Information! + Information ! + + + + RazerGenie + + + The OpenRazer daemon is not started and you are not using systemd as your init system. +You have to either start the daemon manually every time you log in or set up another method of autostarting the daemon. + +Manually starting would be running "openrazer-daemon" in a terminal. + Le daemon OpenRazer n'est pas démarré et vous n'utilisez systemd comme système d'initialisation. Vous devez soit démarrer le daemon manuellement à chaque fois que vous vous connectez, ou prévoyez une autre façon de démarrer le daemon automatiquement. + +Vous pouvez manuellement lancer "openrazer-daemon" depuis un terminal. + + + + The OpenRazer daemon is not installed + Le daemon OpenRazer n'est pas installé + + + + The daemon is not installed or the version installed is too old. Please follow the installation instructions on the website! + +If you are running RazerGenie as a flatpak, you will still have to install OpenRazer outside of flatpak from a distribution package. + Le daemon n'est pas installé ou la version installée est trop ancienne. Veuillez suivre les instructions d'installation sur le site web ! + +Si vous utilisez RazerGenie depuis un flatpak, il faudra tout de même installer OpenRazer depuis un package propre à votre distribution. + + + + Open OpenRazer website + Ouvrir le site d'OpenRazer + + + + The OpenRazer daemon is not available. + Le daemon OpenRazer n'est pas disponible. + + + + The OpenRazer daemon is currently not available. The status output is below. + Le daemon OpenRazer n'est pas disponible pour l'instant. Le statut est rapporté ci-dessous. + + + + If you think, there's a bug, you can report an issue on GitHub: + Si vous pensez qu'il y a un bug, vous pouvez ouvrir un ticket sur GitHub : + + + + + + Report issue + Rapporter un problème + + + + The OpenRazer daemon is not set to auto-start. Click "Enable" to use the full potential of the daemon right after login. + Le daemon OpenRazer ne démarre pour l'instant pas automatiquement. Cliquez sur "Activer" pour utiliser tout le potentiel du daemon dès la connexion à la session. + + + + Enable + Activer + + + + Daemon version: %1 + Version du daemon : %1 + + + + The D-Bus connection was re-established. + La connexion D-Bus a été re-établie. + + + + The D-Bus connection was lost, which probably means that the daemon has crashed. + La connexion D-Bus a été perdue, ce qui signifie probablement que le daemon a rencontré une erreur. + + + + + Lighting + Éclairage + + + + Lighting Logo + Éclairage du logo + + + + Lighting Scroll + Éclairage de la molette + + + + Lighting Backlight + Rétro-éclairage + + + + Brightness + Luminosité + + + + Brightness Logo + Luminosité du logo + + + + Brightness Scroll + Luminosité de la molette + + + + Brightness Backlight + Luminosité du rétro-éclairage + + + + Left + Gauche + + + + Right + Droit + + + + Set Logo Active + Activer le logo + + + + Set Scroll Active + Activer la molette + + + + Set Backlight Active + Activer le rétro-éclairage + + + + Profile LED %1 + Profil LED %1 + + + + + DPI + DPI + + + + DPI X + DPI X + + + + DPI Y + DPI Y + + + + Lock X/Y + Verrouiller X/Y + + + + Polling rate + Fréquence des requêtes (polling) + + + + Open custom editor + Ouvrir l'éditeur personnalisé + + + + Launch matrix discovery + Lancer la découverte de matrice + + + + Serial number: %1 + Numéro de série : %1 + + + + Firmware version: %1 + Version du firmware : %1 + + + + No device was detected + Aucun périphérique détecté + + + + The OpenRazer daemon didn't detect a device that is supported. +This could also be caused due to a misconfiguration of this PC. + Le daemon OpenRazer n'a détecté aucun périphérique supporté. +Il est aussi possible que ce PC soit mal configuré. + + + + Open supported devices + Ouvir les périphériques supportés + + + + The daemon didn't detect a device that is connected + Le daemon n'a détecté aucun périphérique connecté + + + + Linux detected connected devices but the daemon didn't. This could be either due to a permission problem or a kernel module problem. + Linux a détecté des périphériques, mais pas le daemon. Il est possible que ce soit lié à un problème de permissions ou un problème dans un module du noyau (kernel). + + + + Open troubleshooting page + Ouvrir la page de diagnostic + + + + Error while syncing devices. + Erreur lors de la synchronisation des périphériques. + + + + Error while toggling 'turn off on screensaver' + Erreur lors de l'activation de 'désactiver l'économiseur d'écran' + + + + RazerGenieUi + + + RazerGenie + RazerGenie + + + + Preferences + Préférences + + + + Sync devices + Synchroniser les périphériques + + + + Turn off on screensaver + Désactiver l'économiseur d'écran + + + + RazerImageDownloader + + + Image download disabled + Téléchargement des images désactivé + + + + Image downloading is disabled. Visit the preferences to enable it. + Le téléchargement des images est désactivé. Vous pouvez l'activer dans les préférences. + + + + Network Error + Erreur de réseau + + + From 9868dc79c9d2408343bda6a013af050c888579d7 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 18 Apr 2020 03:10:25 +0200 Subject: [PATCH 35/47] =?UTF-8?q?=09-=20RazerGenie=20can=20now=20save=20ke?= =?UTF-8?q?yboard=20layout=20at=20least=20from=20the=20=09=20=20Matrix=20D?= =?UTF-8?q?iscovery=20=09modified=C2=A0:=20=20=20=20=20=20=20=20=20src/CMa?= =?UTF-8?q?keLists.txt=20=09modified=C2=A0:=20=20=20=20=20=20=20=20=20src/?= =?UTF-8?q?customeditor/customeditor.cpp=20=09modified=C2=A0:=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20src/customeditor/customeditor.h=20=09new=20file?= =?UTF-8?q?=C2=A0:=20=20=20=20=20=20=20=20=20src/customeditor/kbdlayout.cp?= =?UTF-8?q?p=20=09new=20file=C2=A0:=20=20=20=20=20=20=20=20=20src/customed?= =?UTF-8?q?itor/kbdlayout.h=20=09modified=C2=A0:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20src/customeditor/matrixpushbutton.cpp=20=09modified=C2=A0:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20src/customeditor/matrixpushbutton.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/customeditor/customeditor.cpp | 122 +++++++++++++++++++++++++- src/customeditor/customeditor.h | 23 ++++- src/customeditor/kbdlayout.cpp | 78 ++++++++++++++++ src/customeditor/kbdlayout.h | 41 +++++++++ src/customeditor/matrixpushbutton.cpp | 5 ++ src/customeditor/matrixpushbutton.h | 1 + 6 files changed, 264 insertions(+), 6 deletions(-) create mode 100644 src/customeditor/kbdlayout.cpp create mode 100644 src/customeditor/kbdlayout.h diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index 8277f89..45c2590 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -98,7 +98,7 @@ CustomEditor::CustomEditor(libopenrazer::Device *device, bool launchMatrixDiscov } // Set every LED to "off"/black - clearAll(); + // clearAll(); No. Definitively. } CustomEditor::~CustomEditor() = default; @@ -125,17 +125,22 @@ QLayout *CustomEditor::generateMainControls() QPushButton *btnSet = new QPushButton(tr("Set")); QPushButton *btnClear = new QPushButton(tr("Clear")); QPushButton *btnClearAll = new QPushButton(tr("Clear All")); + QPushButton *btnLoadLayout = new QPushButton(tr("Load Keyboad Layout")); + QPushButton *btnSaveLayout = new QPushButton(tr("Save Keyboard Layout")); hbox->addWidget(btnColor); hbox->addWidget(btnSet); hbox->addWidget(btnClear); hbox->addWidget(btnClearAll); + hbox->addWidget(btnLoadLayout); + hbox->addWidget(btnSaveLayout); connect(btnColor, &QPushButton::clicked, this, &CustomEditor::colorButtonClicked); connect(btnSet, &QPushButton::clicked, this, &CustomEditor::setDrawStatusSet); connect(btnClear, &QPushButton::clicked, this, &CustomEditor::setDrawStatusClear); connect(btnClearAll, &QPushButton::clicked, this, &CustomEditor::clearAll); - + connect(btnLoadLayout, &QPushButton::clicked, this, &CustomEditor::loadLayout); + connect(btnSaveLayout, &QPushButton::clicked, this, &CustomEditor::saveLayout); return hbox; } @@ -156,11 +161,18 @@ QLayout *CustomEditor::generateKeyboard() closeWindow(); } QStringList langs; +<<<<<<< HEAD langs << "de_DE" << "en_US" << "en_GB"; for (const QString &lang : qAsConst(langs)) { if (keyboardKeys.contains(lang)) { +======= + langs << "de_DE" << "en_US" << "en_GB" << "fr_FR"; + QString lang; + foreach(lang, langs) { + if(keyboardKeys.contains(lang)) { +>>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the keyboardLayout = keyboardKeys[lang].toObject(); found = true; break; @@ -212,6 +224,7 @@ QLayout *CustomEditor::generateKeyboard() } vbox->addLayout(hbox); } + return vbox; } @@ -239,11 +252,37 @@ QLayout *CustomEditor::generateMouse() QLayout *CustomEditor::generateMatrixDiscovery() { +<<<<<<< HEAD auto *vbox = new QVBoxLayout(); for (int i = 0; i < dimens.x; i++) { auto *hbox = new QHBoxLayout(); for (int j = 0; j < dimens.y; j++) { +======= + QJsonObject jsLang; + QJsonObject jsRow; + + QVBoxLayout *vbox = new QVBoxLayout(); + for(int i=0; i>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the MatrixPushButton *btn = new MatrixPushButton(QString::number(i) + "_" + QString::number(j)); + + QJsonObject jsKeysO; + QJsonArray jsMatrixA; + + jsMatrixA.append(i); + jsMatrixA.append(j); + + jsKeysO.insert(klay->mjsLabelStr, klay->mjsLabelStr + QString::number(i) + "_" + QString::number(j)); + jsKeysO.insert(klay->mjsMatrixStr, jsMatrixA); + jsKeysO.insert(klay->mjsColorsStr, "#000000"); + jsKeysA.append(jsKeysO); + btn->setMatrixPos(i, j); connect(btn, &QPushButton::clicked, this, &CustomEditor::onMatrixPushButtonClicked); @@ -251,16 +290,32 @@ QLayout *CustomEditor::generateMatrixDiscovery() hbox->addWidget(btn); matrixPushButtons.append(btn); } + + jsRow.insert(klay->mjsRowStr + QString::number(i), jsKeysA); + vbox->addLayout(hbox); } + + klay->setKbdLayRows(jsRow); + + jsLang.insert(klay->mjsLangStr, jsRow); + + klay->setKbdLayout(jsLang); + return vbox; } bool CustomEditor::parseKeyboardJSON(QString jsonname) { QFile *file; // Pointer to file object to use +<<<<<<< HEAD QFile file_devel("../../data/matrix_layouts/" + jsonname + ".json"); // File during developemnt QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/" + jsonname + ".json"); // File for production +======= + QFile file_devel("../../data/matrix_layouts/"+jsonname+".jsn"); // File during developemnt + QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/"+jsonname+".jsn"); // File for production + QFile file_sel; +>>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the // Try to open the dev file (higher priority) if (file_devel.open(QIODevice::ReadOnly)) { @@ -273,8 +328,20 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) if (file_prod.open(QIODevice::ReadOnly)) { file = &file_prod; } else { +<<<<<<< HEAD QMessageBox::information(nullptr, tr("Error loading %1.json!").arg(jsonname), tr("The file %1.json, used for the custom editor failed to load: %2\nThe editor won't open now.").arg(jsonname, file_prod.errorString())); return false; +======= + QMessageBox::information(0, tr("Error loading %1.json!").arg(jsonname), tr("The file %1.json, used for the custom editor failed to load: %2\nThe editor won't open now.").arg(jsonname).arg(file_prod.errorString())); + QString filename = QFileDialog::getOpenFileName(this, "Select Keyboard Layout file","" , KbdFileFilter, &KbdFileFilter ); + file_sel.setFileName(filename); + if(file_sel.open(QIODevice::ReadOnly)) + { + file = &file_sel; + } else { + return false; + } +>>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the } } @@ -289,9 +356,39 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) return true; } -bool CustomEditor::updateKeyrow(int row) +bool CustomEditor::updateKeyrow(int row, bool fromfile) { +<<<<<<< HEAD return device->defineCustomFrame(row, 0, dimens.y - 1, colors[row]) && device->displayCustomFrame(); +======= + QJsonObject rowsO = klay->getKbdLayRows(); + QJsonArray keysA = QJsonValue(rowsO.take(klay->mjsRowStr+QString::number(row))).toArray(); + QJsonObject keysO; + + //qDebug() << __PRETTY_FUNCTION__ << " : Grabbed parameters of row[" << row << "] => " << keysA << endl; + + for(int i=0; i < dimens[1]; i++) + { + keysO = QJsonValue(keysA.at(i)).toObject(); + + if(fromfile == true) + { + colors[row][i] = QColor(keysO.value(klay->mjsColorsStr).toString()); + } + else + { + keysO.remove(klay->mjsColorsStr); + keysO.insert(klay->mjsColorsStr, colors[row][i].name()); + keysA.replace(i, keysO); + } + } + + rowsO.insert(klay->mjsRowStr+QString::number(row), keysA); + + klay->setKbdLayRows(rowsO); + + return device->setKeyRow(row, 0, dimens[1]-1, colors[row]) && device->setCustom(); +>>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the } void CustomEditor::clearAll() @@ -322,6 +419,23 @@ void CustomEditor::clearAll() } } +void CustomEditor::loadLayout() +{ + QString file = QFileDialog::getOpenFileName(this, "Open Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + klay->openKbdLayout(file); + //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout() << endl; + for(int i = 0; i < 6; i++) + { + updateKeyrow(i, true); + } +} + +void CustomEditor::saveLayout() +{ + QString file = QFileDialog::getSaveFileName(this, "Save Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + klay->saveKbdLayout(file); +} + void CustomEditor::colorButtonClicked() { auto *sender = qobject_cast(QObject::sender()); @@ -363,7 +477,7 @@ void CustomEditor::onMatrixPushButtonClicked() qDebug() << "RazerGenie: Unhandled DrawStatus: " << drawStatus; } // Set color on device - updateKeyrow(pos.first); + updateKeyrow(pos.first, false); } void CustomEditor::setDrawStatusSet() diff --git a/src/customeditor/customeditor.h b/src/customeditor/customeditor.h index 4bb00a6..fb41a52 100644 --- a/src/customeditor/customeditor.h +++ b/src/customeditor/customeditor.h @@ -22,15 +22,22 @@ #include "matrixpushbutton.h" #include +#include +#include #include #include +<<<<<<< HEAD +======= +#include "matrixpushbutton.h" +#include "kbdlayout.h" +>>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the enum DrawStatus { set, clear }; -class CustomEditor : public QDialog +class CustomEditor : public QDialog, public KbdLayout { Q_OBJECT public: @@ -45,12 +52,24 @@ class CustomEditor : public QDialog QLayout *generateMouse(); QLayout *generateMatrixDiscovery(); + bool parseKeyboardJSON(QString jsonname); - bool updateKeyrow(int row); + bool updateKeyrow(int row, bool fromfile); void clearAll(); + + void loadLayout(); + void saveLayout(); + QJsonDocument keyboardLayout; + KbdLayout *klay = new KbdLayout; + QString KbdFileFilter = tr("JSON File (*.json)"); QJsonObject keyboardKeys; +<<<<<<< HEAD QVector matrixPushButtons; +======= + QJsonObject keyboardKeysColors; + QVector matrixPushButtons; +>>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the libopenrazer::Device *device; razer_test::MatrixDimensions dimens; diff --git a/src/customeditor/kbdlayout.cpp b/src/customeditor/kbdlayout.cpp new file mode 100644 index 0000000..d62792d --- /dev/null +++ b/src/customeditor/kbdlayout.cpp @@ -0,0 +1,78 @@ +#include "kbdlayout.h" +#include + +KbdLayout::KbdLayout() +{ + +} + +KbdLayout::~KbdLayout() +{ + +} + + +void KbdLayout::setKbdLayout(const QJsonObject &langs) +{ + this->mjsKbdLayoutDoc.setObject(langs); +} + +void KbdLayout::setKbdLayLangs(const QJsonObject &rows) +{ + QJsonObject newlang; + newlang.insert(this->mjsLangStr, rows); + this->mjsLangs = newlang; +} + +void KbdLayout::setKbdLayRows(const QJsonObject &row) +{ + QJsonObject newrows; + newrows.insert(this->mjsRowStr, row); + this->mjsRows = row; +} + +void KbdLayout::initLayout() +{ + this->mjsLangs = this->mjsKbdLayoutDoc.object(); + this->mjsRows = this->mjsLangs.value(this->mjsLangStr).toObject(); +} + +void KbdLayout::updateLayout() +{ + this->setKbdLayLangs(this->mjsRows); + this->setKbdLayout(this->mjsLangs); +} + +void KbdLayout::openKbdLayout(const QString &filename) +{ + QFile file(filename); + file.open(QIODevice::ReadOnly); + this->mjsKbdLayoutDoc = QJsonDocument::fromJson(file.readAll()); + file.close(); + this->initLayout(); +} + +void KbdLayout::saveKbdLayout(const QString &filename) +{ + this->updateLayout(); + QFile file(filename); + file.open(QIODevice::WriteOnly | QIODevice::Text); + qDebug() << "JSON to write : " << this->mjsKbdLayoutDoc; + file.write(this->mjsKbdLayoutDoc.toJson()); + file.close(); +} + +QJsonDocument KbdLayout::getKbdLayout() +{ + return this->mjsKbdLayoutDoc; +} + +QJsonObject KbdLayout::getKbdLayLangs() +{ + return this->mjsLangs; +} + +QJsonObject KbdLayout::getKbdLayRows() +{ + return this->mjsRows; +} diff --git a/src/customeditor/kbdlayout.h b/src/customeditor/kbdlayout.h new file mode 100644 index 0000000..3902b46 --- /dev/null +++ b/src/customeditor/kbdlayout.h @@ -0,0 +1,41 @@ +#ifndef KBDLAYOUT_H +#define KBDLAYOUT_H + +#include +#include +#include +#include + +class KbdLayout +{ +public: + QString mjsLangStr = "fr_FR"; + QString mjsRowStr = "row"; + QString mjsLabelStr = "label"; + QString mjsMatrixStr = "matrix"; + QString mjsColorsStr = "colors"; + + KbdLayout(); + ~KbdLayout(); + + void setKbdLayout(const QJsonObject &langs); + void setKbdLayLangs(const QJsonObject &rows); + void setKbdLayRows(const QJsonObject &row); + + void initLayout(); + void updateLayout(); + + void openKbdLayout(const QString &filename); + void saveKbdLayout(const QString &filename); + + QJsonDocument getKbdLayout(); + QJsonObject getKbdLayLangs(); + QJsonObject getKbdLayRows(); + +private: + QJsonDocument mjsKbdLayoutDoc; + QJsonObject mjsLangs; + QJsonObject mjsRows; +}; + +#endif // KBDLAYOUT_H diff --git a/src/customeditor/matrixpushbutton.cpp b/src/customeditor/matrixpushbutton.cpp index cb646c4..1e3fd39 100644 --- a/src/customeditor/matrixpushbutton.cpp +++ b/src/customeditor/matrixpushbutton.cpp @@ -54,3 +54,8 @@ void MatrixPushButton::resetButtonColor() { this->setPalette(this->style()->standardPalette()); } + +void saveLayoutButton(QJsonDocument kbdlayout) +{ + qDebug() << "JSON Document contents : " << kbdlayout; +} diff --git a/src/customeditor/matrixpushbutton.h b/src/customeditor/matrixpushbutton.h index ebaa1ec..31d01c3 100644 --- a/src/customeditor/matrixpushbutton.h +++ b/src/customeditor/matrixpushbutton.h @@ -19,6 +19,7 @@ #define MATRIXPUSHBUTTON_H #include +#include class MatrixPushButton : public QPushButton { From 430650fe98b9c8f77c979dbcc949c9f26548d0bd Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 18 Apr 2020 05:28:03 +0200 Subject: [PATCH 36/47] =?UTF-8?q?=20Now=20Restore=20button=20colors=20also?= =?UTF-8?q?=20after=20loaded=20JSON=20layout=20file=20=09modified=C2=A0:?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20src/customeditor/customeditor.cpp=20?= =?UTF-8?q?=09modified=C2=A0:=20=20=20=20=20=20=20=20=20src/customeditor/m?= =?UTF-8?q?atrixpushbutton.cpp=20=09modified=C2=A0:=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20src/customeditor/matrixpushbutton.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/customeditor/customeditor.cpp | 14 ++++++++++---- src/customeditor/matrixpushbutton.cpp | 5 +++++ src/customeditor/matrixpushbutton.h | 5 +++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index 45c2590..d1cd664 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -278,7 +278,7 @@ QLayout *CustomEditor::generateMatrixDiscovery() jsMatrixA.append(i); jsMatrixA.append(j); - jsKeysO.insert(klay->mjsLabelStr, klay->mjsLabelStr + QString::number(i) + "_" + QString::number(j)); + jsKeysO.insert(klay->mjsLabelStr, QString::number(i) + "_" + QString::number(j)); jsKeysO.insert(klay->mjsMatrixStr, jsMatrixA); jsKeysO.insert(klay->mjsColorsStr, "#000000"); jsKeysA.append(jsKeysO); @@ -357,16 +357,18 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) } bool CustomEditor::updateKeyrow(int row, bool fromfile) +<<<<<<< HEAD { <<<<<<< HEAD return device->defineCustomFrame(row, 0, dimens.y - 1, colors[row]) && device->displayCustomFrame(); ======= +======= +{ +>>>>>>> ed9df82... Now Restore button colors also after loaded JSON layout file QJsonObject rowsO = klay->getKbdLayRows(); QJsonArray keysA = QJsonValue(rowsO.take(klay->mjsRowStr+QString::number(row))).toArray(); QJsonObject keysO; - //qDebug() << __PRETTY_FUNCTION__ << " : Grabbed parameters of row[" << row << "] => " << keysA << endl; - for(int i=0; i < dimens[1]; i++) { keysO = QJsonValue(keysA.at(i)).toObject(); @@ -374,6 +376,10 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) if(fromfile == true) { colors[row][i] = QColor(keysO.value(klay->mjsColorsStr).toString()); + int butn = i+(row * dimens[1]); + //qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); + matrixPushButtons.at(butn)->setButtonColor(colors[row][i]); + } else { @@ -387,7 +393,7 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) klay->setKbdLayRows(rowsO); - return device->setKeyRow(row, 0, dimens[1]-1, colors[row]) && device->setCustom(); + return device->defineCustomFrame(row, 0, dimens.y - 1, colors[row]) && device->displayCustomFrame(); >>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the } diff --git a/src/customeditor/matrixpushbutton.cpp b/src/customeditor/matrixpushbutton.cpp index 1e3fd39..d2435a5 100644 --- a/src/customeditor/matrixpushbutton.cpp +++ b/src/customeditor/matrixpushbutton.cpp @@ -59,3 +59,8 @@ void saveLayoutButton(QJsonDocument kbdlayout) { qDebug() << "JSON Document contents : " << kbdlayout; } + +QString MatrixPushButton::getLabel() +{ + return this->mLabel; +} diff --git a/src/customeditor/matrixpushbutton.h b/src/customeditor/matrixpushbutton.h index 31d01c3..9316f6b 100644 --- a/src/customeditor/matrixpushbutton.h +++ b/src/customeditor/matrixpushbutton.h @@ -29,7 +29,12 @@ class MatrixPushButton : public QPushButton QPair matrixPos(); void setButtonColor(QColor color); void resetButtonColor(); +<<<<<<< HEAD +======= + void saveLayoutButton(QJsonDocument kbdlayout); + QString getLabel(); +>>>>>>> ed9df82... Now Restore button colors also after loaded JSON layout file private: QString mLabel; QPair mMatrixPos; From e012866e6aae80f0f9860d8e98d2fb23db64397a Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 18 Apr 2020 20:48:32 +0200 Subject: [PATCH 37/47] Creating JSON document from standart custom editor --- src/customeditor/customeditor.cpp | 123 +++++++++++++++++++++++++++--- src/customeditor/kbdlayout.cpp | 19 +++-- src/customeditor/kbdlayout.h | 3 + 3 files changed, 131 insertions(+), 14 deletions(-) diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index d1cd664..1266f41 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -22,9 +22,13 @@ #include "util.h" #include +<<<<<<< HEAD #include #include #include +======= +#include +>>>>>>> 14ba358... .git/msg CustomEditor::CustomEditor(libopenrazer::Device *device, bool launchMatrixDiscovery, QWidget *parent) : QDialog(parent) @@ -98,7 +102,7 @@ CustomEditor::CustomEditor(libopenrazer::Device *device, bool launchMatrixDiscov } // Set every LED to "off"/black - // clearAll(); No. Definitively. + // clearAll(); // No. Definitively. } CustomEditor::~CustomEditor() = default; @@ -149,9 +153,10 @@ QLayout *CustomEditor::generateKeyboard() //TODO: Add missing logo button auto *vbox = new QVBoxLayout(); QJsonObject keyboardLayout; + QJsonObject cloneobj; bool found = false; QString kbdLayout = device->getKeyboardLayout(); - if (kbdLayout != "unknown" && keyboardKeys.contains(kbdLayout)) { + if(kbdLayout != "unknown" && keyboardKeys.contains(kbdLayout)) { keyboardLayout = keyboardKeys[kbdLayout].toObject(); } else { if (kbdLayout == "unknown") { @@ -174,26 +179,39 @@ QLayout *CustomEditor::generateKeyboard() if(keyboardKeys.contains(lang)) { >>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the keyboardLayout = keyboardKeys[lang].toObject(); + klay->mjsLangStr = lang; found = true; break; } } +<<<<<<< HEAD if (!found) { util::showInfo(tr("Neither one of these layouts was found in the layout file: %1. Exiting.").arg("de_DE, en_US, en_GB")); +======= + if(!found) { + util::showInfo(tr("Neither one of these layouts was found in the layout file: %1. Exiting.").arg("de_DE, en_US, en_GB, fr_FR")); +>>>>>>> 14ba358... .git/msg closeWindow(); } } // Iterate over rows in the object QJsonObject::const_iterator it; +<<<<<<< HEAD for (it = keyboardLayout.constBegin(); it != keyboardLayout.constEnd(); ++it) { +======= + for(it = keyboardLayout.constBegin(); it != keyboardLayout.constEnd(); ++it) { + int i = 0; +>>>>>>> 14ba358... .git/msg QJsonArray row = (*it).toArray(); + QJsonArray arr; auto *hbox = new QHBoxLayout(); hbox->setAlignment(Qt::AlignLeft); // Iterate over keys in row QJsonArray::const_iterator jt; +<<<<<<< HEAD for (jt = row.constBegin(); jt != row.constEnd(); ++jt) { QJsonObject obj = (*jt).toObject(); @@ -207,12 +225,50 @@ QLayout *CustomEditor::generateKeyboard() btn->setMatrixPos(arr[0].toInt(), arr[1].toInt()); } if (obj.contains("disabled")) { +======= + QJsonObject obj; + for(jt = row.constBegin(); jt != row.constEnd(); ++jt) { + obj = (*jt).toObject(); + + if(!obj[klay->mjsLabelStr].isNull()) + { + MatrixPushButton *btn = new MatrixPushButton(obj[klay->mjsLabelStr].toString()); + + int width = obj.contains(klay->mjsWidth) ? obj.value(klay->mjsWidth).toInt() : 60; + int height = /*obj.contains("height") ? obj.value("height").toInt() : */63; + btn->setFixedSize(width, height); + + bool color = false; + + if( ! obj.value(klay->mjsLabelStr).isNull() ) + color = true; + + if(obj.contains(klay->mjsMatrixStr)) { + QJsonArray arr = obj[klay->mjsMatrixStr].toArray(); + btn->setMatrixPos(arr[0].toInt(), arr[1].toInt()); + } + + if(obj.contains(klay->mjsDisabled)) { +>>>>>>> 14ba358... .git/msg btn->setEnabled(false); + color = false; } + /*if(obj["cut"] == "enter") { QPixmap pixmap("../../data/de_DE_mask.png"); btn->setMask(pixmap.mask()); }*/ + + //qDebug() << __PRETTY_FUNCTION__ << " : obj => " << obj << endl; + + if( ! obj.contains(klay->mjsColorsStr) && color == true ) + { + obj.insert(klay->mjsColorsStr, klay->mjsDefColor);; + } + + if(color == true) + btn->setButtonColor(obj[klay->mjsColorsStr].toString() ); + connect(btn, &QPushButton::clicked, this, &CustomEditor::onMatrixPushButtonClicked); hbox->addWidget(btn); @@ -221,10 +277,27 @@ QLayout *CustomEditor::generateKeyboard() auto *spacer = new QSpacerItem(66, 69, QSizePolicy::Fixed, QSizePolicy::Fixed); hbox->addItem(spacer); } + + //qDebug() << __PRETTY_FUNCTION__ << " obj => " << obj; + + arr.append(obj); + } + vbox->addLayout(hbox); + + //qDebug() << __PRETTY_FUNCTION__ << " row => " << arr; + + cloneobj.insert(klay->mjsRowStr+QString::number(i), arr); + + i++; } - + + klay->setKbdLayRows(cloneobj); + klay->updateLayout(); + + //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout(); + return vbox; } @@ -280,7 +353,7 @@ QLayout *CustomEditor::generateMatrixDiscovery() jsKeysO.insert(klay->mjsLabelStr, QString::number(i) + "_" + QString::number(j)); jsKeysO.insert(klay->mjsMatrixStr, jsMatrixA); - jsKeysO.insert(klay->mjsColorsStr, "#000000"); + jsKeysO.insert(klay->mjsColorsStr, klay->mjsDefColor); jsKeysA.append(jsKeysO); btn->setMatrixPos(i, j); @@ -308,12 +381,17 @@ QLayout *CustomEditor::generateMatrixDiscovery() bool CustomEditor::parseKeyboardJSON(QString jsonname) { QFile *file; // Pointer to file object to use +<<<<<<< HEAD <<<<<<< HEAD QFile file_devel("../../data/matrix_layouts/" + jsonname + ".json"); // File during developemnt QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/" + jsonname + ".json"); // File for production ======= QFile file_devel("../../data/matrix_layouts/"+jsonname+".jsn"); // File during developemnt QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/"+jsonname+".jsn"); // File for production +======= + QFile file_devel("../../data/matrix_layouts/"+jsonname+".json"); // File during developemnt + QFile file_prod(QString(RAZERGENIE_DATADIR) + "/matrix_layouts/"+jsonname+".json"); // File for production +>>>>>>> 14ba358... .git/msg QFile file_sel; >>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the @@ -373,16 +451,27 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) { keysO = QJsonValue(keysA.at(i)).toObject(); - if(fromfile == true) + QColor col = keysO.value(klay->mjsColorsStr).toString(); + + if(fromfile == true && col.isValid() == true) { + //qDebug () << __PRETTY_FUNCTION__ << " : Color => " << col; colors[row][i] = QColor(keysO.value(klay->mjsColorsStr).toString()); int butn = i+(row * dimens[1]); - //qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); - matrixPushButtons.at(butn)->setButtonColor(colors[row][i]); - + if(butn < matrixPushButtons.count()) + { + //Avoid the segfault... check this manually + qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); + if(colors[row][i] == klay->mjsDefColor) + { + colors[row][i] = QColor(Qt::black); + } + matrixPushButtons.at(butn)->setButtonColor(colors[row][i]); + } } else { + //qDebug() << __PRETTY_FUNCTION__ << " : No color parameter found, adding default color param&value" << endl; keysO.remove(klay->mjsColorsStr); keysO.insert(klay->mjsColorsStr, colors[row][i].name()); keysA.replace(i, keysO); @@ -390,11 +479,17 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) } rowsO.insert(klay->mjsRowStr+QString::number(row), keysA); - + klay->setKbdLayRows(rowsO); +<<<<<<< HEAD return device->defineCustomFrame(row, 0, dimens.y - 1, colors[row]) && device->displayCustomFrame(); >>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the +======= + //qDebug() << __PRETTY_FUNCTION__ << " : Colors => " << colors[row] << endl; + + return device->setKeyRow(row, 0, dimens[1]-1, colors[row]) && device->setCustom(); +>>>>>>> 14ba358... .git/msg } void CustomEditor::clearAll() @@ -428,8 +523,15 @@ void CustomEditor::clearAll() void CustomEditor::loadLayout() { QString file = QFileDialog::getOpenFileName(this, "Open Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + if( ! QFile::exists(file) ) + return; + else + qDebug() << __PRETTY_FUNCTION__ << " : Opened layout file : " << file << " successfully"; + klay->openKbdLayout(file); + //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout() << endl; + for(int i = 0; i < 6; i++) { updateKeyrow(i, true); @@ -439,6 +541,9 @@ void CustomEditor::loadLayout() void CustomEditor::saveLayout() { QString file = QFileDialog::getSaveFileName(this, "Save Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + + qDebug() << __PRETTY_FUNCTION__ << " : Created new layout file : " << file; + klay->saveKbdLayout(file); } diff --git a/src/customeditor/kbdlayout.cpp b/src/customeditor/kbdlayout.cpp index d62792d..c4228d2 100644 --- a/src/customeditor/kbdlayout.cpp +++ b/src/customeditor/kbdlayout.cpp @@ -3,12 +3,12 @@ KbdLayout::KbdLayout() { - + qDebug() << __PRETTY_FUNCTION__ << " : Constructed()" << endl; } KbdLayout::~KbdLayout() { - + qDebug() << __PRETTY_FUNCTION__ << " : Destroyed()" << endl; } @@ -33,8 +33,16 @@ void KbdLayout::setKbdLayRows(const QJsonObject &row) void KbdLayout::initLayout() { - this->mjsLangs = this->mjsKbdLayoutDoc.object(); - this->mjsRows = this->mjsLangs.value(this->mjsLangStr).toObject(); + this->mjsLangs = this->mjsKbdLayoutDoc[this->mjsLangStr].toObject(); + + //qDebug() << __PRETTY_FUNCTION__ << " : Rows => " << this->mjsRows; + + for(int i = 0; i < 6; i++) + { + this->mjsRows.insert(this->mjsRowStr+QString::number(i), this->mjsLangs.value(this->mjsRowStr+QString::number(i)) ); + } + //qDebug() << __PRETTY_FUNCTION__ << " : Lang contents => " << this->mjsLangs << endl; + //qDebug() << __PRETTY_FUNCTION__ << " : Rows contents => " << this->mjsRows << endl; } void KbdLayout::updateLayout() @@ -48,6 +56,7 @@ void KbdLayout::openKbdLayout(const QString &filename) QFile file(filename); file.open(QIODevice::ReadOnly); this->mjsKbdLayoutDoc = QJsonDocument::fromJson(file.readAll()); + //qDebug() << __PRETTY_FUNCTION__ << " : File content => " << this->mjsKbdLayoutDoc << endl; file.close(); this->initLayout(); } @@ -57,7 +66,7 @@ void KbdLayout::saveKbdLayout(const QString &filename) this->updateLayout(); QFile file(filename); file.open(QIODevice::WriteOnly | QIODevice::Text); - qDebug() << "JSON to write : " << this->mjsKbdLayoutDoc; + //qDebug() << "JSON datas to write : " << this->mjsKbdLayoutDoc; file.write(this->mjsKbdLayoutDoc.toJson()); file.close(); } diff --git a/src/customeditor/kbdlayout.h b/src/customeditor/kbdlayout.h index 3902b46..a59f29b 100644 --- a/src/customeditor/kbdlayout.h +++ b/src/customeditor/kbdlayout.h @@ -14,6 +14,9 @@ class KbdLayout QString mjsLabelStr = "label"; QString mjsMatrixStr = "matrix"; QString mjsColorsStr = "colors"; + QString mjsWidth = "width"; + QString mjsDisabled = "disabled"; + QString mjsDefColor = "#000000"; KbdLayout(); ~KbdLayout(); From da9d087e76ca80cd59c3a8f977039d4256d11843 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 18 Apr 2020 20:59:30 +0200 Subject: [PATCH 38/47] Commented some qDebug() and added sample generated from discovery matrix --- .../discoverysave.example.22.json | 1072 +++++++++++++++++ src/customeditor/customeditor.cpp | 2 +- src/customeditor/kbdlayout.cpp | 4 +- 3 files changed, 1075 insertions(+), 3 deletions(-) create mode 100644 data/matrix_layouts/discoverysave.example.22.json diff --git a/data/matrix_layouts/discoverysave.example.22.json b/data/matrix_layouts/discoverysave.example.22.json new file mode 100644 index 0000000..0b75897 --- /dev/null +++ b/data/matrix_layouts/discoverysave.example.22.json @@ -0,0 +1,1072 @@ +{ + "fr_FR": { + "row0": [ + { + "colors": "#000000", + "label": "label0_0", + "matrix": [ + 0, + 0 + ] + }, + { + "colors": "#ff0000", + "label": "label0_1", + "matrix": [ + 0, + 1 + ] + }, + { + "colors": "#000000", + "label": "label0_2", + "matrix": [ + 0, + 2 + ] + }, + { + "colors": "#00007f", + "label": "label0_3", + "matrix": [ + 0, + 3 + ] + }, + { + "colors": "#00007f", + "label": "label0_4", + "matrix": [ + 0, + 4 + ] + }, + { + "colors": "#00007f", + "label": "label0_5", + "matrix": [ + 0, + 5 + ] + }, + { + "colors": "#00007f", + "label": "label0_6", + "matrix": [ + 0, + 6 + ] + }, + { + "colors": "#00007f", + "label": "label0_7", + "matrix": [ + 0, + 7 + ] + }, + { + "colors": "#00007f", + "label": "label0_8", + "matrix": [ + 0, + 8 + ] + }, + { + "colors": "#00007f", + "label": "label0_9", + "matrix": [ + 0, + 9 + ] + }, + { + "colors": "#00007f", + "label": "label0_10", + "matrix": [ + 0, + 10 + ] + }, + { + "colors": "#00007f", + "label": "label0_11", + "matrix": [ + 0, + 11 + ] + }, + { + "colors": "#00007f", + "label": "label0_12", + "matrix": [ + 0, + 12 + ] + }, + { + "colors": "#00007f", + "label": "label0_13", + "matrix": [ + 0, + 13 + ] + }, + { + "colors": "#00007f", + "label": "label0_14", + "matrix": [ + 0, + 14 + ] + }, + { + "colors": "#ff0000", + "label": "label0_15", + "matrix": [ + 0, + 15 + ] + }, + { + "colors": "#00007f", + "label": "label0_16", + "matrix": [ + 0, + 16 + ] + }, + { + "colors": "#00007f", + "label": "label0_17", + "matrix": [ + 0, + 17 + ] + }, + { + "colors": "#000000", + "label": "label0_18", + "matrix": [ + 0, + 18 + ] + }, + { + "colors": "#000000", + "label": "label0_19", + "matrix": [ + 0, + 19 + ] + }, + { + "colors": "#000000", + "label": "label0_20", + "matrix": [ + 0, + 20 + ] + }, + { + "colors": "#000000", + "label": "label0_21", + "matrix": [ + 0, + 21 + ] + } + ], + "row1": [ + { + "colors": "#00007f", + "label": "label1_0", + "matrix": [ + 1, + 0 + ] + }, + { + "colors": "#00ffff", + "label": "label1_1", + "matrix": [ + 1, + 1 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_2", + "matrix": [ + 1, + 2 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_3", + "matrix": [ + 1, + 3 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_4", + "matrix": [ + 1, + 4 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_5", + "matrix": [ + 1, + 5 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_6", + "matrix": [ + 1, + 6 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_7", + "matrix": [ + 1, + 7 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_8", + "matrix": [ + 1, + 8 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_9", + "matrix": [ + 1, + 9 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_10", + "matrix": [ + 1, + 10 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_11", + "matrix": [ + 1, + 11 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_12", + "matrix": [ + 1, + 12 + ] + }, + { + "colors": "#ff00ff", + "label": "label1_13", + "matrix": [ + 1, + 13 + ] + }, + { + "colors": "#00ffff", + "label": "label1_14", + "matrix": [ + 1, + 14 + ] + }, + { + "colors": "#005500", + "label": "label1_15", + "matrix": [ + 1, + 15 + ] + }, + { + "colors": "#00ffff", + "label": "label1_16", + "matrix": [ + 1, + 16 + ] + }, + { + "colors": "#00ffff", + "label": "label1_17", + "matrix": [ + 1, + 17 + ] + }, + { + "colors": "#ff0000", + "label": "label1_18", + "matrix": [ + 1, + 18 + ] + }, + { + "colors": "#ff007f", + "label": "label1_19", + "matrix": [ + 1, + 19 + ] + }, + { + "colors": "#ff007f", + "label": "label1_20", + "matrix": [ + 1, + 20 + ] + }, + { + "colors": "#ff007f", + "label": "label1_21", + "matrix": [ + 1, + 21 + ] + } + ], + "row2": [ + { + "colors": "#00007f", + "label": "label2_0", + "matrix": [ + 2, + 0 + ] + }, + { + "colors": "#00ffff", + "label": "label2_1", + "matrix": [ + 2, + 1 + ] + }, + { + "colors": "#00ff00", + "label": "label2_2", + "matrix": [ + 2, + 2 + ] + }, + { + "colors": "#00ff00", + "label": "label2_3", + "matrix": [ + 2, + 3 + ] + }, + { + "colors": "#00ff00", + "label": "label2_4", + "matrix": [ + 2, + 4 + ] + }, + { + "colors": "#00ff00", + "label": "label2_5", + "matrix": [ + 2, + 5 + ] + }, + { + "colors": "#00ff00", + "label": "label2_6", + "matrix": [ + 2, + 6 + ] + }, + { + "colors": "#00ff00", + "label": "label2_7", + "matrix": [ + 2, + 7 + ] + }, + { + "colors": "#00ff00", + "label": "label2_8", + "matrix": [ + 2, + 8 + ] + }, + { + "colors": "#00ff00", + "label": "label2_9", + "matrix": [ + 2, + 9 + ] + }, + { + "colors": "#00ff00", + "label": "label2_10", + "matrix": [ + 2, + 10 + ] + }, + { + "colors": "#00ff00", + "label": "label2_11", + "matrix": [ + 2, + 11 + ] + }, + { + "colors": "#ff00ff", + "label": "label2_12", + "matrix": [ + 2, + 12 + ] + }, + { + "colors": "#ff00ff", + "label": "label2_13", + "matrix": [ + 2, + 13 + ] + }, + { + "colors": "#000000", + "label": "label2_14", + "matrix": [ + 2, + 14 + ] + }, + { + "colors": "#ff0000", + "label": "label2_15", + "matrix": [ + 2, + 15 + ] + }, + { + "colors": "#00ffff", + "label": "label2_16", + "matrix": [ + 2, + 16 + ] + }, + { + "colors": "#00ffff", + "label": "label2_17", + "matrix": [ + 2, + 17 + ] + }, + { + "colors": "#ffaa00", + "label": "label2_18", + "matrix": [ + 2, + 18 + ] + }, + { + "colors": "#ffaa00", + "label": "label2_19", + "matrix": [ + 2, + 19 + ] + }, + { + "colors": "#ffaa00", + "label": "label2_20", + "matrix": [ + 2, + 20 + ] + }, + { + "colors": "#ff007f", + "label": "label2_21", + "matrix": [ + 2, + 21 + ] + } + ], + "row3": [ + { + "colors": "#00007f", + "label": "label3_0", + "matrix": [ + 3, + 0 + ] + }, + { + "colors": "#00ffff", + "label": "label3_1", + "matrix": [ + 3, + 1 + ] + }, + { + "colors": "#00ff00", + "label": "label3_2", + "matrix": [ + 3, + 2 + ] + }, + { + "colors": "#00ff00", + "label": "label3_3", + "matrix": [ + 3, + 3 + ] + }, + { + "colors": "#00ff00", + "label": "label3_4", + "matrix": [ + 3, + 4 + ] + }, + { + "colors": "#00ff00", + "label": "label3_5", + "matrix": [ + 3, + 5 + ] + }, + { + "colors": "#00ff00", + "label": "label3_6", + "matrix": [ + 3, + 6 + ] + }, + { + "colors": "#00ff00", + "label": "label3_7", + "matrix": [ + 3, + 7 + ] + }, + { + "colors": "#00ff00", + "label": "label3_8", + "matrix": [ + 3, + 8 + ] + }, + { + "colors": "#00ff00", + "label": "label3_9", + "matrix": [ + 3, + 9 + ] + }, + { + "colors": "#00ff00", + "label": "label3_10", + "matrix": [ + 3, + 10 + ] + }, + { + "colors": "#00ff00", + "label": "label3_11", + "matrix": [ + 3, + 11 + ] + }, + { + "colors": "#ff00ff", + "label": "label3_12", + "matrix": [ + 3, + 12 + ] + }, + { + "colors": "#ff00ff", + "label": "label3_13", + "matrix": [ + 3, + 13 + ] + }, + { + "colors": "#00ffff", + "label": "label3_14", + "matrix": [ + 3, + 14 + ] + }, + { + "colors": "#000000", + "label": "label3_15", + "matrix": [ + 3, + 15 + ] + }, + { + "colors": "#000000", + "label": "label3_16", + "matrix": [ + 3, + 16 + ] + }, + { + "colors": "#000000", + "label": "label3_17", + "matrix": [ + 3, + 17 + ] + }, + { + "colors": "#ffaa00", + "label": "label3_18", + "matrix": [ + 3, + 18 + ] + }, + { + "colors": "#ffaa00", + "label": "label3_19", + "matrix": [ + 3, + 19 + ] + }, + { + "colors": "#ffaa00", + "label": "label3_20", + "matrix": [ + 3, + 20 + ] + }, + { + "colors": "#000000", + "label": "label3_21", + "matrix": [ + 3, + 21 + ] + } + ], + "row4": [ + { + "colors": "#00007f", + "label": "label4_0", + "matrix": [ + 4, + 0 + ] + }, + { + "colors": "#00ffff", + "label": "label4_1", + "matrix": [ + 4, + 1 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_2", + "matrix": [ + 4, + 2 + ] + }, + { + "colors": "#00ff00", + "label": "label4_3", + "matrix": [ + 4, + 3 + ] + }, + { + "colors": "#00ff00", + "label": "label4_4", + "matrix": [ + 4, + 4 + ] + }, + { + "colors": "#00ff00", + "label": "label4_5", + "matrix": [ + 4, + 5 + ] + }, + { + "colors": "#00ff00", + "label": "label4_6", + "matrix": [ + 4, + 6 + ] + }, + { + "colors": "#00ff00", + "label": "label4_7", + "matrix": [ + 4, + 7 + ] + }, + { + "colors": "#00ff00", + "label": "label4_8", + "matrix": [ + 4, + 8 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_9", + "matrix": [ + 4, + 9 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_10", + "matrix": [ + 4, + 10 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_11", + "matrix": [ + 4, + 11 + ] + }, + { + "colors": "#ff00ff", + "label": "label4_12", + "matrix": [ + 4, + 12 + ] + }, + { + "colors": "#000000", + "label": "label4_13", + "matrix": [ + 4, + 13 + ] + }, + { + "colors": "#00ffff", + "label": "label4_14", + "matrix": [ + 4, + 14 + ] + }, + { + "colors": "#000000", + "label": "label4_15", + "matrix": [ + 4, + 15 + ] + }, + { + "colors": "#55007f", + "label": "label4_16", + "matrix": [ + 4, + 16 + ] + }, + { + "colors": "#000000", + "label": "label4_17", + "matrix": [ + 4, + 17 + ] + }, + { + "colors": "#ffaa00", + "label": "label4_18", + "matrix": [ + 4, + 18 + ] + }, + { + "colors": "#ffaa00", + "label": "label4_19", + "matrix": [ + 4, + 19 + ] + }, + { + "colors": "#ffaa00", + "label": "label4_20", + "matrix": [ + 4, + 20 + ] + }, + { + "colors": "#00ffff", + "label": "label4_21", + "matrix": [ + 4, + 21 + ] + } + ], + "row5": [ + { + "colors": "#00007f", + "label": "label5_0", + "matrix": [ + 5, + 0 + ] + }, + { + "colors": "#ff0000", + "label": "label5_1", + "matrix": [ + 5, + 1 + ] + }, + { + "colors": "#ff5500", + "label": "label5_2", + "matrix": [ + 5, + 2 + ] + }, + { + "colors": "#ff0000", + "label": "label5_3", + "matrix": [ + 5, + 3 + ] + }, + { + "colors": "#000000", + "label": "label5_4", + "matrix": [ + 5, + 4 + ] + }, + { + "colors": "#000000", + "label": "label5_5", + "matrix": [ + 5, + 5 + ] + }, + { + "colors": "#000000", + "label": "label5_6", + "matrix": [ + 5, + 6 + ] + }, + { + "colors": "#00ffff", + "label": "label5_7", + "matrix": [ + 5, + 7 + ] + }, + { + "colors": "#000000", + "label": "label5_8", + "matrix": [ + 5, + 8 + ] + }, + { + "colors": "#000000", + "label": "label5_9", + "matrix": [ + 5, + 9 + ] + }, + { + "colors": "#000000", + "label": "label5_10", + "matrix": [ + 5, + 10 + ] + }, + { + "colors": "#ff0000", + "label": "label5_11", + "matrix": [ + 5, + 11 + ] + }, + { + "colors": "#ffff00", + "label": "label5_12", + "matrix": [ + 5, + 12 + ] + }, + { + "colors": "#ff5500", + "label": "label5_13", + "matrix": [ + 5, + 13 + ] + }, + { + "colors": "#ff0000", + "label": "label5_14", + "matrix": [ + 5, + 14 + ] + }, + { + "colors": "#55007f", + "label": "label5_15", + "matrix": [ + 5, + 15 + ] + }, + { + "colors": "#55007f", + "label": "label5_16", + "matrix": [ + 5, + 16 + ] + }, + { + "colors": "#55007f", + "label": "label5_17", + "matrix": [ + 5, + 17 + ] + }, + { + "colors": "#000000", + "label": "label5_18", + "matrix": [ + 5, + 18 + ] + }, + { + "colors": "#ffaa00", + "label": "label5_19", + "matrix": [ + 5, + 19 + ] + }, + { + "colors": "#ff0000", + "label": "label5_20", + "matrix": [ + 5, + 20 + ] + }, + { + "colors": "#000000", + "label": "label5_21", + "matrix": [ + 5, + 21 + ] + } + ] + } +} diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index 1266f41..c03a49e 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -461,7 +461,7 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) if(butn < matrixPushButtons.count()) { //Avoid the segfault... check this manually - qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); + //qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); if(colors[row][i] == klay->mjsDefColor) { colors[row][i] = QColor(Qt::black); diff --git a/src/customeditor/kbdlayout.cpp b/src/customeditor/kbdlayout.cpp index c4228d2..1507bea 100644 --- a/src/customeditor/kbdlayout.cpp +++ b/src/customeditor/kbdlayout.cpp @@ -3,12 +3,12 @@ KbdLayout::KbdLayout() { - qDebug() << __PRETTY_FUNCTION__ << " : Constructed()" << endl; + //qDebug() << __PRETTY_FUNCTION__ << " : Constructed()" << endl; } KbdLayout::~KbdLayout() { - qDebug() << __PRETTY_FUNCTION__ << " : Destroyed()" << endl; + //qDebug() << __PRETTY_FUNCTION__ << " : Destroyed()" << endl; } From 90ed80adb6c6c5c0855079229ae50addeac25279 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Tue, 21 Apr 2020 02:47:25 +0200 Subject: [PATCH 39/47] Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere --- .../discoverysave.example.22.json | 266 +++++++++--------- data/matrix_layouts/razerdefault22.json | 4 +- src/customeditor/customeditor.cpp | 138 ++++++--- src/customeditor/customeditor.h | 2 +- src/customeditor/kbdlayout.cpp | 26 +- src/customeditor/kbdlayout.h | 18 +- src/customeditor/matrixpushbutton.cpp | 29 +- src/customeditor/matrixpushbutton.h | 7 +- src/razergenie.cpp | 156 ++++++++++ 9 files changed, 436 insertions(+), 210 deletions(-) diff --git a/data/matrix_layouts/discoverysave.example.22.json b/data/matrix_layouts/discoverysave.example.22.json index 0b75897..7850ccd 100644 --- a/data/matrix_layouts/discoverysave.example.22.json +++ b/data/matrix_layouts/discoverysave.example.22.json @@ -1,9 +1,9 @@ { - "fr_FR": { + "en_US": { "row0": [ { "colors": "#000000", - "label": "label0_0", + "label": "0_0", "matrix": [ 0, 0 @@ -11,7 +11,7 @@ }, { "colors": "#ff0000", - "label": "label0_1", + "label": "0_1", "matrix": [ 0, 1 @@ -19,7 +19,7 @@ }, { "colors": "#000000", - "label": "label0_2", + "label": "0_2", "matrix": [ 0, 2 @@ -27,7 +27,7 @@ }, { "colors": "#00007f", - "label": "label0_3", + "label": "0_3", "matrix": [ 0, 3 @@ -35,7 +35,7 @@ }, { "colors": "#00007f", - "label": "label0_4", + "label": "0_4", "matrix": [ 0, 4 @@ -43,7 +43,7 @@ }, { "colors": "#00007f", - "label": "label0_5", + "label": "0_5", "matrix": [ 0, 5 @@ -51,7 +51,7 @@ }, { "colors": "#00007f", - "label": "label0_6", + "label": "0_6", "matrix": [ 0, 6 @@ -59,7 +59,7 @@ }, { "colors": "#00007f", - "label": "label0_7", + "label": "0_7", "matrix": [ 0, 7 @@ -67,7 +67,7 @@ }, { "colors": "#00007f", - "label": "label0_8", + "label": "0_8", "matrix": [ 0, 8 @@ -75,7 +75,7 @@ }, { "colors": "#00007f", - "label": "label0_9", + "label": "0_9", "matrix": [ 0, 9 @@ -83,7 +83,7 @@ }, { "colors": "#00007f", - "label": "label0_10", + "label": "0_10", "matrix": [ 0, 10 @@ -91,7 +91,7 @@ }, { "colors": "#00007f", - "label": "label0_11", + "label": "0_11", "matrix": [ 0, 11 @@ -99,7 +99,7 @@ }, { "colors": "#00007f", - "label": "label0_12", + "label": "0_12", "matrix": [ 0, 12 @@ -107,7 +107,7 @@ }, { "colors": "#00007f", - "label": "label0_13", + "label": "0_13", "matrix": [ 0, 13 @@ -115,7 +115,7 @@ }, { "colors": "#00007f", - "label": "label0_14", + "label": "0_14", "matrix": [ 0, 14 @@ -123,7 +123,7 @@ }, { "colors": "#ff0000", - "label": "label0_15", + "label": "0_15", "matrix": [ 0, 15 @@ -131,7 +131,7 @@ }, { "colors": "#00007f", - "label": "label0_16", + "label": "0_16", "matrix": [ 0, 16 @@ -139,7 +139,7 @@ }, { "colors": "#00007f", - "label": "label0_17", + "label": "0_17", "matrix": [ 0, 17 @@ -147,7 +147,7 @@ }, { "colors": "#000000", - "label": "label0_18", + "label": "0_18", "matrix": [ 0, 18 @@ -155,7 +155,7 @@ }, { "colors": "#000000", - "label": "label0_19", + "label": "0_19", "matrix": [ 0, 19 @@ -163,7 +163,7 @@ }, { "colors": "#000000", - "label": "label0_20", + "label": "0_20", "matrix": [ 0, 20 @@ -171,7 +171,7 @@ }, { "colors": "#000000", - "label": "label0_21", + "label": "0_21", "matrix": [ 0, 21 @@ -181,7 +181,7 @@ "row1": [ { "colors": "#00007f", - "label": "label1_0", + "label": "1_0", "matrix": [ 1, 0 @@ -189,7 +189,7 @@ }, { "colors": "#00ffff", - "label": "label1_1", + "label": "1_1", "matrix": [ 1, 1 @@ -197,7 +197,7 @@ }, { "colors": "#ff00ff", - "label": "label1_2", + "label": "1_2", "matrix": [ 1, 2 @@ -205,7 +205,7 @@ }, { "colors": "#ff00ff", - "label": "label1_3", + "label": "1_3", "matrix": [ 1, 3 @@ -213,7 +213,7 @@ }, { "colors": "#ff00ff", - "label": "label1_4", + "label": "1_4", "matrix": [ 1, 4 @@ -221,7 +221,7 @@ }, { "colors": "#ff00ff", - "label": "label1_5", + "label": "1_5", "matrix": [ 1, 5 @@ -229,7 +229,7 @@ }, { "colors": "#ff00ff", - "label": "label1_6", + "label": "1_6", "matrix": [ 1, 6 @@ -237,7 +237,7 @@ }, { "colors": "#ff00ff", - "label": "label1_7", + "label": "1_7", "matrix": [ 1, 7 @@ -245,7 +245,7 @@ }, { "colors": "#ff00ff", - "label": "label1_8", + "label": "1_8", "matrix": [ 1, 8 @@ -253,7 +253,7 @@ }, { "colors": "#ff00ff", - "label": "label1_9", + "label": "1_9", "matrix": [ 1, 9 @@ -261,7 +261,7 @@ }, { "colors": "#ff00ff", - "label": "label1_10", + "label": "1_10", "matrix": [ 1, 10 @@ -269,7 +269,7 @@ }, { "colors": "#ff00ff", - "label": "label1_11", + "label": "1_11", "matrix": [ 1, 11 @@ -277,7 +277,7 @@ }, { "colors": "#ff00ff", - "label": "label1_12", + "label": "1_12", "matrix": [ 1, 12 @@ -285,7 +285,7 @@ }, { "colors": "#ff00ff", - "label": "label1_13", + "label": "1_13", "matrix": [ 1, 13 @@ -293,7 +293,7 @@ }, { "colors": "#00ffff", - "label": "label1_14", + "label": "1_14", "matrix": [ 1, 14 @@ -301,7 +301,7 @@ }, { "colors": "#005500", - "label": "label1_15", + "label": "1_15", "matrix": [ 1, 15 @@ -309,7 +309,7 @@ }, { "colors": "#00ffff", - "label": "label1_16", + "label": "1_16", "matrix": [ 1, 16 @@ -317,7 +317,7 @@ }, { "colors": "#00ffff", - "label": "label1_17", + "label": "1_17", "matrix": [ 1, 17 @@ -325,7 +325,7 @@ }, { "colors": "#ff0000", - "label": "label1_18", + "label": "1_18", "matrix": [ 1, 18 @@ -333,7 +333,7 @@ }, { "colors": "#ff007f", - "label": "label1_19", + "label": "1_19", "matrix": [ 1, 19 @@ -341,7 +341,7 @@ }, { "colors": "#ff007f", - "label": "label1_20", + "label": "1_20", "matrix": [ 1, 20 @@ -349,7 +349,7 @@ }, { "colors": "#ff007f", - "label": "label1_21", + "label": "1_21", "matrix": [ 1, 21 @@ -359,7 +359,7 @@ "row2": [ { "colors": "#00007f", - "label": "label2_0", + "label": "2_0", "matrix": [ 2, 0 @@ -367,7 +367,7 @@ }, { "colors": "#00ffff", - "label": "label2_1", + "label": "2_1", "matrix": [ 2, 1 @@ -375,7 +375,7 @@ }, { "colors": "#00ff00", - "label": "label2_2", + "label": "2_2", "matrix": [ 2, 2 @@ -383,7 +383,7 @@ }, { "colors": "#00ff00", - "label": "label2_3", + "label": "2_3", "matrix": [ 2, 3 @@ -391,7 +391,7 @@ }, { "colors": "#00ff00", - "label": "label2_4", + "label": "2_4", "matrix": [ 2, 4 @@ -399,7 +399,7 @@ }, { "colors": "#00ff00", - "label": "label2_5", + "label": "2_5", "matrix": [ 2, 5 @@ -407,7 +407,7 @@ }, { "colors": "#00ff00", - "label": "label2_6", + "label": "2_6", "matrix": [ 2, 6 @@ -415,7 +415,7 @@ }, { "colors": "#00ff00", - "label": "label2_7", + "label": "2_7", "matrix": [ 2, 7 @@ -423,7 +423,7 @@ }, { "colors": "#00ff00", - "label": "label2_8", + "label": "2_8", "matrix": [ 2, 8 @@ -431,7 +431,7 @@ }, { "colors": "#00ff00", - "label": "label2_9", + "label": "2_9", "matrix": [ 2, 9 @@ -439,7 +439,7 @@ }, { "colors": "#00ff00", - "label": "label2_10", + "label": "2_10", "matrix": [ 2, 10 @@ -447,7 +447,7 @@ }, { "colors": "#00ff00", - "label": "label2_11", + "label": "2_11", "matrix": [ 2, 11 @@ -455,7 +455,7 @@ }, { "colors": "#ff00ff", - "label": "label2_12", + "label": "2_12", "matrix": [ 2, 12 @@ -463,7 +463,7 @@ }, { "colors": "#ff00ff", - "label": "label2_13", + "label": "2_13", "matrix": [ 2, 13 @@ -471,7 +471,7 @@ }, { "colors": "#000000", - "label": "label2_14", + "label": "2_14", "matrix": [ 2, 14 @@ -479,7 +479,7 @@ }, { "colors": "#ff0000", - "label": "label2_15", + "label": "2_15", "matrix": [ 2, 15 @@ -487,7 +487,7 @@ }, { "colors": "#00ffff", - "label": "label2_16", + "label": "2_16", "matrix": [ 2, 16 @@ -495,7 +495,7 @@ }, { "colors": "#00ffff", - "label": "label2_17", + "label": "2_17", "matrix": [ 2, 17 @@ -503,7 +503,7 @@ }, { "colors": "#ffaa00", - "label": "label2_18", + "label": "2_18", "matrix": [ 2, 18 @@ -511,7 +511,7 @@ }, { "colors": "#ffaa00", - "label": "label2_19", + "label": "2_19", "matrix": [ 2, 19 @@ -519,7 +519,7 @@ }, { "colors": "#ffaa00", - "label": "label2_20", + "label": "2_20", "matrix": [ 2, 20 @@ -527,7 +527,7 @@ }, { "colors": "#ff007f", - "label": "label2_21", + "label": "2_21", "matrix": [ 2, 21 @@ -537,7 +537,7 @@ "row3": [ { "colors": "#00007f", - "label": "label3_0", + "label": "3_0", "matrix": [ 3, 0 @@ -545,7 +545,7 @@ }, { "colors": "#00ffff", - "label": "label3_1", + "label": "3_1", "matrix": [ 3, 1 @@ -553,7 +553,7 @@ }, { "colors": "#00ff00", - "label": "label3_2", + "label": "3_2", "matrix": [ 3, 2 @@ -561,7 +561,7 @@ }, { "colors": "#00ff00", - "label": "label3_3", + "label": "3_3", "matrix": [ 3, 3 @@ -569,7 +569,7 @@ }, { "colors": "#00ff00", - "label": "label3_4", + "label": "3_4", "matrix": [ 3, 4 @@ -577,7 +577,7 @@ }, { "colors": "#00ff00", - "label": "label3_5", + "label": "3_5", "matrix": [ 3, 5 @@ -585,7 +585,7 @@ }, { "colors": "#00ff00", - "label": "label3_6", + "label": "3_6", "matrix": [ 3, 6 @@ -593,7 +593,7 @@ }, { "colors": "#00ff00", - "label": "label3_7", + "label": "3_7", "matrix": [ 3, 7 @@ -601,7 +601,7 @@ }, { "colors": "#00ff00", - "label": "label3_8", + "label": "3_8", "matrix": [ 3, 8 @@ -609,7 +609,7 @@ }, { "colors": "#00ff00", - "label": "label3_9", + "label": "3_9", "matrix": [ 3, 9 @@ -617,7 +617,7 @@ }, { "colors": "#00ff00", - "label": "label3_10", + "label": "3_10", "matrix": [ 3, 10 @@ -625,7 +625,7 @@ }, { "colors": "#00ff00", - "label": "label3_11", + "label": "3_11", "matrix": [ 3, 11 @@ -633,7 +633,7 @@ }, { "colors": "#ff00ff", - "label": "label3_12", + "label": "3_12", "matrix": [ 3, 12 @@ -641,7 +641,7 @@ }, { "colors": "#ff00ff", - "label": "label3_13", + "label": "3_13", "matrix": [ 3, 13 @@ -649,7 +649,7 @@ }, { "colors": "#00ffff", - "label": "label3_14", + "label": "3_14", "matrix": [ 3, 14 @@ -657,7 +657,7 @@ }, { "colors": "#000000", - "label": "label3_15", + "label": "3_15", "matrix": [ 3, 15 @@ -665,7 +665,7 @@ }, { "colors": "#000000", - "label": "label3_16", + "label": "3_16", "matrix": [ 3, 16 @@ -673,7 +673,7 @@ }, { "colors": "#000000", - "label": "label3_17", + "label": "3_17", "matrix": [ 3, 17 @@ -681,7 +681,7 @@ }, { "colors": "#ffaa00", - "label": "label3_18", + "label": "3_18", "matrix": [ 3, 18 @@ -689,7 +689,7 @@ }, { "colors": "#ffaa00", - "label": "label3_19", + "label": "3_19", "matrix": [ 3, 19 @@ -697,7 +697,7 @@ }, { "colors": "#ffaa00", - "label": "label3_20", + "label": "3_20", "matrix": [ 3, 20 @@ -705,7 +705,7 @@ }, { "colors": "#000000", - "label": "label3_21", + "label": "3_21", "matrix": [ 3, 21 @@ -715,7 +715,7 @@ "row4": [ { "colors": "#00007f", - "label": "label4_0", + "label": "4_0", "matrix": [ 4, 0 @@ -723,7 +723,7 @@ }, { "colors": "#00ffff", - "label": "label4_1", + "label": "4_1", "matrix": [ 4, 1 @@ -731,7 +731,7 @@ }, { "colors": "#ff00ff", - "label": "label4_2", + "label": "4_2", "matrix": [ 4, 2 @@ -739,7 +739,7 @@ }, { "colors": "#00ff00", - "label": "label4_3", + "label": "4_3", "matrix": [ 4, 3 @@ -747,7 +747,7 @@ }, { "colors": "#00ff00", - "label": "label4_4", + "label": "4_4", "matrix": [ 4, 4 @@ -755,7 +755,7 @@ }, { "colors": "#00ff00", - "label": "label4_5", + "label": "4_5", "matrix": [ 4, 5 @@ -763,7 +763,7 @@ }, { "colors": "#00ff00", - "label": "label4_6", + "label": "4_6", "matrix": [ 4, 6 @@ -771,7 +771,7 @@ }, { "colors": "#00ff00", - "label": "label4_7", + "label": "4_7", "matrix": [ 4, 7 @@ -779,7 +779,7 @@ }, { "colors": "#00ff00", - "label": "label4_8", + "label": "4_8", "matrix": [ 4, 8 @@ -787,7 +787,7 @@ }, { "colors": "#ff00ff", - "label": "label4_9", + "label": "4_9", "matrix": [ 4, 9 @@ -795,7 +795,7 @@ }, { "colors": "#ff00ff", - "label": "label4_10", + "label": "4_10", "matrix": [ 4, 10 @@ -803,7 +803,7 @@ }, { "colors": "#ff00ff", - "label": "label4_11", + "label": "4_11", "matrix": [ 4, 11 @@ -811,7 +811,7 @@ }, { "colors": "#ff00ff", - "label": "label4_12", + "label": "4_12", "matrix": [ 4, 12 @@ -819,7 +819,7 @@ }, { "colors": "#000000", - "label": "label4_13", + "label": "4_13", "matrix": [ 4, 13 @@ -827,7 +827,7 @@ }, { "colors": "#00ffff", - "label": "label4_14", + "label": "4_14", "matrix": [ 4, 14 @@ -835,7 +835,7 @@ }, { "colors": "#000000", - "label": "label4_15", + "label": "4_15", "matrix": [ 4, 15 @@ -843,7 +843,7 @@ }, { "colors": "#55007f", - "label": "label4_16", + "label": "4_16", "matrix": [ 4, 16 @@ -851,7 +851,7 @@ }, { "colors": "#000000", - "label": "label4_17", + "label": "4_17", "matrix": [ 4, 17 @@ -859,7 +859,7 @@ }, { "colors": "#ffaa00", - "label": "label4_18", + "label": "4_18", "matrix": [ 4, 18 @@ -867,7 +867,7 @@ }, { "colors": "#ffaa00", - "label": "label4_19", + "label": "4_19", "matrix": [ 4, 19 @@ -875,7 +875,7 @@ }, { "colors": "#ffaa00", - "label": "label4_20", + "label": "4_20", "matrix": [ 4, 20 @@ -883,7 +883,7 @@ }, { "colors": "#00ffff", - "label": "label4_21", + "label": "4_21", "matrix": [ 4, 21 @@ -893,7 +893,7 @@ "row5": [ { "colors": "#00007f", - "label": "label5_0", + "label": "5_0", "matrix": [ 5, 0 @@ -901,7 +901,7 @@ }, { "colors": "#ff0000", - "label": "label5_1", + "label": "5_1", "matrix": [ 5, 1 @@ -909,7 +909,7 @@ }, { "colors": "#ff5500", - "label": "label5_2", + "label": "5_2", "matrix": [ 5, 2 @@ -917,7 +917,7 @@ }, { "colors": "#ff0000", - "label": "label5_3", + "label": "5_3", "matrix": [ 5, 3 @@ -925,7 +925,7 @@ }, { "colors": "#000000", - "label": "label5_4", + "label": "5_4", "matrix": [ 5, 4 @@ -933,7 +933,7 @@ }, { "colors": "#000000", - "label": "label5_5", + "label": "5_5", "matrix": [ 5, 5 @@ -941,7 +941,7 @@ }, { "colors": "#000000", - "label": "label5_6", + "label": "5_6", "matrix": [ 5, 6 @@ -949,7 +949,7 @@ }, { "colors": "#00ffff", - "label": "label5_7", + "label": "5_7", "matrix": [ 5, 7 @@ -957,7 +957,7 @@ }, { "colors": "#000000", - "label": "label5_8", + "label": "5_8", "matrix": [ 5, 8 @@ -965,7 +965,7 @@ }, { "colors": "#000000", - "label": "label5_9", + "label": "5_9", "matrix": [ 5, 9 @@ -973,7 +973,7 @@ }, { "colors": "#000000", - "label": "label5_10", + "label": "5_10", "matrix": [ 5, 10 @@ -981,7 +981,7 @@ }, { "colors": "#ff0000", - "label": "label5_11", + "label": "5_11", "matrix": [ 5, 11 @@ -989,7 +989,7 @@ }, { "colors": "#ffff00", - "label": "label5_12", + "label": "5_12", "matrix": [ 5, 12 @@ -997,7 +997,7 @@ }, { "colors": "#ff5500", - "label": "label5_13", + "label": "5_13", "matrix": [ 5, 13 @@ -1005,7 +1005,7 @@ }, { "colors": "#ff0000", - "label": "label5_14", + "label": "5_14", "matrix": [ 5, 14 @@ -1013,7 +1013,7 @@ }, { "colors": "#55007f", - "label": "label5_15", + "label": "5_15", "matrix": [ 5, 15 @@ -1021,7 +1021,7 @@ }, { "colors": "#55007f", - "label": "label5_16", + "label": "5_16", "matrix": [ 5, 16 @@ -1029,7 +1029,7 @@ }, { "colors": "#55007f", - "label": "label5_17", + "label": "5_17", "matrix": [ 5, 17 @@ -1037,7 +1037,7 @@ }, { "colors": "#000000", - "label": "label5_18", + "label": "5_18", "matrix": [ 5, 18 @@ -1045,7 +1045,7 @@ }, { "colors": "#ffaa00", - "label": "label5_19", + "label": "5_19", "matrix": [ 5, 19 @@ -1053,7 +1053,7 @@ }, { "colors": "#ff0000", - "label": "label5_20", + "label": "5_20", "matrix": [ 5, 20 @@ -1061,7 +1061,7 @@ }, { "colors": "#000000", - "label": "label5_21", + "label": "5_21", "matrix": [ 5, 21 diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index 837b60e..49dbd51 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -271,7 +271,7 @@ {"label": "alt", "width": 94, "matrix": [5, 3]}, {"label": "space", "width": 388}, {"label": "alt gr", "width": 94, "matrix": [5, 11]}, - {"label": "fn"}, + {"label": "fn", "matrix": [5, 12]}, {"label": "\u2630", "matrix": [5, 13]}, {"label": "strg", "width": 92, "matrix": [5, 14]}, {"label": "\ud83e\udc38", "matrix": [5, 15]}, @@ -407,7 +407,7 @@ {"label": "alt", "width": 94, "matrix": [5, 3]}, {"label": "space", "width": 388}, {"label": "alt gr", "width": 94, "matrix": [5, 11]}, - {"label": "fn"}, + {"label": "fn", "matrix": [5, 12]}, {"label": "\u2630", "matrix": [5, 13]}, {"label": "ctrl", "width": 92, "matrix": [5, 14]}, {"label": "\u2190", "matrix": [5, 15]}, diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index c03a49e..e093406 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -197,14 +197,21 @@ QLayout *CustomEditor::generateKeyboard() // Iterate over rows in the object QJsonObject::const_iterator it; +<<<<<<< HEAD <<<<<<< HEAD for (it = keyboardLayout.constBegin(); it != keyboardLayout.constEnd(); ++it) { ======= for(it = keyboardLayout.constBegin(); it != keyboardLayout.constEnd(); ++it) { int i = 0; >>>>>>> 14ba358... .git/msg +======= + QJsonObject clonelay; + int i = 0; + int j = 0; + for(it = keyboardLayout.constBegin(); it != keyboardLayout.constEnd(); ++it) { +>>>>>>> 6cb5d0b... Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere QJsonArray row = (*it).toArray(); - QJsonArray arr; + QJsonArray clonerow; auto *hbox = new QHBoxLayout(); hbox->setAlignment(Qt::AlignLeft); @@ -227,29 +234,33 @@ QLayout *CustomEditor::generateKeyboard() if (obj.contains("disabled")) { ======= QJsonObject obj; - for(jt = row.constBegin(); jt != row.constEnd(); ++jt) { + for(jt = row.constBegin(); jt != row.constEnd(); ++jt) + { obj = (*jt).toObject(); if(!obj[klay->mjsLabelStr].isNull()) { MatrixPushButton *btn = new MatrixPushButton(obj[klay->mjsLabelStr].toString()); - int width = obj.contains(klay->mjsWidth) ? obj.value(klay->mjsWidth).toInt() : 60; + int width = obj.contains(klay->mjsWidthStr) ? obj.value(klay->mjsWidthStr).toInt() : 60; int height = /*obj.contains("height") ? obj.value("height").toInt() : */63; btn->setFixedSize(width, height); bool color = false; - if( ! obj.value(klay->mjsLabelStr).isNull() ) - color = true; + color = true; if(obj.contains(klay->mjsMatrixStr)) { QJsonArray arr = obj[klay->mjsMatrixStr].toArray(); btn->setMatrixPos(arr[0].toInt(), arr[1].toInt()); } +<<<<<<< HEAD if(obj.contains(klay->mjsDisabled)) { >>>>>>> 14ba358... .git/msg +======= + if(obj.contains(klay->mjsDisabledStr)) { +>>>>>>> 6cb5d0b... Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere btn->setEnabled(false); color = false; } @@ -258,14 +269,14 @@ QLayout *CustomEditor::generateKeyboard() QPixmap pixmap("../../data/de_DE_mask.png"); btn->setMask(pixmap.mask()); }*/ - - //qDebug() << __PRETTY_FUNCTION__ << " : obj => " << obj << endl; if( ! obj.contains(klay->mjsColorsStr) && color == true ) { obj.insert(klay->mjsColorsStr, klay->mjsDefColor);; } + //qDebug() << __FUNCTION__ << " : obj => " << obj; + if(color == true) btn->setButtonColor(obj[klay->mjsColorsStr].toString() ); @@ -276,27 +287,23 @@ QLayout *CustomEditor::generateKeyboard() } else { auto *spacer = new QSpacerItem(66, 69, QSizePolicy::Fixed, QSizePolicy::Fixed); hbox->addItem(spacer); + obj.insert(klay->mjsLabelStr, QJsonValue::Null); } - - //qDebug() << __PRETTY_FUNCTION__ << " obj => " << obj; - - arr.append(obj); - + clonerow.append(obj); + i++; } - vbox->addLayout(hbox); - - //qDebug() << __PRETTY_FUNCTION__ << " row => " << arr; + //qDebug() << __FUNCTION__ << " : clonerow => " << clonerow; - cloneobj.insert(klay->mjsRowStr+QString::number(i), arr); + clonelay.insert(klay->mjsRowStr+QString::number(j), clonerow); + j++; - i++; + vbox->addLayout(hbox); } - klay->setKbdLayRows(cloneobj); - klay->updateLayout(); + //qDebug() << __FUNCTION__ << " : clonelay => " << clonelay; - //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout(); + klay->setKbdLayRows(clonelay); return vbox; } @@ -434,6 +441,7 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) return true; } +<<<<<<< HEAD bool CustomEditor::updateKeyrow(int row, bool fromfile) <<<<<<< HEAD { @@ -441,52 +449,94 @@ bool CustomEditor::updateKeyrow(int row, bool fromfile) return device->defineCustomFrame(row, 0, dimens.y - 1, colors[row]) && device->displayCustomFrame(); ======= ======= +======= +bool CustomEditor::updateKeyrow(int row, const bool fromfile) +>>>>>>> 6cb5d0b... Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere { >>>>>>> ed9df82... Now Restore button colors also after loaded JSON layout file QJsonObject rowsO = klay->getKbdLayRows(); + //qDebug() << __FUNCTION__ << " : rowsO => " << rowsO; QJsonArray keysA = QJsonValue(rowsO.take(klay->mjsRowStr+QString::number(row))).toArray(); + //qDebug() << __FUNCTION__ << " : rowsO => " << rowsO; + //qDebug() << __FUNCTION__ << " : KeyA => " << keysA; QJsonObject keysO; for(int i=0; i < dimens[1]; i++) { keysO = QJsonValue(keysA.at(i)).toObject(); - QColor col = keysO.value(klay->mjsColorsStr).toString(); + //qDebug() << __FUNCTION__ << " : KeysO => " << keysO; + + if(keysO.isEmpty() == true) + break; + + QColor colour = keysO.value(klay->mjsColorsStr).toString(); - if(fromfile == true && col.isValid() == true) + if(fromfile == true && + colour.isValid() == true && + keysO.value(klay->mjsLabelStr).isNull() == false && + keysO.value(klay->mjsDisabledStr).isBool() == false ) { - //qDebug () << __PRETTY_FUNCTION__ << " : Color => " << col; - colors[row][i] = QColor(keysO.value(klay->mjsColorsStr).toString()); - int butn = i+(row * dimens[1]); - if(butn < matrixPushButtons.count()) + //qDebug () << __FUNCTION__ << " : Color => " << colour; + colors[row][i] = colour; + + int j = 0; + + QStringList discovery = keysO.value(klay->mjsLabelStr).toString().split("_"); + + for(; j < matrixPushButtons.count(); j++) { - //Avoid the segfault... check this manually - //qDebug() << " butn index : " << butn << " label " << matrixPushButtons.at(butn)->getLabel(); - if(colors[row][i] == klay->mjsDefColor) - { - colors[row][i] = QColor(Qt::black); - } - matrixPushButtons.at(butn)->setButtonColor(colors[row][i]); + if(keysO.value(klay->mjsLabelStr).toString() == matrixPushButtons.at(j)->getLabel() ) + break; + } + + if(discovery.isEmpty() == true ) + { + j = i+(row * dimens[1]); + } + + /* + qDebug() << __FUNCTION__ << ": JSon Label => " << keysO.value(klay->mjsLabelStr).toString() + << ": JSon Color => " << colour + << ": Butn index => " << j; + */ + // Threat the out of range if matrix discovery file loaded from the standart matrix layout files + if(j < matrixPushButtons.count() ) + { + matrixPushButtons.at(j)->setButtonColor(colors[row][i]); + qDebug() << __FUNCTION__ << ": Set color for button n°" << i << " which is labeled " << matrixPushButtons.at(j)->getLabel(); } } else { - //qDebug() << __PRETTY_FUNCTION__ << " : No color parameter found, adding default color param&value" << endl; - keysO.remove(klay->mjsColorsStr); - keysO.insert(klay->mjsColorsStr, colors[row][i].name()); - keysA.replace(i, keysO); + if(keysO.value(klay->mjsLabelStr).isNull() == false && + keysO.value(klay->mjsDisabledStr).isBool() == false) + { + if(keysO.contains(klay->mjsColorsStr)) + keysO.remove(klay->mjsColorsStr); + keysO.insert(klay->mjsColorsStr, colors[row][i].name()); + keysA.replace(i, keysO); + //qDebug() << __FUNCTION__ << " : Prepared row => " << keysO << endl << " Color prepared => " << keysA; + } + else { + qDebug() << __FUNCTION__ << ": Null / Disabled key found "; + } } } rowsO.insert(klay->mjsRowStr+QString::number(row), keysA); - klay->setKbdLayRows(rowsO); + //qDebug() << __FUNCTION__ << " Built of rowsO => " << rowsO; +<<<<<<< HEAD <<<<<<< HEAD return device->defineCustomFrame(row, 0, dimens.y - 1, colors[row]) && device->displayCustomFrame(); >>>>>>> 68af1e8... - RazerGenie can now save keyboard layout at least from the ======= //qDebug() << __PRETTY_FUNCTION__ << " : Colors => " << colors[row] << endl; +======= + klay->setKbdLayRows(rowsO); +>>>>>>> 6cb5d0b... Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere return device->setKeyRow(row, 0, dimens[1]-1, colors[row]) && device->setCustom(); >>>>>>> 14ba358... .git/msg @@ -525,12 +575,12 @@ void CustomEditor::loadLayout() QString file = QFileDialog::getOpenFileName(this, "Open Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); if( ! QFile::exists(file) ) return; - else - qDebug() << __PRETTY_FUNCTION__ << " : Opened layout file : " << file << " successfully"; + + qDebug() << __FUNCTION__ << " : Opened layout file : " << file << " successfully"; klay->openKbdLayout(file); - //qDebug() << __PRETTY_FUNCTION__ << " : JSON contents => " << klay->getKbdLayout() << endl; + //qDebug() << __FUNCTION__ << " : JSON contents => " << klay->getKbdLayout() << endl; for(int i = 0; i < 6; i++) { @@ -542,7 +592,7 @@ void CustomEditor::saveLayout() { QString file = QFileDialog::getSaveFileName(this, "Save Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); - qDebug() << __PRETTY_FUNCTION__ << " : Created new layout file : " << file; + qDebug() << __FUNCTION__ << " : Created new layout file : " << file; klay->saveKbdLayout(file); } @@ -578,8 +628,12 @@ void CustomEditor::onMatrixPushButtonClicked() colors[pos.first][pos.second] = selectedColor; // Set color in view sender->setButtonColor(selectedColor); +<<<<<<< HEAD } else if (drawStatus == DrawStatus::clear) { qDebug() << "Clearing color."; +======= + } else if(drawStatus == DrawStatus::clear) { +>>>>>>> 6cb5d0b... Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere // Set color in model colors[pos.first][pos.second] = QColor(Qt::black); // Set color in view diff --git a/src/customeditor/customeditor.h b/src/customeditor/customeditor.h index fb41a52..d99dfd2 100644 --- a/src/customeditor/customeditor.h +++ b/src/customeditor/customeditor.h @@ -54,7 +54,7 @@ class CustomEditor : public QDialog, public KbdLayout bool parseKeyboardJSON(QString jsonname); - bool updateKeyrow(int row, bool fromfile); + bool updateKeyrow(int row, const bool fromfile); void clearAll(); void loadLayout(); diff --git a/src/customeditor/kbdlayout.cpp b/src/customeditor/kbdlayout.cpp index 1507bea..ec7407c 100644 --- a/src/customeditor/kbdlayout.cpp +++ b/src/customeditor/kbdlayout.cpp @@ -3,18 +3,18 @@ KbdLayout::KbdLayout() { - //qDebug() << __PRETTY_FUNCTION__ << " : Constructed()" << endl; + //qDebug() << __FUNCTION__ << " : Constructed()" << endl; } KbdLayout::~KbdLayout() { - //qDebug() << __PRETTY_FUNCTION__ << " : Destroyed()" << endl; + //qDebug() << __FUNCTION__ << " : Destroyed()" << endl; } - void KbdLayout::setKbdLayout(const QJsonObject &langs) { this->mjsKbdLayoutDoc.setObject(langs); + qDebug() << __FUNCTION__ << ": JSON keyboard layout document created"; } void KbdLayout::setKbdLayLangs(const QJsonObject &rows) @@ -22,6 +22,7 @@ void KbdLayout::setKbdLayLangs(const QJsonObject &rows) QJsonObject newlang; newlang.insert(this->mjsLangStr, rows); this->mjsLangs = newlang; + qDebug() << __FUNCTION__ << ": JSON keyboard lang layout container filled"; } void KbdLayout::setKbdLayRows(const QJsonObject &row) @@ -29,26 +30,34 @@ void KbdLayout::setKbdLayRows(const QJsonObject &row) QJsonObject newrows; newrows.insert(this->mjsRowStr, row); this->mjsRows = row; + qDebug() << __FUNCTION__ << ": JSON keyboard row inserted into rowS container"; +} + +void KbdLayout::setParsedKeys(const QJsonObject &keys) +{ + this->mjsKeys = keys; } void KbdLayout::initLayout() { this->mjsLangs = this->mjsKbdLayoutDoc[this->mjsLangStr].toObject(); - //qDebug() << __PRETTY_FUNCTION__ << " : Rows => " << this->mjsRows; + //qDebug() << __FUNCTION__ << " : Rows => " << this->mjsRows; for(int i = 0; i < 6; i++) { this->mjsRows.insert(this->mjsRowStr+QString::number(i), this->mjsLangs.value(this->mjsRowStr+QString::number(i)) ); } - //qDebug() << __PRETTY_FUNCTION__ << " : Lang contents => " << this->mjsLangs << endl; - //qDebug() << __PRETTY_FUNCTION__ << " : Rows contents => " << this->mjsRows << endl; + //qDebug() << __FUNCTION__ << " : Lang contents => " << this->mjsLangs << endl; + //qDebug() << __FUNCTION__ << " : Rows contents => " << this->mjsRows << endl; + qDebug() << __FUNCTION__ << ": JSON keyboard layout document Initialised"; } void KbdLayout::updateLayout() { this->setKbdLayLangs(this->mjsRows); this->setKbdLayout(this->mjsLangs); + qDebug() << __FUNCTION__ << ": JSON Keyboard layout document updated"; } void KbdLayout::openKbdLayout(const QString &filename) @@ -56,9 +65,10 @@ void KbdLayout::openKbdLayout(const QString &filename) QFile file(filename); file.open(QIODevice::ReadOnly); this->mjsKbdLayoutDoc = QJsonDocument::fromJson(file.readAll()); - //qDebug() << __PRETTY_FUNCTION__ << " : File content => " << this->mjsKbdLayoutDoc << endl; + //qDebug() << __FUNCTION__ << " : File content => " << this->mjsKbdLayoutDoc << endl; file.close(); this->initLayout(); + qDebug() << __FUNCTION__ << ": Grabbed successfully JSON datas from file : " << filename; } void KbdLayout::saveKbdLayout(const QString &filename) @@ -66,9 +76,9 @@ void KbdLayout::saveKbdLayout(const QString &filename) this->updateLayout(); QFile file(filename); file.open(QIODevice::WriteOnly | QIODevice::Text); - //qDebug() << "JSON datas to write : " << this->mjsKbdLayoutDoc; file.write(this->mjsKbdLayoutDoc.toJson()); file.close(); + qDebug() << __FUNCTION__ << ": Saved successfully JSON datas to file : " << filename; } QJsonDocument KbdLayout::getKbdLayout() diff --git a/src/customeditor/kbdlayout.h b/src/customeditor/kbdlayout.h index a59f29b..812bf32 100644 --- a/src/customeditor/kbdlayout.h +++ b/src/customeditor/kbdlayout.h @@ -9,14 +9,14 @@ class KbdLayout { public: - QString mjsLangStr = "fr_FR"; - QString mjsRowStr = "row"; - QString mjsLabelStr = "label"; - QString mjsMatrixStr = "matrix"; - QString mjsColorsStr = "colors"; - QString mjsWidth = "width"; - QString mjsDisabled = "disabled"; - QString mjsDefColor = "#000000"; + QString mjsLangStr = "en_US"; + const QString mjsRowStr = "row"; + const QString mjsLabelStr = "label"; + const QString mjsMatrixStr = "matrix"; + const QString mjsColorsStr = "colors"; + const QString mjsWidthStr = "width"; + const QString mjsDisabledStr = "disabled"; + const QString mjsDefColor = "#000000"; KbdLayout(); ~KbdLayout(); @@ -24,6 +24,7 @@ class KbdLayout void setKbdLayout(const QJsonObject &langs); void setKbdLayLangs(const QJsonObject &rows); void setKbdLayRows(const QJsonObject &row); + void setParsedKeys(const QJsonObject &keys); void initLayout(); void updateLayout(); @@ -39,6 +40,7 @@ class KbdLayout QJsonDocument mjsKbdLayoutDoc; QJsonObject mjsLangs; QJsonObject mjsRows; + QJsonObject mjsKeys; }; #endif // KBDLAYOUT_H diff --git a/src/customeditor/matrixpushbutton.cpp b/src/customeditor/matrixpushbutton.cpp index d2435a5..7287939 100644 --- a/src/customeditor/matrixpushbutton.cpp +++ b/src/customeditor/matrixpushbutton.cpp @@ -39,15 +39,29 @@ QPair MatrixPushButton::matrixPos() void MatrixPushButton::setButtonColor(QColor color) { +<<<<<<< HEAD // Calculate "the perfect font color" - from https://24ways.org/2010/calculating-color-contrast/ double yiq = ((color.red() * 299) + (color.green() * 587) + (color.blue() * 114)) / 1000; QString fontcolor = (yiq >= 128) ? "black" : "white"; +======= + // Do not handle black color... + if(color == QColor(Qt::black)) + { + this->resetButtonColor(); + } + else + { + // Calculate "the perfect font color" - from https://24ways.org/2010/calculating-color-contrast/ + double yiq = ((color.red()*299)+(color.green()*587)+(color.blue()*114))/1000; + QString fontcolor = (yiq >= 128) ? "black" : "white"; +>>>>>>> 6cb5d0b... Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere - // Construct QPalette with the wanted color - QPalette p = QPalette(color); - // Set the font color to the previously calculated value - p.setColor(QPalette::ButtonText, fontcolor); - this->setPalette(p); + // Construct QPalette with the wanted color + QPalette p = QPalette(color); + // Set the font color to the previously calculated value + p.setColor(QPalette::ButtonText, fontcolor); + this->setPalette(p); + } } void MatrixPushButton::resetButtonColor() @@ -55,11 +69,6 @@ void MatrixPushButton::resetButtonColor() this->setPalette(this->style()->standardPalette()); } -void saveLayoutButton(QJsonDocument kbdlayout) -{ - qDebug() << "JSON Document contents : " << kbdlayout; -} - QString MatrixPushButton::getLabel() { return this->mLabel; diff --git a/src/customeditor/matrixpushbutton.h b/src/customeditor/matrixpushbutton.h index 9316f6b..6fb138b 100644 --- a/src/customeditor/matrixpushbutton.h +++ b/src/customeditor/matrixpushbutton.h @@ -19,7 +19,6 @@ #define MATRIXPUSHBUTTON_H #include -#include class MatrixPushButton : public QPushButton { @@ -29,12 +28,8 @@ class MatrixPushButton : public QPushButton QPair matrixPos(); void setButtonColor(QColor color); void resetButtonColor(); -<<<<<<< HEAD - -======= - void saveLayoutButton(QJsonDocument kbdlayout); QString getLabel(); ->>>>>>> ed9df82... Now Restore button colors also after loaded JSON layout file + private: QString mLabel; QPair mMatrixPos; diff --git a/src/razergenie.cpp b/src/razergenie.cpp index 2ab2ad9..eb21c21 100644 --- a/src/razergenie.cpp +++ b/src/razergenie.cpp @@ -323,7 +323,163 @@ void RazerGenie::addDeviceToGui(const QDBusObjectPath &devicePath) scrollArea->setWidgetResizable(true); /* Create actual DeviceWidget */ +<<<<<<< HEAD auto *widget = new DeviceWidget(name, devicePath, currentDevice); +======= + RazerDeviceWidget *widget = new RazerDeviceWidget(name, serial); + + QVBoxLayout *verticalLayout = new QVBoxLayout(widget); + + // List of locations to iterate through + QList lightingLocationsTodo; + + // Check what lighting locations the device has + if(currentDevice->hasCapability("lighting") || + currentDevice->hasCapability("lighting_bw2013") || + currentDevice->hasCapability("lighting_profile_leds") || + currentDevice->hasCapability("brightness")) + lightingLocationsTodo.append(libopenrazer::Device::Lighting); + if(currentDevice->hasCapability("lighting_logo")) + lightingLocationsTodo.append(libopenrazer::Device::LightingLogo); + if(currentDevice->hasCapability("lighting_scroll")) + lightingLocationsTodo.append(libopenrazer::Device::LightingScroll); + if(currentDevice->hasCapability("lighting_backlight")) + lightingLocationsTodo.append(libopenrazer::Device::LightingBacklight); + + // Declare header font + QFont headerFont("Arial", 15, QFont::Bold); + QFont titleFont("Arial", 18, QFont::Bold); + + // Add header with the device name + QLabel *header = new QLabel(name, widget); + header->setFont(titleFont); + verticalLayout->addWidget(header); + + // Lighting header + if(lightingLocationsTodo.size() != 0) { + QLabel *lightingHeader = new QLabel(tr("Lighting"), widget); + lightingHeader->setFont(headerFont); + verticalLayout->addWidget(lightingHeader); + } + + // Iterate through lighting locations + while(lightingLocationsTodo.size() != 0) { + // Get location we are iterating through + libopenrazer::Device::LightingLocation currentLocation = lightingLocationsTodo.takeFirst(); + + QLabel *lightingLocationLabel; + + // Set appropriate text + if(currentLocation == libopenrazer::Device::Lighting) { + lightingLocationLabel = new QLabel(tr("Lighting")); + } else if(currentLocation == libopenrazer::Device::LightingLogo) { + lightingLocationLabel = new QLabel(tr("Lighting Logo")); + } else if(currentLocation == libopenrazer::Device::LightingScroll) { + lightingLocationLabel = new QLabel(tr("Lighting Scroll")); + } else if(currentLocation == libopenrazer::Device::LightingBacklight) { + lightingLocationLabel = new QLabel(tr("Lighting Backlight")); + } else { + // Houston, we have a problem. + util::showError("Unhanded lighting location in fillList()"); + continue; + } + + QHBoxLayout *lightingHBox = new QHBoxLayout(); + verticalLayout->addWidget(lightingLocationLabel); + verticalLayout->addLayout(lightingHBox); + + QComboBox *comboBox = new QComboBox; + QLabel *brightnessLabel = NULL; + QSlider *brightnessSlider = NULL; + + comboBox->setObjectName(QString::number(currentLocation)); + qDebug() << "CURRENT LOCATION: " << QString::number(currentLocation); + //TODO More elegant solution instead of the sizePolicy? + comboBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + + //TODO Battery + //TODO Sync effects in comboboxes & colorStuff when the sync checkbox is active + + if(currentLocation == libopenrazer::Device::Lighting) { + // Add items from capabilities + for(int i=0; ihasCapability(libopenrazer::lightingComboBoxCapabilites[i].getIdentifier())) { + comboBox->addItem(libopenrazer::lightingComboBoxCapabilites[i].getDisplayString(), QVariant::fromValue(libopenrazer::lightingComboBoxCapabilites[i])); + } + } + + // Connect signal from combobox + connect(comboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &RazerGenie::standardCombo); + + // Brightness slider + if(currentDevice->hasCapability("brightness")) { + brightnessLabel = new QLabel(tr("Brightness")); + brightnessSlider = new QSlider(Qt::Horizontal, widget); + if(currentDevice->hasCapability("get_brightness")) { + //qDebug() << "Brightness:" << currentDevice->getBrightness(); + brightnessSlider->setValue(currentDevice->getBrightness()); + } else { + // Set the slider to 100 by default as it's more likely it's 100 than 0... + brightnessSlider->setValue(100); + } + connect(brightnessSlider, &QSlider::valueChanged, this, &RazerGenie::brightnessChanged); + } + + } else if(currentLocation == libopenrazer::Device::LightingLogo) { + // Add items from capabilities + for(int i=0; ihasCapability(libopenrazer::logoComboBoxCapabilites[i].getIdentifier())) { + comboBox->addItem(libopenrazer::logoComboBoxCapabilites[i].getDisplayString(), QVariant::fromValue(libopenrazer::logoComboBoxCapabilites[i])); + } + } + + // Connect signal from combobox + connect(comboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &RazerGenie::logoCombo); + + // Brightness slider + if(currentDevice->hasCapability("lighting_logo_brightness")) { + brightnessLabel = new QLabel(tr("Brightness Logo")); + brightnessSlider = new QSlider(Qt::Horizontal, widget); + if(currentDevice->hasCapability("get_lighting_logo_brightness")) { + brightnessSlider->setValue(currentDevice->getLogoBrightness()); + } else { + // Set the slider to 100 by default as it's more likely it's 100 than 0... + brightnessSlider->setValue(100); + } + connect(brightnessSlider, &QSlider::valueChanged, this, &RazerGenie::logoBrightnessChanged); + } + + } else if(currentLocation == libopenrazer::Device::LightingScroll) { + // Add items from capabilities + for(int i=0; ihasCapability(libopenrazer::scrollComboBoxCapabilites[i].getIdentifier())) { + comboBox->addItem(libopenrazer::scrollComboBoxCapabilites[i].getDisplayString(), QVariant::fromValue(libopenrazer::scrollComboBoxCapabilites[i])); + } + } + + // Connect signal from combobox + connect(comboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &RazerGenie::scrollCombo); + + // Brightness slider + if(currentDevice->hasCapability("lighting_scroll_brightness")) { + brightnessLabel = new QLabel(tr("Brightness Scroll")); + brightnessSlider = new QSlider(Qt::Horizontal, widget); + if(currentDevice->hasCapability("get_lighting_scroll_brightness")) { + brightnessSlider->setValue(currentDevice->getScrollBrightness()); + } else { + // Set the slider to 100 by default as it's more likely it's 100 than 0... + brightnessSlider->setValue(100); + } + connect(brightnessSlider, &QSlider::valueChanged, this, &RazerGenie::scrollBrightnessChanged); + } + } else if(currentLocation == libopenrazer::Device::LightingBacklight) { + // Add items from capabilities + for(int i=0; ihasCapability(libopenrazer::backlightComboBoxCapabilites[i].getIdentifier())) { + comboBox->addItem(libopenrazer::backlightComboBoxCapabilites[i].getDisplayString(), QVariant::fromValue(libopenrazer::backlightComboBoxCapabilites[i])); + } + } +>>>>>>> 6cb5d0b... Good going on, last thing to fix before the big cleaning is to render correctly from the standart custom editor, for some reason it looks to be a shift somewhere // Set the main widget as child of the scrollArea scrollArea->setWidget(widget); From a10100f98d9e695d923c17be8313d8e63af5b0ab Mon Sep 17 00:00:00 2001 From: Tikeri Date: Tue, 21 Apr 2020 12:35:38 +0200 Subject: [PATCH 40/47] Removed unused stuff, removed the null label which leads in improper layout values.. this wasted my time btw. --- data/matrix_layouts/razerdefault22.json | 1 - src/customeditor/customeditor.cpp | 31 +++++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index 49dbd51..74ba49a 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -428,7 +428,6 @@ {"label": null}, {"label": "esc", "matrix": [0, 1]}, {"label": null}, - {"label": null}, {"label": "F1", "matrix": [0, 3]}, {"label": "F2", "matrix": [0, 4]}, {"label": "F3", "matrix": [0, 5]}, diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index e093406..6cbcb0d 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -194,6 +194,8 @@ QLayout *CustomEditor::generateKeyboard() closeWindow(); } } + + qDebug() << __FUNCTION__ << ": Selected language is " << klay->mjsLangStr; // Iterate over rows in the object QJsonObject::const_iterator it; @@ -464,7 +466,6 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) for(int i=0; i < dimens[1]; i++) { keysO = QJsonValue(keysA.at(i)).toObject(); - //qDebug() << __FUNCTION__ << " : KeysO => " << keysO; if(keysO.isEmpty() == true) @@ -481,20 +482,13 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) colors[row][i] = colour; int j = 0; - - QStringList discovery = keysO.value(klay->mjsLabelStr).toString().split("_"); - + for(; j < matrixPushButtons.count(); j++) { if(keysO.value(klay->mjsLabelStr).toString() == matrixPushButtons.at(j)->getLabel() ) break; } - if(discovery.isEmpty() == true ) - { - j = i+(row * dimens[1]); - } - /* qDebug() << __FUNCTION__ << ": JSon Label => " << keysO.value(klay->mjsLabelStr).toString() << ": JSon Color => " << colour @@ -504,7 +498,9 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) if(j < matrixPushButtons.count() ) { matrixPushButtons.at(j)->setButtonColor(colors[row][i]); - qDebug() << __FUNCTION__ << ": Set color for button n°" << i << " which is labeled " << matrixPushButtons.at(j)->getLabel(); + qDebug() << __FUNCTION__ << ": Set color " << colors[row][i] + << " for button n°" << i + << " which is labeled " << matrixPushButtons.at(j)->getLabel(); } } else @@ -516,7 +512,7 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) keysO.remove(klay->mjsColorsStr); keysO.insert(klay->mjsColorsStr, colors[row][i].name()); keysA.replace(i, keysO); - //qDebug() << __FUNCTION__ << " : Prepared row => " << keysO << endl << " Color prepared => " << keysA; + //qDebug() << __FUNCTION__ << ": Prepared row => " << keysO << endl << " Color prepared => " << keysA; } else { qDebug() << __FUNCTION__ << ": Null / Disabled key found "; @@ -525,7 +521,6 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) } rowsO.insert(klay->mjsRowStr+QString::number(row), keysA); - //qDebug() << __FUNCTION__ << " Built of rowsO => " << rowsO; <<<<<<< HEAD @@ -550,13 +545,20 @@ void CustomEditor::clearAll() blankColors << QColor(Qt::black); } + /* // Send one request per row for (int i = 0; i < dimens.x; i++) { device->defineCustomFrame(i, 0, dimens.y - 1, blankColors); } +<<<<<<< HEAD device->displayCustomFrame(); +======= + device->setCustom(); + */ + +>>>>>>> de3e62c... Removed unused stuff, removed the null label which leads in improper layout values.. this wasted my time btw. // Reset view for (auto matrixPushButton : qAsConst(matrixPushButtons)) { matrixPushButton->resetButtonColor(); @@ -568,6 +570,11 @@ void CustomEditor::clearAll() j = QColor(Qt::black); } } + + for(int i=0; i < dimens[0]; i++) + { + this->updateKeyrow(i, false); + } } void CustomEditor::loadLayout() From 806c80e93fc503cb8d199a09c9eb7decf82d068d Mon Sep 17 00:00:00 2001 From: Tikeri Date: Tue, 21 Apr 2020 15:03:13 +0200 Subject: [PATCH 41/47] Razerlogo LED added into fr_FR kayboard layout, should be the same for others keyboards ? --- data/matrix_layouts/razerdefault22.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/matrix_layouts/razerdefault22.json b/data/matrix_layouts/razerdefault22.json index 74ba49a..eb42e65 100644 --- a/data/matrix_layouts/razerdefault22.json +++ b/data/matrix_layouts/razerdefault22.json @@ -442,7 +442,9 @@ {"label": "F12", "matrix": [0, 14]}, {"label": "impr.", "matrix": [0, 15]}, {"label": "arrêt", "matrix": [0, 16]}, - {"label": "pause", "matrix": [0, 17]} + {"label": "pause", "matrix": [0, 17]}, + {"label": null}, + {"label": "Triskel", "width": 180, "matrix": [0, 20]} ], "row1": [ {"label": "M1", "matrix": [1, 0]}, From d4cb44ae883a81537a823a605f7114e577b4c138 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 2 May 2020 17:35:52 +0200 Subject: [PATCH 42/47] Forgot to remove some old files --- src/libopenrazer/docs/libopenrazermodule.h | 2 -- src/libopenrazer/docs/meson.build | 11 ----------- subprojects/libopenrazer.wrap | 4 ---- 3 files changed, 17 deletions(-) delete mode 100644 src/libopenrazer/docs/libopenrazermodule.h delete mode 100644 src/libopenrazer/docs/meson.build delete mode 100644 subprojects/libopenrazer.wrap diff --git a/src/libopenrazer/docs/libopenrazermodule.h b/src/libopenrazer/docs/libopenrazermodule.h deleted file mode 100644 index 3dfdd72..0000000 --- a/src/libopenrazer/docs/libopenrazermodule.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "../libopenrazer.h" -#include "../razercapability.h" diff --git a/src/libopenrazer/docs/meson.build b/src/libopenrazer/docs/meson.build deleted file mode 100644 index 12f005c..0000000 --- a/src/libopenrazer/docs/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -qdoc = find_program('qdoc', required : false) - -if qdoc.found() - # TODO Fix up includes to work automatically (especially the gcc include) - custom_target('docs', - output: 'html', - input : 'config.qdocconf', - command: [qdoc, '@INPUT@', '-I', meson.current_source_dir(), - '-I/usr/include/qt', '-I/usr/include/qt/QtCore', '-I/usr/include/qt/QtGui', '-I/usr/include/qt/QtDBus', '-I/usr/include/qt/QtXml', - '-I/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include']) -endif diff --git a/subprojects/libopenrazer.wrap b/subprojects/libopenrazer.wrap deleted file mode 100644 index 27a3fad..0000000 --- a/subprojects/libopenrazer.wrap +++ /dev/null @@ -1,4 +0,0 @@ -[wrap-git] -directory = libopenrazer -url = https://github.com/z3ntu/libopenrazer.git -revision = head From 812b891e0834933ce0a4885d518158022f564a84 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 2 May 2020 18:19:16 +0200 Subject: [PATCH 43/47] Fixed dimens.{x,y} in customeditor.cpp Fixed double declaration in customeditor.h Fixed meson.build to include new kbdlayout.{h,cpp} files like it was done in CMakeLists.txt before Fixed meson.build in data/ to include the saved layout example file --- data/meson.build | 15 +++++++++++++++ meson.build | 13 ++++++------- src/customeditor/customeditor.cpp | 8 ++++---- src/customeditor/customeditor.h | 1 - src/meson.build | 2 +- 5 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 data/meson.build diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..2b7c1d8 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,15 @@ +# Matrix Layouts +install_data('matrix_layouts/razerblade16.json', + 'matrix_layouts/razerdefault22.json', + 'matrix_layouts/razerblade25.json', + install_dir : join_paths(get_option('datadir'), 'razergenie/matrix_layouts')) + +# Appstream XML +install_data('xyz.z3ntu.razergenie.appdata.xml', + install_dir : join_paths(get_option('datadir'), 'metainfo')) + +# Desktop file +install_data('xyz.z3ntu.razergenie.desktop', + install_dir : join_paths(get_option('datadir'), 'applications')) + +subdir('translations') diff --git a/meson.build b/meson.build index ee95c0b..620a7df 100644 --- a/meson.build +++ b/meson.build @@ -3,13 +3,6 @@ project('razergenie', 'cpp', meson_version : '>=0.44.0', default_options : ['cpp_std=c++11']) - -qt5 = import('qt5') -qt5_dep = dependency('qt5', modules: ['Core', 'DBus', 'Gui', 'Network', 'Widgets']) - -razer_test_dep = dependency('razer_test', fallback : ['razer_test', 'razer_test_dep']) -libopenrazer_dep = dependency('libopenrazer', fallback : ['libopenrazer', 'libopenrazer_dep']) - if get_option('include_matrix_discovery') add_global_arguments('-DINCLUDE_MATRIX_DISCOVERY', language : 'cpp') message('razergenie: Matrix discovery feature included.') @@ -17,6 +10,12 @@ else message('razergenie: Matrix discovery feature not included.') endif +qt5 = import('qt5') +qt5_dep = dependency('qt5', modules: ['Core', 'DBus', 'Gui', 'Network', 'Widgets']) + +razer_test_dep = dependency('razer_test', fallback : ['razer_test', 'razer_test_dep']) +libopenrazer_dep = dependency('libopenrazer', fallback : ['libopenrazer', 'libopenrazer_dep']) + install_data('logo/xyz.z3ntu.razergenie.svg', install_dir : join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps')) subdir('data') diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index 17a9ca7..fcf3d2c 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -294,13 +294,13 @@ QLayout *CustomEditor::generateMatrixDiscovery() QJsonObject jsRow; auto *vbox = new QVBoxLayout(); - for(int i=0; i " << keysA; QJsonObject keysO; - for(int i=0; i < dimens.x; i++) + for(int i=0; i < dimens.y; i++) { keysO = QJsonValue(keysA.at(i)).toObject(); //qDebug() << __FUNCTION__ << " : KeysO => " << keysO; @@ -478,7 +478,7 @@ void CustomEditor::clearAll() } } - for(int i=0; i < dimens.y; i++) + for(int i=0; i < dimens.x; i++) { this->updateKeyrow(i, false); } diff --git a/src/customeditor/customeditor.h b/src/customeditor/customeditor.h index ff17b95..3699dc8 100644 --- a/src/customeditor/customeditor.h +++ b/src/customeditor/customeditor.h @@ -64,7 +64,6 @@ class CustomEditor : public QDialog, public KbdLayout QJsonObject keyboardKeys; QVector matrixPushButtons; QJsonObject keyboardKeysColors; - QVector matrixPushButtons; libopenrazer::Device *device; razer_test::MatrixDimensions dimens; diff --git a/src/meson.build b/src/meson.build index 9baa10d..1fe4a2f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,7 +7,7 @@ configure_file(input : 'config.h.in', configuration : conf_data) razergenie_sources = ['main.cpp', 'razergenie.cpp', 'razerimagedownloader.cpp', 'devicewidget.cpp', 'devicelistwidget.cpp', 'ledwidget.cpp', 'util.cpp', - 'customeditor/customeditor.cpp', 'customeditor/matrixpushbutton.cpp', 'preferences/preferences.cpp'] + 'customeditor/customeditor.cpp', 'customeditor/matrixpushbutton.cpp', 'customeditor/kbdlayout.cpp', 'preferences/preferences.cpp'] processed = qt5.preprocess( moc_headers : ['razergenie.h', 'razerimagedownloader.h', 'devicelistwidget.h', 'ledwidget.h', 'customeditor/customeditor.h', 'preferences/preferences.h'], From d042eebb8e05c9dcf3b0d0a35bdfb567fc6bda7d Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 2 May 2020 19:52:54 +0200 Subject: [PATCH 44/47] Added fr_FR in supported language Fixed some dialog boxes strings to be compatible for translations Added and updated fr.ts translation file that was there before... Updated de.fr translation --- data/meson.build | 1 + data/translations/de.ts | 58 ++++++++++++++++++++----------- data/translations/fr.ts | 56 +++++++++++++++++++---------- src/customeditor/customeditor.cpp | 15 ++++---- 4 files changed, 84 insertions(+), 46 deletions(-) diff --git a/data/meson.build b/data/meson.build index 2b7c1d8..a7b08b6 100644 --- a/data/meson.build +++ b/data/meson.build @@ -2,6 +2,7 @@ install_data('matrix_layouts/razerblade16.json', 'matrix_layouts/razerdefault22.json', 'matrix_layouts/razerblade25.json', + 'matrix_layouts/discoverysave.example.22.json', install_dir : join_paths(get_option('datadir'), 'razergenie/matrix_layouts')) # Appstream XML diff --git a/data/translations/de.ts b/data/translations/de.ts index 62f03b4..2d2659c 100644 --- a/data/translations/de.ts +++ b/data/translations/de.ts @@ -4,73 +4,91 @@ CustomEditor - + RazerGenie - Custom Editor RazerGenie - Custom Editor - - + + Unknown matrix dimensions - Unbekannte Matrix Maße + - - + + Please open an issue in the RazerGenie repository. Device name: %1 - matrix dimens: %2 %3 Bitte öffne ein Issue in der RazerGenie Repository. Gerätname: %1 - Matix Maße: %2 %3 - + Device type not implemented! Gerät Typ nicht implementiert! - + Please open an issue in the RazerGenie repository. Device type: %1 Bitte öffne ein Issue in der RazerGenie Repository. Gerätname: %1 - + Set Setzen - + Clear Löschen - + Clear All Alle löschen - + + Load Keyboad Layout + Tastaturlayout laden + + + + Save Keyboard Layout + Tastaturlayout speichern + + + You are using a keyboard with a layout which is not known to the daemon. Please help us by visiting <a href='https://github.com/openrazer/openrazer/wiki/Keyboard-layouts'>https://github.com/openrazer/openrazer/wiki/Keyboard-layouts</a>. Using a fallback layout for now. Du benutzt eine Tastatur mit einem Layout, welches nicht vom Daemon erkannt wurde. Bitte helfe uns indem du <a href='https://github.com/openrazer/openrazer/wiki/Keyboard-layouts'>https://github.com/openrazer/openrazer/wiki/Keyboard-layouts</a> besuchst. Ein Rückfalllayout wird einstweilen benutzt. - + Your keyboard layout (%1) is not yet supported by RazerGenie for this keyboard. Please open an issue in the RazerGenie repository. Dein Tastaturlayout (%1) ist noch nicht von RazerGenie für diese Tastatur unterstützt. Bitte öffne ein Issue in der RazerGenie Repository. - + Neither one of these layouts was found in the layout file: %1. Exiting. Keines der folgenden Layouts wird in der Layout Datei gefunden: %1. Der Editor wird nicht geöffnet. - + Error loading %1.json! Fehler beim laden von%1.json! - - The file %1.json, used for the custom editor failed to load: %2 -The editor won't open now. - Die Datei %1.json, welche für den Custom Editor benützt wird, wurde nicht geladen: %2 -Der Editor wird nicht geöffnet. + + Select Keyboard Layout file + Wählen Sie Layoutdatei + + + + Open Keyboard layout + Öffnen Sie das Tastaturlayout + + + + Save Keyboard layout + Tastaturlayout speichern diff --git a/data/translations/fr.ts b/data/translations/fr.ts index 16681c8..92edbd7 100644 --- a/data/translations/fr.ts +++ b/data/translations/fr.ts @@ -4,73 +4,91 @@ CustomEditor - + RazerGenie - Custom Editor RazerGenie - Éditeur personnalisé - - + + Unknown matrix dimensions Dimensions de la matrice inconnues - - + + Please open an issue in the RazerGenie repository. Device name: %1 - matrix dimens: %2 %3 Veuillez ouvrir un ticket dans le dépôt RazerGenie. Nom du périphérique : %1 - dimensions de la matrice : %2 %3 - + Device type not implemented! Ce type de périphérique n'est pas implémenté ! - + Please open an issue in the RazerGenie repository. Device type: %1 Veuillez ouvrir un ticket dans le dépôt RazerGenie. Type de périphérique : %1 - + Set Appliquer - + Clear Enlever - + Clear All Tout enlever - + + Load Keyboad Layout + Charger une configuration + + + + Save Keyboad Layout + Sauvegarder la configuration + + + You are using a keyboard with a layout which is not known to the daemon. Please help us by visiting <a href='https://github.com/openrazer/openrazer/wiki/Keyboard-layouts'>https://github.com/openrazer/openrazer/wiki/Keyboard-layouts</a>. Using a fallback layout for now. Vous utilisez un clavier dont la disposition n'est pas connue du daemon. Aidez-nous en visitant <a href='https://github.com/openrazer/openrazer/wiki/Keyboard-layouts'>https://github.com/openrazer/openrazer/wiki/Keyboard-layouts</a>. Pour l'instant, un dispositif générique sera utilisé. - + Your keyboard layout (%1) is not yet supported by RazerGenie for this keyboard. Please open an issue in the RazerGenie repository. La disposition du clavier (%1) n'est pas encore supportée par RazerGenie pour ce clavier. Veuillez ouvrir un tricket dans le dépôt RazerGenie. - + Neither one of these layouts was found in the layout file: %1. Exiting. Aucune de ces dispositions n'a été trouvée dans le fichier source : %1. L'éditeur va se fermer. - + Error loading %1.json! Erreur lors du chargement de %1.json ! - - The file %1.json, used for the custom editor failed to load: %2 -The editor won't open now. - Le fichier %1.json, utilisé pour l'éditeur personnalisé, n'a pas pu être chargé : %2 -L'éditeur ne s'ouvrira pas pour l'instant. + + Select Keyboard Layout + Selectionnez une configuration + + + + Open Keyboard layout + Ouvrir un fichier de configuration + + + + Save Keyboard layout + Sauvegarder la configuration diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index fcf3d2c..708c9ec 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -165,7 +165,8 @@ QLayout *CustomEditor::generateKeyboard() QStringList langs; langs << "de_DE" << "en_US" - << "en_GB"; + << "en_GB" + << "fr_FR"; for (const QString &lang : qAsConst(langs)) { if (keyboardKeys.contains(lang)) { keyboardLayout = keyboardKeys[lang].toObject(); @@ -355,7 +356,7 @@ bool CustomEditor::parseKeyboardJSON(QString jsonname) file = &file_prod; } else { QMessageBox::information(0, tr("Error loading %1.json!").arg(jsonname), tr("The file %1.json, used for the custom editor failed to load: %2\nThe editor won't open now.").arg(jsonname).arg(file_prod.errorString())); - QString filename = QFileDialog::getOpenFileName(this, "Select Keyboard Layout file","" , KbdFileFilter, &KbdFileFilter ); + QString filename = QFileDialog::getOpenFileName(this, tr("Select Keyboard Layout file"),"" , KbdFileFilter, &KbdFileFilter ); file_sel.setFileName(filename); if(file_sel.open(QIODevice::ReadOnly)) { @@ -421,9 +422,9 @@ bool CustomEditor::updateKeyrow(int row, const bool fromfile) if(j < matrixPushButtons.count() ) { matrixPushButtons.at(j)->setButtonColor(colors[row][i]); - qDebug() << __FUNCTION__ << ": Set color " << colors[row][i] - << " for button n°" << i - << " which is labeled " << matrixPushButtons.at(j)->getLabel(); + //qDebug() << __FUNCTION__ << ": Set color " << colors[row][i] + // << " for button n°" << i + // << " which is labeled " << matrixPushButtons.at(j)->getLabel(); } } else @@ -486,7 +487,7 @@ void CustomEditor::clearAll() void CustomEditor::loadLayout() { - QString file = QFileDialog::getOpenFileName(this, "Open Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + QString file = QFileDialog::getOpenFileName(this, tr("Open Keyboard layout"),"" , KbdFileFilter, &KbdFileFilter ); if( ! QFile::exists(file) ) return; @@ -504,7 +505,7 @@ void CustomEditor::loadLayout() void CustomEditor::saveLayout() { - QString file = QFileDialog::getSaveFileName(this, "Save Keyboard layout","" , KbdFileFilter, &KbdFileFilter ); + QString file = QFileDialog::getSaveFileName(this, tr("Save Keyboard layout"),"" , KbdFileFilter, &KbdFileFilter ); qDebug() << __FUNCTION__ << " : Created new layout file : " << file; From 63650f7120e06002892c6b238a61b681b01a9bea Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sat, 2 May 2020 23:20:44 +0200 Subject: [PATCH 45/47] Now include french translation while building Fixed a typo in fr.ts --- data/translations/fr.ts | 2 +- data/translations/meson.build | 3 ++- src/customeditor/kbdlayout.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/data/translations/fr.ts b/data/translations/fr.ts index 92edbd7..ceaa898 100644 --- a/data/translations/fr.ts +++ b/data/translations/fr.ts @@ -52,7 +52,7 @@ - Save Keyboad Layout + Save Keyboard Layout Sauvegarder la configuration diff --git a/data/translations/meson.build b/data/translations/meson.build index 84369ee..4e68727 100644 --- a/data/translations/meson.build +++ b/data/translations/meson.build @@ -1,6 +1,7 @@ # Translations ts_files = [ - 'de.ts' + 'de.ts', + 'fr.ts' ] qt5.compile_translations(ts_files : ts_files, install : true, diff --git a/src/customeditor/kbdlayout.h b/src/customeditor/kbdlayout.h index 812bf32..f1ecdad 100644 --- a/src/customeditor/kbdlayout.h +++ b/src/customeditor/kbdlayout.h @@ -9,7 +9,7 @@ class KbdLayout { public: - QString mjsLangStr = "en_US"; + QString mjsLangStr = "en_US"; const QString mjsRowStr = "row"; const QString mjsLabelStr = "label"; const QString mjsMatrixStr = "matrix"; From e5cc7a1be27d2af3ff196fb3e0877cd4a92bf1f2 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sun, 3 May 2020 13:01:48 +0200 Subject: [PATCH 46/47] Removed forced test variable from customeditor.cpp + fixed end line with double --- data/matrix_layouts/discoverysave.example.22.json | 4 ++-- data/translations/de.ts | 10 +++++----- data/translations/fr.ts | 10 +++++----- src/customeditor/customeditor.cpp | 6 ++---- src/customeditor/kbdlayout.h | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/data/matrix_layouts/discoverysave.example.22.json b/data/matrix_layouts/discoverysave.example.22.json index 7850ccd..6e82338 100644 --- a/data/matrix_layouts/discoverysave.example.22.json +++ b/data/matrix_layouts/discoverysave.example.22.json @@ -1,5 +1,5 @@ { - "en_US": { + "US": { "row0": [ { "colors": "#000000", @@ -162,7 +162,7 @@ ] }, { - "colors": "#000000", + "colors": "#00ff00", "label": "0_20", "matrix": [ 0, diff --git a/data/translations/de.ts b/data/translations/de.ts index 2d2659c..2f2d99c 100644 --- a/data/translations/de.ts +++ b/data/translations/de.ts @@ -66,27 +66,27 @@ Dein Tastaturlayout (%1) ist noch nicht von RazerGenie für diese Tastatur unterstützt. Bitte öffne ein Issue in der RazerGenie Repository. - + Neither one of these layouts was found in the layout file: %1. Exiting. Keines der folgenden Layouts wird in der Layout Datei gefunden: %1. Der Editor wird nicht geöffnet. - + Error loading %1.json! Fehler beim laden von%1.json! - + Select Keyboard Layout file Wählen Sie Layoutdatei - + Open Keyboard layout Öffnen Sie das Tastaturlayout - + Save Keyboard layout Tastaturlayout speichern diff --git a/data/translations/fr.ts b/data/translations/fr.ts index ceaa898..91031e3 100644 --- a/data/translations/fr.ts +++ b/data/translations/fr.ts @@ -66,27 +66,27 @@ La disposition du clavier (%1) n'est pas encore supportée par RazerGenie pour ce clavier. Veuillez ouvrir un tricket dans le dépôt RazerGenie. - + Neither one of these layouts was found in the layout file: %1. Exiting. Aucune de ces dispositions n'a été trouvée dans le fichier source : %1. L'éditeur va se fermer. - + Error loading %1.json! Erreur lors du chargement de %1.json ! - + Select Keyboard Layout Selectionnez une configuration - + Open Keyboard layout Ouvrir un fichier de configuration - + Save Keyboard layout Sauvegarder la configuration diff --git a/src/customeditor/customeditor.cpp b/src/customeditor/customeditor.cpp index 708c9ec..9fb8dcd 100644 --- a/src/customeditor/customeditor.cpp +++ b/src/customeditor/customeditor.cpp @@ -210,9 +210,7 @@ QLayout *CustomEditor::generateKeyboard() int height = /*obj.contains("height") ? obj.value("height").toInt() : */63; btn->setFixedSize(width, height); - bool color = false; - - color = true; + bool color = true; if(obj.contains(klay->mjsMatrixStr)) { QJsonArray arr = obj[klay->mjsMatrixStr].toArray(); @@ -231,7 +229,7 @@ QLayout *CustomEditor::generateKeyboard() if( ! obj.contains(klay->mjsColorsStr) && color == true ) { - obj.insert(klay->mjsColorsStr, klay->mjsDefColor);; + obj.insert(klay->mjsColorsStr, klay->mjsDefColor); } //qDebug() << __FUNCTION__ << " : obj => " << obj; diff --git a/src/customeditor/kbdlayout.h b/src/customeditor/kbdlayout.h index f1ecdad..7376783 100644 --- a/src/customeditor/kbdlayout.h +++ b/src/customeditor/kbdlayout.h @@ -9,7 +9,7 @@ class KbdLayout { public: - QString mjsLangStr = "en_US"; + QString mjsLangStr = "US"; const QString mjsRowStr = "row"; const QString mjsLabelStr = "label"; const QString mjsMatrixStr = "matrix"; From 85523d523b7c010573f14fae6f4dd901477c2104 Mon Sep 17 00:00:00 2001 From: Tikeri Date: Sun, 10 May 2020 16:40:19 +0200 Subject: [PATCH 47/47] Missing file from rebase...? libopenrazer.wrap --- subprojects/libopenrazer.wrap | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 subprojects/libopenrazer.wrap diff --git a/subprojects/libopenrazer.wrap b/subprojects/libopenrazer.wrap new file mode 100644 index 0000000..27a3fad --- /dev/null +++ b/subprojects/libopenrazer.wrap @@ -0,0 +1,4 @@ +[wrap-git] +directory = libopenrazer +url = https://github.com/z3ntu/libopenrazer.git +revision = head