From 6942d286f3648546d67151c03838101a24999503 Mon Sep 17 00:00:00 2001 From: Yury Shuvakin Date: Thu, 15 Feb 2024 12:52:48 +0900 Subject: [PATCH] Added output pipe for Windows cmd. Fixed some colors --- qml/Controls/GroupBox.qml | 1 + qml/Palette/Palette.qml | 1 + qml/main.qml | 6 +++--- settings.ini | 2 +- sources/main.cpp | 16 +++++++++++++++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/qml/Controls/GroupBox.qml b/qml/Controls/GroupBox.qml index 3fddaef..12754ea 100644 --- a/qml/Controls/GroupBox.qml +++ b/qml/Controls/GroupBox.qml @@ -46,6 +46,7 @@ Controls.GroupBox { visible: control.subTitle.length > 0 font.pixelSize: 23 font.weight: Font.Normal + backgroundColor: Palette.readyBackgroundColor backgroundRadius: 16 readOnly: true } diff --git a/qml/Palette/Palette.qml b/qml/Palette/Palette.qml index 59b7357..ffe5682 100644 --- a/qml/Palette/Palette.qml +++ b/qml/Palette/Palette.qml @@ -10,6 +10,7 @@ QtObject { property color backgroundColor: "#EEE" property color controlBackgroundColor: "#FCFCFC" property color indicatorBackgroundColor: "#F0F4FF" + property color readyBackgroundColor: "#C4FFCA" property color switchBackgroundColor: "#F0F4FF" property color switchActiveBackgroundColor: "#3069FE" diff --git a/qml/main.qml b/qml/main.qml index 9a93014..3a2cd87 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -55,7 +55,7 @@ ApplicationWindow { CustomControls.IndicatorTextField { visible: DataController.firstStatus === "0x07" && DataController.secondStatus === "0x07" text: "Готов к работе" - backgroundColor: "#C4FFCA" + backgroundColor: Palette.readyBackgroundColor backgroundRadius: 16 font.pixelSize: 24 font.weight: Font.Normal @@ -141,8 +141,8 @@ ApplicationWindow { CustomControls.TristateSwitch { id: modeSwitch // enabled: false // uncomment for non clickable - firstStateDescription: "АИН 1,2,3" - secondStateDescription: "АИН 4,5,6" + firstStateDescription: "АИН1 - АИН3" + secondStateDescription: "АИН4 - АИН6" checkState: DataController.ainMode === 2 ? Qt.Unchecked : DataController.ainMode === 1 ? Qt.Checked : Qt.PartiallyChecked Layout.fillHeight: false Layout.fillWidth: true diff --git a/settings.ini b/settings.ini index 529aaf4..2eb5f22 100644 --- a/settings.ini +++ b/settings.ini @@ -1,6 +1,6 @@ [General] name=/dev/ttyS0 -;baudRate=9600 +;baudRate=115200 ;dataBits=8 ;parity=0 ;stopBits=1 diff --git a/sources/main.cpp b/sources/main.cpp index 090bdbf..7cf030e 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -5,15 +5,29 @@ #include #include #include +#include #include "DataController.h" +#ifdef _WIN32 +#include "Windows.h" +#endif + int main(int argc, char *argv[]) { //#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //#endif + // qputenv("QT_SCALE_FACTOR", "0.5"); + +#ifdef _WIN32 + if (AttachConsole(ATTACH_PARENT_PROCESS)) { + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + } +#endif + QGuiApplication app(argc, argv); QCoreApplication::setOrganizationName("Tksi");