From f9c5e187edbe006bf024c899a0022d24673d8e5f Mon Sep 17 00:00:00 2001 From: Nasi Date: Sat, 12 Mar 2022 13:21:24 -0800 Subject: [PATCH] First release First fullt functional release with some bugs --- consoleEmulator.pro | 20 +- logic/include/logger/ConsoleLogger.h | 13 + logic/include/model/ButtonHelper.h | 81 +++++ logic/include/model/Console.h | 125 +++++++- logic/include/model/DataSender.h | 16 +- logic/include/model/FunctionCodes.h | 134 ++++++++ logic/include/model/Led.h | 35 ++ logic/include/model/Logger.h | 12 + logic/include/model/PushButton.h | 31 ++ logic/include/model/RotaryButton.h | 26 ++ logic/include/network/UdpDataSender.h | 27 ++ logic/include/viewModel/MainViewModel.h | 211 ++++++++++++- logic/include/viewModel/utils/Property.h | 82 +++++ logic/logic.pro | 39 ++- logic/src/logger/Consolelogger.cpp | 12 + logic/src/model/Console.cpp | 157 ++++++++- logic/src/model/Led.cpp | 39 +++ logic/src/model/PushButton.cpp | 51 +++ logic/src/model/RotaryButton.cpp | 37 +++ logic/src/network/UdpDataSender.cpp | 34 ++ logic/src/viewModel/MainViewModel.cpp | 99 ++++-- network/Network.cpp | 5 - network/Network.h | 10 - network/UdpDataSender.cpp | 12 - network/UdpDataSender.h | 13 - network/network.pro | 30 -- test/TestDataSender.h | 5 +- test/TestLogger.h | 25 ++ test/test.pro | 18 +- test/tst_console.cpp | 261 ++++++++++++++- ui/App.qml | 14 + ui/MainView.qml | 70 +--- ui/const/Const.qml | 35 ++ ui/const/qmldir | 1 + ui/emulator/Emulator.qml | 36 +++ ui/emulator/components/HoverGlow.qml | 31 ++ ui/emulator/components/JoystickButton.qml | 259 +++++++++++++++ ui/emulator/components/Knob.qml | 254 +++++++++++++++ ui/emulator/components/KnobImage.qml | 113 +++++++ ui/emulator/components/KnobLight.qml | 334 ++++++++++++++++++++ ui/emulator/components/LightImage.qml | 29 ++ ui/emulator/components/LightRing.qml | 190 +++++++++++ ui/emulator/components/ModeBg.qml | 106 +++++++ ui/emulator/components/ModeBgOption.qml | 124 ++++++++ ui/emulator/components/ModeButton.qml | 63 ++++ ui/emulator/components/ModeOption.qml | 77 +++++ ui/emulator/components/NeuButton.qml | 272 ++++++++++++++++ ui/emulator/components/NeuImage.qml | 101 ++++++ ui/emulator/components/NeuLight.qml | 304 ++++++++++++++++++ ui/emulator/components/SegmentButton.qml | 186 +++++++++++ ui/emulator/components/SegmentCircle.qml | 51 +++ ui/emulator/components/SliderBar.qml | 219 +++++++++++++ ui/emulator/components/Trackball.qml | 133 ++++++++ ui/emulator/elements/JoystickButtonBind.qml | 52 +++ ui/emulator/elements/KnobLightBind.qml | 28 ++ ui/emulator/elements/LightImageBind.qml | 19 ++ ui/emulator/elements/ModeButtonBind.qml | 55 ++++ ui/emulator/elements/ModeOptionBind.qml | 55 ++++ ui/emulator/elements/SliderBarBind.qml | 18 ++ ui/emulator/elements/TrackballBind.qml | 127 ++++++++ ui/emulator/items/BottomRight.qml | 57 ++++ ui/emulator/items/CurveButtons.qml | 84 +++++ ui/emulator/items/Encoders.qml | 76 +++++ ui/emulator/items/JoystickCouple.qml | 69 ++++ ui/emulator/items/Joysticks.qml | 65 ++++ ui/emulator/items/Setting.qml | 85 +++++ ui/emulator/items/TopLeft.qml | 38 +++ ui/emulator/items/TopRight.qml | 39 +++ ui/emulator/items/TrackballGroup.qml | 8 + ui/icons/bottomRight/dual.png | Bin 0 -> 143 bytes ui/icons/bottomRight/p1.png | Bin 0 -> 159 bytes ui/icons/bottomRight/p2.png | Bin 0 -> 188 bytes ui/icons/bottomRight/p3.png | Bin 0 -> 182 bytes ui/icons/bottomRight/p4.png | Bin 0 -> 183 bytes ui/icons/bottomRight/quad.png | Bin 0 -> 144 bytes ui/icons/bottomRight/single.png | Bin 0 -> 144 bytes ui/icons/curveButtons/3d.png | Bin 0 -> 184 bytes ui/icons/curveButtons/4d.png | Bin 0 -> 198 bytes ui/icons/curveButtons/abc.png | Bin 0 -> 194 bytes ui/icons/curveButtons/auto.png | Bin 0 -> 245 bytes ui/icons/curveButtons/bodyMark.png | Bin 0 -> 213 bytes ui/icons/curveButtons/clear.png | Bin 0 -> 239 bytes ui/icons/curveButtons/exit.png | Bin 0 -> 213 bytes ui/icons/curveButtons/freeze.png | Bin 0 -> 255 bytes ui/icons/curveButtons/meas.png | Bin 0 -> 225 bytes ui/icons/curveButtons/pointer.png | Bin 0 -> 214 bytes ui/icons/encoder/mode2d.png | Bin 0 -> 175 bytes ui/icons/encoder/modeC.png | Bin 0 -> 152 bytes ui/icons/encoder/modeM.png | Bin 0 -> 159 bytes ui/icons/encoder/modePd.png | Bin 0 -> 159 bytes ui/icons/encoder/modePw.png | Bin 0 -> 168 bytes ui/icons/encoder/quadratic.png | Bin 0 -> 172 bytes ui/icons/encoder/x.png | Bin 0 -> 165 bytes ui/icons/encoder/y.png | Bin 0 -> 162 bytes ui/icons/encoder/z.png | Bin 0 -> 160 bytes ui/icons/joystick/TT.svg | 101 ++++++ ui/icons/miniButton/angle.png | Bin 0 -> 226 bytes ui/icons/miniButton/depth.png | Bin 0 -> 230 bytes ui/icons/miniButton/focusDepth.png | Bin 0 -> 177 bytes ui/icons/miniButton/focusZone.png | Bin 0 -> 195 bytes ui/icons/miniButton/zoom.png | Bin 0 -> 229 bytes ui/icons/mode/2d.png | Bin 0 -> 198 bytes ui/icons/mode/bf.png | Bin 0 -> 171 bytes ui/icons/mode/c.png | Bin 0 -> 152 bytes ui/icons/mode/m.png | Bin 0 -> 177 bytes ui/icons/mode/pd.png | Bin 0 -> 159 bytes ui/icons/mode/pw.png | Bin 0 -> 168 bytes ui/icons/topLeft/archive.png | Bin 0 -> 259 bytes ui/icons/topLeft/dvd.png | Bin 0 -> 230 bytes ui/icons/topLeft/end.png | Bin 0 -> 268 bytes ui/icons/topLeft/patient.png | Bin 0 -> 272 bytes ui/icons/topLeft/power.png | Bin 0 -> 201 bytes ui/icons/topLeft/probe.png | Bin 0 -> 242 bytes ui/icons/topLeft/report.png | Bin 0 -> 258 bytes ui/icons/topLeft/utils.png | Bin 0 -> 237 bytes ui/icons/topRight/bf.png | Bin 0 -> 171 bytes ui/icons/topRight/p5.png | Bin 0 -> 181 bytes ui/icons/topRight/p6.png | Bin 0 -> 180 bytes ui/icons/topRight/xtd.png | Bin 0 -> 217 bytes ui/icons/uiMode/dark.svg | 1 + ui/icons/uiMode/light.svg | 1 + ui/theme/Dark.qml | 7 + ui/theme/Light.qml | 7 + ui/theme/Palette.qml | 44 +++ ui/theme/Theme.qml | 10 + ui/theme/qmldir | 1 + ui/ui.qrc | 96 +++++- 127 files changed, 5579 insertions(+), 226 deletions(-) create mode 100644 logic/include/logger/ConsoleLogger.h create mode 100644 logic/include/model/ButtonHelper.h create mode 100644 logic/include/model/FunctionCodes.h create mode 100644 logic/include/model/Led.h create mode 100644 logic/include/model/Logger.h create mode 100644 logic/include/model/PushButton.h create mode 100644 logic/include/model/RotaryButton.h create mode 100644 logic/include/network/UdpDataSender.h create mode 100644 logic/include/viewModel/utils/Property.h create mode 100644 logic/src/logger/Consolelogger.cpp create mode 100644 logic/src/model/Led.cpp create mode 100644 logic/src/model/PushButton.cpp create mode 100644 logic/src/model/RotaryButton.cpp create mode 100644 logic/src/network/UdpDataSender.cpp delete mode 100644 network/Network.cpp delete mode 100644 network/Network.h delete mode 100644 network/UdpDataSender.cpp delete mode 100644 network/UdpDataSender.h delete mode 100644 network/network.pro create mode 100644 test/TestLogger.h mode change 100644 => 100755 ui/App.qml mode change 100644 => 100755 ui/MainView.qml create mode 100755 ui/const/Const.qml create mode 100755 ui/const/qmldir create mode 100755 ui/emulator/Emulator.qml create mode 100755 ui/emulator/components/HoverGlow.qml create mode 100644 ui/emulator/components/JoystickButton.qml create mode 100644 ui/emulator/components/Knob.qml create mode 100644 ui/emulator/components/KnobImage.qml create mode 100644 ui/emulator/components/KnobLight.qml create mode 100644 ui/emulator/components/LightImage.qml create mode 100644 ui/emulator/components/LightRing.qml create mode 100644 ui/emulator/components/ModeBg.qml create mode 100644 ui/emulator/components/ModeBgOption.qml create mode 100644 ui/emulator/components/ModeButton.qml create mode 100644 ui/emulator/components/ModeOption.qml create mode 100755 ui/emulator/components/NeuButton.qml create mode 100644 ui/emulator/components/NeuImage.qml create mode 100644 ui/emulator/components/NeuLight.qml create mode 100644 ui/emulator/components/SegmentButton.qml create mode 100644 ui/emulator/components/SegmentCircle.qml create mode 100644 ui/emulator/components/SliderBar.qml create mode 100644 ui/emulator/components/Trackball.qml create mode 100644 ui/emulator/elements/JoystickButtonBind.qml create mode 100644 ui/emulator/elements/KnobLightBind.qml create mode 100644 ui/emulator/elements/LightImageBind.qml create mode 100644 ui/emulator/elements/ModeButtonBind.qml create mode 100644 ui/emulator/elements/ModeOptionBind.qml create mode 100644 ui/emulator/elements/SliderBarBind.qml create mode 100644 ui/emulator/elements/TrackballBind.qml create mode 100755 ui/emulator/items/BottomRight.qml create mode 100755 ui/emulator/items/CurveButtons.qml create mode 100755 ui/emulator/items/Encoders.qml create mode 100644 ui/emulator/items/JoystickCouple.qml create mode 100755 ui/emulator/items/Joysticks.qml create mode 100644 ui/emulator/items/Setting.qml create mode 100755 ui/emulator/items/TopLeft.qml create mode 100755 ui/emulator/items/TopRight.qml create mode 100644 ui/emulator/items/TrackballGroup.qml create mode 100755 ui/icons/bottomRight/dual.png create mode 100755 ui/icons/bottomRight/p1.png create mode 100755 ui/icons/bottomRight/p2.png create mode 100755 ui/icons/bottomRight/p3.png create mode 100755 ui/icons/bottomRight/p4.png create mode 100755 ui/icons/bottomRight/quad.png create mode 100755 ui/icons/bottomRight/single.png create mode 100755 ui/icons/curveButtons/3d.png create mode 100755 ui/icons/curveButtons/4d.png create mode 100755 ui/icons/curveButtons/abc.png create mode 100755 ui/icons/curveButtons/auto.png create mode 100755 ui/icons/curveButtons/bodyMark.png create mode 100755 ui/icons/curveButtons/clear.png create mode 100755 ui/icons/curveButtons/exit.png create mode 100755 ui/icons/curveButtons/freeze.png create mode 100755 ui/icons/curveButtons/meas.png create mode 100755 ui/icons/curveButtons/pointer.png create mode 100755 ui/icons/encoder/mode2d.png create mode 100755 ui/icons/encoder/modeC.png create mode 100755 ui/icons/encoder/modeM.png create mode 100755 ui/icons/encoder/modePd.png create mode 100755 ui/icons/encoder/modePw.png create mode 100755 ui/icons/encoder/quadratic.png create mode 100755 ui/icons/encoder/x.png create mode 100755 ui/icons/encoder/y.png create mode 100755 ui/icons/encoder/z.png create mode 100644 ui/icons/joystick/TT.svg create mode 100755 ui/icons/miniButton/angle.png create mode 100755 ui/icons/miniButton/depth.png create mode 100755 ui/icons/miniButton/focusDepth.png create mode 100755 ui/icons/miniButton/focusZone.png create mode 100755 ui/icons/miniButton/zoom.png create mode 100755 ui/icons/mode/2d.png create mode 100755 ui/icons/mode/bf.png create mode 100755 ui/icons/mode/c.png create mode 100755 ui/icons/mode/m.png create mode 100755 ui/icons/mode/pd.png create mode 100755 ui/icons/mode/pw.png create mode 100755 ui/icons/topLeft/archive.png create mode 100755 ui/icons/topLeft/dvd.png create mode 100755 ui/icons/topLeft/end.png create mode 100755 ui/icons/topLeft/patient.png create mode 100755 ui/icons/topLeft/power.png create mode 100755 ui/icons/topLeft/probe.png create mode 100755 ui/icons/topLeft/report.png create mode 100755 ui/icons/topLeft/utils.png create mode 100755 ui/icons/topRight/bf.png create mode 100755 ui/icons/topRight/p5.png create mode 100755 ui/icons/topRight/p6.png create mode 100755 ui/icons/topRight/xtd.png create mode 100644 ui/icons/uiMode/dark.svg create mode 100644 ui/icons/uiMode/light.svg create mode 100755 ui/theme/Dark.qml create mode 100755 ui/theme/Light.qml create mode 100755 ui/theme/Palette.qml create mode 100755 ui/theme/Theme.qml create mode 100755 ui/theme/qmldir diff --git a/consoleEmulator.pro b/consoleEmulator.pro index 30c3b59..26b82e5 100644 --- a/consoleEmulator.pro +++ b/consoleEmulator.pro @@ -1,11 +1,9 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - logic \ - network \ - test \ - ui - -logic.depends += network -ui.depends += logic -test.depends += logic +TEMPLATE = subdirs + +SUBDIRS += \ + logic \ + test \ + ui + +ui.depends += logic +test.depends += logic diff --git a/logic/include/logger/ConsoleLogger.h b/logic/include/logger/ConsoleLogger.h new file mode 100644 index 0000000..2b15b80 --- /dev/null +++ b/logic/include/logger/ConsoleLogger.h @@ -0,0 +1,13 @@ +#ifndef CONSOLELOGGER_H +#define CONSOLELOGGER_H + +#include "model/Logger.h" + +class ConsoleLogger : public Logger +{ +public: + void log(QString message) override; + ~ConsoleLogger() override; +}; + +#endif //CONSOLELOGGER_H diff --git a/logic/include/model/ButtonHelper.h b/logic/include/model/ButtonHelper.h new file mode 100644 index 0000000..98cb5df --- /dev/null +++ b/logic/include/model/ButtonHelper.h @@ -0,0 +1,81 @@ +#ifndef BUTTONHELPER_H +#define BUTTONHELPER_H + +#define PUSH_BUTTON(CAPITAL_NAME, SMALL_NAME, FUNC_CODE, LED_FUNC_CODE) \ + private: \ + PushButton _ ## SMALL_NAME{FUNC_CODE, LED_FUNC_CODE}; \ + void init ## CAPITAL_NAME() \ + { \ + connect(this, &Console::dataReady, _ ## SMALL_NAME.getLed(), &Led::newData);\ + connect(_ ## SMALL_NAME.getLed(), SIGNAL(ledChanged(char)), this, SIGNAL(SMALL_NAME ## LedChanged(char)));\ + } \ + public: \ + void press ## CAPITAL_NAME() \ + { \ + auto arr = _ ## SMALL_NAME.press(); \ + _dataSender->send(arr); \ + } \ + void release ## CAPITAL_NAME() \ + { \ + auto arr = _ ## SMALL_NAME.release(); \ + _dataSender->send(arr); \ + } \ + Q_SIGNAL void SMALL_NAME ## LedChanged(char value) + +/*************************************************************************************************/ +#define PUSH_BUTTON_NO_LED(CAPITAL_NAME, SMALL_NAME, FUNC_CODE) \ + private: \ + PushButton _ ## SMALL_NAME{FUNC_CODE}; \ + void init ## CAPITAL_NAME() \ + { \ + connect(this, &Console::dataReady, _ ## SMALL_NAME.getLed(), &Led::newData);\ + connect(_ ## SMALL_NAME.getLed(), SIGNAL(ledChanged(char)), this, SIGNAL(SMALL_NAME ## LedChanged(char)));\ + } \ + public: \ + void press ## CAPITAL_NAME() \ + { \ + auto arr = _ ## SMALL_NAME.press(); \ + _dataSender->send(arr); \ + } \ + void release ## CAPITAL_NAME() \ + { \ + auto arr = _ ## SMALL_NAME.release(); \ + _dataSender->send(arr); \ + } \ + Q_SIGNAL void SMALL_NAME ## LedChanged(char value) + +/*************************************************************************************************/ +#define ROTARY_BUTTON(CAPITAL_NAME, SMALL_NAME, FUNC_CODE, LED_FUNC_CODE) \ + private: \ + RotaryButton _ ## SMALL_NAME{FUNC_CODE, LED_FUNC_CODE}; \ + void init ## CAPITAL_NAME() \ + { \ + connect(this, &Console::dataReady, _ ## SMALL_NAME.getLed(), &Led::newData);\ + connect(_ ## SMALL_NAME.getLed(), SIGNAL(ledChanged(char)), this, SIGNAL(SMALL_NAME ## LedChanged(char)));\ + } \ + public: \ + void rotate ## CAPITAL_NAME(int value) \ + { \ + auto arr = _ ## SMALL_NAME.rotate(value); \ + _dataSender->send(arr); \ + } \ + Q_SIGNAL void SMALL_NAME ## LedChanged(char value) + +/*************************************************************************************************/ +#define ROTARY_BUTTON_NO_LED(CAPITAL_NAME, SMALL_NAME, FUNC_CODE) \ + private: \ + RotaryButton _ ## SMALL_NAME{FUNC_CODE}; \ + void init ## CAPITAL_NAME() \ + { \ + connect(this, &Console::dataReady, _ ## SMALL_NAME.getLed(), &Led::newData);\ + connect(_ ## SMALL_NAME.getLed(), SIGNAL(ledChanged(char)), this, SIGNAL(SMALL_NAME ## LedChanged(char)));\ + } \ + public: \ + void rotate ## CAPITAL_NAME(int value) \ + { \ + auto arr = _ ## SMALL_NAME.rotate(value); \ + _dataSender->send(arr); \ + } \ + Q_SIGNAL void SMALL_NAME ## LedChanged(char value) + +#endif //BUTTONHELPER_H diff --git a/logic/include/model/Console.h b/logic/include/model/Console.h index 5d056a5..0bbd51e 100644 --- a/logic/include/model/Console.h +++ b/logic/include/model/Console.h @@ -1,18 +1,129 @@ #ifndef CONSOLE_H #define CONSOLE_H +#define PROTOCOL_LENGTH 8 +#define PacketAppDirection 0x01 +#define EchoDataLength 0x02 +#define EchoType 0x06 +#define EchoFunctionCode 0xA4 +#define ZeroValue 0x00 -class DataSender; +#include -class Console +#include "ButtonHelper.h" +#include "FunctionCodes.h" +#include "PushButton.h" +#include "RotaryButton.h" + +#include "DataSender.h" +#include "Logger.h" + +class Console : public QObject { + Q_OBJECT + + //PushButton with LED + PUSH_BUTTON(Dual, dual, DUAL_FC, static_cast(DUAL_LED_FC)); + PUSH_BUTTON(Quad, quad, QUAD_FC, static_cast(QUAD_LED_FC)); + PUSH_BUTTON(Single, single, SINGLE_FC, static_cast(SINGLE_LED_FC)); + PUSH_BUTTON(P1, p1, P1_FC, static_cast(P1_LED_FC)); + PUSH_BUTTON(P2, p2, P2_FC, static_cast(P2_LED_FC)); + PUSH_BUTTON(P3, p3, P3_FC, static_cast(P3_LED_FC)); + PUSH_BUTTON(P4, p4, P4_FC, static_cast(P4_LED_FC)); + PUSH_BUTTON(P5, p5, P5_FC, static_cast(P5_LED_FC)); + PUSH_BUTTON(P6, p6, P6_FC, static_cast(P6_LED_FC)); + PUSH_BUTTON(Exit, exit, EXIT_FC, static_cast(EXIT_LED_FC)); + PUSH_BUTTON(Freeze, freeze, FREEZE_FC, static_cast(FREEZE_LED_FC)); + PUSH_BUTTON(Pointer, pointer, POINTER_FC, static_cast(POINTER_LED_FC)); + PUSH_BUTTON(AutoSet, autoSet, AUTOSET_FC, static_cast(AUTOSET_LED_FC)); + PUSH_BUTTON(Abc, abc, ABC_FC, static_cast(ABC_LED_FC)); + PUSH_BUTTON(FourD, fourD, FOUR_D_FC, static_cast(FOUR_D_LED_FC)); + PUSH_BUTTON(Clear, clear, CLEAR_FC, static_cast(CLEAR_LED_FC)); + PUSH_BUTTON(ThreeD, threeD, THREE_D_FC, static_cast(THREE_D_LED_FC)); + PUSH_BUTTON(Measure, measure, MEASURE_FC, static_cast(MEASURE_LED_FC)); + PUSH_BUTTON(BodyMark, bodyMark, BODY_MARK_FC, static_cast(BODY_MARK_LED_FC)); + PUSH_BUTTON(Patient, patient, PATIENT_FC, static_cast(PATIENT_LED_FC)); + PUSH_BUTTON(Utils, utils, UTILS_FC, static_cast(UTILS_LED_FC)); + PUSH_BUTTON(Dvd, dvd, DVD_FC, static_cast(DVD_LED_FC)); + PUSH_BUTTON(Report, report, REPORT_FC, static_cast(REPORT_LED_FC)); + PUSH_BUTTON(Probe, probe, PROBE_FC, static_cast(PROBE_LED_FC)); + PUSH_BUTTON(Archive, archive, ARCHIVE_FC, static_cast(ARCHIVE_LED_FC)); + PUSH_BUTTON(End, end, END_FC, static_cast(END_LED_FC)); + PUSH_BUTTON(Xtd, xtd, XTD_FC, static_cast(XTD_LED_FC)); + PUSH_BUTTON(Bf, bf, BF_FC, static_cast(BF_LED_FC)); + PUSH_BUTTON(DepthCenter, depthCenter, DEPTH_CENTER_FC, static_cast(ZOOM_LED_FC)); + PUSH_BUTTON(FocusCenter, focusCenter, FOCUS_CENTER_FC, static_cast(FOCUS_ZONE_LED_FC)); + PUSH_BUTTON(ModePwCenter, modePwCenter, MODE_PW_CENTER_FC, static_cast(MODE_PW_LED_FC)); + PUSH_BUTTON(ModeMCenter, modeMCenter, MODE_M_CENTER_FC, static_cast(MODE_M_LED_FC)); + PUSH_BUTTON(ModePdCenter, modePdCenter, MODE_PD_CENTER_FC, static_cast(MODE_PD_LED_FC)); + PUSH_BUTTON(ModeCCenter, modeCCenter, MODE_C_CENTER_FC, static_cast(MODE_C_LED_FC)); + PUSH_BUTTON(ModeBCenter, modeBCenter, MODE_2D_CENTER_FC, static_cast(MODE_2D_LED_FC)); + PUSH_BUTTON(DepthBottom, depthBottom, DEPTH_BOTTOM_FC, static_cast(DEPTH_LED_FC)); + PUSH_BUTTON(FocusBottom, focusBottom, FOCUS_BOTTOM_FC, static_cast(FOCUS_DEPTH_LED_FC)); + + //PushButton with No LED + PUSH_BUTTON_NO_LED(Js1Top, js1Top, JOYSTICK1_TOP_FC); + PUSH_BUTTON_NO_LED(Js2Top, js2Top, JOYSTICK2_TOP_FC); + PUSH_BUTTON_NO_LED(Js3Top, js3Top, JOYSTICK3_TOP_FC); + PUSH_BUTTON_NO_LED(Js4Top, js4Top, JOYSTICK4_TOP_FC); + PUSH_BUTTON_NO_LED(Js5Top, js5Top, JOYSTICK5_TOP_FC); + PUSH_BUTTON_NO_LED(DepthTop, depthTop, DEPTHTOP_FC); + PUSH_BUTTON_NO_LED(FocusTop, focusTop, FOCUSTOP_FC); + PUSH_BUTTON_NO_LED(Js1Center, js1Center, JOYSTICK1_CENTER_FC); + PUSH_BUTTON_NO_LED(Js2Center, js2Center, JOYSTICK2_CENTER_FC); + PUSH_BUTTON_NO_LED(Js3Center, js3Center, JOYSTICK3_CENTER_FC); + PUSH_BUTTON_NO_LED(Js4Center, js4Center, JOYSTICK4_CENTER_FC); + PUSH_BUTTON_NO_LED(Js5Center, js5Center, JOYSTICK5_CENTER_FC); + PUSH_BUTTON_NO_LED(Js1Bottom, js1Bottom, JOYSTICK1_BOTTOM_FC); + PUSH_BUTTON_NO_LED(Js2Bottom, js2Bottom, JOYSTICK2_BOTTOM_FC); + PUSH_BUTTON_NO_LED(Js3Bottom, js3Bottom, JOYSTICK3_BOTTOM_FC); + PUSH_BUTTON_NO_LED(Js4Bottom, js4Bottom, JOYSTICK4_BOTTOM_FC); + PUSH_BUTTON_NO_LED(Js5Bottom, js5Bottom, JOYSTICK5_BOTTOM_FC); + PUSH_BUTTON_NO_LED(TrackballTop, trackballTop, TRACKBALL_TOP_FC); + PUSH_BUTTON_NO_LED(TrackballTopRight, trackballTopRight, TRACKBALL_TOP_RIGHT_FC); + PUSH_BUTTON_NO_LED(TrackballRight, trackballRight, TRACKBALL_RIGHT_FC); + PUSH_BUTTON_NO_LED(TrackballBottomRight, trackballBottomRight, TRACKBALL_BOTTOM_RIGHT_FC); + PUSH_BUTTON_NO_LED(TrackballBottom, trackballBottom, TRACKBALL_BOTTOM_FC); + PUSH_BUTTON_NO_LED(TrackballBottomLeft, trackballBottomLeft, TRACKBALL_TOP_BOTTOM_FC); + PUSH_BUTTON_NO_LED(TrackballLeft, trackballLeft, TRACKBALL_LEFT_FC); + PUSH_BUTTON_NO_LED(TrackballTopLeft, trackballTopLeft, TRACKBALL_TOP_LEFT_FC); + + //ROTAY_BUTTON with LED + ROTARY_BUTTON(Focus, focus, FOCUS_FC, static_cast(ANGLE_LED_FC)); + ROTARY_BUTTON(ModeM, modeM, MODE_M_FC, static_cast(QUADRAT_LED_FC)); + ROTARY_BUTTON(ModePd, modePd, MODE_PD_FC, static_cast(Z_LED_FC)); + ROTARY_BUTTON(ModeC, modeC, MODE_C_FC, static_cast(Y_LED_FC)); + ROTARY_BUTTON(ModeB, modeB, MODE_2D_FC, static_cast(X_LED_FC)); + + //ROTAY_BUTTON with No LED + ROTARY_BUTTON_NO_LED(Js1, js1, JOYSTICK1_FC); + ROTARY_BUTTON_NO_LED(Js2, js2, JOYSTICK2_FC); + ROTARY_BUTTON_NO_LED(Js3, js3, JOYSTICK3_FC); + ROTARY_BUTTON_NO_LED(Js4, js4, JOYSTICK4_FC); + ROTARY_BUTTON_NO_LED(Js5, js5, JOYSTICK5_FC); + ROTARY_BUTTON_NO_LED(Depth, depth, DEPTH_FC); + ROTARY_BUTTON_NO_LED(ModePw, modePw, MODE_PW_FC); + private: - DataSender* _dataSender; + DataSender* _dataSender; + Logger* _logger; public: - Console(); - void injectDataSender(DataSender* sender); - void test(); + Console(); + + void injectDataSender(DataSender* sender); + void injectLogger(Logger* logger); + void hasValidDataFormat(const QByteArray& data); + bool isEchoPacket(const QByteArray& data); + void initializeButtons(); + +signals: + void dataReady(QByteArray data, Logger* log); + +//uncrustify off +public slots: +//uncrustify on + void newData(QByteArray data); }; -#endif // CONSOLE_H +#endif //CONSOLE_H diff --git a/logic/include/model/DataSender.h b/logic/include/model/DataSender.h index d27da19..e0f4ad6 100644 --- a/logic/include/model/DataSender.h +++ b/logic/include/model/DataSender.h @@ -1,13 +1,21 @@ #ifndef DATASENDER_H #define DATASENDER_H +#include #include -class DataSender +class DataSender : public QObject { + Q_OBJECT + public: - virtual int send(const QByteArray& data) = 0; - virtual ~DataSender(){} + virtual void send(const QByteArray& data) = 0; + virtual ~DataSender() + { + } + +signals: + void dataReady(const QByteArray& data); }; -#endif // DATASENDER_H +#endif //DATASENDER_H diff --git a/logic/include/model/FunctionCodes.h b/logic/include/model/FunctionCodes.h new file mode 100644 index 0000000..ac2dd94 --- /dev/null +++ b/logic/include/model/FunctionCodes.h @@ -0,0 +1,134 @@ +#ifndef FUNCTIONCODES_H +#define FUNCTIONCODES_H + +//Buttons +#define DUAL_FC 0x1D +#define QUAD_FC 0x1C +#define SINGLE_FC 0x1B +#define P1_FC 0x21 +#define P2_FC 0x22 +#define P3_FC 0x23 +#define P4_FC 0x24 +#define EXIT_FC 0x0C +#define FREEZE_FC 0x15 +#define POINTER_FC 0x0D +#define AUTOSET_FC 0x14 +#define ABC_FC 0x0E +#define FOUR_D_FC 0x13 +#define CLEAR_FC 0x10 +#define THREE_D_FC 0x12 +#define MEASURE_FC 0x11 +#define BODY_MARK_FC 0x0F +#define PATIENT_FC 0x02 +#define UTILS_FC 0x03 +#define DVD_FC 0x04 +#define REPORT_FC 0x05 +#define PROBE_FC 0x06 +#define ARCHIVE_FC 0x07 +#define END_FC 0x08 +#define XTD_FC 0x16 +#define BF_FC 0x17 +#define P5_FC 0x25 +#define P6_FC 0x26 + +#define JOYSTICK1_TOP_FC 0x39 +#define JOYSTICK2_TOP_FC 0x3C +#define JOYSTICK3_TOP_FC 0x3F +#define JOYSTICK4_TOP_FC 0x42 +#define JOYSTICK5_TOP_FC 0x45 +#define DEPTHTOP_FC 0x33 +#define FOCUSTOP_FC 0x36 + +#define JOYSTICK1_CENTER_FC 0x38 +#define JOYSTICK2_CENTER_FC 0x3B +#define JOYSTICK3_CENTER_FC 0x3E +#define JOYSTICK4_CENTER_FC 0x41 +#define JOYSTICK5_CENTER_FC 0x44 +#define DEPTH_CENTER_FC 0x32 +#define FOCUS_CENTER_FC 0x35 +#define MODE_PW_CENTER_FC 0x49 +#define MODE_M_CENTER_FC 0x4A +#define MODE_PD_CENTER_FC 0x4B +#define MODE_C_CENTER_FC 0x4C +#define MODE_2D_CENTER_FC 0x4D + +#define JOYSTICK1_BOTTOM_FC 0x37 +#define JOYSTICK2_BOTTOM_FC 0x3A +#define JOYSTICK3_BOTTOM_FC 0x3D +#define JOYSTICK4_BOTTOM_FC 0x40 +#define JOYSTICK5_BOTTOM_FC 0x43 +#define DEPTH_BOTTOM_FC 0x31 +#define FOCUS_BOTTOM_FC 0x34 + +//Trackball +#define TRACKBALL_TOP_FC 0x2A +#define TRACKBALL_BOTTOM_FC 0x2B +#define TRACKBALL_RIGHT_FC 0x2C +#define TRACKBALL_LEFT_FC 0x2D +#define TRACKBALL_TOP_RIGHT_FC 0x2E +#define TRACKBALL_BOTTOM_RIGHT_FC 0x28 +#define TRACKBALL_TOP_LEFT_FC 0x2F +#define TRACKBALL_TOP_BOTTOM_FC 0x29 + +//Joystick +#define JOYSTICK1_FC 0x56 +#define JOYSTICK2_FC 0x57 +#define JOYSTICK3_FC 0x58 +#define JOYSTICK4_FC 0x59 +#define JOYSTICK5_FC 0x5A +#define DEPTH_FC 0x52 +#define FOCUS_FC 0x51 +#define MODE_PW_FC 0x5E +#define MODE_M_FC 0x5F +#define MODE_PD_FC 0x60 +#define MODE_C_FC 0x61 +#define MODE_2D_FC 0x62 + +//Leds +#define DUAL_LED_FC 0X82 +#define QUAD_LED_FC 0X81 +#define SINGLE_LED_FC 0X80 +#define P1_LED_FC 0X86 +#define P2_LED_FC 0X87 +#define P3_LED_FC 0X88 +#define P4_LED_FC 0X89 +#define EXIT_LED_FC 0X71 +#define FREEZE_LED_FC 0X7A +#define POINTER_LED_FC 0X72 +#define AUTOSET_LED_FC 0X79 +#define ABC_LED_FC 0X73 +#define FOUR_D_LED_FC 0X78 +#define CLEAR_LED_FC 0X75 +#define THREE_D_LED_FC 0X77 +#define MEASURE_LED_FC 0X76 +#define BODY_MARK_LED_FC 0X74 +#define POWER_LED_FC 0X66 +#define PATIENT_LED_FC 0X67 +#define UTILS_LED_FC 0X68 +#define DVD_LED_FC 0X69 +#define REPORT_LED_FC 0X6A +#define PROBE_LED_FC 0X6B +#define ARCHIVE_LED_FC 0X6C +#define END_LED_FC 0X6D +#define XTD_LED_FC 0X7B +#define BF_LED_FC 0X7C +#define P5_LED_FC 0X8A +#define P6_LED_FC 0X8B + +#define MODE_PW_LED_FC 0X98 +#define MODE_2D_LED_FC 0X9A +#define MODE_M_LED_FC 0X9C +#define MODE_C_LED_FC 0X9E +#define MODE_PD_LED_FC 0X9F +#define QUADRAT_LED_FC 0X9D +#define X_LED_FC 0X9B +#define Y_LED_FC 0X99 +#define Z_LED_FC 0X97 + +#define ZOOM_LED_FC 0X8F +#define DEPTH_LED_FC 0X90 +#define ANGLE_LED_FC 0X91 +#define FOCUS_ZONE_LED_FC 0X92 +#define FOCUS_DEPTH_LED_FC 0X93 + +#endif //FUNCTIONCODES_H diff --git a/logic/include/model/Led.h b/logic/include/model/Led.h new file mode 100644 index 0000000..6dc1d52 --- /dev/null +++ b/logic/include/model/Led.h @@ -0,0 +1,35 @@ +#ifndef LED_H +#define LED_H + +#define LED_OFF 0x00 +#define LED_COLOR_WHITE 0x01 +#define LED_COLOR_GREEN 0x02 +#define FUNCTION_CODE 3 +#define LED_COLOR 4 + +#include + +#include "Logger.h" + +class Led : public QObject +{ + Q_OBJECT + +private: + char _functionCode; + bool _hasLed; + +public: + Led(); + Led(char functionCode); + +signals: + void ledChanged(char value); + +//uncrustify off +public slots: +//uncrustify on + void newData(QByteArray data, Logger* log); +}; + +#endif //LED_H diff --git a/logic/include/model/Logger.h b/logic/include/model/Logger.h new file mode 100644 index 0000000..afa8255 --- /dev/null +++ b/logic/include/model/Logger.h @@ -0,0 +1,12 @@ +#ifndef LOGGER_H +#define LOGGER_H +#include "QString" + +class Logger +{ +public: + virtual void log(QString message) = 0; + virtual ~Logger(){} +}; + +#endif // LOGGER_H diff --git a/logic/include/model/PushButton.h b/logic/include/model/PushButton.h new file mode 100644 index 0000000..6d4e4eb --- /dev/null +++ b/logic/include/model/PushButton.h @@ -0,0 +1,31 @@ +#ifndef PUSHBUTTON_H +#define PUSHBUTTON_H + +#define PROTOCOL_LENGTH 8 +#define MESSAGE_DIRECTION 0x00 +#define PushButtonDataLength 0x01 +#define PushButtonType 0x04 +#define PushButtonPush 0x01 +#define PushButtonRelease 0x00 +#define TIME_TAG 0x00 + +#include "Led.h" + +class PushButton +{ +private: + char _functionCode; + Led _led; + + QByteArray generateCode(bool isPressed); + +public: + PushButton(char functionCode); + PushButton(char functionCode, char ledFunctionCode); + + QByteArray press(); + QByteArray release(); + Led* getLed(); +}; + +#endif //PUSHBUTTON_H diff --git a/logic/include/model/RotaryButton.h b/logic/include/model/RotaryButton.h new file mode 100644 index 0000000..c50bad9 --- /dev/null +++ b/logic/include/model/RotaryButton.h @@ -0,0 +1,26 @@ +#ifndef RotaryButton_H +#define RotaryButton_H + +#define PROTOCOL_LENGTH 8 +#define MESSAGE_DIRECTION 0x00 +#define ROTARY_DATA_LENGTH 0X02 +#define ROTARY_TYPE 0x05 +#define TIME_TAG 0x00 + +#include "Led.h" + +class RotaryButton +{ +private: + char _functionCode; + Led _led; + +public: + RotaryButton(char functionCode); + RotaryButton(char functionCode, char ledFunctionCode); + + Led* getLed(); + QByteArray rotate(int value); +}; + +#endif //RotaryButton_H diff --git a/logic/include/network/UdpDataSender.h b/logic/include/network/UdpDataSender.h new file mode 100644 index 0000000..6a38573 --- /dev/null +++ b/logic/include/network/UdpDataSender.h @@ -0,0 +1,27 @@ +#ifndef UDPDATASENDER_H +#define UDPDATASENDER_H + +#include + +#include "model/DataSender.h" + +class UdpDataSender : public DataSender +{ + Q_OBJECT + +private: + QUdpSocket* _socket; + +public: + UdpDataSender(); + ~UdpDataSender() override; + + void send(const QByteArray& data) override; + +//uncrustify off +public slots: +//uncrustify on + void read(); +}; + +#endif //UDPDATASENDER_H diff --git a/logic/include/viewModel/MainViewModel.h b/logic/include/viewModel/MainViewModel.h index 85566fe..6dc7ed9 100644 --- a/logic/include/viewModel/MainViewModel.h +++ b/logic/include/viewModel/MainViewModel.h @@ -2,28 +2,215 @@ #define MAINVIEWMODEL_H #include +#include "utils/Property.h" +#include "model/Console.h" + +#define LED_OFF 0x00 +#define LED_COLOR_WHITE 0x01 +#define LED_COLOR_GREEN 0x02 +#define LedColorYellow 0x03 class MainViewModel : public QtMvvm::ViewModel { - Q_OBJECT + Q_OBJECT - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) + Console * panel; -public: - Q_INVOKABLE explicit MainViewModel(QObject *parent = nullptr); + MVVM_PROPERTY(int, stepInc, 1) + MVVM_PROPERTY(int, stepDec, -1) + + //Top Left + BUTTON_LED_PROPERTY(patient, Patient, false, LED_OFF) + BUTTON_LED_PROPERTY(utils, Utils, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(dvd, Dvd, false, LED_COLOR_GREEN) + BUTTON_LED_PROPERTY(report, Report, false, LedColorYellow) + BUTTON_LED_PROPERTY(probe, Probe, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(archive, Archive, false, LED_COLOR_GREEN) + BUTTON_LED_PROPERTY(end, End, false, LedColorYellow) + + //TopRight + BUTTON_LED_PROPERTY(xtd, Xtd, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(bf, Bf, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(p5, P5, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(p6, P6, false, LED_COLOR_WHITE) + + //BottomRight + BUTTON_LED_PROPERTY(dual, Dual, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(quad, Quad, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(single, Single, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(p1, P1, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(p2, P2, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(p3, P3, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(p4, P4, false, LED_COLOR_WHITE) + + //CurveButtons + BUTTON_LED_PROPERTY(exit, Exit, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(freeze, Freeze, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(pointer, Pointer, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(autoSet, AutoSet, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(abc, Abc, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(fourD, FourD, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(clear, Clear, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(threeD, ThreeD, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(measure, Measure, false, LED_COLOR_WHITE) + BUTTON_LED_PROPERTY(bodyMark, BodyMark, false, LED_COLOR_WHITE) + + //TrackballGroup + BUTTON_LED_PROPERTY(trackballLeft, TrackballLeft, false, LED_OFF) + BUTTON_LED_PROPERTY(trackballRight, TrackballRight, false, LED_OFF) + BUTTON_LED_PROPERTY(trackballTop, TrackballTop, false, LED_OFF) + BUTTON_LED_PROPERTY(trackballBottom, TrackballBottom, false, LED_OFF) + + BUTTON_LED_PROPERTY(trackballTopLeft, TrackballTopLeft, false, LED_OFF) + BUTTON_LED_PROPERTY(trackballTopRight, TrackballTopRight, false, LED_OFF) + BUTTON_LED_PROPERTY(trackballBottomLeft, TrackballBottomLeft, false, LED_OFF) + BUTTON_LED_PROPERTY(trackballBottomRight, TrackballBottomRight, false, LED_OFF) + + //Encoders + LED_PROPERTY(modeM, LED_OFF) //quadrat -> modeMLed + LED_PROPERTY(modePd, LED_OFF) //z -> modePdLed + LED_PROPERTY(modeC, LED_OFF) //y -> modeCLed + LED_PROPERTY(modeB, LED_OFF) //x -> modeBLed + + LED_PROPERTY(modePwCenter, LED_OFF) //modePw -> modePwCenterLed + LED_PROPERTY(modeMCenter, LED_OFF) //modeM -> modeMCenterLed + LED_PROPERTY(modePdCenter, LED_OFF) //modePd -> modePdCenterLed + LED_PROPERTY(modeCCenter, LED_OFF) //modeC -> modeCCenterLed + LED_PROPERTY(modeBCenter, LED_OFF) //modeB -> modeBCenterLed + + BUTTON_PROPERTY(modePwCenter, ModePwCenter, false) + BUTTON_PROPERTY(modeMCenter, ModeMCenter, false) + BUTTON_PROPERTY(modePdCenter, ModePdCenter, false) + BUTTON_PROPERTY(modeCCenter, ModeCCenter, false) + BUTTON_PROPERTY(modeBCenter, ModeBCenter, false) + + JOYSTICK_PROPERTY(modePw, ModePw) + JOYSTICK_PROPERTY(modePd, ModePd) + JOYSTICK_PROPERTY(modeC, ModeC) + JOYSTICK_PROPERTY(modeM, ModeM) + JOYSTICK_PROPERTY(modeB, ModeB) + + //JoystickCouple + LED_PROPERTY(depthCenter, LED_OFF) //zoom -> depthCenterLed + LED_PROPERTY(depthBottom, LED_OFF) //depth -> depthBottomLed + LED_PROPERTY(focus, LED_OFF) //angle -> focusLed + LED_PROPERTY(focusCenter, LED_OFF) //focusZone -> focusCenterLed + LED_PROPERTY(focusBottom, LED_OFF) //focusDepth -> focusBottomLed + + BUTTON_PROPERTY(depthCenter, DepthCenter, false) + BUTTON_PROPERTY(focusCenter, FocusCenter, false) + + BUTTON_PROPERTY(depthBottom, DepthBottom, false) + BUTTON_PROPERTY(focusBottom, FocusBottom, false) - QString text() const; + BUTTON_PROPERTY(depthTop, DepthTop, false) + BUTTON_PROPERTY(focusTop, FocusTop, false) -public Q_SLOTS: - void showSettings(); + JOYSTICK_PROPERTY(depth, Depth) + JOYSTICK_PROPERTY(focus, Focus) - void setText(const QString &text); + //Joysticks + BUTTON_PROPERTY(js1Top, Js1Top, false) + BUTTON_PROPERTY(js2Top, Js2Top, false) + BUTTON_PROPERTY(js3Top, Js3Top, false) + BUTTON_PROPERTY(js4Top, Js4Top, false) + BUTTON_PROPERTY(js5Top, Js5Top, false) -Q_SIGNALS: - void textChanged(const QString &text); + BUTTON_PROPERTY(js1Center, Js1Center, false) + BUTTON_PROPERTY(js2Center, Js2Center, false) + BUTTON_PROPERTY(js3Center, Js3Center, false) + BUTTON_PROPERTY(js4Center, Js4Center, false) + BUTTON_PROPERTY(js5Center, Js5Center, false) + + BUTTON_PROPERTY(js1Bottom, Js1Bottom, false) + BUTTON_PROPERTY(js2Bottom, Js2Bottom, false) + BUTTON_PROPERTY(js3Bottom, Js3Bottom, false) + BUTTON_PROPERTY(js4Bottom, Js4Bottom, false) + BUTTON_PROPERTY(js5Bottom, Js5Bottom, false) + + JOYSTICK_PROPERTY(js1, Js1) + JOYSTICK_PROPERTY(js2, Js2) + JOYSTICK_PROPERTY(js3, Js3) + JOYSTICK_PROPERTY(js4, Js4) + JOYSTICK_PROPERTY(js5, Js5) + +public: + Q_INVOKABLE explicit MainViewModel(QObject* parent = nullptr); private: - QString _text; + +signals: + void ledChanged(char value); + +//uncrustify off +public slots: + //Top Left + LED_SLOT(patient) + LED_SLOT(utils) + LED_SLOT(dvd) + LED_SLOT(report) + LED_SLOT(probe) + LED_SLOT(archive) + LED_SLOT(end) + + // TopRight + LED_SLOT(xtd) + LED_SLOT(bf) + LED_SLOT(p5) + LED_SLOT(p6) + + // BottomRight + LED_SLOT(dual) + LED_SLOT(quad) + LED_SLOT(single) + LED_SLOT(p1) + LED_SLOT(p2) + LED_SLOT(p3) + LED_SLOT(p4) + + // CurveButtons + LED_SLOT(exit) + LED_SLOT(freeze) + LED_SLOT(pointer) + LED_SLOT(autoSet) + LED_SLOT(abc) + LED_SLOT(fourD) + LED_SLOT(clear) + LED_SLOT(threeD) + LED_SLOT(measure) + LED_SLOT(bodyMark) + + //TrackballGroup + LED_SLOT(trackballLeft) + LED_SLOT(trackballRight) + LED_SLOT(trackballTop) + LED_SLOT(trackballBottom) + + LED_SLOT(trackballTopLeft) + LED_SLOT(trackballTopRight) + LED_SLOT(trackballBottomLeft) + LED_SLOT(trackballBottomRight) + + //Encoders + LED_SLOT(modeM) + LED_SLOT(modePd) + LED_SLOT(modeC) + LED_SLOT(modeB) + + LED_SLOT(modePwCenter) + LED_SLOT(modeMCenter) + LED_SLOT(modePdCenter) + LED_SLOT(modeCCenter) + LED_SLOT(modeBCenter) + + //JoystickCouple + LED_SLOT(focus) + LED_SLOT(depthCenter) + LED_SLOT(focusCenter) + LED_SLOT(depthBottom) + LED_SLOT(focusBottom) + +//uncrustify on }; -#endif // MAINVIEWMODEL_H +#endif //MAINVIEWMODEL_H diff --git a/logic/include/viewModel/utils/Property.h b/logic/include/viewModel/utils/Property.h new file mode 100644 index 0000000..c6c861a --- /dev/null +++ b/logic/include/viewModel/utils/Property.h @@ -0,0 +1,82 @@ +#ifndef PROPERTY_H +#define PROPERTY_H + +#include +#include + +//uncrustify off +#define MVVM_PROPERTY(TYPE, NAME, DEFAULT_VALUE) \ + Q_PROPERTY(TYPE NAME READ NAME WRITE NAME NOTIFY NAME ## Changed ) \ + public: \ + TYPE NAME() const { return _ ## NAME ; } \ + void NAME(TYPE value) { \ + if (_ ## NAME == value) return; \ + _ ## NAME = value; \ + emit NAME ## Changed(value); \ + } \ + Q_SIGNAL void NAME ## Changed(TYPE value);\ + private: \ + TYPE _ ## NAME = DEFAULT_VALUE; \ + +/**************************************************************************************************/ +#define MVVM_PROPERTY_CUSTOM(TYPE, NAME, DEFAULT_VALUE) \ + Q_PROPERTY(TYPE NAME READ NAME WRITE NAME NOTIFY NAME ## Changed ) \ + public: \ + TYPE NAME() const { return _ ## NAME ; } \ + void NAME(TYPE value) { \ + if (_ ## NAME == value) return; \ + _ ## NAME = value; \ + emit NAME ## Changed(value); \ + NAME ## Handle(); \ + } \ + Q_SIGNAL void NAME ## Changed(TYPE value);\ + private: \ + TYPE _ ## NAME = DEFAULT_VALUE; \ + +/**************************************************************************************************/ +#define BUTTON_LED_PROPERTY(NAME, CAP_NAME, DEFAULT_VALUE, LED_DEF_VAL) \ + LED_PROPERTY(NAME, LED_DEF_VAL) \ + BUTTON_PROPERTY(NAME, CAP_NAME, DEFAULT_VALUE) + +/**************************************************************************************************/ +#define BUTTON_PROPERTY(NAME, CAP_NAME, DEFAULT_VALUE) \ + MVVM_PROPERTY_CUSTOM(bool, NAME, DEFAULT_VALUE) \ + void NAME ## Handle() { \ + if(_ ## NAME){ \ + panel->press ## CAP_NAME(); \ + } \ + else { \ + panel->release ## CAP_NAME(); \ + } \ + } \ + +/**************************************************************************************************/ +#define LED_PROPERTY(NAME, LED_DEF_VAL) \ + MVVM_PROPERTY(int, NAME ## Led, LED_DEF_VAL) \ + +/**************************************************************************************************/ +#define JOYSTICK_PROPERTY(NAME, CAP_NAME) \ + MVVM_PROPERTY_CUSTOM(bool, NAME ## Left, false) \ + MVVM_PROPERTY_CUSTOM(bool, NAME ## Right, false) \ + void NAME ## LeftHandle() { \ + if(NAME ## Left()) \ + { \ + panel->rotate ## CAP_NAME(stepDec()); \ + } \ + } \ + void NAME ## RightHandle() { \ + if(NAME ## Right()) \ + { \ + panel->rotate ## CAP_NAME(stepInc()); \ + } \ + } + +/**************************************************************************************************/ +#define LED_SLOT(NAME) \ + void NAME ## LedHandle(char value) { \ + NAME ## Led(static_cast(value)); \ + } \ + +//uncrustify on + +#endif //PROPERTY_H diff --git a/logic/logic.pro b/logic/logic.pro index 226215a..80531c3 100644 --- a/logic/logic.pro +++ b/logic/logic.pro @@ -1,20 +1,19 @@ -TEMPLATE = lib - -QT += mvvmcore -# Creating a static library is typically more efficient. You can still create a shared library if you want to -CONFIG += c++14 static - -TARGET = logic - -DEFINES += QT_DEPRECATED_WARNINGS - -SOURCES += $$files(src/*.cpp, true) - -HEADERS += $$files(include/*.h, true) - -INCLUDEPATH += $$PWD/include/ -INCLUDEPATH += $$PWD/../network/ - -_never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*) -# Uncomment the following line to automatically generated and update settings translations when building -#PRE_TARGETDEPS += qtmvvm-tsgen +TEMPLATE = lib + +QT += mvvmcore network +# Creating a static library is typically more efficient. You can still create a shared library if you want to +CONFIG += c++14 static + +TARGET = logic + +DEFINES += QT_DEPRECATED_WARNINGS + +SOURCES += $$files(src/*.cpp, true) + +HEADERS += $$files(include/*.h, true) + +INCLUDEPATH += $$PWD/include/ + +_never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*) +# Uncomment the following line to automatically generated and update settings translations when building +#PRE_TARGETDEPS += qtmvvm-tsgen diff --git a/logic/src/logger/Consolelogger.cpp b/logic/src/logger/Consolelogger.cpp new file mode 100644 index 0000000..e04b20a --- /dev/null +++ b/logic/src/logger/Consolelogger.cpp @@ -0,0 +1,12 @@ +#include "logger/ConsoleLogger.h" + +#include + +void ConsoleLogger::log(QString message) +{ + qDebug() << "[LOG] :: " << message; +} + +ConsoleLogger::~ConsoleLogger() +{ +} diff --git a/logic/src/model/Console.cpp b/logic/src/model/Console.cpp index 9fc8331..72c5ac7 100644 --- a/logic/src/model/Console.cpp +++ b/logic/src/model/Console.cpp @@ -1,22 +1,161 @@ #include "model/Console.h" -#include +#include "model/DataSender.h" +#include "QByteArray" Console::Console() { - + initializeButtons(); } -void Console::injectDataSender(DataSender *sender) +/*************************************************************************************************/ +void Console::injectDataSender(DataSender* sender) { _dataSender = sender; } -void Console::test() +/*************************************************************************************************/ +void Console::injectLogger(Logger* logger) +{ + _logger = logger; +} + +/*************************************************************************************************/ +void Console::newData(QByteArray data) +{ + try + { + hasValidDataFormat(data); + if(isEchoPacket(data)) + { + _dataSender->send(data); + } + else + { + emit dataReady(data, _logger); + } + } + catch(const std::exception& e) + { + _logger->log(e.what()); + } +} + +/*************************************************************************************************/ +void Console::hasValidDataFormat(const QByteArray& data) +{ + if(data.size() != PROTOCOL_LENGTH) + { + throw std::runtime_error(("Data length is not Correct, expected 8 got " + QString::number( + data.size())).toStdString()); + } + if(data[0] != static_cast(PacketAppDirection)) + { + throw std::runtime_error("Data direction is not From App"); + } +} + +/*************************************************************************************************/ +bool Console::isEchoPacket(const QByteArray& data) +{ + QByteArray echoPacket; + + echoPacket.resize(PROTOCOL_LENGTH); + echoPacket[0] = PacketAppDirection; + echoPacket[1] = EchoDataLength; + echoPacket[2] = EchoType; + echoPacket[3] = static_cast(EchoFunctionCode); + echoPacket[4] = ZeroValue; + echoPacket[5] = ZeroValue; + echoPacket[6] = ZeroValue; + echoPacket[7] = ZeroValue; + + for(int i = 0; i < data.length(); i++) + { + if(data[i] != echoPacket[i]) + { + return false; + } + } + + return true; +} + +/*************************************************************************************************/ +void Console::initializeButtons() { - QByteArray arr; - arr.append(0x01); - arr.append(0x03); - arr.append(0x05); - _dataSender->send(arr); + initDual(); + initQuad(); + initSingle(); + initP1(); + initP2(); + initP3(); + initP4(); + initP5(); + initP6(); + initExit(); + initFreeze(); + initPointer(); + initAutoSet(); + initAbc(); + initFourD(); + initClear(); + initThreeD(); + initMeasure(); + initBodyMark(); + initPatient(); + initUtils(); + initDvd(); + initReport(); + initProbe(); + initArchive(); + initEnd(); + initXtd(); + initBf(); + initJs1Top(); + initJs2Top(); + initJs3Top(); + initJs4Top(); + initJs5Top(); + initDepthTop(); + initFocusTop(); + initJs1Center(); + initJs2Center(); + initJs3Center(); + initJs4Center(); + initJs5Center(); + initDepthCenter(); + initFocusCenter(); + initModePwCenter(); + initModeMCenter(); + initModePdCenter(); + initModeCCenter(); + initModeBCenter(); + initJs1Bottom(); + initJs2Bottom(); + initJs3Bottom(); + initJs4Bottom(); + initJs5Bottom(); + initDepthBottom(); + initFocusBottom(); + initTrackballTop(); + initTrackballTopRight(); + initTrackballRight(); + initTrackballBottomRight(); + initTrackballBottom(); + initTrackballBottomLeft(); + initTrackballLeft(); + initTrackballTopLeft(); + initJs1(); + initJs2(); + initJs3(); + initJs4(); + initJs5(); + initDepth(); + initFocus(); + initModePw(); + initModeM(); + initModePd(); + initModeC(); + initModeB(); } diff --git a/logic/src/model/Led.cpp b/logic/src/model/Led.cpp new file mode 100644 index 0000000..cf9b672 --- /dev/null +++ b/logic/src/model/Led.cpp @@ -0,0 +1,39 @@ +#include "model/Led.h" +#include "QDebug" + +Led::Led() +{ + _hasLed = false; +} + +/*************************************************************************************************/ +Led::Led(char functionCode) +{ + _functionCode = functionCode; + _hasLed = true; +} + +/*************************************************************************************************/ +void Led::newData(QByteArray data, Logger* _logger) +{ + if(data[FUNCTION_CODE] != _functionCode) + { + return; + } + try { + if(!(data[LED_COLOR] == static_cast(LED_OFF) || + data[LED_COLOR] == static_cast(LED_COLOR_WHITE) || + data[LED_COLOR] == static_cast(LED_COLOR_GREEN))) + { + throw std::runtime_error("Led state color is not correct"); + } + if(data[FUNCTION_CODE] == _functionCode) + { + emit ledChanged(data[LED_COLOR]); + } + } + catch(const std::exception& e) + { + _logger->log(e.what()); + } +} diff --git a/logic/src/model/PushButton.cpp b/logic/src/model/PushButton.cpp new file mode 100644 index 0000000..f3a5187 --- /dev/null +++ b/logic/src/model/PushButton.cpp @@ -0,0 +1,51 @@ +#include "model/PushButton.h" + +/*************************************************************************************************/ +QByteArray PushButton::generateCode(bool isPressed) +{ + QByteArray arr; + + arr.resize(PROTOCOL_LENGTH); + arr[0] = MESSAGE_DIRECTION; + arr[1] = PushButtonDataLength; + arr[2] = PushButtonType; + arr[3] = _functionCode; + arr[4] = isPressed ? PushButtonPush : PushButtonRelease; + arr[5] = TIME_TAG; + arr[6] = TIME_TAG; + arr[7] = TIME_TAG; + + return arr; +} + +/*************************************************************************************************/ +PushButton::PushButton(char functionCode) +{ + _functionCode = functionCode; +} + +/*************************************************************************************************/ +PushButton::PushButton(char functionCode, char ledFunctionCode) : + _led(ledFunctionCode) +{ + _functionCode = functionCode; +} + +/*************************************************************************************************/ +QByteArray PushButton::press() +{ + return generateCode(true); +} + +/*************************************************************************************************/ +QByteArray PushButton::release() +{ + return generateCode(false); +} + +/*************************************************************************************************/ +Led* PushButton::getLed() + +{ + return &_led; +} diff --git a/logic/src/model/RotaryButton.cpp b/logic/src/model/RotaryButton.cpp new file mode 100644 index 0000000..2420591 --- /dev/null +++ b/logic/src/model/RotaryButton.cpp @@ -0,0 +1,37 @@ +#include "model/RotaryButton.h" + +RotaryButton::RotaryButton(char functionCode) +{ + _functionCode = functionCode; +} + +/*************************************************************************************************/ +RotaryButton::RotaryButton(char functionCode, char ledFunctionCode) : + _led(ledFunctionCode) +{ + _functionCode = functionCode; +} + +/*************************************************************************************************/ +Led* RotaryButton::getLed() +{ + return &_led; +} + +/*************************************************************************************************/ +QByteArray RotaryButton::rotate(int value) +{ + QByteArray arr; + + arr.resize(PROTOCOL_LENGTH); + arr[0] = MESSAGE_DIRECTION; + arr[1] = ROTARY_DATA_LENGTH; + arr[2] = ROTARY_TYPE; + arr[3] = _functionCode; + arr[4] = static_cast(value >> PROTOCOL_LENGTH); + arr[5] = static_cast(value); + arr[6] = TIME_TAG; + arr[7] = TIME_TAG; + + return arr; +} diff --git a/logic/src/network/UdpDataSender.cpp b/logic/src/network/UdpDataSender.cpp new file mode 100644 index 0000000..2f3f65e --- /dev/null +++ b/logic/src/network/UdpDataSender.cpp @@ -0,0 +1,34 @@ +#include "network/UdpDataSender.h" + +#define DATAGRAM_SIZE 8 + +void UdpDataSender::send(const QByteArray& data) +{ + _socket->writeDatagram(data, QHostAddress::LocalHost, 5446); +} + +/*************************************************************************************************/ +void UdpDataSender::read() +{ + char data[DATAGRAM_SIZE]; + int cnt = _socket->readDatagram(data, DATAGRAM_SIZE); + QByteArray a(data, cnt); + emit dataReady(a); +} + +/*************************************************************************************************/ +UdpDataSender::UdpDataSender() +{ + _socket = new QUdpSocket(); + + _socket->bind(QHostAddress::Any, 5445); + + connect(_socket, SIGNAL(readyRead()), this, SLOT(read())); +} + +/*************************************************************************************************/ +UdpDataSender::~UdpDataSender() +{ + _socket->close(); + delete _socket; +} diff --git a/logic/src/viewModel/MainViewModel.cpp b/logic/src/viewModel/MainViewModel.cpp index 52b2300..0b3c689 100644 --- a/logic/src/viewModel/MainViewModel.cpp +++ b/logic/src/viewModel/MainViewModel.cpp @@ -3,33 +3,86 @@ #include #include "model/Console.h" -#include "UdpDataSender.h" +#include "logger/ConsoleLogger.h" +#include "network/UdpDataSender.h" -MainViewModel::MainViewModel(QObject *parent) : - ViewModel(parent), - _text(QStringLiteral("hello world")) -{ - Console c; - auto u = new UdpDataSender; - c.injectDataSender(u); - c.test(); -} +#define CONNECT_LED(NAME) \ + connect(panel, SIGNAL(NAME ## LedChanged(char)), this, SLOT(NAME ## LedHandle(char))); -QString MainViewModel::text() const +MainViewModel::MainViewModel(QObject* parent) : + ViewModel(parent) { - return _text; -} + panel = new Console; + auto network = new UdpDataSender; + panel->injectDataSender(network); + auto logger = new ConsoleLogger; + panel->injectLogger(logger); -void MainViewModel::showSettings() -{ - show(); -} + connect(network, &UdpDataSender::dataReady, panel, &Console::newData); -void MainViewModel::setText(const QString &text) -{ - if (_text == text) - return; + //Top Left + CONNECT_LED(patient) + CONNECT_LED(utils) + CONNECT_LED(dvd) + CONNECT_LED(report) + CONNECT_LED(probe) + CONNECT_LED(archive) + CONNECT_LED(end) + + //TopRight + CONNECT_LED(xtd) + CONNECT_LED(bf) + CONNECT_LED(p5) + CONNECT_LED(p6) + + //BottomRight + CONNECT_LED(dual) + CONNECT_LED(quad) + CONNECT_LED(single) + CONNECT_LED(p1) + CONNECT_LED(p2) + CONNECT_LED(p3) + CONNECT_LED(p4) + + //CurveButtons + CONNECT_LED(exit) + CONNECT_LED(freeze) + CONNECT_LED(pointer) + CONNECT_LED(autoSet) + CONNECT_LED(abc) + CONNECT_LED(fourD) + CONNECT_LED(clear) + CONNECT_LED(threeD) + CONNECT_LED(measure) + CONNECT_LED(bodyMark) + + //TrackballGroup + CONNECT_LED(trackballLeft) + CONNECT_LED(trackballRight) + CONNECT_LED(trackballTop) + CONNECT_LED(trackballBottom) + + CONNECT_LED(trackballTopLeft) + CONNECT_LED(trackballTopRight) + CONNECT_LED(trackballBottomLeft) + CONNECT_LED(trackballBottomRight) + + //Encoders + CONNECT_LED(modeM) + CONNECT_LED(modePd) + CONNECT_LED(modeC) + CONNECT_LED(modeB) + + CONNECT_LED(modePwCenter) + CONNECT_LED(modeMCenter) + CONNECT_LED(modePdCenter) + CONNECT_LED(modeCCenter) + CONNECT_LED(modeBCenter) - _text = text; - emit textChanged(_text); + //JoystickCouple + CONNECT_LED(focus) + CONNECT_LED(depthCenter) + CONNECT_LED(focusCenter) + CONNECT_LED(depthBottom) + CONNECT_LED(focusBottom) } diff --git a/network/Network.cpp b/network/Network.cpp deleted file mode 100644 index 0c3fbe3..0000000 --- a/network/Network.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "Network.h" - -Network::Network() -{ -} diff --git a/network/Network.h b/network/Network.h deleted file mode 100644 index 2669bb7..0000000 --- a/network/Network.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef NETWORK_H -#define NETWORK_H - -class Network -{ -public: - Network(); -}; - -#endif // NETWORK_H diff --git a/network/UdpDataSender.cpp b/network/UdpDataSender.cpp deleted file mode 100644 index f279c09..0000000 --- a/network/UdpDataSender.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "UdpDataSender.h" -#include - -int UdpDataSender::send(const QByteArray &data) -{ - qDebug() << "Just a little test"; -} - -UdpDataSender::~UdpDataSender() -{ - -} diff --git a/network/UdpDataSender.h b/network/UdpDataSender.h deleted file mode 100644 index c59d55d..0000000 --- a/network/UdpDataSender.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef UDPDATASENDER_H -#define UDPDATASENDER_H - -#include "model/DataSender.h" - -class UdpDataSender : public DataSender -{ -public: - int send(const QByteArray &data) override; - ~UdpDataSender() override; -}; - -#endif // UDPDATASENDER_H diff --git a/network/network.pro b/network/network.pro deleted file mode 100644 index 6d99ab2..0000000 --- a/network/network.pro +++ /dev/null @@ -1,30 +0,0 @@ -QT -= gui - -TEMPLATE = lib -CONFIG += staticlib - -CONFIG += c++11 - -TARGET = network - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - Network.cpp \ - UdpDataSender.cpp - -HEADERS += \ - Network.h \ - UdpDataSender.h - -INCLUDEPATH += $$PWD/../logic/include -DEPENDPATH += $$PWD/../logic/include diff --git a/test/TestDataSender.h b/test/TestDataSender.h index 40a59ee..1915d36 100644 --- a/test/TestDataSender.h +++ b/test/TestDataSender.h @@ -8,11 +8,10 @@ class TestDataSender : public DataSender public: QByteArray consoleData; - int send(const QByteArray &data) override + void send(const QByteArray& data) override { consoleData = data; - return data.length(); } }; -#endif // TESTDATASENDER_H +#endif //TESTDATASENDER_H diff --git a/test/TestLogger.h b/test/TestLogger.h new file mode 100644 index 0000000..603296a --- /dev/null +++ b/test/TestLogger.h @@ -0,0 +1,25 @@ +#ifndef TESTLOGGER_H +#define TESTLOGGER_H + +#include + +#include "model/Logger.h" + +class TestLogger : public QObject, public Logger +{ + Q_OBJECT + +public: + QString message; + + void log(QString message) override + { + this->message = message; + emit isCalled(); + } + +signals: + void isCalled(); +}; + +#endif //TESTLOGGER_H diff --git a/test/test.pro b/test/test.pro index 85a9eaf..4ca7e1d 100644 --- a/test/test.pro +++ b/test/test.pro @@ -11,6 +11,21 @@ SOURCES += tst_console.cpp INCLUDEPATH += $$PWD/../logic/include DEPENDPATH += $$PWD/../logic/include +INCLUDEPATH += $$PWD/../logger +DEPENDPATH += $$PWD/../logger + + +# Link with core project +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../logger/release/ -llogger +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../logger/debug/ -llogger +else:unix: LIBS += -L$$OUT_PWD/../logger/ -llogger + +win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../logger/release/liblogger.a +else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../logger/debug/liblogger.a +else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../logger/release/logger.lib +else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../logger/debug/logger.lib +else:unix: PRE_TARGETDEPS += $$OUT_PWD/../logger/liblogger.a + # Link with core project win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../logic/release/ -llogic else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../logic/debug/ -llogic @@ -23,4 +38,5 @@ else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/ else:unix: PRE_TARGETDEPS += $$OUT_PWD/../logic/liblogic.a HEADERS += \ - TestDataSender.h + TestDataSender.h \ + TestLogger.h diff --git a/test/tst_console.cpp b/test/tst_console.cpp index 355965c..922f2cd 100644 --- a/test/tst_console.cpp +++ b/test/tst_console.cpp @@ -2,44 +2,283 @@ #include "TestDataSender.h" #include "model/Console.h" +#include "TestLogger.h" + +#include class ConsoleTest : public QObject { Q_OBJECT +private: + Console c; + TestDataSender t; + TestLogger log; + public: ConsoleTest(); ~ConsoleTest(); + //uncrustify off private slots: - void test_case1(); + //uncrustify on + void pressDual_test_case(); + void releaseDual_test_case(); + void dualLedChange_test_case(); + + void pressQuad_test_case(); + void releaseQuad_test_case(); + + void rotateJs1_test_case(); + void rotatFocus_test_case(); + void echo_test_case(); + void wrongProtocol_test_case(); + void wrongMessageDirection_test_case(); + void ledWrongColor_test_case(); }; +/*************************************************************************************************/ ConsoleTest::ConsoleTest() { - + c.injectDataSender(&t); + c.injectLogger(&log); } +/*************************************************************************************************/ ConsoleTest::~ConsoleTest() { +} + +/*************************************************************************************************/ +void ConsoleTest::pressDual_test_case() +{ + c.pressDual(); + + QByteArray arr; + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0x01; + arr[2] = 0x04; + arr[3] = 0x1D; + arr[4] = 0x01; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + QCOMPARE(t.consoleData, arr); +} + +/*************************************************************************************************/ +void ConsoleTest::releaseDual_test_case() +{ + c.releaseDual(); + QByteArray arr; + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0x01; + arr[2] = 0x04; + arr[3] = 0x1D; + arr[4] = 0x00; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + QCOMPARE(t.consoleData, arr); } -void ConsoleTest::test_case1() +/*************************************************************************************************/ +void ConsoleTest::dualLedChange_test_case() { - Console c; - auto t = new TestDataSender; - c.injectDataSender(t); - c.test(); + QSignalSpy spy(&c, SIGNAL(dualLedChanged(char))); + + char ledValue = 0x01; + + QByteArray arr; + arr.resize(8); + arr[0] = 0x01; + arr[1] = 0x01; + arr[2] = 0x03; + arr[3] = static_cast(0x82); + arr[4] = ledValue; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + c.newData(arr); + + auto result = spy.takeFirst()[0].value(); + + QCOMPARE(result[0], ledValue); +} + +/*************************************************************************************************/ +void ConsoleTest::pressQuad_test_case() +{ + c.pressQuad(); + + QByteArray arr; + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0x01; + arr[2] = 0x04; + arr[3] = 0x1C; + arr[4] = 0x01; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + QCOMPARE(t.consoleData, arr); +} + +/*************************************************************************************************/ +void ConsoleTest::releaseQuad_test_case() +{ + c.releaseQuad(); + + QByteArray arr; + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0x01; + arr[2] = 0x04; + arr[3] = 0x1C; + arr[4] = 0x00; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + QCOMPARE(t.consoleData, arr); +} + +/*************************************************************************************************/ +void ConsoleTest::rotateJs1_test_case() +{ + auto value = 0; + c.rotateJs1(value); QByteArray arr; - arr.append(0x01); - arr.append(0x04); - arr.append(0x05); - QCOMPARE(t->consoleData, arr); + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0x02; + arr[2] = 0x05; + arr[3] = 0x56; + arr[4] = static_cast(value >> 8); + arr[5] = static_cast(value); + arr[6] = 0x00; + arr[7] = 0x00; + + QCOMPARE(t.consoleData, arr); +} + +/*************************************************************************************************/ +void ConsoleTest::rotatFocus_test_case() +{ + auto value = 40000; + c.rotateFocus(value); + + QByteArray arr; + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0x02; + arr[2] = 0x05; + arr[3] = 0x51; + arr[4] = static_cast(value >> 8); + arr[5] = static_cast(value); + arr[6] = 0x00; + arr[7] = 0x00; + + QCOMPARE(t.consoleData, arr); +} + +/*************************************************************************************************/ +void ConsoleTest::echo_test_case() +{ + QByteArray arr; + arr.resize(8); + arr[0] = 0x01; + arr[1] = 0x02; + arr[2] = 0x06; + arr[3] = static_cast(0xA4); + arr[4] = 0x00; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + c.newData(arr); + + QCOMPARE(t.consoleData, arr); } +/*************************************************************************************************/ +void ConsoleTest::wrongProtocol_test_case() +{ + char ledValue = 0x01; + + QByteArray arr; + arr.resize(5); + arr[0] = 0x01; + arr[1] = 0x01; + arr[2] = 0x03; + arr[3] = static_cast(0x82); + arr[4] = ledValue; + + QSignalSpy spy(&log, SIGNAL(isCalled())); + + c.newData(arr); + + QCOMPARE(spy.count(), 1); +} + +/*************************************************************************************************/ +void ConsoleTest::wrongMessageDirection_test_case() +{ + char ledValue = 0x01; + + QByteArray arr; + arr.resize(8); + arr[0] = 0x00; + arr[1] = 0x01; + arr[2] = 0x03; + arr[3] = static_cast(0x82); + arr[4] = ledValue; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + QSignalSpy spy(&log, SIGNAL(isCalled())); + + c.newData(arr); + + QCOMPARE(spy.count(), 1); +} + +/*************************************************************************************************/ +void ConsoleTest::ledWrongColor_test_case() +{ + QByteArray arr; + + char ledValue = 0x05; + + arr.resize(8); + arr[0] = 0x01; + arr[1] = 0x01; + arr[2] = 0x04; + arr[3] = static_cast(0x82); + arr[4] = ledValue; + arr[5] = 0x00; + arr[6] = 0x00; + arr[7] = 0x00; + + QSignalSpy spy(&log, SIGNAL(isCalled())); + + c.newData(arr); + + QCOMPARE(spy.count(), 1); +} + +/*************************************************************************************************/ + QTEST_APPLESS_MAIN(ConsoleTest) #include "tst_console.moc" diff --git a/ui/App.qml b/ui/App.qml old mode 100644 new mode 100755 index ac61da9..e75023b --- a/ui/App.qml +++ b/ui/App.qml @@ -1,6 +1,20 @@ import QtQuick 2.10 +import QtQuick.Window 2.13 import de.skycoder42.QtMvvm.Quick 1.0 +import "qrc:/const/" +import "qrc:/theme/" QtMvvmApp { title: qsTr("consoleEmulator") + id: mvvmApp + + onWidthChanged: Const.widthRatio = mvvmApp.width / Const.windowWidth + onHeightChanged: Const.heightRatio = mvvmApp.height / Const.windowHeight + + Component.onCompleted: { + width = Const.windowWidth + height = Const.windowHeight + x = (Screen.width - width) / 2 + y = (Screen.height - height) + } } diff --git a/ui/MainView.qml b/ui/MainView.qml old mode 100644 new mode 100755 index 9299e7c..fd5af8d --- a/ui/MainView.qml +++ b/ui/MainView.qml @@ -1,70 +1,32 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 +import QtQuick.Window 2.13 import QtQuick.Layouts 1.3 import de.skycoder42.QtMvvm.Core 1.0 import de.skycoder42.QtMvvm.Quick 1.0 import com.example.consoleemulator 1.0 +import "qrc:/emulator/" +import "qrc:/theme/" +import "qrc:/const/" Page { id: mainView property MainViewModel viewModel: null - header: ContrastToolBar { - RowLayout { - anchors.fill: parent - spacing: 0 - - ToolBarLabel { - text: qsTr("MainViewModel") - Layout.fillWidth: true - } - - MenuButton { - MenuItem { - id: settings - text: qsTr("Settings") - onClicked: viewModel.showSettings() - } - } - } - } - - PresenterProgress {} - - Pane { + Rectangle{ anchors.fill: parent + color: Theme.current.background + } - ColumnLayout { - anchors.fill: parent - - TextField { - id: textEdit - Layout.fillWidth: true - - MvvmBinding { - viewModel: mainView.viewModel - viewModelProperty: "text" - view: textEdit - viewProperty: "text" - } - } - - Label { - id: textLabel - Layout.fillWidth: true - - MvvmBinding { - viewModel: mainView.viewModel - viewModelProperty: "text" - view: textLabel - viewProperty: "text" - type: MvvmBinding.OneWayToView - } - } + Rectangle { + id: correctedPosition + width: Const.windowWidth + height: Const.windowHeight + scale: Const.ratio + color: Theme.current.background + x: (mainView.width - width) / 2 + y: (mainView.height - height) / 2 - Item { - Layout.fillHeight: true - } - } + Emulator {} } } diff --git a/ui/const/Const.qml b/ui/const/Const.qml new file mode 100755 index 0000000..7d9b77a --- /dev/null +++ b/ui/const/Const.qml @@ -0,0 +1,35 @@ +pragma Singleton +import QtQuick 2.13 + +QtObject { + /**************************************************************************/ + // General + + property var widthRatio: 1 + property var heightRatio: 1 + property var ratio: Math.min(widthRatio , heightRatio) + property var windowAspectRatio: 16 / 6 + property var windowWidth: 1920 // Do Not Change This Property + property var windowHeight: 860 // Do Not Change This Property + + property var lightButton: 64 + property var microButton: 32 + property var macroButton: 64 + property var margin: 6 + property var microLightThickness: 10 + property var macroLightThickness: 10 + property var imageScale: 0.75 + property var imageScalePressed: 0.65 + property var rotateStep: 45 + + property var radiusLong: 44 + property var radiusShort: 24 + + property var sliderWidth: 250 + property var sliderHeight: 50 + property var sliderThickness: 20 + + property var textWidth: 250 + property var textHeight: 30 + +} diff --git a/ui/const/qmldir b/ui/const/qmldir new file mode 100755 index 0000000..ca7d4f1 --- /dev/null +++ b/ui/const/qmldir @@ -0,0 +1 @@ +singleton Const Const.qml diff --git a/ui/emulator/Emulator.qml b/ui/emulator/Emulator.qml new file mode 100755 index 0000000..3e4cffb --- /dev/null +++ b/ui/emulator/Emulator.qml @@ -0,0 +1,36 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.13 + +import "qrc:/emulator/items" +import "qrc:/theme" +import "qrc:/const" + +Item { + width: Const.windowWidth + height: Const.windowHeight + + Setting { + anchors.horizontalCenter: topLeft.horizontalCenter + anchors.top: topLeft.bottom + anchors.topMargin: 120 + } + + TopLeft { + id: topLeft + } + + TopRight {} + + BottomRight {} + + CurveButtons {} + + Joysticks {} + + Encoders {} + + JoystickCouple {} + + TrackballGroup {} + +} diff --git a/ui/emulator/components/HoverGlow.qml b/ui/emulator/components/HoverGlow.qml new file mode 100755 index 0000000..beb2502 --- /dev/null +++ b/ui/emulator/components/HoverGlow.qml @@ -0,0 +1,31 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" + +LinearGradient { + anchors.fill: parent + start: Qt.point(parent.width, parent.height/2) + end: Qt.point(0, 0) + + gradient: Gradient { + GradientStop { + position: 0 + color: Theme.current.isDarkTheme ? "#10FFFFFF" : "#4DFFFFFF" + } + GradientStop { + position: 0.08 + color: Theme.current.isDarkTheme ? "#20FFFFFF" : "#80FFFFFF" + } + GradientStop { + position: 0.27 + color: Theme.current.isDarkTheme ? "#05FFFFFF" : "#21FFFFFF" + } + + GradientStop { + position: 1 + color: Theme.current.isDarkTheme ? "#05FFFFFF" : "#21FFFFFF" + } + } +} diff --git a/ui/emulator/components/JoystickButton.qml b/ui/emulator/components/JoystickButton.qml new file mode 100644 index 0000000..4bb2399 --- /dev/null +++ b/ui/emulator/components/JoystickButton.qml @@ -0,0 +1,259 @@ +import QtQuick 2.0 + +import "qrc:/theme" +import "qrc:/const" + +Item { + id: control + + property bool centerButDown: centerBut.down + property bool leftButDown + property bool rightButDown + property bool topButDown + property bool bottomButDown + + width: 2 * (Const.radiusLong + Const.margin) + height: 2 * (Const.radiusLong + Const.margin) + + SegmentButton { + id: topBut + angle: 45 + x: Const.margin + } + + SegmentButton { + id: bottomBut + angle: -135 + x: Const.margin + y: 2 * Const.margin + } + + SegmentButton { + id: leftBut + angle: -45 + y: Const.margin + } + + SegmentButton { + id: rightBut + angle: 135 + x: 2 * Const.margin + y: Const.margin + } + + Rectangle { + color: "transparent" + anchors.fill: parent + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onPressed: { + if(beInCenter()) { + // inside + } else if (isOutside()) { + // outside + } else { + if(beInNorthOrWest()) { + if(beInNorthOrEast()) { + // top key + topButPressed() + } else { + // left key + leftButPressed() + } + } else { + if(beInNorthOrEast()) { + // right key + rightButPressed() + } else { + // bottom key + bottomButPressed() + } + } + } + } + + onReleased: { + topButReleased() + leftButReleased() + rightButReleased() + bottomButReleased() + } + onMouseXChanged: { + if(!mouseArea.pressed) { + if(beInCenter()) { + // inside + topButExit() + leftButExit() + rightButExit() + bottomButExit() + } else if (isOutside()) { + // outside + topButExit() + leftButExit() + rightButExit() + bottomButExit() + } else { + if(beInNorthOrWest()) { + if(beInNorthOrEast()) { + // top key + topButHover() + leftButExit() + rightButExit() + bottomButExit() + } else { + // left key + leftButHover() + topButExit() + rightButExit() + bottomButExit() + } + } else { + if(beInNorthOrEast()) { + // right key + rightButHover() + topButExit() + leftButExit() + bottomButExit() + } else { + // bottom key + bottomButHover() + topButExit() + leftButExit() + rightButExit() + } + } + } + } + } + + onExited: { + topButExit() + leftButExit() + rightButExit() + bottomButExit() + } + + function beInNorthOrWest() { + var verDist = (Const.radiusLong + Const.margin) - mouseY + var horDist = mouseX - (Const.radiusLong + Const.margin) + var inNorthorWest = (verDist > horDist) + return inNorthorWest + } + + function beInNorthOrEast() { + var verDist = (Const.radiusLong + Const.margin) - mouseY + var horDist = mouseX - (Const.radiusLong + Const.margin) + var inNorthorEast = (verDist > - horDist) + return inNorthorEast + } + + function beInCenter() { + var verLength = (mouseY - (Const.radiusLong + Const.margin)) ** 2 + var horLength = (mouseX - (Const.radiusLong + Const.margin)) ** 2 + var inCenter = (verLength + horLength < ((Const.radiusShort + Const.margin) ** 2)) + return inCenter + } + + function isOutside() { + var verLength = (mouseY - (Const.radiusLong + Const.margin)) ** 2 + var horLength = (mouseX - (Const.radiusLong + Const.margin)) ** 2 + var isOut = (verLength + horLength > ((Const.radiusLong + Const.margin) ** 2)) + return isOut + } + } + } + + + NeuButton { + id: centerBut + width: 2 * (Const.radiusShort - Const.margin) + height: 2 * (Const.radiusShort - Const.margin) + anchors.centerIn: parent + } + + /***********************************/ + function leftButPressed() { + leftButDown = true + leftBut.state = "Pressed" + leftBut.pressed() + } + + function leftButReleased() { + leftButDown = false + leftBut.released() + leftBut.state = "" + } + + function leftButHover() { + leftBut.state = "Hovering" + } + + function leftButExit() { + leftBut.state = "" + } + + /***********************************/ + function rightButPressed() { + rightButDown = true + rightBut.state = "Pressed" + rightBut.pressed() + } + + function rightButReleased() { + rightButDown = false + rightBut.released() + rightBut.state = "" + } + + function rightButHover() { + rightBut.state = "Hovering" + } + + function rightButExit() { + rightBut.state = "" + } + + /***********************************/ + function topButPressed() { + topButDown = true + topBut.state = "Pressed" + topBut.pressed() + } + + function topButReleased() { + topButDown = false + topBut.released() + topBut.state = "" + } + + function topButHover() { + topBut.state = "Hovering" + } + + function topButExit() { + topBut.state = "" + } + + /***********************************/ + function bottomButPressed() { + bottomButDown = true + bottomBut.state = "Pressed" + bottomBut.pressed() + } + + function bottomButReleased() { + bottomButDown = false + bottomBut.released() + bottomBut.state = "" + } + + function bottomButHover() { + bottomBut.state = "Hovering" + } + + function bottomButExit() { + bottomBut.state = "" + } +} diff --git a/ui/emulator/components/Knob.qml b/ui/emulator/components/Knob.qml new file mode 100644 index 0000000..8597c8c --- /dev/null +++ b/ui/emulator/components/Knob.qml @@ -0,0 +1,254 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Button { + id: button + property var image: "" + property var radius: Math.min(width / 2, height / 2) + property var timeToPress: 100 + property var border: 4 + + signal pressed + signal released + + onPressed: { button.down = true } + onReleased: { button.down = false } + + implicitWidth: Const.macroButton + implicitHeight: Const.macroButton + + contentItem: Item { + id: content + anchors.fill: parent + z: 1 + + Item { + property var factor: button.state == "Pressed" ? + Const.imageScalePressed : Const.imageScale + property var elevator: button.state == "Pressed" ? 3 : 0 + + anchors.horizontalCenter: parent.horizontalCenter + y: (parent.height * (1-factor)) / 2 + elevator + width: parent.width * factor + height: parent.height * factor + + Behavior on y { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Behavior on width { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Behavior on height { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Image { + id: img + anchors.fill: parent + source: image + fillMode: Image.PreserveAspectFit + antialiasing: true + smooth: true + } + + ColorOverlay { + anchors.fill: img + source: img + color: button.state == "Pressed" ? Theme.current.textSelected : Theme.current.text + antialiasing: true + smooth: true + } + } + } + + background: Item{ + width: parent.implicitWidth + height: parent.implicitHeight + + Rectangle { + id: background + anchors.fill: parent + radius: button.radius + color: Theme.current.button + + Behavior on color { + ColorAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + } + + Item { + id: coloredRing + width: parent.width + height: parent.height + + Rectangle { + id: lightRing + width: parent.width + height: parent.height + radius: width / 2 + color: "transparent" + border{ + color: background.color + width: button.border + } + } + + Item { + id: borderGrad + implicitWidth: parent.implicitWidth + implicitHeight: parent.implicitHeight + anchors.fill: parent + + layer.enabled: true + layer.effect: + OpacityMask { + maskSource: lightRing + } + + Rectangle { + width: parent.width + height: parent.height + color: "transparent" + + LinearGradient { + id: linGrad + anchors.fill: parent + start: Qt.point(0, parent.height) + end: Qt.point(0, 0) + gradient: Gradient { + GradientStop { + id: buttonDown + position: 0 + color: Theme.current.shadow + + Behavior on color { + ColorAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + } + + GradientStop { + id: buttonUp + position: 1 + color: Theme.current.light + + Behavior on color { + ColorAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + } + } + } + } + } + } + + MouseArea { + hoverEnabled: true + anchors.fill: background + onEntered: { + button.state = "Hovering" + } + + onExited: { + button.state = "" + } + + onPressed: { + button.state = "Pressed" + button.pressed() + } + + onReleased: { + button.released() + if (containsMouse) + button.state = "Hovering" + else + button.state = "" + } + } + } + + Item { + id: hoverLight + implicitWidth: parent.implicitWidth + implicitHeight: parent.implicitHeight + anchors.fill: parent + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: background + } + + Rectangle { + id: hoverGlow + width: 2 * parent.width + height: parent.height + x: - 2 * parent.width + color: "transparent" + + HoverGlow {} + } + } + + states: [ + State { + name: "Hovering" + PropertyChanges { + target: hoverGlow + x: 0 + } + }, + + State { + name: "Pressed" + PropertyChanges { + target: background + color: Theme.current.buttonSelected + } + + PropertyChanges { + target: buttonUp + color: Theme.current.shadow + } + + PropertyChanges { + target: buttonDown + color: Theme.current.light + } + } + ] + + transitions: [ + Transition { + from: ""; to: "Hovering" + NumberAnimation { + properties: "x" + duration: 500 + easing.type: Easing.OutQuad + } + } + ] +} diff --git a/ui/emulator/components/KnobImage.qml b/ui/emulator/components/KnobImage.qml new file mode 100644 index 0000000..a81e3eb --- /dev/null +++ b/ui/emulator/components/KnobImage.qml @@ -0,0 +1,113 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Item { + id: button + + property var image: "" + property var radius: Math.min(width / 2, height / 2) + property var border: 4 + + implicitWidth: Const.macroButton + implicitHeight: Const.macroButton + + Item { + width: parent.width + height: parent.height + + Rectangle { + id: background + anchors.fill: parent + radius: button.radius + color: Theme.current.button + } + + Item { + id: coloredRing + width: parent.width + height: parent.height + + Rectangle { + id: lightRing + width: parent.width + height: parent.height + radius: Math.min(width / 2, height / 2) + color: "transparent" + border{ + color: background.color + width: button.border + } + } + + Item { + id: borderGrad + implicitWidth: parent.width + implicitHeight: parent.height + anchors.fill: parent + + layer.enabled: true + layer.effect: + OpacityMask { + maskSource: lightRing + } + + Rectangle { + width: parent.width + height: parent.height + color: "transparent" + + LinearGradient { + id: linGrad + anchors.fill: parent + start: Qt.point(0, parent.height) + end: Qt.point(0, 0) + gradient: Gradient { + GradientStop { + id: buttonDown + position: 0 + color: Theme.current.shadow + } + + GradientStop { + id: buttonUp + position: 1 + color: Theme.current.light + } + } + } + } + } + } + } + + Item { + id: content + anchors.fill: parent + + Item { + property var factor: Const.imageScale + + anchors.horizontalCenter: parent.horizontalCenter + y: (parent.height * (1-factor)) / 2 + width: parent.width * factor + height: parent.height * factor + + Image { + id: img + anchors.fill: parent + source: image + fillMode: Image.PreserveAspectFit + } + + ColorOverlay { + anchors.fill: img + source: img + color: Theme.current.text + } + } + } +} diff --git a/ui/emulator/components/KnobLight.qml b/ui/emulator/components/KnobLight.qml new file mode 100644 index 0000000..e0db9a5 --- /dev/null +++ b/ui/emulator/components/KnobLight.qml @@ -0,0 +1,334 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Button { + id: button + property var image: "" + property var radius: Math.min(width / 2, height / 2) + property var timeToPress: 100 + property var border: 6 + + property var colorMode: 0 // 0->None; 1->White; 2->Green; 3->Yellow + property color lightColor: getColor() + property color lightGlow: getColorGlow() + + signal pressed + signal released + + implicitWidth: width + implicitHeight: height + + onPressed: { button.down = true } + onReleased: { button.down = false } + + function getColor() { + switch(colorMode) { + case(0): return Theme.current.none + case(1): return Theme.current.white + case(2): return Theme.current.green + case(3): return Theme.current.yellow + } + } + + function getColorGlow() { + switch(colorMode) { + case(0): return Theme.current.noneGlow + case(1): return Theme.current.whiteGlow + case(2): return Theme.current.greenGlow + case(3): return Theme.current.yellowGlow + } + } + + width: Const.macroButton + height: Const.macroButton + + contentItem: Item { + id: content + anchors.fill: parent + z: 1 + + Item { + property var factor: button.state == "Pressed" ? + Const.imageScalePressed : Const.imageScale + property var elevator: button.state == "Pressed" ? 3 : 0 + + anchors.horizontalCenter: parent.horizontalCenter + y: (parent.height * (1-factor)) / 2 + elevator + width: parent.width * factor + height: parent.height * factor + + Behavior on y { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Behavior on width { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Behavior on height { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Image { + id: img + anchors.fill: parent + source: image + fillMode: Image.PreserveAspectFit + antialiasing: true + smooth: true + } + + ColorOverlay { + anchors.fill: img + source: img + color: button.state == "Pressed" ? Theme.current.textSelected : Theme.current.text + antialiasing: true + smooth: true + } + } + } + + background: Item{ + width: parent.width + height: parent.height + + Rectangle { + id: backLightGlow + property var diffusion: Theme.current.glowRaduis + width: backLight.width + diffusion + height: backLight.height + diffusion + radius: width / 2 + anchors.horizontalCenter: backLight.horizontalCenter + y: - diffusion / 4 + color: Theme.current.background + border { + width: diffusion / 2 + color: Theme.current.background + } + } + + Rectangle { + anchors.fill: backLightGlow + + color: "transparent" + layer.enabled: true + layer.effect: OpacityMask { + maskSource: backLightGlow + } + + Rectangle { + width: parent.width + height: parent.height + radius: parent.radius + color: "transparent" + + RadialGradient { + anchors.fill: parent + gradient: Gradient { + GradientStop { position: 0.0; color: lightGlow } + GradientStop { + position: 0.5 * (backLight.width - backLightGlow.diffusion / backLightGlow.width) + color: lightGlow + } + GradientStop { position: 0.5; color: "transparent" } + GradientStop { position: 1.0; color: "transparent" } + } + } + } + } + + Rectangle { + id: backLight + width: parent.width + 4 + height: parent.height + 4 + radius: width / 2 + color: lightColor + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + } + + Rectangle { + id: background + anchors.fill: parent + radius: button.radius + color: Theme.current.button + + Behavior on color { + ColorAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + } + + Item { + id: coloredRing + width: parent.width + height: parent.height + + Rectangle { + id: lightRing + width: parent.width + height: parent.height + radius: width / 2 + color: "transparent" + border{ + color: background.color + width: button.border + } + } + + Item { + id: borderGrad + implicitWidth: parent.width + implicitHeight: parent.height + anchors.fill: parent + + layer.enabled: true + layer.effect: + OpacityMask { + maskSource: lightRing + } + + Rectangle { + width: parent.width + height: parent.height + color: background.color + + LinearGradient { + id: linGrad + anchors.fill: parent + start: Qt.point(0, parent.height) + end: Qt.point(0, 0) + gradient: Gradient { + GradientStop { + id: buttonDown + position: 0 + color: Theme.current.shadow + + Behavior on color { + ColorAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + } + + GradientStop { + id: buttonUp + position: 1 + color: Theme.current.light + + Behavior on color { + ColorAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + } + } + } + } + } + } + + MouseArea { + hoverEnabled: true + anchors.fill: background + onEntered: { + button.state = "Hovering" + } + + onExited: { + button.state = "" + } + + onPressed: { + button.state = "Pressed" + button.pressed() + } + + onReleased: { + button.released() + if (containsMouse) + button.state = "Hovering" + else + button.state = "" + } + } + } + + Item { + id: hoverLight + implicitWidth: parent.width + implicitHeight: parent.height + anchors.fill: parent + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: background + } + + Rectangle { + id: hoverGlow + width: 2 * parent.width + height: parent.height + x: - 2 * parent.width + color: "transparent" + + HoverGlow {} + } + } + + states: [ + State { + name: "Hovering" + PropertyChanges { + target: hoverGlow + x: 0 + } + }, + + State { + name: "Pressed" + PropertyChanges { + target: background + color: Theme.current.buttonSelected + } + + PropertyChanges { + target: buttonUp + color: Theme.current.shadow + } + + PropertyChanges { + target: buttonDown + color: Theme.current.light + } + } + ] + + transitions: [ + Transition { + from: ""; to: "Hovering" + NumberAnimation { + properties: "x" + duration: 500 + easing.type: Easing.OutQuad + } + } + ] +} diff --git a/ui/emulator/components/LightImage.qml b/ui/emulator/components/LightImage.qml new file mode 100644 index 0000000..42ef707 --- /dev/null +++ b/ui/emulator/components/LightImage.qml @@ -0,0 +1,29 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.13 + +import "qrc:/const" + +Item { + property var image: "" + property var colorMode: 0 + property var thickness: Const.macroLightThickness + + implicitWidth: Const.lightButton + implicitHeight: Const.lightButton + + LightRing { + id: lightRing + width: parent.width + height: parent.height + thickness: parent.thickness + colorMode: parent.colorMode + } + + KnobImage { + id: knobImage + anchors.centerIn: lightRing + width: parent.width - 2 * lightRing.thickness + height: parent.height - 2 * lightRing.thickness + image: parent.image + } +} diff --git a/ui/emulator/components/LightRing.qml b/ui/emulator/components/LightRing.qml new file mode 100644 index 0000000..be4c3a8 --- /dev/null +++ b/ui/emulator/components/LightRing.qml @@ -0,0 +1,190 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Item { + id: control + + property var angle: 0 + property var thickness: Const.macroLightThickness + + property var colorMode: 0 // 0->None; 1->White; 2->Green; 3->Yellow + property color lightColor: getColor() + property color lightDeep: getColorDeep() + property var timeFactor: 1 + property bool indicator: false + + width: Const.macroButton + 2 * thickness + height: Const.macroButton + 2 * thickness + + function getColor() { + switch(colorMode) { + case(0): return Theme.current.none + case(1): return Theme.current.white + case(2): return Theme.current.green + case(3): return Theme.current.yellow + } + } + + function getColorDeep() { + switch(colorMode) { + case(0): return Theme.current.noneDeep + case(1): return Theme.current.whiteDeep + case(2): return Theme.current.greenDeep + case(3): return Theme.current.yellowDeep + } + } + + Item { + id: shadowedRing + anchors.fill: parent + + Item { + id: coloredRing + width: parent.width + height: parent.height + + Rectangle { + id: lightRing + width: parent.width + height: parent.height + radius: width / 2 + color: "transparent" + border{ + color: lightColor + width: thickness + } + } + + Item { + id: borderGrad + implicitWidth: parent.implicitWidth + implicitHeight: parent.implicitHeight + anchors.fill: parent + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: lightRing + } + + Rectangle { + width: parent.width + height: parent.height + color: "transparent" + + LinearGradient { + id: linGrad + anchors.fill: parent + start: Qt.point(0, parent.height) + end: Qt.point(0, 0) + gradient: Gradient { + GradientStop { + position: 0 + color: lightDeep + } + + GradientStop { + position: 1 + color: lightColor + } + } + } + } + + Rectangle { + id: indic + width: thickness * 2 + height: width + color: lightDeep + y: 0.5 * thickness + anchors.horizontalCenter: parent.horizontalCenter + visible: indicator + + transform: Rotation { + angle: 45 + origin { + x: indic.width / 2 + y: indic.height / 2 + } + + axis { + z: 1 + x: 0 + y: 0 + } + } + } + + transform: Rotation { + origin { + x: borderGrad.width / 2 + y: borderGrad.height / 2 + } + + axis { + z: 1 + x: 0 + y: 0 + } + + angle: control.angle + + Behavior on angle { + NumberAnimation { + duration: 200 * timeFactor + easing.type: Easing.OutQuad + } + } + } + } + } + + DropShadow { + id: dropDown + anchors.fill: coloredRing + source: coloredRing + horizontalOffset: 3 + verticalOffset: 3 + radius: 4 + samples: 8 + color: Theme.current.light + } + + DropShadow { + id: dropUp + anchors.fill: coloredRing + source: coloredRing + horizontalOffset: - 3 + verticalOffset: - 3 + radius: 4 + samples: 8 + color: Theme.current.light + } + + InnerShadow { + id: inner + anchors.fill: coloredRing + source: coloredRing + horizontalOffset: 3 + verticalOffset: 3 + radius: 3 + samples: 6 + smooth: true + color: Theme.current.lightShadow + } + } + +// Glow { +// id: glow +// property var base: shadowedRing +// anchors.fill: base +// source: base +// radius: 10 +// samples: 20 +// color: Theme.current.light //orange ? "#FFEAA5" : (green ? "#B8E49B" : (white ? "white" : "transparent")) +// transparentBorder: true +// } +} + diff --git a/ui/emulator/components/ModeBg.qml b/ui/emulator/components/ModeBg.qml new file mode 100644 index 0000000..426697e --- /dev/null +++ b/ui/emulator/components/ModeBg.qml @@ -0,0 +1,106 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Item { + id: control + property var image: "" + + width: coloredRing.width + height: coloredRing.height + + property var additionalLength: 0 + + Item { + id: coloredRing + width: childrenRect.width + height: childrenRect.height + + Item { + id: background + width: baseBackground.width + height: baseBackground.height + + Rectangle { + id: baseBackground + width: Const.macroButton + Const.microButton + 2 * Const.margin + additionalLength + height: width + radius: width / 2 + color: Theme.current.noneGlow + } + } + + Item { + id: borderGrad + implicitWidth: parent.implicitWidth + implicitHeight: parent.implicitHeight + anchors.fill: parent + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: background + } + + Rectangle { + width: parent.width + height: parent.height + color: "transparent" + + LinearGradient { + id: linGrad + anchors.fill: parent + start: Qt.point(0, parent.height) + end: Qt.point(0, 0) + gradient: Gradient { + GradientStop { + position: 0 + color: Theme.current.none + } + + GradientStop { + position: 1 + color: Theme.current.noneGlow + } + } + } + } + } + } + + DropShadow { + id: dropDown + anchors.fill: coloredRing + source: background + horizontalOffset: 3 + verticalOffset: 3 + radius: 4 + samples: 8 + color: Theme.current.light + } + + DropShadow { + id: dropUp + anchors.fill: coloredRing + source: background + horizontalOffset: - 3 + verticalOffset: - 3 + radius: 4 + samples: 8 + color: Theme.current.light + } + + InnerShadow { + id: inner + anchors.fill: coloredRing + source: background + horizontalOffset: 3 + verticalOffset: 3 + radius: 3 + samples: 6 + smooth: true + color: Theme.current.lightShadow + } +} diff --git a/ui/emulator/components/ModeBgOption.qml b/ui/emulator/components/ModeBgOption.qml new file mode 100644 index 0000000..5e068b2 --- /dev/null +++ b/ui/emulator/components/ModeBgOption.qml @@ -0,0 +1,124 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Item { + id: control + property var image: "" + + width: coloredRing.width + height: coloredRing.height + + Item { + id: coloredRing + width: childrenRect.width + height: childrenRect.height + + Item { + id: background + width: baseBackground.width + option.width / 2 + height: baseBackground.height + option.height / 2 + + Rectangle { + id: baseBackground + width: Const.macroButton + Const.microButton + 2 * Const.margin + height: width + radius: width / 2 + y: option.height / 2 + color: Theme.current.noneGlow + } + + Rectangle { + id: corner + width: baseBackground.width / 2 + height: baseBackground.height / 2 + y: option.height / 2 + anchors.right: baseBackground.right + color: baseBackground.color + } + + Rectangle { + id: option + width: Const.microButton + 2 * Const.microLightThickness + height: width + radius: width / 2 + anchors.verticalCenter: corner.top + anchors.horizontalCenter: corner.right + color: baseBackground.color + } + } + + Item { + id: borderGrad + implicitWidth: parent.implicitWidth + implicitHeight: parent.implicitHeight + anchors.fill: parent + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: background + } + + Rectangle { + width: parent.width + height: parent.height + color: "transparent" + + LinearGradient { + id: linGrad + anchors.fill: parent + start: Qt.point(0, parent.height) + end: Qt.point(0, 0) + gradient: Gradient { + GradientStop { + position: 0 + color: Theme.current.none + } + + GradientStop { + position: 1 + color: Theme.current.noneGlow + } + } + } + } + } + } + + DropShadow { + id: dropDown + anchors.fill: coloredRing + source: background + horizontalOffset: 3 + verticalOffset: 3 + radius: 4 + samples: 8 + color: Theme.current.light + } + + DropShadow { + id: dropUp + anchors.fill: coloredRing + source: background + horizontalOffset: - 3 + verticalOffset: - 3 + radius: 4 + samples: 8 + color: Theme.current.light + } + + InnerShadow { + id: inner + anchors.fill: coloredRing + source: background + horizontalOffset: 3 + verticalOffset: 3 + radius: 3 + samples: 6 + smooth: true + color: Theme.current.lightShadow + } +} diff --git a/ui/emulator/components/ModeButton.qml b/ui/emulator/components/ModeButton.qml new file mode 100644 index 0000000..b971fb3 --- /dev/null +++ b/ui/emulator/components/ModeButton.qml @@ -0,0 +1,63 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/const" + +ModeBg { + id: modeBackground + + property var image: "qrc:/icons/topLeft/utils.png" + + property var down: mainKnob.down + property var increase: incButton.down + property var decrease: decButton.down + + property var led: 1 + + property var stepInc + property var stepDec + + LightRing { + id: lightRing + colorMode: parent.led + anchors.verticalCenter: mainKnob.verticalCenter + anchors.horizontalCenter: mainKnob.horizontalCenter + width: Const.macroButton + 2 * thickness + indicator: true + } + + Knob { + id: mainKnob + image: parent.image + x: Const.microButton / 2 + Const.margin + anchors.bottom: parent.bottom + anchors.bottomMargin: x + } + + Knob { + id: decButton + anchors.verticalCenter: mainKnob.verticalCenter + anchors.right: mainKnob.left + anchors.rightMargin: Const.margin + implicitWidth: Const.microButton + implicitHeight: Const.microButton + onPressed: { + lightRing.timeFactor = - stepDec + lightRing.angle = lightRing.angle + Const.rotateStep * stepDec + } + } + + Knob { + id: incButton + anchors.verticalCenter: mainKnob.verticalCenter + anchors.left: mainKnob.right + anchors.leftMargin: Const.margin + implicitWidth: Const.microButton + implicitHeight: Const.microButton + onPressed: { + lightRing.timeFactor = stepInc + lightRing.angle = lightRing.angle + Const.rotateStep * stepInc + } + } +} diff --git a/ui/emulator/components/ModeOption.qml b/ui/emulator/components/ModeOption.qml new file mode 100644 index 0000000..faa1f25 --- /dev/null +++ b/ui/emulator/components/ModeOption.qml @@ -0,0 +1,77 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/const" + + +ModeBgOption { + id: modeBackground + + property var image: "qrc:/icons/topLeft/utils.png" + property var imageOption: "qrc:/icons/topLeft/utils.png" + + property bool down: mainKnob.down + property bool increase: incButton.down + property bool decrease: decButton.down + + property var led: 1 + property var ledOption: 0 + + property var stepInc + property var stepDec + + LightRing { + id: lightRing + colorMode: parent.led + anchors.verticalCenter: mainKnob.verticalCenter + anchors.horizontalCenter: mainKnob.horizontalCenter + width: Const.macroButton + 2 * thickness + indicator: true + } + + Knob { + id: mainKnob + image: parent.image + x: Const.microButton / 2 + Const.margin + anchors.bottom: parent.bottom + anchors.bottomMargin: x + } + + NeuImage { + id: option + image: parent.imageOption + anchors.right: parent.right + anchors.rightMargin: Const.microLightThickness + y: Const.microLightThickness + colorMode: parent.ledOption + implicitWidth: Const.microButton + implicitHeight: Const.microButton + } + + Knob { + id: decButton + anchors.verticalCenter: mainKnob.verticalCenter + anchors.right: mainKnob.left + anchors.rightMargin: Const.margin + implicitWidth: Const.microButton + implicitHeight: Const.microButton + onPressed: { + lightRing.timeFactor = - stepDec + lightRing.angle = lightRing.angle + Const.rotateStep * stepDec + } + } + + Knob { + id: incButton + anchors.verticalCenter: mainKnob.verticalCenter + anchors.left: mainKnob.right + anchors.leftMargin: Const.margin + implicitWidth: Const.microButton + implicitHeight: Const.microButton + onPressed: { + lightRing.timeFactor = stepInc + lightRing.angle = lightRing.angle + Const.rotateStep * stepInc + } + } +} diff --git a/ui/emulator/components/NeuButton.qml b/ui/emulator/components/NeuButton.qml new file mode 100755 index 0000000..e943bbf --- /dev/null +++ b/ui/emulator/components/NeuButton.qml @@ -0,0 +1,272 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Button { + id: button + property var image: "" + property var radius: Math.min(width / 2, height / 2) + property var timeToPress: 100 + + signal pressed + signal released + + onPressed: { button.down = true } + onReleased: { button.down = false } + + implicitWidth: Const.macroButton + implicitHeight: Const.macroButton + + contentItem: Item { + id: content + anchors.fill: parent + z: 1 + + Item { + property var factor: button.state == "Pressed" ? + Const.imageScalePressed : Const.imageScale + property var elevator: button.state == "Pressed" ? 3 : 0 + + anchors.horizontalCenter: parent.horizontalCenter + y: (parent.height * (1-factor)) / 2 + elevator + width: parent.width * factor + height: parent.height * factor + + Behavior on y { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Behavior on width { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Behavior on height { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Image { + id: img + anchors.fill: parent + source: image + fillMode: Image.PreserveAspectFit + antialiasing: true + smooth: true + } + + ColorOverlay { + anchors.fill: img + source: img + color: button.state == "Pressed" ? Theme.current.textSelected : Theme.current.text + antialiasing: true + smooth: true + } + } + } + + background: Rectangle{ + id: background + width: parent.implicitWidth + height: parent.implicitHeight + radius: button.radius + color: Theme.current.button + anchors.fill: parent + +// Rectangle { +// anchors.fill: parent + +// layer.enabled: true +// layer.effect: OpacityMask { +// maskSource: parent +// } +// color: Theme.current.button +// opacity: Theme.current.mergeOpacity + +// RadialGradient { +// anchors.fill: parent +// gradient: Gradient { +// GradientStop { position: 0.0; color: backLightColor } +// GradientStop { position: 0.3; color: backLightColor } +// GradientStop { position: 0.5; color: "transparent" } +// GradientStop { position: 1.0; color: "transparent" } +// } +// } +// } + + MouseArea { + hoverEnabled: true + anchors.fill: background + onEntered: { + button.state = "Hovering" + } + + onExited: { + button.state = "" + } + + onPressed: { + button.state = "Pressed" + button.pressed() + } + + onReleased: { + button.released() + if (containsMouse) + button.state = "Hovering" + else + button.state = "" + } + } + } + + DropShadow { + id: dropDown + anchors.fill: background + source: background + horizontalOffset: 6 + verticalOffset: 6 + radius: 10 + samples: 16 + color: Theme.current.shadow + } + + DropShadow { + id: dropUp + anchors.fill: background + source: background + horizontalOffset: -4 + verticalOffset: -4 + radius: 5 + samples: 10 + color: Theme.current.light + } + + + InnerShadow { + id: innerUp + anchors.fill: background + source: background + horizontalOffset: 3 + verticalOffset: 3 + radius: 2 + samples: 6 + smooth: true + color: Theme.current.shadow + } + + Item { + id: hoverLight + implicitWidth: parent.implicitWidth + implicitHeight: parent.implicitHeight + anchors.fill: parent + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: background + } + + Rectangle { + id: hoverGlow + width: 2 * parent.width + height: parent.height + x: - 2 * parent.width + color: "transparent" + + HoverGlow {} + } + } + + states: [ + State { + name: "Hovering" + PropertyChanges { + target: hoverGlow + x: 0 + } + }, + + State { + name: "Pressed" + PropertyChanges { + target: background + color: Theme.current.buttonSelected + } + + PropertyChanges { + target: dropDown + horizontalOffset: 0 + verticalOffset: 0 + radius: 0 + samples: 0 + } + + PropertyChanges { + target: dropUp + horizontalOffset: 0 + verticalOffset: 0 + radius: 0 + samples: 0 + } + + PropertyChanges { + target: innerUp + horizontalOffset: 6 + verticalOffset: 6 + radius: 6 + samples: 12 + } + } + ] + + transitions: [ + Transition { + from: ""; to: "Hovering" + NumberAnimation { + properties: "x" + duration: 500 + easing.type: Easing.OutQuad + } + }, + + Transition { + from: "*"; to: "Pressed" + + ColorAnimation { + properties: "color" + duration: timeToPress + } + + NumberAnimation { + properties: "horizontalOffset, verticalOffset, radius, samples" + duration: timeToPress + easing.type: Easing.InOutQuad + } + }, + + Transition { + from: "Pressed"; to: "*" + + ColorAnimation { + properties: "color" + duration: timeToPress + } + + NumberAnimation { + properties: "horizontalOffset, verticalOffset, radius, samples" + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + ] +} diff --git a/ui/emulator/components/NeuImage.qml b/ui/emulator/components/NeuImage.qml new file mode 100644 index 0000000..9f29643 --- /dev/null +++ b/ui/emulator/components/NeuImage.qml @@ -0,0 +1,101 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Item { + id: button + property var image: "" + property var radius: Math.min(width / 2, height / 2) + + property var colorMode: 0 // 0->None; 1->White; 2->Green; 3->Yellow + property color backLightColor: getColorMode() + + implicitWidth: Const.microButton + implicitHeight: Const.microButton + + function getColorMode() { + switch(colorMode) { + case(0): return Theme.current.none + case(1): return Theme.current.white + case(2): return Theme.current.green + case(3): return Theme.current.yellow + } + } + + Item { + id: content + width: parent.implicitWidth + height: parent.implicitWidth + z: 1 + + Item { + property var factor: 0.8 + + anchors.horizontalCenter: parent.horizontalCenter + y: (parent.height * (1-factor)) / 2 + width: parent.width * factor + height: parent.height * factor + + Image { + id: img + anchors.fill: parent + source: image + fillMode: Image.PreserveAspectFit + antialiasing: true + smooth: true + } + + ColorOverlay { + anchors.fill: img + source: img + color: Theme.current.text + antialiasing: true + smooth: true + } + } + } + + Rectangle{ + id: background + width: parent.implicitWidth + height: parent.implicitHeight + radius: button.radius + color: Theme.current.button + anchors.fill: parent + } + + DropShadow { + id: dropDown + anchors.fill: background + source: background + horizontalOffset: 6 + verticalOffset: 6 + radius: 10 + samples: 16 + color: Theme.current.shadow + } + + DropShadow { + id: dropUp + anchors.fill: background + source: background + horizontalOffset: -4 + verticalOffset: -4 + radius: 5 + samples: 10 + color: Theme.current.light + } + + Glow { + id: glow + anchors.fill: background + source: background + radius: 10 + samples: 20 + color: backLightColor + transparentBorder: true + } +} diff --git a/ui/emulator/components/NeuLight.qml b/ui/emulator/components/NeuLight.qml new file mode 100644 index 0000000..cfd238e --- /dev/null +++ b/ui/emulator/components/NeuLight.qml @@ -0,0 +1,304 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Button { + id: button + property var image: "" + property var radius: Math.min(width / 2, height / 2) + property var timeToPress: 100 + property var colorMode: 0 // 0->None; 1->White; 2->Green; 3->Yellow + property color backLightColor: getColorMode() + property var specialScale: 1 + property var visibleGlow: true + + signal pressed + signal released + + onPressed: { button.down = true } + onReleased: { button.down = false } + + implicitWidth: Const.macroButton + implicitHeight: Const.macroButton + + function getColorMode() { + switch(colorMode) { + case(0): return Theme.current.none + case(1): return Theme.current.white + case(2): return Theme.current.green + case(3): return Theme.current.yellow + } + } + + contentItem: Item { + id: content + anchors.fill: parent + z: 1 + + Item { + property var factor: specialScale * (button.state == "Pressed" ? + Const.imageScalePressed : Const.imageScale) + property var elevator: button.state == "Pressed" ? 3 : 0 + + anchors.horizontalCenter: parent.horizontalCenter + y: (parent.height * (1-factor)) / 2 + elevator + width: parent.width * factor + height: parent.height * factor + + Behavior on y { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Behavior on width { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Behavior on height { + NumberAnimation { + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + + Image { + id: img + anchors.fill: parent + source: image + fillMode: Image.PreserveAspectFit + antialiasing: true + smooth: true + } + + ColorOverlay { + anchors.fill: img + source: img + color: button.state == "Pressed" ? Theme.current.textSelected : Theme.current.text + antialiasing: true + smooth: true + } + } + } + + background: Rectangle{ + id: background + width: parent.implicitWidth + height: parent.implicitHeight + radius: button.radius + color: Theme.current.button + anchors.fill: parent + +// Rectangle { +// anchors.fill: parent + +// layer.enabled: true +// layer.effect: OpacityMask { +// maskSource: parent +// } +// color: Theme.current.button +// opacity: Theme.current.mergeOpacity + +// RadialGradient { +// anchors.fill: parent +// gradient: Gradient { +// GradientStop { position: 0.0; color: backLightColor } +// GradientStop { position: 0.3; color: backLightColor } +// GradientStop { position: 0.5; color: "transparent" } +// GradientStop { position: 1.0; color: "transparent" } +// } +// } +// } + + MouseArea { + hoverEnabled: true + anchors.fill: background + onEntered: { + button.state = "Hovering" + } + + onExited: { + button.state = "" + } + + onPressed: { + button.state = "Pressed" + button.pressed() + } + + onReleased: { + button.released() + if (containsMouse) + button.state = "Hovering" + else + button.state = "" + } + } + } + + DropShadow { + id: dropDown + anchors.fill: background + source: background + horizontalOffset: 6 + verticalOffset: 6 + radius: 10 + samples: 16 + color: Theme.current.shadow + } + + DropShadow { + id: dropUp + anchors.fill: background + source: background + horizontalOffset: -4 + verticalOffset: -4 + radius: 5 + samples: 10 + color: Theme.current.light + } + + + InnerShadow { + id: innerUp + anchors.fill: background + source: background + horizontalOffset: 3 + verticalOffset: 3 + radius: 2 + samples: 6 + smooth: true + color: Theme.current.shadow + } + + Glow { + id: glow + anchors.fill: background + source: background + radius: 10 + samples: 20 + color: backLightColor + transparentBorder: true + visible: visibleGlow + } + + Item { + id: hoverLight + implicitWidth: parent.implicitWidth + implicitHeight: parent.implicitHeight + anchors.fill: parent + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: background + } + + Rectangle { + id: hoverGlow + width: 2 * parent.width + height: parent.height + x: - 2 * parent.width + color: "transparent" + + HoverGlow {} + } + } + + states: [ + State { + name: "Hovering" + PropertyChanges { + target: hoverGlow + x: 0 + } + }, + + State { + name: "Pressed" + PropertyChanges { + target: background + color: Theme.current.buttonSelected + } + + PropertyChanges { + target: dropDown + horizontalOffset: 0 + verticalOffset: 0 + radius: 0 + samples: 0 + } + + PropertyChanges { + target: dropUp + horizontalOffset: 0 + verticalOffset: 0 + radius: 0 + samples: 0 + } + + PropertyChanges { + target: innerUp + horizontalOffset: 6 + verticalOffset: 6 + radius: 6 + samples: 12 + } + + // PropertyChanges { + // target: innerDown + // horizontalOffset: - 4 + // verticalOffset: - 4 + // radius: 4 + // samples: 8 + // } + } + ] + + transitions: [ + Transition { + from: ""; to: "Hovering" + NumberAnimation { + properties: "x" + duration: 500 + easing.type: Easing.OutQuad + } + }, + + Transition { + from: "*"; to: "Pressed" + + ColorAnimation { + properties: "color" + duration: timeToPress + } + + NumberAnimation { + properties: "horizontalOffset, verticalOffset, radius, samples" + duration: timeToPress + easing.type: Easing.InOutQuad + } + }, + + Transition { + from: "Pressed"; to: "*" + + ColorAnimation { + properties: "color" + duration: timeToPress + } + + NumberAnimation { + properties: "horizontalOffset, verticalOffset, radius, samples" + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + ] +} diff --git a/ui/emulator/components/SegmentButton.qml b/ui/emulator/components/SegmentButton.qml new file mode 100644 index 0000000..ac7f745 --- /dev/null +++ b/ui/emulator/components/SegmentButton.qml @@ -0,0 +1,186 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Button { + id: button + property var timeToPress: 100 + property var angle: 45 + signal pressed + signal released + + onPressed: { button.down = true } + onReleased: { button.down = false } + + background: SegmentCircle { + id: background + + angle: button.angle + + MouseArea { + hoverEnabled: true + anchors.fill: background + onEntered: { + button.state = "Hovering" + } + + onExited: { + button.state = "" + } + + onPressed: { + button.state = "Pressed" + button.pressed() + } + + onReleased: { + button.released() + if (containsMouse) + button.state = "Hovering" + else + button.state = "" + } + } + } + + DropShadow { + id: dropDown + anchors.fill: background + source: background + horizontalOffset: 6 + verticalOffset: 6 + radius: 10 + samples: 16 + color: Theme.current.shadow + } + + DropShadow { + id: dropUp + anchors.fill: background + source: background + horizontalOffset: -4 + verticalOffset: -4 + radius: 5 + samples: 10 + color: Theme.current.light + } + + + InnerShadow { + id: innerUp + anchors.fill: background + source: background + horizontalOffset: 3 + verticalOffset: 3 + radius: 2 + samples: 6 + smooth: true + color: Theme.current.shadow + } + + Item { + id: hoverLight + anchors.fill: background + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: background + } + + Rectangle { + id: hoverGlow + width: 2 * parent.width + height: parent.height + x: - 2 * parent.width + color: "transparent" + + HoverGlow {} + } + } + + states: [ + State { + name: "Hovering" + PropertyChanges { + target: hoverGlow + x: 0 + } + }, + + State { + name: "Pressed" + PropertyChanges { + target: background + color: Theme.current.buttonSelected + } + + PropertyChanges { + target: dropDown + horizontalOffset: 0 + verticalOffset: 0 + radius: 0 + samples: 0 + } + + PropertyChanges { + target: dropUp + horizontalOffset: 0 + verticalOffset: 0 + radius: 0 + samples: 0 + } + + PropertyChanges { + target: innerUp + horizontalOffset: 6 + verticalOffset: 6 + radius: 6 + samples: 12 + } + } + ] + + transitions: [ + Transition { + from: ""; to: "Hovering" + NumberAnimation { + properties: "x" + duration: 500 + easing.type: Easing.OutQuad + } + }, + + Transition { + from: "*"; to: "Pressed" + + ColorAnimation { + properties: "color" + duration: timeToPress + } + + NumberAnimation { + properties: "horizontalOffset, verticalOffset, radius, samples" + duration: timeToPress + easing.type: Easing.InOutQuad + } + }, + + Transition { + from: "Pressed"; to: "*" + + ColorAnimation { + properties: "color" + duration: timeToPress + } + + NumberAnimation { + properties: "horizontalOffset, verticalOffset, radius, samples" + duration: timeToPress + easing.type: Easing.InOutQuad + } + } + ] +} diff --git a/ui/emulator/components/SegmentCircle.qml b/ui/emulator/components/SegmentCircle.qml new file mode 100644 index 0000000..496fae4 --- /dev/null +++ b/ui/emulator/components/SegmentCircle.qml @@ -0,0 +1,51 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.13 +import QtQuick.Shapes 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Item { + id: control + property var angle: 45 + property var color: Theme.current.button + + implicitWidth: Const.radiusLong * 2 + implicitHeight: Const.radiusLong * 2 + + Rectangle { + id: innerShape + + width: Const.radiusLong + height: Const.radiusLong + color: "transparent" + clip: true + + Rectangle { + id: baseCircle + width: Const.radiusLong * 2 + height: width + radius: width / 2 + color: "transparent" + border.width: Const.radiusLong - Const.radiusShort + border.color: control.color + } + + transform: Rotation { + angle: control.angle + origin { + x: Const.radiusLong + y: Const.radiusLong + } + + axis { + z: 1 + x: 0 + y: 0 + } + } + } +} + + + diff --git a/ui/emulator/components/SliderBar.qml b/ui/emulator/components/SliderBar.qml new file mode 100644 index 0000000..b139100 --- /dev/null +++ b/ui/emulator/components/SliderBar.qml @@ -0,0 +1,219 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/theme" +import "qrc:/const" + +Item { + id: main + property var color: Theme.current.green + property var colorDeep: Theme.current.greenDeep + property var sliderSize: Const.sliderHeight + property var backgroundLenght: Const.sliderWidth + property bool flip: false + property var value: control.value + + implicitHeight: sliderSize + width: backgroundLenght + + Slider { + id: control + width: (4 / 5) * parent.width + height: Const.sliderThickness + x: parent.width - width + y: 0 + + from: flip ? -1 : 1 + to: flip ? -5 : 5 + stepSize: 1 + value: flip ? -1 : 1 + snapMode: Slider.SnapOnRelease + + transform: Rotation { + origin { + x: control.width / 2 - main.width / 10 + y: control.height / 2 + } + + axis { + z: 0 + x: 0 + y: 1 + } + + angle: flip ? 180 : 0 + } + + background: Item { + id: controlBackground + width: main.width + height: parent.height + x: - parent.x + + Item { + id: backgroundObject + width: parent.width + height: parent.height + + Rectangle { + id: backgroundArea + width: parent.width + height: parent.height + radius: height / 2 + color: "pink" + } + + Item { + id: backgroundGrad + implicitWidth: parent.implicitWidth + implicitHeight: parent.implicitHeight + anchors.fill: parent + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: backgroundArea + } + + Rectangle { + width: parent.width + height: parent.height + color: "transparent" + + LinearGradient { + anchors.fill: parent + start: Qt.point(parent.width / 2 , parent.height) + end: Qt.point(0, 0) + gradient: Gradient { + GradientStop { + position: 0 + color: Theme.current.none + } + + GradientStop { + position: 1 + color: Theme.current.noneDeep + } + } + } + } + } + + Rectangle { + id: progressArea + width: (control.visualPosition * parent.width * 4 / 5) + (parent.width / 5) + height: parent.height + radius: height / 2 + color: "pink" + } + + Item { + id: progressGrad + anchors.fill: progressArea + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: progressArea + } + + Rectangle { + width: parent.width + height: parent.height + color: "transparent" + + LinearGradient { + anchors.fill: parent + start: Qt.point(parent.width / 2 , parent.height) + end: Qt.point(0, 0) + gradient: Gradient { + GradientStop { + position: 0 + color: main.color + } + + GradientStop { + position: 1 + color: main.colorDeep + } + } + } + } + } + } + + DropShadow { + id: dropDown + anchors.fill: backgroundObject + source: backgroundObject + horizontalOffset: 3 + verticalOffset: 3 + radius: 4 + samples: 8 + color: Theme.current.light + } + + DropShadow { + id: dropUp + anchors.fill: backgroundObject + source: backgroundObject + horizontalOffset: - 3 + verticalOffset: - 3 + radius: 4 + samples: 8 + color: Theme.current.light + } + + InnerShadow { + id: inner + anchors.fill: backgroundObject + source: backgroundObject + horizontalOffset: 3 + verticalOffset: 3 + radius: 3 + samples: 6 + smooth: true + color: Theme.current.lightShadow + } + } + + handle: KnobImage { + id: knob + x: control.leftPadding + (control.visualPosition * control.availableWidth) - width / 2 + y: control.topPadding + control.availableHeight / 2 - height / 2 + implicitWidth: sliderSize + implicitHeight: sliderSize + radius: implicitHeight / 2 + + Item { + width: parent.width + height: parent.height + anchors.centerIn: knob + + Text { + horizontalAlignment: Text.horizontalCenter + text: control.value + color: Theme.current.text + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + + transform: Rotation { + origin { + x: knob.width / 2 + y: knob.height / 2 + } + + axis { + z: 0 + x: 0 + y: 1 + } + + angle: flip ? 180 : 0 + } + } + } + } +} + + diff --git a/ui/emulator/components/Trackball.qml b/ui/emulator/components/Trackball.qml new file mode 100644 index 0000000..ff51b8f --- /dev/null +++ b/ui/emulator/components/Trackball.qml @@ -0,0 +1,133 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.13 +import QtGraphicalEffects 1.13 + +import "qrc:/const" + +Item { + id: control + + property var longBut: 70 //Const.macroButton + property var shortBut: 32 //Const.microButton + property var margin: 10 //Const.margin + + property alias leftDown: leftBut.down + property alias rightDown: rightBut.down + property alias topDown: topBut.down + property alias bottomDown: bottomBut.down + + property alias topLeftDown: topLeftBut.down + property alias topRightDown: topRightBut.down + property alias bottomLeftDown: bottomLeftBut.down + property alias bottomRightDown: bottomRightBut.down + + property var leftColor + property var rightColor + property var topColor + property var bottomColor + + property var topLeftColor + property var topRightColor + property var bottomLeftColor + property var bottomRightColor + + width: longBut + shortBut + 2 * margin + height: width + + + NeuButton { + enabled: false + anchors.centerIn: parent + width: longBut + shortBut + 2 * margin + 115 + height: width + } + + LightRing { + colorMode: 0 + anchors.centerIn: parent + width: longBut + shortBut - margin + height: width + thickness: 10 + } + + NeuLight { + id: leftBut + anchors.right: parent.left + anchors.verticalCenter: parent.verticalCenter + implicitWidth: shortBut + implicitHeight: longBut + colorMode: leftColor + visibleGlow: false + } + + NeuLight { + id: rightBut + anchors.left: parent.right + anchors.verticalCenter: parent.verticalCenter + implicitWidth: shortBut + implicitHeight: longBut + colorMode: rightColor + visibleGlow: false + } + + NeuLight { + id: topBut + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.top + implicitWidth: longBut + implicitHeight: shortBut + colorMode: topColor + visibleGlow: false + } + + NeuLight { + id: bottomBut + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.bottom + implicitWidth: longBut + implicitHeight: shortBut + colorMode: bottomColor + visibleGlow: false + } + + NeuLight { + id: topLeftBut + anchors.verticalCenter: parent.top + anchors.horizontalCenter: parent.left + implicitWidth: shortBut + implicitHeight: shortBut + colorMode: topLeftColor + visibleGlow: false + } + + NeuLight { + id: topRightBut + anchors.verticalCenter: parent.top + anchors.horizontalCenter: parent.right + implicitWidth: shortBut + implicitHeight: shortBut + colorMode: topRightColor + visibleGlow: false + } + + NeuLight { + id: bottomLeftBut + anchors.verticalCenter: parent.bottom + anchors.horizontalCenter: parent.left + implicitWidth: shortBut + implicitHeight: shortBut + colorMode: bottomLeftColor + visibleGlow: false + } + + NeuLight { + id: bottomRightBut + anchors.verticalCenter: parent.bottom + anchors.horizontalCenter: parent.right + implicitWidth: shortBut + implicitHeight: shortBut + colorMode: bottomRightColor + visibleGlow: false + } +} + diff --git a/ui/emulator/elements/JoystickButtonBind.qml b/ui/emulator/elements/JoystickButtonBind.qml new file mode 100644 index 0000000..0087963 --- /dev/null +++ b/ui/emulator/elements/JoystickButtonBind.qml @@ -0,0 +1,52 @@ +import QtQuick 2.0 + +import de.skycoder42.QtMvvm.Core 1.0 +import de.skycoder42.QtMvvm.Quick 1.0 +import com.example.consoleemulator 1.0 + +import "qrc:/qtmvvm/views" +import "qrc:/const" +import "qrc:/emulator/components" + +JoystickButton { + property var nameCenter + property var nameLeft + property var nameRight + property var nameTop + property var nameBottom + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "centerButDown" + viewModelProperty: nameCenter + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "leftButDown" + viewModelProperty: nameLeft + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "rightButDown" + viewModelProperty: nameRight + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "topButDown" + viewModelProperty: nameTop + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "bottomButDown" + viewModelProperty: nameBottom + type: MvvmBinding.OneWayToViewModel + } +} diff --git a/ui/emulator/elements/KnobLightBind.qml b/ui/emulator/elements/KnobLightBind.qml new file mode 100644 index 0000000..a1dd7df --- /dev/null +++ b/ui/emulator/elements/KnobLightBind.qml @@ -0,0 +1,28 @@ +import QtQuick 2.0 + +import de.skycoder42.QtMvvm.Core 1.0 +import de.skycoder42.QtMvvm.Quick 1.0 +import com.example.consoleemulator 1.0 + +import "qrc:/qtmvvm/views" +import "qrc:/const" +import "qrc:/emulator/components" + +KnobLight { + id: knobLight + property var name + property var nameLed: name + "Led" + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "down" + viewModelProperty: name + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "colorMode" + viewModelProperty: nameLed + } +} diff --git a/ui/emulator/elements/LightImageBind.qml b/ui/emulator/elements/LightImageBind.qml new file mode 100644 index 0000000..b3fefb5 --- /dev/null +++ b/ui/emulator/elements/LightImageBind.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 + +import de.skycoder42.QtMvvm.Core 1.0 +import de.skycoder42.QtMvvm.Quick 1.0 +import com.example.consoleemulator 1.0 + +import "qrc:/qtmvvm/views" +import "qrc:/const" +import "qrc:/emulator/components" + +LightImage { + property var nameLed + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "colorMode" + viewModelProperty: nameLed + } +} diff --git a/ui/emulator/elements/ModeButtonBind.qml b/ui/emulator/elements/ModeButtonBind.qml new file mode 100644 index 0000000..a520298 --- /dev/null +++ b/ui/emulator/elements/ModeButtonBind.qml @@ -0,0 +1,55 @@ +import QtQuick 2.0 + +import de.skycoder42.QtMvvm.Core 1.0 +import de.skycoder42.QtMvvm.Quick 1.0 +import com.example.consoleemulator 1.0 + +import "qrc:/qtmvvm/views" +import "qrc:/const" +import "qrc:/emulator/components" + +ModeButton { + property var name: "" + property var nameIncrease: "" + property var nameDecrease: "" + property var nameLed: "" + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "stepInc" + viewModelProperty: "stepInc" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "stepDec" + viewModelProperty: "stepDec" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "down" + viewModelProperty: name + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "increase" + viewModelProperty: nameIncrease + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "decrease" + viewModelProperty: nameDecrease + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "led" + viewModelProperty: nameLed + } +} diff --git a/ui/emulator/elements/ModeOptionBind.qml b/ui/emulator/elements/ModeOptionBind.qml new file mode 100644 index 0000000..5302511 --- /dev/null +++ b/ui/emulator/elements/ModeOptionBind.qml @@ -0,0 +1,55 @@ +import QtQuick 2.0 + +import de.skycoder42.QtMvvm.Core 1.0 +import de.skycoder42.QtMvvm.Quick 1.0 +import com.example.consoleemulator 1.0 + +import "qrc:/qtmvvm/views" +import "qrc:/const" +import "qrc:/emulator/components" + +ModeOption { + property var name: "" + property var nameIncrease: "" + property var nameDecrease: "" + property var nameLed: "" + property var nameLedOption: "" + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "stepInc" + viewModelProperty: "stepInc" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "stepDec" + viewModelProperty: "stepDec" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "increase" + viewModelProperty: nameIncrease + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "decrease" + viewModelProperty: nameDecrease + type: MvvmBinding.OneWayToViewModel + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "led" + viewModelProperty: nameLed + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "ledOption" + viewModelProperty: nameLedOption + } +} diff --git a/ui/emulator/elements/SliderBarBind.qml b/ui/emulator/elements/SliderBarBind.qml new file mode 100644 index 0000000..885f02a --- /dev/null +++ b/ui/emulator/elements/SliderBarBind.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 + +import de.skycoder42.QtMvvm.Core 1.0 +import de.skycoder42.QtMvvm.Quick 1.0 +import com.example.consoleemulator 1.0 + +import "qrc:/qtmvvm/views" +import "qrc:/const" +import "qrc:/emulator/components" + +SliderBar { + property var name: "" + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "value" + viewModelProperty: name + } +} diff --git a/ui/emulator/elements/TrackballBind.qml b/ui/emulator/elements/TrackballBind.qml new file mode 100644 index 0000000..cab847e --- /dev/null +++ b/ui/emulator/elements/TrackballBind.qml @@ -0,0 +1,127 @@ +import QtQuick 2.0 + +import de.skycoder42.QtMvvm.Core 1.0 +import de.skycoder42.QtMvvm.Quick 1.0 +import com.example.consoleemulator 1.0 + +import "qrc:/emulator/components" + +Trackball { + property bool leftPressed: leftDown + property bool rightPressed: rightDown + property bool topPressed: topDown + property bool bottomPressed: bottomDown + + property bool topLeftPressed: topLeftDown + property bool topRightPressed: topRightDown + property bool bottomLeftPressed: bottomLeftDown + property bool bottomRightPressed: bottomRightDown + + onLeftDownChanged: leftPressed = leftDown + onRightDownChanged: rightPressed = rightDown + onTopDownChanged: topPressed = topDown + onBottomDownChanged: bottomPressed = bottomDown + + onTopLeftDownChanged: topLeftPressed = topLeftDown + onTopRightDownChanged: topRightPressed = topRightDown + onBottomLeftDownChanged: bottomLeftPressed = bottomLeftDown + onBottomRightDownChanged: bottomRightPressed = bottomRightDown + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "leftPressed" + viewModelProperty: "trackballLeft" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "rightPressed" + viewModelProperty: "trackballRight" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "topPressed" + viewModelProperty: "trackballTop" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "bottomPressed" + viewModelProperty: "trackballBottom" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "topLeftPressed" + viewModelProperty: "trackballTopLeft" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "topRightPressed" + viewModelProperty: "trackballTopRight" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "bottomLeftPressed" + viewModelProperty: "trackballBottomLeft" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "bottomRightPressed" + viewModelProperty: "trackballBottomRight" + } + + // Leds + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "leftColor" + viewModelProperty: "trackballLeft" + "Led" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "rightColor" + viewModelProperty: "trackballRight" + "Led" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "topColor" + viewModelProperty: "trackballTop" + "Led" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "bottomColor" + viewModelProperty: "trackballBottom" + "Led" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "topLeftColor" + viewModelProperty: "trackballTopLeft" + "Led" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "topRightColor" + viewModelProperty: "trackballTopRight" + "Led" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "bottomLeftColor" + viewModelProperty: "trackballBottomLeft" + "Led" + } + + MvvmBinding { + viewModel: mainView.viewModel + viewProperty: "bottomRightColor" + viewModelProperty: "trackballBottomRight" + "Led" + } +} diff --git a/ui/emulator/items/BottomRight.qml b/ui/emulator/items/BottomRight.qml new file mode 100755 index 0000000..a347ed5 --- /dev/null +++ b/ui/emulator/items/BottomRight.qml @@ -0,0 +1,57 @@ +import QtQuick 2.0 + +import "qrc:/emulator/elements" +import "qrc:/const" + +Item { + width: 284 + height: 284 + x: 1433 + y: 520 + + KnobLightBind { + name: "dual" + image: "qrc:/icons/bottomRight/dual.png" + x: 20 + } + + KnobLightBind { + name: "quad" + image: "qrc:/icons/bottomRight/quad.png" + x: 118 + } + + KnobLightBind { + name: "single" + image: "qrc:/icons/bottomRight/single.png" + x: 220 + } + + KnobLightBind { + name: "p2" + image: "qrc:/icons/bottomRight/p2.png" + y: 110 + } + + KnobLightBind { + name: "p3" + image: "qrc:/icons/bottomRight/p3.png" + x: 100 + y: 110 + } + + KnobLightBind { + name: "p4" + image: "qrc:/icons/bottomRight/p4.png" + x: 200 + y: 110 + } + + KnobLightBind { + name: "p1" + image: "qrc:/icons/bottomRight/p1.png" + width: 90 + x: 154 + y: 220 + } +} diff --git a/ui/emulator/items/CurveButtons.qml b/ui/emulator/items/CurveButtons.qml new file mode 100755 index 0000000..af1e4c4 --- /dev/null +++ b/ui/emulator/items/CurveButtons.qml @@ -0,0 +1,84 @@ +import QtQuick 2.0 + +import "qrc:/emulator/elements" +import "qrc:/const" + +Item { + width: childrenRect.width + height: childrenRect.height + + x: 600 + y: 430 + + KnobLightBind { + name: "exit" + image: "qrc:/icons/curveButtons/exit.png" + width: 90 + y: 310 + } + + KnobLightBind { + name: "freeze" + image: "qrc:/icons/curveButtons/freeze.png" + width: 140 + x: 630 + y: 310 + colorMode: 2 + } + + KnobLightBind { + name: "pointer" + image: "qrc:/icons/curveButtons/pointer.png" + x: 58 + y: 200 + } + + KnobLightBind { + name: "autoSet" + image: "qrc:/icons/curveButtons/auto.png" + x: 602 + y: 200 + } + + KnobLightBind { + name: "abc" + image: "qrc:/icons/curveButtons/abc.png" + x: 106 + y: 90 + } + + KnobLightBind { + name: "fourD" + image: "qrc:/icons/curveButtons/4d.png" + width: 90 + x: 554 + y: 90 + } + + KnobLightBind { + name: "clear" + image: "qrc:/icons/curveButtons/clear.png" + x: 202 + y: 20 + } + + KnobLightBind { + name: "threeD" + image: "qrc:/icons/curveButtons/3d.png" + x: 458 + y: 20 + } + + KnobLightBind { + name: "measure" + image: "qrc:/icons/curveButtons/meas.png" + width: 90 + x: 317 + } + + KnobLightBind { + name: "bodyMark" + image: "qrc:/icons/curveButtons/bodyMark.png" + y: 90 + } +} diff --git a/ui/emulator/items/Encoders.qml b/ui/emulator/items/Encoders.qml new file mode 100755 index 0000000..0840bd8 --- /dev/null +++ b/ui/emulator/items/Encoders.qml @@ -0,0 +1,76 @@ +import QtQuick 2.0 + +import "qrc:/emulator/elements" +import "qrc:/const" + +Item { +// width: 670 +// height: 240 +// x: 891 + + width: childrenRect.width + height: childrenRect.height + anchors.horizontalCenter: parent.horizontalCenter + y: 210 + + Row { + spacing: 40 + ModeOptionBind { + id: modePw + y: 130 + name: "modePwCenter" + nameLed: "modePwCenterLed" + nameLedOption: "modeBLed" // x name + nameIncrease: "modePwRight" + nameDecrease: "modePwLeft" + image: "qrc:/icons/encoder/modePw.png" + imageOption: "qrc:/icons/encoder/x.png" + } + + ModeOptionBind { + id: modeM + y: 41 + name: "modeMCenter" + nameLed: "modeMCenterLed" + nameLedOption: "modeCLed" // y name + nameIncrease: "modeMRight" + nameDecrease: "modeMLeft" + image: "qrc:/icons/encoder/modeM.png" + imageOption: "qrc:/icons/encoder/y.png" + } + + ModeOptionBind { + id: modePd + name: "modePdCenter" + nameLed: "modePdCenterLed" + nameLedOption: "modePdLed" // z name + nameIncrease: "modePdRight" + nameDecrease: "modePdLeft" + imageOption: "qrc:/icons/encoder/z.png" + image: "qrc:/icons/encoder/modePd.png" + } + + ModeOptionBind { + id: modeC + y: 41 + name: "modeCCenter" + nameLed: "modeCCenterLed" + nameLedOption: "modeMLed" // quadrat name + nameIncrease: "modeCRight" + nameDecrease: "modeCLeft" + imageOption: "qrc:/icons/encoder/quadratic.png" + image: "qrc:/icons/encoder/modeC.png" + } + + ModeButtonBind { + id: modeB + y: 130 + name: "modeBCenter" + nameIncrease: "modeBRight" + nameDecrease: "modeBLeft" + nameLed: "modeBCenterLed" + image: "qrc:/icons/encoder/mode2d.png" + led: 2 + } + } +} diff --git a/ui/emulator/items/JoystickCouple.qml b/ui/emulator/items/JoystickCouple.qml new file mode 100644 index 0000000..5dbd22e --- /dev/null +++ b/ui/emulator/items/JoystickCouple.qml @@ -0,0 +1,69 @@ +import QtQuick 2.0 + +import "qrc:/emulator/elements" +import "qrc:/const" + +Item { + y: 244 + + JoystickButtonBind { + id: leftJoy +// name: "depth" + nameCenter: "depthCenter" + nameLeft: "depthLeft" + nameRight: "depthRight" + nameTop: "depthTop" + nameBottom: "depthBottom" + x: 1481 + } + + Row { + spacing: 10 + anchors.top: leftJoy.bottom + anchors.topMargin: 10 + anchors.horizontalCenter: leftJoy.horizontalCenter + + LightImageBind { + nameLed: "depthCenterLed" + image: "qrc:/icons/miniButton/zoom.png" + } + + LightImageBind { + nameLed: "depthBottomLed" + image: "qrc:/icons/miniButton/depth.png" + } + } + + JoystickButtonBind { + id: rightJoy +// name: "focus" + nameCenter: "focusCenter" + nameLeft: "focusLeft" + nameRight: "focusRight" + nameTop: "focusTop" + nameBottom: "focusBottom" + x: 1711 + } + + Row { + spacing: 10 + anchors.top: rightJoy.bottom + anchors.topMargin: 10 + anchors.horizontalCenter: rightJoy.horizontalCenter + + LightImageBind { + nameLed: "focusLed" + image: "qrc:/icons/miniButton/angle.png" + } + + LightImageBind { + nameLed: "focusCenterLed" + image: "qrc:/icons/miniButton/focusZone.png" + } + + LightImageBind { + nameLed: "focusBottomLed" + image: "qrc:/icons/miniButton/focusDepth.png" + } + } +} diff --git a/ui/emulator/items/Joysticks.qml b/ui/emulator/items/Joysticks.qml new file mode 100755 index 0000000..43d6e25 --- /dev/null +++ b/ui/emulator/items/Joysticks.qml @@ -0,0 +1,65 @@ +import QtQuick 2.0 + +import "qrc:/emulator/elements" +import "qrc:/const" + +Item { + width: childrenRect.width + height: childrenRect.height + anchors.horizontalCenter: parent.horizontalCenter + + // width: 820 + // height: 80 + // x: 550 + + y: 50 + + Row { + spacing: 64 + + JoystickButtonBind { + id: joystick1 + nameCenter: "js1Center" + nameLeft: "js1Left" + nameRight: "js1Right" + nameTop: "js1Top" + nameBottom: "js1Bottom" + } + + JoystickButtonBind { + id: joystick2 + nameCenter: "js2Center" + nameLeft: "js2Left" + nameRight: "js2Right" + nameTop: "js2Top" + nameBottom: "js2Bottom" + } + + JoystickButtonBind { + id: joystick3 + nameCenter: "js3Center" + nameLeft: "js3Left" + nameRight: "js3Right" + nameTop: "js3Top" + nameBottom: "js3Bottom" + } + + JoystickButtonBind { + id: joystick4 + nameCenter: "js4Center" + nameLeft: "js4Left" + nameRight: "js4Right" + nameTop: "js4Top" + nameBottom: "js4Bottom" + } + + JoystickButtonBind { + id: joystick5 + nameCenter: "js5Center" + nameLeft: "js5Left" + nameRight: "js5Right" + nameTop: "js5Top" + nameBottom: "js5Bottom" + } + } +} diff --git a/ui/emulator/items/Setting.qml b/ui/emulator/items/Setting.qml new file mode 100644 index 0000000..17a20fb --- /dev/null +++ b/ui/emulator/items/Setting.qml @@ -0,0 +1,85 @@ +import QtQuick 2.0 + +import "qrc:/emulator/components" +import "qrc:/emulator/elements" +import "qrc:/const" +import "qrc:/theme" + +Item { + width: childrenRect.width + height: childrenRect.height + + Column { + spacing: 15 + + Item { + width: Const.textWidth + implicitHeight: Const.textHeight + + Text { + horizontalAlignment: Text.horizontalCenter + text: "Incremental step" + color: Theme.current.text + anchors.verticalCenter: parent.verticalCenter + } + } + + SliderBarBind { + name: "stepInc" + } + + Item { + width: Const.textWidth + implicitHeight: Const.textHeight + + Text { + horizontalAlignment: Text.horizontalCenter + text: "Decremental step" + color: Theme.current.text + } + } + + SliderBarBind { + name: "stepDec" + color: Theme.current.yellow + colorDeep: Theme.current.yellowDeep + flip: true + } + + Row { + width: Const.sliderWidth + height: Const.sliderHeight + + Item { + width: Const.textWidth / 3 + height: Const.textHeight + anchors.verticalCenter: parent.verticalCenter + Text { + anchors.verticalCenter: parent.verticalCenter + horizontalAlignment: Text.horizontalCenter + text: "Theme" + color: Theme.current.text + } + } + + NeuLight { + anchors.verticalCenter: parent.verticalCenter + colorMode: 0 + width: Const.microButton + height: Const.microButton + image: Theme.current=== Theme.dark ? "qrc:/icons/uiMode/light.svg" : + "qrc:/icons/uiMode/dark.svg" + MouseArea{ + anchors.fill: parent + onClicked: { + if(Theme.current=== Theme.dark) { + Theme.current = Theme.light + } else { + Theme.current = Theme.dark + } + } + } + } + } + } +} diff --git a/ui/emulator/items/TopLeft.qml b/ui/emulator/items/TopLeft.qml new file mode 100755 index 0000000..6afa1e1 --- /dev/null +++ b/ui/emulator/items/TopLeft.qml @@ -0,0 +1,38 @@ +import QtQuick.Layouts 1.13 + +import "qrc:/emulator/elements" +import "qrc:/emulator/components" +import "qrc:/const" + +GridLayout { + id: topLeft + x: 70 + y: 120 + rows: 3 + columns: 4 + rowSpacing: 36 + columnSpacing: 36 + + NeuLight { + image: "qrc:/icons/topLeft/power.png" + Layout.column: 3 + colorMode: 3 +// enabled: false + // name: "power" + } + + KnobLightBind { name: "patient" ; image: "qrc:/icons/topLeft/patient.png" } + KnobLightBind { name: "utils" ; image: "qrc:/icons/topLeft/utils.png" } + KnobLightBind { name: "dvd" ; image: "qrc:/icons/topLeft/dvd.png" } + KnobLightBind { name: "report" ; image: "qrc:/icons/topLeft/report.png" } + KnobLightBind { name: "probe" ; image: "qrc:/icons/topLeft/probe.png" + Layout.column: 1 + Layout.row: 2 + } + + KnobLightBind { name: "archive" ; image: "qrc:/icons/topLeft/archive.png" } + KnobLightBind { name: "end" ; image: "qrc:/icons/topLeft/end.png" } +} + + + diff --git a/ui/emulator/items/TopRight.qml b/ui/emulator/items/TopRight.qml new file mode 100755 index 0000000..35873fb --- /dev/null +++ b/ui/emulator/items/TopRight.qml @@ -0,0 +1,39 @@ +import QtQuick 2.0 + +import "qrc:/emulator/elements" +import "qrc:/const" + +Item { + width: childrenRect.width + height: childrenRect.height + anchors.right: parent.right + anchors.rightMargin: 70 + y: 70 + +// x: 1466 +// y: 148 + + Row { + spacing: 36 + + KnobLightBind { + name: "xtd" + image: "qrc:/icons/topRight/xtd.png" + } + + KnobLightBind { + name: "bf" + image: "qrc:/icons/topRight/bf.png" + } + + KnobLightBind { + name: "p5" + image: "qrc:/icons/topRight/p5.png" + } + + KnobLightBind { + name: "p6" + image: "qrc:/icons/topRight/p6.png" + } + } +} diff --git a/ui/emulator/items/TrackballGroup.qml b/ui/emulator/items/TrackballGroup.qml new file mode 100644 index 0000000..5694ba5 --- /dev/null +++ b/ui/emulator/items/TrackballGroup.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +import "qrc:/emulator/elements" + +TrackballBind { + anchors.horizontalCenter: parent.horizontalCenter + y: 620 +} diff --git a/ui/icons/bottomRight/dual.png b/ui/icons/bottomRight/dual.png new file mode 100755 index 0000000000000000000000000000000000000000..c6629ce9d0b222cc530cbecf77b1178949f2c9da GIT binary patch literal 143 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJFi#i9kO=p;R}F<23|L$OtN%Nn z-qA4QX49kPq6f8|Hr8y3vCm*&WXa=BN!#_mWl7lyvk2Z2{v98s`q%^n1lqvh>FVdQ&MBb@0O1ZV?f?J) literal 0 HcmV?d00001 diff --git a/ui/icons/bottomRight/p1.png b/ui/icons/bottomRight/p1.png new file mode 100755 index 0000000000000000000000000000000000000000..0b3cfed42acd70cd926eb5c7b96a2ed3428454f8 GIT binary patch literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJG*1`DkO=p;(;T^g5-hj>+uwR2 z&>~SGsJtxuCSP-h)LHklKbaYL5*U~zJR}W_KPyKEMeM$J@7sgG{d~tjko0j(-dw;FieqHaYs71nFFjbUV4UMZH%IDT=y}cjSQZyelF{r5}E*P CR5FeL literal 0 HcmV?d00001 diff --git a/ui/icons/bottomRight/p2.png b/ui/icons/bottomRight/p2.png new file mode 100755 index 0000000000000000000000000000000000000000..868ecd4768e31ea6cace35919b374e7ad22d016d GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJW=|K#kO=p;(++YmC~~-b{%?P4 zsdM|0wShefY5kFB9w%Edz)cj25iQa^KeBlm1pN`oHu~g9dSnYgIp1 z?W@Z7V%WpLf9iHQ3j^ literal 0 HcmV?d00001 diff --git a/ui/icons/bottomRight/p4.png b/ui/icons/bottomRight/p4.png new file mode 100755 index 0000000000000000000000000000000000000000..758b04208d03b3ea8d900eedf86051fe4867e2c9 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJI!_nJkO=p;)1tW!DDbeH{mVZ$ zX`zDSVKtW}oBsW}QP{I+%VA%>=jKco7rVTT(@7x%6x-0Tyf$D zz923EUVYXRE$s|@q)xQ8GhA5IeP~H`f{D>?)%Wk_%>Hy%pK*hM$A|q4W&flXDl34^ ciphPzSjiHhxLYP%3+NICPgg&ebxsLQ0Ih;S0RR91 literal 0 HcmV?d00001 diff --git a/ui/icons/bottomRight/quad.png b/ui/icons/bottomRight/quad.png new file mode 100755 index 0000000000000000000000000000000000000000..e2eb342a2bf3f4e9099313636f2c344e78e8b618 GIT binary patch literal 144 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJa8DPIT{#P@`O*EDf!Rox%T9?2&P?Zd3(<&GBCw6EoqQ&N-$-8 r_u=I4+pjAg9oWmv$l;JM_W*PJ;ugjHlTVfatzhtU^>bP0l+XkK_Iojq literal 0 HcmV?d00001 diff --git a/ui/icons/bottomRight/single.png b/ui/icons/bottomRight/single.png new file mode 100755 index 0000000000000000000000000000000000000000..02e7872c64bd38b8ba9c173174733f4bfc910859 GIT binary patch literal 144 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJa8DPUB*%e&9%`E^i~ombU^O|gX#PP#bxfcr9dkfJYD@<);T3K0RT<-F?#?2 literal 0 HcmV?d00001 diff --git a/ui/icons/curveButtons/3d.png b/ui/icons/curveButtons/3d.png new file mode 100755 index 0000000000000000000000000000000000000000..2895b476a792eb4ffd7e670adc0a32c07131b2e6 GIT binary patch literal 184 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJdQTU}kO=p;Qv&%8C~!DG{nwuM z@py^L#1)dagX~=w+AR#4G+pJozK8>p3J?jXEm+mHO;_pdI`P?&wH^+-4XoKgcQ${# z_jBTe2@UsB{ToDI1pb)D@F)8=^F8su?F{>#T$HOgDzfC)fipg3k4`7=2>$YH#d4vw h&lDMj6c~keFwADnQMBBwZUl4+gQu&X%Q~loCII@($p6HetYM=a&3R*Vmn@iqstrE zL|Q!jvf&Br4Oh)+wru$(TimZQmZvh>~;OXk;vd$@?2>{;mOX2_k literal 0 HcmV?d00001 diff --git a/ui/icons/curveButtons/abc.png b/ui/icons/curveButtons/abc.png new file mode 100755 index 0000000000000000000000000000000000000000..0b17e427a6aeea7f3ebbbc4aa0201b40711470bd GIT binary patch literal 194 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJPEQxdkO=p;QylpYC~&Ym{olXr zp+i!~uBf1wiPal37xQgivE`9_*Y|vu1&mTaWMQ;mRaW@+j*h*zXY4(-UHk*@;|kUV z>%WCF)PAj%k(+va>n0ZEj>z*o3*H-d=r&kXUTMi+9LdyUB^z2*Wo5_i;Go%{?K{Kv qd4^q%(-wzs_KX<~Y#9sg9ALhbJVnt=_dp5IQ4F50elF{r5}E);`$^3J literal 0 HcmV?d00001 diff --git a/ui/icons/curveButtons/auto.png b/ui/icons/curveButtons/auto.png new file mode 100755 index 0000000000000000000000000000000000000000..8ae218bf7b31fa4fc238fc3a75f4d5e4bee55417 GIT binary patch literal 245 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJJ)SO(ArbCxr(EP}FyL_g{NKJR zQKe%`<$JL;2jUhP*;-#dx$)Z zkzP#R`&e(`g$#(eCb!I}h{hqrU;~mI#frwAMMUlbG%*^thXJeFM+iicM&<>cfzKJR z&c3xHMnk?tz*|JGw!mu*+Oj1Aca`pEU^Gm#-{BU_3XJ|M14W<+q!Ty*G4`M#cQWP4 P00000NkvXXu0mjf{Sa3l literal 0 HcmV?d00001 diff --git a/ui/icons/curveButtons/clear.png b/ui/icons/curveButtons/clear.png new file mode 100755 index 0000000000000000000000000000000000000000..b1717770a4977a99b63a077902e9c1c9ae3f48f2 GIT binary patch literal 239 zcmVS$_?CIB>8zfI=G5ID9(R1Kr8Sc1rQMdzy$Wj@${Jw$}y$K zt+Dk$$~RH~S`voa4nPS;nfV-*pOgqIz!hpqj{*?=n-Z2!mOStY1xh{e7)RL$$ELvQ z@3t}YI@}wV+Jsj1nR{~&$lgY)^8if&W^=CHu|Xq-OaaKBl3dN1m7E5UZXXjzT9x*| pD09{;CV{3f#vU)FB-^W@-Qc002ovPDHLkV1gMLU%3DP literal 0 HcmV?d00001 diff --git a/ui/icons/curveButtons/exit.png b/ui/icons/curveButtons/exit.png new file mode 100755 index 0000000000000000000000000000000000000000..11c3096e366d55918d4fee5572dccbdb0af1136c GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJIi4<#ArbCxr$loxC~~;&{vE%? znc2;w@8)F2->Y@jA7{VxwDt7AU=9u@#|QN+9UWV4G9Hkf@Y_-BLeY}B(am`?8OolB z8tFQCd*)j$WA!+4oU>=q^KxgFb!CmASMODuGp=Voy)W7!_HBG|LbTwi{>uAS=L7Zg zoz(*BW2~>U==wJHyxP%lX*Wa45naQuFZrvgddhCKG$;tLG#y}mtI(jRCv;#B(47pP Lu6{1-oD!M literal 0 HcmV?d00001 diff --git a/ui/icons/curveButtons/meas.png b/ui/icons/curveButtons/meas.png new file mode 100755 index 0000000000000000000000000000000000000000..b2e949b109917557e0a87865383519476e8c4832 GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ6`n4RArbCxr{3l|V8G!#`~Uw8 zclIWaXk+fzZ10Xb>UX-Y%xJflxt5>0fJ3BF=|e7)k`luuwV9t!pI*#ecKx@+k9Nkh zCeq=|{Yn!=`@BS^J?IVe6%0`Jar5_WXUp?p*tO%|_ZMe-uD$&?bK`}Eu5=~mW}^q* z3vNbP-BXxcd!t49Ojt(BnSFD7&M)D};Quji##irOvI$u`cB|WFl(l}Xk?G zhYAxSob#{bqPbn=X!JV^N)JAf^2ix*~snLRiU{2tl>PMLm50> L{an^LB{Ts5+OJF$ literal 0 HcmV?d00001 diff --git a/ui/icons/encoder/mode2d.png b/ui/icons/encoder/mode2d.png new file mode 100755 index 0000000000000000000000000000000000000000..11e3b90891160260ebc0e5a2bd4d821d7e5d2d85 GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJGEW!BkO=p;Qx9@6C~~-b{%?Ql zD68YNBvTFj^}$`Hhl2y$K2J>h+sMe_z`!KXa6pVPG&DL%>C?XN7SA?$ugf`bWYLDZ z={u9z9v#=ala!z;^;weZsaVDNy}b8->}a$ouqz2~H)!4(wE1dN*MWFlHU$QtNe>tc XUb`qNNcDvRUBKY!>gTe~DWM4fu{A#t literal 0 HcmV?d00001 diff --git a/ui/icons/encoder/modeC.png b/ui/icons/encoder/modeC.png new file mode 100755 index 0000000000000000000000000000000000000000..1b8b31d3b2a88e7d663a97de90a3ab0c8153b983 GIT binary patch literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJcuyC{kO=p;Qysa05-hj>+u!=2 z;IiDnv*V@OlHEPrStjbiI}2}{H<*4i zKaj_w$;Re!izBV!>Z#4v55&qo_r*6x-#E+6z$^jOtEI8qLvfu+9S6`x22WQ%mvv4F FO#oW8HBA5j literal 0 HcmV?d00001 diff --git a/ui/icons/encoder/modePw.png b/ui/icons/encoder/modePw.png new file mode 100755 index 0000000000000000000000000000000000000000..0c5ebe6e2c0e45692a656319272c9ee8ab5b4ec6 GIT binary patch literal 168 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJd`}n0kO=p;Q@yzkDDbe>ezz~_ zYHjEc66z{5T=z%do`K+^vdWi5b<7OR5(gOA3?>*Qq&++AeJT3(`^3FVdQ&MBb@093y@#{d8T literal 0 HcmV?d00001 diff --git a/ui/icons/encoder/quadratic.png b/ui/icons/encoder/quadratic.png new file mode 100755 index 0000000000000000000000000000000000000000..912dc0b79393f33f214e7baef6085960dd57f9e5 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=k0IPZ!6K2=}+sy!jdoI9#m1+nXG7 zjlDTZQOmG0_S<0|eTP*S_gqz=^HSHEL# zv$b6koW<$SSfLj7_uIL{Yzzk+QXcg2KjiGVqRqg-EOFp~K97y;FB8S1%j#u-mNIy{ L`njxgN@xNAX3#l+ literal 0 HcmV?d00001 diff --git a/ui/icons/encoder/z.png b/ui/icons/encoder/z.png new file mode 100755 index 0000000000000000000000000000000000000000..8d5e58e2ae639b8df3e0099bd0b2f621ae34fe36 GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJbWaz@kO=p;(+s%|81Nh^`d`1r zyRA>MD7}FDRGtdA&?3_slQZ!g0S!zdKjIr#t-AbL^JUe-*Nwt8-MySUKJ4|0QD{8Q zq-i7cqTx1EY=QRz;XLk|PqGF3%RZWx9DFasB(i{kRpSGLO0$Y0_reADfmSkjy85}S Ib4q9e0N&0w(f|Me literal 0 HcmV?d00001 diff --git a/ui/icons/joystick/TT.svg b/ui/icons/joystick/TT.svg new file mode 100644 index 0000000..a1bf9b8 --- /dev/null +++ b/ui/icons/joystick/TT.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/icons/miniButton/angle.png b/ui/icons/miniButton/angle.png new file mode 100755 index 0000000000000000000000000000000000000000..4f578563407da654886dcbb3ff0f0a167af75006 GIT binary patch literal 226 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJm7Xq+ArbCxr(EP}FyL_g{NKJx zQRReJnamc$4bzimet&asY0PZ>n``Pt9V`R*=Dc*sUiT0q7)4DB>*JXO zI&W8rDZO=2*}{^bVpR42so$x_dv)0oYbRS6Fx-`0Yiz;tVD=>A35^a6Uf%!8gDxL$ zVyw9rxXnt~@sFN6Sx0#_&k4>{W6Dgwr!D{%Xlki**b<(jYSJ& ab}*iDXi=$Hc zu%*o;H$mYR@4Gkcl5$oidiEue^;;U%F0jmE@M)MCd8oVN+1dvaoTCDk_PsDOhS-hyeWPs4jKihkkaHgDG`~8-K ea0b(LPMhOxC5p8hHC_T8&fw|l=d#Wzp$Pz3mt3m= literal 0 HcmV?d00001 diff --git a/ui/icons/miniButton/focusDepth.png b/ui/icons/miniButton/focusDepth.png new file mode 100755 index 0000000000000000000000000000000000000000..11e0bec734218e026dfdd4ce3658f693755685c4 GIT binary patch literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ3QrfukO=p;Qx0++FyL^W{r`VP zJ9~GJY)FdOta(uZLi5AcJZw(<>&mR+z@#!kNkNGz;rX8XQY#0+sK26o z^*!M(flR{(y{;~`J|_=^Z(XeWV{XH@pXVeks`yiu*Yg*dZq(NQ%e%Y9vw_6}hz@Yr Y1iZ;mbjz734|D^Ar>mdKI;Vst01CE0EC2ui literal 0 HcmV?d00001 diff --git a/ui/icons/miniButton/focusZone.png b/ui/icons/miniButton/focusZone.png new file mode 100755 index 0000000000000000000000000000000000000000..14bd047d240e283253e9e91667c1f8b576ecc7ba GIT binary patch literal 195 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJE>9Q7kO=p;Q@r^OC~&Yo{nx%M z(b2i*>GMM~?80Y-Nw6vP9`5FQF3-@wDACY3jWI1vsp|c?=cgW*i8rhb`EGr+d*!4? zjs?t9*(N-=75#F5`L_SApEs}?G~Y-m^RVqOX<+#nb>U+Ctj4KDrW4kdr7lWwVE*%6 rwnJ^#=e<{({1&aZ2Aj+%QNgf!R)wM;%STP1s~9|8{an^LB{Ts5xwK4D literal 0 HcmV?d00001 diff --git a/ui/icons/miniButton/zoom.png b/ui/icons/miniButton/zoom.png new file mode 100755 index 0000000000000000000000000000000000000000..67ed4647cf99e658a7fe35b264c63ce6e32d2ab7 GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJHJ&bxArbCxr+D)nP~dQR`mcRi zp`)`#%f^3ZCFuvwB@3*G{r6&1opwXf0vQeV1ojy-J71iApT7G@iA-!kFoRfzbi=wZ z7aR9J#*Q7Vn*%(g>$W;De_8cbQgE6Khr+5aE0~?;+?;dNezI{=`1!Len|=s2@KmKp zEij+JdG1IeL%w*$p^SSML_FT#_s&v{?pVuE#qGAueYVk=`7iHx?fxJgq4@0YVun+V dMGtl{^Ya(CD0bN?PY1f2!PC{xWt~$(697gZS@Zw^ literal 0 HcmV?d00001 diff --git a/ui/icons/mode/2d.png b/ui/icons/mode/2d.png new file mode 100755 index 0000000000000000000000000000000000000000..9f9c84a359923cc7cf082598a8c115dee35e709e GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJUQZXtkO=p;QylpYC~&Ym{olXL zFjG2N;F`k6O}1j(k2At=J$2VRpU<*@Q3{9}cvr0I+o-Gbe|wy6R~5$sehKz(%O3CE znYT8+aSFqkhIy*v{AwY*Qc)I$ztaD0e0svikM+pD` literal 0 HcmV?d00001 diff --git a/ui/icons/mode/bf.png b/ui/icons/mode/bf.png new file mode 100755 index 0000000000000000000000000000000000000000..c36a517d7eb1bdfd9c570c97d3494e5a640707a0 GIT binary patch literal 171 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJB2O2`kO=p;Qw{kJDDW_U{4YPZ z%dge#&?%v|WS729y|4=zc3E}x7Z_L+7#KMsSd^5$P1Vg@dDdie+V#IRbM`09O6RY8 zZ`AuZS9n3A7n|SbdgDiDI(cFo51ec;{(MQUpeX2SgyNc6)}+u!=2 z;IiDnv*V@OlHEPrStjNaUXYQ}~^7b;@9*>kmM>pTNzGort zjvx14-kL5Dao2s(QZ|`vwC9uRvrFY3W(KPHv$;61xGb1^ afMsh-jN(-DEti09VDNPHb6Mw<&;$TbiI}2}{H<*4i zKaj_w$;Re!izBV!>Z#4v55&qo_r*6x-#E+6z$^jOtEI8qLvfu+9S6`x22WQ%mvv4F FO#oW8HBA5j literal 0 HcmV?d00001 diff --git a/ui/icons/mode/pw.png b/ui/icons/mode/pw.png new file mode 100755 index 0000000000000000000000000000000000000000..0c5ebe6e2c0e45692a656319272c9ee8ab5b4ec6 GIT binary patch literal 168 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJd`}n0kO=p;Q@yzkDDbe>ezz~_ zYHjEc66z{5T=z%do`K+^vdWi5b<7OR5(gOA3?>*Qq&++AeJT3(`^3FVdQ&MBb@093y@#{d8T literal 0 HcmV?d00001 diff --git a/ui/icons/topLeft/archive.png b/ui/icons/topLeft/archive.png new file mode 100755 index 0000000000000000000000000000000000000000..d6c241de570c7af3e2a80dbe0cd70991bcd1c33a GIT binary patch literal 259 zcmV+e0sQ`nP)R!Ac;jCaRFE=?J<42T6@C`fW(KGG|nv$W`HhI>cFV7vt{Vz z56sD#%E!M_08#gN9t7}I=7~kX%K^MV4*=9$Z{N`5({j`!kP^8FuX2vp-mk`EEBxjF z8m)btYTM5PfJXBJfCp)J{Y@B+ZnUVrc@0Y?2s{-Zggj>=MUvjv9D}Yj<6etB!1$ys2GAj|e*D^UH z!t^-B($a*3?N|rP$$QaYB0NxE*XWRzxE*Ak{oKctV0cNu& gIR#J(lmex|1((3!AyK=HNB{r;07*qoM6N<$f+u=g(*OVf literal 0 HcmV?d00001 diff --git a/ui/icons/topLeft/end.png b/ui/icons/topLeft/end.png new file mode 100755 index 0000000000000000000000000000000000000000..795d63c989ead24d9fedb9ec82a8be34f9c9785e GIT binary patch literal 268 zcmV+n0rUQeP)>Of3%I8&`ekr26yX)9$SUSFlgmE{K(<_R{@j)r9fDL)>;#h>3aR{t+Qhv z2Iw1S!L!MGObP%YEDT$@DnSD%#1lY7dUBL@)vB!);ASg(whcd3pjXbef(BSs{xQ{J zQbrda1%Sz|2Qt;Cr{K#-V8quH7*)*npHcvWuN==pP##d}vm>`{!hig}g%!ZlE^;YF zVJQGitU%s74}=21gXZ<4cy{~EK)lN7+t7MoGzp`&cp%{xc!9Ft3!oG@uD}g)2;?EA SjdpJU0000Vqk_H8bCzlEISYYTigS%QoP217WPxlG;9VytoRB*k0EqPVF_x%hye>wCk9GMd&0Sch^VT!!t{IBp!6KSQp;pG|0p={NMi8 z(RPJJTLU?6r&hgr)Wd#yi73D3wR{r?CY1?F3szah#|wHM<&u4MNZT;~Y;|@5vsyz+ z=eyU-6qxfJ7k}0k`Y!!pLfUmVp=hQ^!7XAL4J_MO)+83(8!id0ayuMH!!M~4d|jY*p|ZvkpAen z3BZ+l<}|AQY~dC$2bICC`w>gRdZ3_z5zqqBWAfQ^P(c7$)vS68z%z9az*4G#W>cWw sEjOa*Do5XcdmAG9C&tS_8Q5;%07f>vAq=`(MgRZ+07*qoM6N<$f|Dj?1poj5 literal 0 HcmV?d00001 diff --git a/ui/icons/topLeft/report.png b/ui/icons/topLeft/report.png new file mode 100755 index 0000000000000000000000000000000000000000..e27636dd7b8a2ebca963e461084889449f9f9554 GIT binary patch literal 258 zcmV+d0sa1oP)o5$MGF8H zY`u%lTmoRaRv~17sO#wfMdG^X6o7gZMUm+MxLDHxwgR|lc%F(O4WA)iL1a8P_f!&E zM&$WQ*L6)v0R@(gr2ug2*^e`EG=NL2I$Z=Y1b_xqimAIm1K_gt%t%#;2EY-tya4|T zk^HA(Oi<73T?H>(kAPKz0#G5D_-mv}@E5VKDex3-11wkI0LggNA!+Y$rvLx|07*qo IM6N<$f;QD@AOHXW literal 0 HcmV?d00001 diff --git a/ui/icons/topLeft/utils.png b/ui/icons/topLeft/utils.png new file mode 100755 index 0000000000000000000000000000000000000000..6bbc9081c4b16e96c99e8c3d4e34c70ba2090214 GIT binary patch literal 237 zcmV$o5Ey_fv56}{wg8^?N{|r1YPaX$)I!*TRkgPFClDckRE%iPfWQD>fxHIr=6Y2< zVx$aUXK1%CLIAsfI9T*-wKF_(#{jzW%w|jjaAIvkTZ#6+exC-=3(B_TUjW{L66M|< nwGg%d4V3+^0op(txNhJ9v6k2&9cT%O00000NkvXXu0mjfZd70{ literal 0 HcmV?d00001 diff --git a/ui/icons/topRight/bf.png b/ui/icons/topRight/bf.png new file mode 100755 index 0000000000000000000000000000000000000000..c36a517d7eb1bdfd9c570c97d3494e5a640707a0 GIT binary patch literal 171 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJB2O2`kO=p;Qw{kJDDW_U{4YPZ z%dge#&?%v|WS729y|4=zc3E}x7Z_L+7#KMsSd^5$P1Vg@dDdie+V#IRbM`09O6RY8 zZ`AuZS9n3A7n|SbdgDiDI(cFo51ec;{(MQUpeX2SgyNc6)} zBDU9_{k*)NmC>ltn*T`Lx5i8V@2Y#9*Rl;O{->Bwdiy-*o>z=V)vrpNWWIWMstt<+ f1Cv08`Ub`c84-$e#Gp=^| z4lN5Am!CapOttsr*uo?Oj6PMe{o=j9E~E79OMxVXq`zDFH2h7i-A_4`6{pIw0nOo< cB5c8Mc|n3=x_IVupfeaeUHx3vIVCg!0E8qx-T(jq literal 0 HcmV?d00001 diff --git a/ui/icons/topRight/xtd.png b/ui/icons/topRight/xtd.png new file mode 100755 index 0000000000000000000000000000000000000000..00841f72d73558326b0a3e19da1de7b591f31000 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ1)eUBArbCxr{3i{pupkw`LFz~ zi>?Bbe(lUMEeQYZXe*Z*Xjyad;V)IjO9%e*7#Is*H2P4m=r!Y_21RDw%6ON3tIvOZ z-qy#-Heqfr*Y!ob46QfVKFnmSoR)K&F_&d?yQB%z+SM7`m2doJ{I&L4$@km(@AnGs zWV@H;_V^u}!|n?v${&|8sx+D=tK4JVz!h=2eIDmKzKUp@-?ogG9Hcy$`M0fHqsVu+ Rej3oN44$rjF6*2UngCsXR*?Vz literal 0 HcmV?d00001 diff --git a/ui/icons/uiMode/dark.svg b/ui/icons/uiMode/dark.svg new file mode 100644 index 0000000..28d436a --- /dev/null +++ b/ui/icons/uiMode/dark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui/icons/uiMode/light.svg b/ui/icons/uiMode/light.svg new file mode 100644 index 0000000..57cd380 --- /dev/null +++ b/ui/icons/uiMode/light.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui/theme/Dark.qml b/ui/theme/Dark.qml new file mode 100755 index 0000000..ff7f596 --- /dev/null +++ b/ui/theme/Dark.qml @@ -0,0 +1,7 @@ +Palette { + id: dark + isDarkTheme: true +// shiny: "#B8E2FF" +// primary: "#62B5ED" +// selected: "#9BCDFF" +} diff --git a/ui/theme/Light.qml b/ui/theme/Light.qml new file mode 100755 index 0000000..88b42ba --- /dev/null +++ b/ui/theme/Light.qml @@ -0,0 +1,7 @@ +Palette { + id: light + isDarkTheme: false +// shiny: "#AEE9FF" +// primary: "#4CA9DF" +// selected: "#3D88D4" +} diff --git a/ui/theme/Palette.qml b/ui/theme/Palette.qml new file mode 100755 index 0000000..3eeb0a1 --- /dev/null +++ b/ui/theme/Palette.qml @@ -0,0 +1,44 @@ +import QtQuick 2.13 +import QtGraphicalEffects 1.13 + +QtObject { + property bool isDarkTheme: false + + property color shiny: "#D7DEE9" + property color primary + property color selected: isDarkTheme ? "#D1D7E3" : "#D1D7E3" + + property color background: isDarkTheme ? "#181818" : "#B8C5D7" + property color light: isDarkTheme ? "#05FFFFFF" : "#80F1F2F5" + property color shadow: isDarkTheme ? "#C0000000" : "#95A4B9" + property color lightShadow: isDarkTheme ? "#80000000" : "#80C9D1DD" + + property color button: isDarkTheme ? "#303032" : "#C6D1E1" + property color buttonSelected: isDarkTheme ? "#242426" : "#AAB7CA" + + property color text: isDarkTheme ? "#656E85" : "#323B52" + property color textSelected: isDarkTheme ? "#656E85" : "#323B52" + + property color none: isDarkTheme ? "#2D2F32" : "#A7B4C7" + property color noneGlow: isDarkTheme ? "#2D2F32" : "#A3B2C7" + property color noneDeep: isDarkTheme ? "#767F8C" : "#767F8C" + + property color white: isDarkTheme ? "#FFFFFF" : "#FFFFFF" + property color whiteGlow: isDarkTheme ? "#F1F5FA" : "#F1F5FA" + property color whiteDeep: isDarkTheme ? "#A4C5EF" : "#A4C5EF" + + property color green: isDarkTheme ? "#95CF6C" : "#95CF6C" + property color greenGlow: isDarkTheme ? "#B8E49B" : "#B8E49B" + property color greenDeep: isDarkTheme ? "#17A58C" : "#17A58C" + + property color yellow: isDarkTheme ? "#F5CC3C" : "#F5CC3C" + property color yellowGlow: isDarkTheme ? "#F3DE96" : "#80F3DE96" + property color yellowDeep: isDarkTheme ? "#D37129" : "#D37129" + + property var glowRaduis: isDarkTheme ? 15 : 30 + + property var disabledOpacity: 0.4 + property var mergeOpacity: isDarkTheme ? 0.1 : 0.6 + property var disabledTextOpacity: isDarkTheme ? 0.38 : 0.64 +// green "#32EC7B" +} diff --git a/ui/theme/Theme.qml b/ui/theme/Theme.qml new file mode 100755 index 0000000..5e38944 --- /dev/null +++ b/ui/theme/Theme.qml @@ -0,0 +1,10 @@ +pragma Singleton +import QtQuick 2.13 + +QtObject { + + property Palette light: Light {} + property Palette dark: Dark {} + property Palette current: light + +} diff --git a/ui/theme/qmldir b/ui/theme/qmldir new file mode 100755 index 0000000..8bafca7 --- /dev/null +++ b/ui/theme/qmldir @@ -0,0 +1 @@ +singleton Theme Theme.qml diff --git a/ui/ui.qrc b/ui/ui.qrc index c4c3f4c..b0f1949 100644 --- a/ui/ui.qrc +++ b/ui/ui.qrc @@ -1,8 +1,102 @@ App.qml + const/Const.qml + const/qmldir + emulator/components/HoverGlow.qml + emulator/components/JoystickButton.qml + emulator/components/Knob.qml + emulator/components/KnobImage.qml + emulator/components/KnobLight.qml + emulator/components/LightImage.qml + emulator/components/LightRing.qml + emulator/components/ModeBg.qml + emulator/components/ModeBgOption.qml + emulator/components/ModeButton.qml + emulator/components/ModeOption.qml + emulator/components/NeuButton.qml + emulator/components/NeuImage.qml + emulator/components/NeuLight.qml + emulator/components/SegmentButton.qml + emulator/components/SegmentCircle.qml + emulator/components/Trackball.qml + emulator/elements/JoystickButtonBind.qml + emulator/elements/KnobLightBind.qml + emulator/elements/LightImageBind.qml + emulator/elements/ModeButtonBind.qml + emulator/elements/ModeOptionBind.qml + emulator/elements/TrackballBind.qml + emulator/items/BottomRight.qml + emulator/items/CurveButtons.qml + emulator/items/Encoders.qml + emulator/items/JoystickCouple.qml + emulator/items/Joysticks.qml + emulator/items/TopLeft.qml + emulator/items/TopRight.qml + emulator/items/TrackballGroup.qml + emulator/Emulator.qml + icons/bottomRight/dual.png + icons/bottomRight/p1.png + icons/bottomRight/p2.png + icons/bottomRight/p3.png + icons/bottomRight/p4.png + icons/bottomRight/quad.png + icons/bottomRight/single.png + icons/curveButtons/3d.png + icons/curveButtons/4d.png + icons/curveButtons/abc.png + icons/curveButtons/auto.png + icons/curveButtons/bodyMark.png + icons/curveButtons/clear.png + icons/curveButtons/exit.png + icons/curveButtons/freeze.png + icons/curveButtons/meas.png + icons/curveButtons/pointer.png + icons/encoder/mode2d.png + icons/encoder/modeC.png + icons/encoder/modeM.png + icons/encoder/modePd.png + icons/encoder/modePw.png + icons/encoder/quadratic.png + icons/encoder/x.png + icons/encoder/y.png + icons/encoder/z.png + icons/joystick/TT.svg + icons/miniButton/angle.png + icons/miniButton/depth.png + icons/miniButton/focusDepth.png + icons/miniButton/focusZone.png + icons/miniButton/zoom.png + icons/mode/2d.png + icons/mode/bf.png + icons/mode/c.png + icons/mode/m.png + icons/mode/pd.png + icons/mode/pw.png + icons/topLeft/archive.png + icons/topLeft/dvd.png + icons/topLeft/end.png + icons/topLeft/patient.png + icons/topLeft/power.png + icons/topLeft/probe.png + icons/topLeft/report.png + icons/topLeft/utils.png + icons/topRight/bf.png + icons/topRight/p5.png + icons/topRight/p6.png + icons/topRight/xtd.png + icons/uiMode/dark.svg + icons/uiMode/light.svg + theme/Dark.qml + theme/Light.qml + theme/Palette.qml + theme/qmldir + theme/Theme.qml + emulator/components/SliderBar.qml + emulator/elements/SliderBarBind.qml + emulator/items/Setting.qml - + MainView.qml