Skip to content

Commit

Permalink
updated mainwindow
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno3634-gif committed Aug 29, 2024
1 parent b683fcc commit f7f4f64
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 51 deletions.
25 changes: 17 additions & 8 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <cstddef>
#include <qmainwindow.h>
#include "flabel.h"
#include "qprogressbar.h"

static store* store_ref;
/**
Expand Down Expand Up @@ -42,22 +43,30 @@ MainWindow::MainWindow(QWidget *parent, QString serialDev)
**/

#ifdef __LART_T24__
FLabel* Soc_Label = this->findChild<FLabel*>("Soc_Label");
FLabel* BatteryTemperature_Label = this->findChild<FLabel*>("BatteryTemperature_Label");
QProgressBar* Soc_Label = this->findChild<QProgressBar*>("SOCLimitBar");
QProgressBar* Power_Limit_Label = this->findChild<QProgressBar*>("PowerLimitBar");
FLabel* Speed_Label = this->findChild<FLabel*>("speed_Label");
FLabel* InverterTemperature_Label = this->findChild<FLabel*>("InverterTemperature_Label");
FLabel* Power_Label = this->findChild<FLabel*>("Power_Label");
FLabel* Consumed_Power_Label = this->findChild<FLabel*>("Consumed_Label");
//TODO change representation of laptime
FLabel* LapTime_Label = this->findChild<FLabel*>("LapTime_Label");
FLabel* DiffTime_Label = this->findChild<FLabel*>("DiffTime_Label");
FLabel* LapCount_Label = this->findChild<FLabel*>("LapCount_Label");
//FLabel* TyreTemperature_Label = this->findChild<FLabel*>("TyreTemperature_Label");
connect(store_ref, &store::socChanged, Soc_Label, (void (FLabel::*)(float, float))&FLabel::setVisual);
connect(store_ref, &store::batteryTemperatureChanged, BatteryTemperature_Label, (void (FLabel::*)(float, float))&FLabel::setVisual);
connect(store_ref, &store::inverterTemperatureChanged, InverterTemperature_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::powerChanged, Power_Label, (void (FLabel::*)(short, short))&FLabel::setVisual);
connect(store_ref,&store::socChanged,[Soc_Label](int soc){
Soc_Label->setValue(soc);
});
connect(store_ref,&store::power_limitChanged,[Power_Limit_Label](int power){
Power_Limit_Label->setValue(power);
});

connect(store_ref, &store::vehicleSpeedChanged, Speed_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::vehicleSpeedChanged, Speed_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::inverterTemperatureChanged, InverterTemperature_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::powerChanged, Consumed_Power_Label, (void (FLabel::*)(short, short))&FLabel::setVisual);
connect(store_ref, &store::lapTimeChanged, LapTime_Label, (void (FLabel::*)(QTime, QTime))&FLabel::setVisual);
connect(store_ref, &store::diffLapTimeChanged, DiffTime_Label, (void (FLabel::*)(QTime, QTime))&FLabel::setVisual);
connect(store_ref, &store::lapCountChanged, LapCount_Label, (void (FLabel::*)(short, short))&FLabel::setVisual);
connect(store_ref, &store::lapCountChanged, LapCount_Label, (void (FLabel::*)(short, short))&FLabel::setVisual);
//connect(store_ref, &store::tyreTemperatureChanged, TyreTemperature_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);


Expand Down
57 changes: 14 additions & 43 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<width>844</width>
<height>480</height>
</rect>
</property>
Expand All @@ -26,7 +26,7 @@
<string>LukHudX</string>
</property>
<property name="layoutDirection">
<enum>Qt::LayoutDirection::LeftToRight</enum>
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>true</bool>
Expand All @@ -52,11 +52,8 @@
</property>
<item>
<spacer name="vs_4">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -68,9 +65,6 @@
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
Expand All @@ -93,18 +87,13 @@
<font>
<family>Fira Mono</family>
<pointsize>28</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="value">
<number>24</number>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
Expand All @@ -117,11 +106,8 @@
</item>
<item>
<spacer name="vs_3">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -140,11 +126,8 @@
</property>
<item>
<spacer name="vs_4">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -156,9 +139,6 @@
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
Expand All @@ -181,18 +161,13 @@
<font>
<family>Fira Mono</family>
<pointsize>28</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="value">
<number>24</number>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
Expand All @@ -205,11 +180,8 @@
</item>
<item>
<spacer name="vs_1">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -233,6 +205,7 @@
<font>
<family>Fira Mono</family>
<pointsize>60</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand All @@ -250,7 +223,7 @@
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="Velocity_Label">
<widget class="QLabel" name="speed_Label">
<property name="minimumSize">
<size>
<width>194</width>
Expand All @@ -267,15 +240,13 @@
<font>
<family>Fira Mono</family>
<pointsize>48</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>100</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
Expand All @@ -290,6 +261,7 @@
<font>
<family>Fira Mono</family>
<pointsize>48</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand All @@ -316,6 +288,7 @@
<font>
<family>Fira Mono</family>
<pointsize>48</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -348,15 +321,13 @@
<font>
<family>Fira Mono</family>
<pointsize>48</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>80</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
</layout>
Expand Down

0 comments on commit f7f4f64

Please sign in to comment.