Moved time to special menudisplay
This commit is contained in:
@@ -199,6 +199,7 @@ set(headers
|
|||||||
webserver_settings.h
|
webserver_settings.h
|
||||||
webserver_stringsettings.h
|
webserver_stringsettings.h
|
||||||
widgets/doubleprogressbar.h
|
widgets/doubleprogressbar.h
|
||||||
|
widgets/menudisplaywithtime.h
|
||||||
wifi_bobbycar.h
|
wifi_bobbycar.h
|
||||||
wifitexthelpers.h
|
wifitexthelpers.h
|
||||||
)
|
)
|
||||||
@@ -405,6 +406,7 @@ set(sources
|
|||||||
webserver_settings.cpp
|
webserver_settings.cpp
|
||||||
webserver_stringsettings.cpp
|
webserver_stringsettings.cpp
|
||||||
widgets/doubleprogressbar.cpp
|
widgets/doubleprogressbar.cpp
|
||||||
|
widgets/menudisplaywithtime.cpp
|
||||||
wifi_bobbycar.cpp
|
wifi_bobbycar.cpp
|
||||||
wifitexthelpers.cpp
|
wifitexthelpers.cpp
|
||||||
)
|
)
|
||||||
|
@@ -110,16 +110,3 @@ void MainMenu::back()
|
|||||||
{
|
{
|
||||||
switchScreen<StatusDisplay>();
|
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
|
#pragma once
|
||||||
|
|
||||||
// 3rdparty lib includes
|
// 3rdparty lib includes
|
||||||
#include "menudisplay.h"
|
|
||||||
#include "menuitem.h"
|
#include "menuitem.h"
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
|
#include "widgets/menudisplaywithtime.h"
|
||||||
#ifdef MAINMENU_PLUGIN
|
#ifdef MAINMENU_PLUGIN
|
||||||
#include MAINMENU_PLUGIN
|
#include MAINMENU_PLUGIN
|
||||||
#endif
|
#endif
|
||||||
@@ -22,15 +22,11 @@ namespace {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class MainMenu :
|
class MainMenu :
|
||||||
public espgui::MenuDisplay,
|
public bobbygui::MenuDisplayWithTime,
|
||||||
public espgui::StaticText<TEXT_MAINMENU>
|
public espgui::StaticText<TEXT_MAINMENU>
|
||||||
{
|
{
|
||||||
using Base = espgui::MenuDisplay;
|
using Base = espgui::MenuDisplay;
|
||||||
public:
|
public:
|
||||||
MainMenu();
|
MainMenu();
|
||||||
|
|
||||||
void back() override;
|
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