Move R2D/precharge bar to custom container

This commit is contained in:
2024-06-11 22:17:21 +02:00
parent 5a66f9bc54
commit cb2f55be1b
19 changed files with 382 additions and 170 deletions

View File

@ -0,0 +1,37 @@
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#ifndef PROGRESSBARBASE_HPP
#define PROGRESSBARBASE_HPP
#include <gui/common/FrontendApplication.hpp>
#include <touchgfx/containers/Container.hpp>
#include <touchgfx/widgets/TextAreaWithWildcard.hpp>
#include <touchgfx/widgets/TextArea.hpp>
#include <touchgfx/containers/progress_indicators/BoxProgress.hpp>
class ProgressBarBase : public touchgfx::Container
{
public:
ProgressBarBase();
virtual ~ProgressBarBase();
virtual void initialize();
protected:
FrontendApplication& application() {
return *static_cast<FrontendApplication*>(touchgfx::Application::getInstance());
}
/*
* Member Declarations
*/
touchgfx::TextAreaWithOneWildcard r2dProgressLabel;
touchgfx::TextArea r2dLabel;
touchgfx::TextArea prechargeLabel;
touchgfx::BoxProgress progressBar;
private:
};
#endif // PROGRESSBARBASE_HPP

View File

@ -20,7 +20,7 @@
#include <gui/containers/DriverViewField.hpp>
#include <touchgfx/containers/ListLayout.hpp>
#include <gui/containers/DriverViewStatusItem.hpp>
#include <touchgfx/containers/progress_indicators/BoxProgress.hpp>
#include <gui/containers/ProgressBar.hpp>
#include <gui/containers/ErrorPopup.hpp>
class DriverViewViewBase : public touchgfx::View<DriverViewPresenter>
@ -98,10 +98,7 @@ protected:
DriverViewStatusItem statusPDU;
DriverViewStatusItem statusINV;
DriverViewStatusItem statusLV;
touchgfx::BoxProgress progressBar;
touchgfx::TextArea prechargeLabel;
touchgfx::TextArea r2dLabel;
touchgfx::TextAreaWithOneWildcard r2dProgressLabel;
ProgressBar progressBar;
ErrorPopup errorPopup;
private:

View File

@ -19,6 +19,27 @@ public:
EnduranceViewBase();
virtual ~EnduranceViewBase();
virtual void setupScreen();
virtual void handleKeyEvent(uint8_t key);
/*
* Virtual Action Handlers
*/
virtual void decreasePowerLimit()
{
// Override and implement this function in Endurance
}
virtual void increasePowerLimit()
{
// Override and implement this function in Endurance
}
virtual void decreaseSpeedLimit()
{
// Override and implement this function in Endurance
}
virtual void increaseSpeedLimit()
{
// Override and implement this function in Endurance
}
protected:
FrontendApplication& application() {

View File

@ -0,0 +1,53 @@
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/containers/ProgressBarBase.hpp>
#include <texts/TextKeysAndLanguages.hpp>
#include <touchgfx/Color.hpp>
#include <images/BitmapDatabase.hpp>
ProgressBarBase::ProgressBarBase()
{
setWidth(456);
setHeight(33);
r2dProgressLabel.setPosition(168, -2, 219, 37);
r2dProgressLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
r2dProgressLabel.setLinespacing(0);
r2dProgressLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_6EXA));
r2dProgressLabel.setVisible(false);
add(r2dProgressLabel);
r2dLabel.setPosition(70, -2, 317, 37);
r2dLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
r2dLabel.setLinespacing(0);
r2dLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_570K));
r2dLabel.setVisible(false);
add(r2dLabel);
prechargeLabel.setXY(95, -2);
prechargeLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
prechargeLabel.setLinespacing(0);
prechargeLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_G2S2));
prechargeLabel.setVisible(false);
add(prechargeLabel);
progressBar.setXY(0, 0);
progressBar.setProgressIndicatorPosition(0, 0, 480, 55);
progressBar.setRange(0, 100);
progressBar.setDirection(touchgfx::AbstractDirectionProgress::RIGHT);
progressBar.setBackground(touchgfx::Bitmap(BITMAP_PROG_HORIZ_BG_ID));
progressBar.setColor(touchgfx::Color::getColorFromRGB(99, 186, 0));
progressBar.setValue(0);
progressBar.setVisible(false);
add(progressBar);
}
ProgressBarBase::~ProgressBarBase()
{
}
void ProgressBarBase::initialize()
{
}

View File

@ -124,36 +124,8 @@ DriverViewViewBase::DriverViewViewBase() :
statusBar.add(statusItems);
progressBar.setXY(0, 0);
progressBar.setProgressIndicatorPosition(0, 0, 480, 55);
progressBar.setRange(0, 100);
progressBar.setDirection(touchgfx::AbstractDirectionProgress::RIGHT);
progressBar.setBackground(touchgfx::Bitmap(BITMAP_PROG_HORIZ_BG_ID));
progressBar.setColor(touchgfx::Color::getColorFromRGB(99, 186, 0));
progressBar.setValue(0);
progressBar.setVisible(false);
statusBar.add(progressBar);
prechargeLabel.setXY(95, -2);
prechargeLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
prechargeLabel.setLinespacing(0);
prechargeLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_HMH2));
prechargeLabel.setVisible(false);
statusBar.add(prechargeLabel);
r2dLabel.setPosition(70, -2, 317, 37);
r2dLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
r2dLabel.setLinespacing(0);
r2dLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_NGUK));
r2dLabel.setVisible(false);
statusBar.add(r2dLabel);
r2dProgressLabel.setPosition(168, -2, 219, 37);
r2dProgressLabel.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
r2dProgressLabel.setLinespacing(0);
r2dProgressLabel.setTypedText(touchgfx::TypedText(T___SINGLEUSE_J5UH));
r2dProgressLabel.setVisible(false);
statusBar.add(r2dProgressLabel);
add(statusBar);
errorPopup.setXY(12, 125);
@ -187,6 +159,7 @@ void DriverViewViewBase::setupScreen()
statusPDU.initialize();
statusINV.initialize();
statusLV.initialize();
progressBar.initialize();
errorPopup.initialize();
}

View File

@ -126,3 +126,42 @@ void EnduranceViewBase::setupScreen()
{
}
void EnduranceViewBase::handleKeyEvent(uint8_t key)
{
if(104 == key)
{
//DecreasePLim
//When hardware button 104 clicked call virtual function
//Call decreasePowerLimit
decreasePowerLimit();
}
if(108 == key)
{
//IncreasePLim
//When hardware button 108 clicked call virtual function
//Call increasePowerLimit
increasePowerLimit();
}
if(107 == key)
{
//DecreaseSLim
//When hardware button 107 clicked call virtual function
//Call decreaseSpeedLimit
decreaseSpeedLimit();
}
if(106 == key)
{
//IncreaseSLim
//When hardware button 106 clicked call virtual function
//Call increaseSpeedLimit
increaseSpeedLimit();
}
}