Added linux build and some UI minor fixes
This commit is contained in:
@@ -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("Штатный режим");
|
||||
}
|
||||
|
||||
statuses_.clear();
|
||||
|
||||
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_.clear();
|
||||
statuses_.append(statusMap);
|
||||
}
|
||||
|
||||
emit statusesChanged();
|
||||
|
||||
// if (statuses_.isEmpty() || statuses_.first().toMap()["status"] != statusMap["status"])
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "SocketCanDriver.h"
|
||||
#include "SocketCanInterface.h"
|
||||
#include <core/Backend.h>
|
||||
#include <driver/GenericCanSetupPage.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <linux/if.h>
|
||||
@@ -38,10 +37,8 @@
|
||||
#include <string.h>
|
||||
|
||||
SocketCanDriver::SocketCanDriver(Backend &backend)
|
||||
: CanDriver(backend),
|
||||
setupPage(new GenericCanSetupPage())
|
||||
: CanDriver(backend)
|
||||
{
|
||||
QObject::connect(&backend, SIGNAL(onSetupDialogCreated(SetupDialog&)), setupPage, SLOT(onSetupDialogCreated(SetupDialog&)));
|
||||
}
|
||||
|
||||
SocketCanDriver::~SocketCanDriver() {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -8,5 +8,5 @@ HEADERS += \
|
||||
$$PWD/SocketCanInterface.h \
|
||||
$$PWD/SocketCanDriver.h
|
||||
|
||||
FORMS +=
|
||||
|
||||
INCLUDEPATH += /usr/include/libnl3
|
||||
LIBS += -lnl-3 -lnl-route-3
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
7
deploy.sh
Normal file
7
deploy.sh
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user