diff --git a/BatteryController.cpp b/BatteryController.cpp index 70c09eb..812d84b 100644 --- a/BatteryController.cpp +++ b/BatteryController.cpp @@ -184,14 +184,20 @@ void BatteryController::setStatuses(const QVariantList& statuses) void BatteryController::addStatus(const quint16 status) { - QString description; - auto appendDescription = [&description](const QString& subStatus) + // QString description; + // auto appendDescription = [&description](const QString& subStatus) + // { + // if (!description.isEmpty()) + // { + // description += ", "; + // } + // description += subStatus; + // }; + + QStringList descriptionList; + auto appendDescription = [&descriptionList](const QString& subStatus) { - if (!description.isEmpty()) - { - description += ", "; - } - description += subStatus; + descriptionList.append(subStatus); }; std::bitset<16> descriptionBitset(status); @@ -252,18 +258,23 @@ void BatteryController::addStatus(const quint16 status) appendDescription("Разночтение в токах"); } - if (description.isEmpty()) + if (descriptionList.isEmpty()) { appendDescription("Штатный режим"); } - QVariantMap statusMap; - statusMap.insert("time", QDateTime::currentDateTime().toString("hh:mm:ss dd-MM-yyyy")); - statusMap.insert("status", "0x" + QString::number(status, 16).toUpper().rightJustified(2, '0')); - statusMap.insert("description", description); - statuses_.clear(); - statuses_.append(statusMap); + + for (const auto& description: descriptionList) + { + QVariantMap statusMap; + statusMap.insert("time", QDateTime::currentDateTime().toString("hh:mm:ss dd-MM-yyyy")); + statusMap.insert("status", "0x" + QString::number(status, 16).toUpper().rightJustified(2, '0')); + statusMap.insert("description", description); + + statuses_.append(statusMap); + } + emit statusesChanged(); // if (statuses_.isEmpty() || statuses_.first().toMap()["status"] != statusMap["status"]) diff --git a/CanDriver/driver/SocketCanDriver/SocketCanDriver.cpp b/CanDriver/driver/SocketCanDriver/SocketCanDriver.cpp index c002854..c5b91b9 100644 --- a/CanDriver/driver/SocketCanDriver/SocketCanDriver.cpp +++ b/CanDriver/driver/SocketCanDriver/SocketCanDriver.cpp @@ -23,7 +23,6 @@ #include "SocketCanDriver.h" #include "SocketCanInterface.h" #include -#include #include #include @@ -38,10 +37,8 @@ #include SocketCanDriver::SocketCanDriver(Backend &backend) - : CanDriver(backend), - setupPage(new GenericCanSetupPage()) + : CanDriver(backend) { - QObject::connect(&backend, SIGNAL(onSetupDialogCreated(SetupDialog&)), setupPage, SLOT(onSetupDialogCreated(SetupDialog&))); } SocketCanDriver::~SocketCanDriver() { diff --git a/CanDriver/driver/SocketCanDriver/SocketCanDriver.h b/CanDriver/driver/SocketCanDriver/SocketCanDriver.h index 4675942..b5354d7 100644 --- a/CanDriver/driver/SocketCanDriver/SocketCanDriver.h +++ b/CanDriver/driver/SocketCanDriver/SocketCanDriver.h @@ -27,7 +27,6 @@ class SocketCanInterface; class SetupDialogInterfacePage; -class GenericCanSetupPage; class SocketCanDriver: public CanDriver { public: @@ -39,5 +38,4 @@ public: private: SocketCanInterface *createOrUpdateInterface(int index, QString name); - GenericCanSetupPage *setupPage; }; diff --git a/CanDriver/driver/SocketCanDriver/SocketCanDriver.pri b/CanDriver/driver/SocketCanDriver/SocketCanDriver.pri index 390efee..c496487 100644 --- a/CanDriver/driver/SocketCanDriver/SocketCanDriver.pri +++ b/CanDriver/driver/SocketCanDriver/SocketCanDriver.pri @@ -8,5 +8,5 @@ HEADERS += \ $$PWD/SocketCanInterface.h \ $$PWD/SocketCanDriver.h -FORMS += - +INCLUDEPATH += /usr/include/libnl3 +LIBS += -lnl-3 -lnl-route-3 \ No newline at end of file diff --git a/Qml/Battery.qml b/Qml/Battery.qml index aff2d22..556a4e9 100644 --- a/Qml/Battery.qml +++ b/Qml/Battery.qml @@ -131,17 +131,11 @@ Rectangle { delegate: CustomControls.ColoredLabel { text: modelData.description backgroundColor: Palette.neutralColor - font.pixelSize: 11 - - onWidthChanged: { - if (width > statusView.contentWidth) { - statusView.contentWidth = width - } - } + font.pixelSize: 12 + width: parent.width } ScrollBar.vertical: ScrollBar {} - ScrollBar.horizontal: ScrollBar {} Layout.fillWidth: true Layout.fillHeight: true diff --git a/Qml/Controls/TextField.qml b/Qml/Controls/TextField.qml index eb122c2..31dc7f0 100644 --- a/Qml/Controls/TextField.qml +++ b/Qml/Controls/TextField.qml @@ -13,8 +13,8 @@ Controls.TextField { horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter - topPadding: 6 - bottomPadding: 6 + topPadding: 4 + bottomPadding: 4 leftPadding: 12 rightPadding: 12 + Math.ceil(indicatorLabel.width) + (indicatorLabel.visible ? 12 : 0) diff --git a/Qml/Main.qml b/Qml/Main.qml index 551ea11..ff304fd 100644 --- a/Qml/Main.qml +++ b/Qml/Main.qml @@ -12,6 +12,8 @@ ApplicationWindow { width: 1280 height: 1024 visible: true + visibility: Qt.platform.os === "linux" ? "FullScreen" : "Windowed" + flags: Qt.platform.os === "linux" ? Qt.FramelessWindowHint | Qt.Window : Qt.Window title: qsTr("Stand Battery View") color: Palette.backgroundColor diff --git a/StandBatteryView.pro b/StandBatteryView.pro index efd03d6..1e4f9ef 100644 --- a/StandBatteryView.pro +++ b/StandBatteryView.pro @@ -23,9 +23,9 @@ RESOURCES += \ Fonts/fonts.qrc \ Qml/qml.qrc -TRANSLATIONS += StandBatteryView_ru_RU.ts -CONFIG += lrelease -CONFIG += embed_translations +# TRANSLATIONS += StandBatteryView_ru_RU.ts +# CONFIG += lrelease +# CONFIG += embed_translations # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = $$PWD/Qml $$PWD/Qml/Controls $$PWD/Qml/Palette diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..aeb9500 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cqtdeployer -bin ./StandBatteryView -qmlDir ../StandBatteryView/Qml force-clear -customScript "export QT_QPA_PLATFORM=eglfs" -extraLibs nl-3,nl-route-3,harfbuzz,md4c,double-conversion,pcre2-16,graphite2 +cp -r /usr/lib/x86_64-linux-gnu/qt5/plugins/egldeviceintegrations ./DistributionKit/plugins +rm -rf ./StandBatteryViewLinux +mv ./DistributionKit ./StandBatteryViewLinux +tar -czf StandBatteryViewLinux.tar.gz StandBatteryViewLinux \ No newline at end of file