Moved time to special menudisplay
This commit is contained in:
@ -199,6 +199,7 @@ set(headers
|
||||
webserver_settings.h
|
||||
webserver_stringsettings.h
|
||||
widgets/doubleprogressbar.h
|
||||
widgets/menudisplaywithtime.h
|
||||
wifi_bobbycar.h
|
||||
wifitexthelpers.h
|
||||
)
|
||||
@ -405,6 +406,7 @@ set(sources
|
||||
webserver_settings.cpp
|
||||
webserver_stringsettings.cpp
|
||||
widgets/doubleprogressbar.cpp
|
||||
widgets/menudisplaywithtime.cpp
|
||||
wifi_bobbycar.cpp
|
||||
wifitexthelpers.cpp
|
||||
)
|
||||
|
@ -110,16 +110,3 @@ void MainMenu::back()
|
||||
{
|
||||
switchScreen<StatusDisplay>();
|
||||
}
|
||||
|
||||
void MainMenu::start()
|
||||
{
|
||||
Base::start();
|
||||
m_label_currentTime.start();
|
||||
}
|
||||
|
||||
void MainMenu::redraw()
|
||||
{
|
||||
Base::redraw();
|
||||
tft.setTextFont(2);
|
||||
m_label_currentTime.redraw(fmt::format("&7Time: {}", local_clock_string()));
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include "menudisplay.h"
|
||||
#include "menuitem.h"
|
||||
|
||||
// local includes
|
||||
#include "texts.h"
|
||||
#include "widgets/menudisplaywithtime.h"
|
||||
#ifdef MAINMENU_PLUGIN
|
||||
#include MAINMENU_PLUGIN
|
||||
#endif
|
||||
@ -22,15 +22,11 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
class MainMenu :
|
||||
public espgui::MenuDisplay,
|
||||
public bobbygui::MenuDisplayWithTime,
|
||||
public espgui::StaticText<TEXT_MAINMENU>
|
||||
{
|
||||
using Base = espgui::MenuDisplay;
|
||||
public:
|
||||
MainMenu();
|
||||
|
||||
void back() override;
|
||||
void start() override;
|
||||
void redraw() override;
|
||||
espgui::Label m_label_currentTime{145, 6};
|
||||
};
|
||||
|
21
main/widgets/menudisplaywithtime.cpp
Normal file
21
main/widgets/menudisplaywithtime.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "menudisplaywithtime.h"
|
||||
#include "tftinstance.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace espgui;
|
||||
|
||||
namespace bobbygui {
|
||||
void MenuDisplayWithTime::start()
|
||||
{
|
||||
Base::start();
|
||||
m_label_currentTime.start();
|
||||
}
|
||||
|
||||
void MenuDisplayWithTime::redraw()
|
||||
{
|
||||
Base::redraw();
|
||||
tft.setTextFont(2);
|
||||
m_label_currentTime.redraw(fmt::format("&7Time: {}", local_clock_string()));
|
||||
}
|
||||
|
||||
} // namespace
|
15
main/widgets/menudisplaywithtime.h
Normal file
15
main/widgets/menudisplaywithtime.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <menudisplay.h>
|
||||
|
||||
namespace bobbygui {
|
||||
class MenuDisplayWithTime :
|
||||
public espgui::MenuDisplay
|
||||
{
|
||||
using Base = espgui::MenuDisplay;
|
||||
public:
|
||||
void start() override;
|
||||
void redraw() override;
|
||||
espgui::Label m_label_currentTime{145, 6};
|
||||
};
|
||||
} // namespace
|
Reference in New Issue
Block a user