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)
|
void BatteryController::addStatus(const quint16 status)
|
||||||
{
|
{
|
||||||
QString description;
|
// QString description;
|
||||||
auto appendDescription = [&description](const QString& subStatus)
|
// auto appendDescription = [&description](const QString& subStatus)
|
||||||
|
// {
|
||||||
|
// if (!description.isEmpty())
|
||||||
|
// {
|
||||||
|
// description += ", ";
|
||||||
|
// }
|
||||||
|
// description += subStatus;
|
||||||
|
// };
|
||||||
|
|
||||||
|
QStringList descriptionList;
|
||||||
|
auto appendDescription = [&descriptionList](const QString& subStatus)
|
||||||
{
|
{
|
||||||
if (!description.isEmpty())
|
descriptionList.append(subStatus);
|
||||||
{
|
|
||||||
description += ", ";
|
|
||||||
}
|
|
||||||
description += subStatus;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::bitset<16> descriptionBitset(status);
|
std::bitset<16> descriptionBitset(status);
|
||||||
@@ -252,18 +258,23 @@ void BatteryController::addStatus(const quint16 status)
|
|||||||
appendDescription("Разночтение в токах");
|
appendDescription("Разночтение в токах");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (description.isEmpty())
|
if (descriptionList.isEmpty())
|
||||||
{
|
{
|
||||||
appendDescription("Штатный режим");
|
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_.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();
|
emit statusesChanged();
|
||||||
|
|
||||||
// if (statuses_.isEmpty() || statuses_.first().toMap()["status"] != statusMap["status"])
|
// if (statuses_.isEmpty() || statuses_.first().toMap()["status"] != statusMap["status"])
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "SocketCanDriver.h"
|
#include "SocketCanDriver.h"
|
||||||
#include "SocketCanInterface.h"
|
#include "SocketCanInterface.h"
|
||||||
#include <core/Backend.h>
|
#include <core/Backend.h>
|
||||||
#include <driver/GenericCanSetupPage.h>
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
@@ -38,10 +37,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
SocketCanDriver::SocketCanDriver(Backend &backend)
|
SocketCanDriver::SocketCanDriver(Backend &backend)
|
||||||
: CanDriver(backend),
|
: CanDriver(backend)
|
||||||
setupPage(new GenericCanSetupPage())
|
|
||||||
{
|
{
|
||||||
QObject::connect(&backend, SIGNAL(onSetupDialogCreated(SetupDialog&)), setupPage, SLOT(onSetupDialogCreated(SetupDialog&)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketCanDriver::~SocketCanDriver() {
|
SocketCanDriver::~SocketCanDriver() {
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
class SocketCanInterface;
|
class SocketCanInterface;
|
||||||
class SetupDialogInterfacePage;
|
class SetupDialogInterfacePage;
|
||||||
class GenericCanSetupPage;
|
|
||||||
|
|
||||||
class SocketCanDriver: public CanDriver {
|
class SocketCanDriver: public CanDriver {
|
||||||
public:
|
public:
|
||||||
@@ -39,5 +38,4 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SocketCanInterface *createOrUpdateInterface(int index, QString name);
|
SocketCanInterface *createOrUpdateInterface(int index, QString name);
|
||||||
GenericCanSetupPage *setupPage;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ HEADERS += \
|
|||||||
$$PWD/SocketCanInterface.h \
|
$$PWD/SocketCanInterface.h \
|
||||||
$$PWD/SocketCanDriver.h
|
$$PWD/SocketCanDriver.h
|
||||||
|
|
||||||
FORMS +=
|
INCLUDEPATH += /usr/include/libnl3
|
||||||
|
LIBS += -lnl-3 -lnl-route-3
|
||||||
@@ -131,17 +131,11 @@ Rectangle {
|
|||||||
delegate: CustomControls.ColoredLabel {
|
delegate: CustomControls.ColoredLabel {
|
||||||
text: modelData.description
|
text: modelData.description
|
||||||
backgroundColor: Palette.neutralColor
|
backgroundColor: Palette.neutralColor
|
||||||
font.pixelSize: 11
|
font.pixelSize: 12
|
||||||
|
width: parent.width
|
||||||
onWidthChanged: {
|
|
||||||
if (width > statusView.contentWidth) {
|
|
||||||
statusView.contentWidth = width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {}
|
ScrollBar.vertical: ScrollBar {}
|
||||||
ScrollBar.horizontal: ScrollBar {}
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ Controls.TextField {
|
|||||||
horizontalAlignment: Text.AlignRight
|
horizontalAlignment: Text.AlignRight
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
topPadding: 6
|
topPadding: 4
|
||||||
bottomPadding: 6
|
bottomPadding: 4
|
||||||
leftPadding: 12
|
leftPadding: 12
|
||||||
rightPadding: 12 + Math.ceil(indicatorLabel.width) + (indicatorLabel.visible ? 12 : 0)
|
rightPadding: 12 + Math.ceil(indicatorLabel.width) + (indicatorLabel.visible ? 12 : 0)
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ ApplicationWindow {
|
|||||||
width: 1280
|
width: 1280
|
||||||
height: 1024
|
height: 1024
|
||||||
visible: true
|
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")
|
title: qsTr("Stand Battery View")
|
||||||
color: Palette.backgroundColor
|
color: Palette.backgroundColor
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ RESOURCES += \
|
|||||||
Fonts/fonts.qrc \
|
Fonts/fonts.qrc \
|
||||||
Qml/qml.qrc
|
Qml/qml.qrc
|
||||||
|
|
||||||
TRANSLATIONS += StandBatteryView_ru_RU.ts
|
# TRANSLATIONS += StandBatteryView_ru_RU.ts
|
||||||
CONFIG += lrelease
|
# CONFIG += lrelease
|
||||||
CONFIG += embed_translations
|
# CONFIG += embed_translations
|
||||||
|
|
||||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
# 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
|
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