Update to latest libopenui

This commit is contained in:
Bertrand Songis
2020-12-04 16:37:42 +01:00
parent edd16a4b85
commit 0f87115dc4
9 changed files with 15 additions and 14 deletions
+2 -2
View File
@@ -23,7 +23,7 @@
#include "opentx.h" #include "opentx.h"
FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string message, std::string action, const std::function<void(void)> & confirmHandler): FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string message, std::string action, const std::function<void(void)> & confirmHandler):
FormGroup(&mainWindow, {0, 0, LCD_W, LCD_H}, OPAQUE), FormGroup(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE),
type(type), type(type),
title(std::move(title)), title(std::move(title)),
message(std::move(message)), message(std::move(message)),
@@ -145,7 +145,7 @@ void FullScreenDialog::runForever()
WDG_RESET(); WDG_RESET();
RTOS_WAIT_MS(20); RTOS_WAIT_MS(20);
mainWindow.run(false); MainWindow::instance()->run(false);
} }
Window::deleteLater(); Window::deleteLater();
+4 -4
View File
@@ -58,19 +58,19 @@
inline MessageDialog * createPopupInformation(const char * message) inline MessageDialog * createPopupInformation(const char * message)
{ {
return new MessageDialog(&mainWindow, "Message", message); return new MessageDialog(MainWindow::instance(), "Message", message);
} }
inline MessageDialog * createPopupWarning(const char * message) inline MessageDialog * createPopupWarning(const char * message)
{ {
return new MessageDialog(&mainWindow, "Warning", message); return new MessageDialog(MainWindow::instance(), "Warning", message);
} }
inline void POPUP_INFORMATION(const char * message) inline void POPUP_INFORMATION(const char * message)
{ {
auto popup = createPopupInformation(message); auto popup = createPopupInformation(message);
while (popup->getParent()) { while (popup->getParent()) {
mainWindow.run(false); MainWindow::instance()->run(false);
} }
} }
@@ -81,7 +81,7 @@ inline void POPUP_WARNING(const char * message, const char * info = nullptr)
popup->setInfoText(std::string(info)); popup->setInfoText(std::string(info));
} }
while (popup->getParent()) { while (popup->getParent()) {
mainWindow.run(false); MainWindow::instance()->run(false);
} }
} }
+1 -1
View File
@@ -42,7 +42,7 @@ void PageHeader::paint(BitmapBuffer * dc)
} }
Page::Page(unsigned icon): Page::Page(unsigned icon):
Window(&mainWindow, {0, 0, LCD_W, LCD_H}, OPAQUE), Window(MainWindow::instance(), {0, 0, LCD_W, LCD_H}, OPAQUE),
header(this, icon), header(this, icon),
body(this, { 0, MENU_HEADER_HEIGHT, LCD_W, LCD_H - MENU_HEADER_HEIGHT }, FORM_FORWARD_FOCUS) body(this, { 0, MENU_HEADER_HEIGHT, LCD_W, LCD_H - MENU_HEADER_HEIGHT }, FORM_FORWARD_FOCUS)
{ {
+1 -1
View File
@@ -113,7 +113,7 @@ class FlashDialog: public FullScreenDialog
device.flashFirmware(filename, [=](const char * title, const char * message, int count, int total) -> void { device.flashFirmware(filename, [=](const char * title, const char * message, int count, int total) -> void {
setMessage(message); setMessage(message);
progress.setValue(total > 0 ? count * 100 / total : 0); progress.setValue(total > 0 ? count * 100 / total : 0);
mainWindow.run(false); MainWindow::instance()->run(false);
}); });
deleteLater(); deleteLater();
} }
+1 -1
View File
@@ -74,7 +74,7 @@ bool TabsCarousel::onTouchEnd(coord_t x, coord_t y)
#endif #endif
TabsGroup::TabsGroup(uint8_t icon): TabsGroup::TabsGroup(uint8_t icon):
Window(&mainWindow, { 0, 0, LCD_W, LCD_H }, OPAQUE), Window(MainWindow::instance(), { 0, 0, LCD_W, LCD_H }, OPAQUE),
header(this, icon), header(this, icon),
body(this, { 0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT }, FORM_FORWARD_FOCUS) body(this, { 0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT }, FORM_FORWARD_FOCUS)
{ {
+1 -1
View File
@@ -59,7 +59,7 @@ int getMainViewsCount()
ViewMain * ViewMain::instance = nullptr; ViewMain * ViewMain::instance = nullptr;
ViewMain::ViewMain(bool icons): ViewMain::ViewMain(bool icons):
FormWindow(&mainWindow, { 0, 0, LCD_W, LCD_H }) FormWindow(MainWindow::instance(), { 0, 0, LCD_W, LCD_H })
{ {
instance = this; instance = this;
+2 -2
View File
@@ -36,7 +36,7 @@ void openUsbMenu()
static Menu * menu = nullptr; static Menu * menu = nullptr;
if (menu) if (menu)
return; return;
menu = new Menu(&mainWindow); menu = new Menu(MainWindow::instance());
menu->setCloseHandler([]() { menu->setCloseHandler([]() {
menu = nullptr; menu = nullptr;
}); });
@@ -329,7 +329,7 @@ void guiMain(event_t evt)
bool screenshotRequested = (mainRequestFlags & (1u << REQUEST_SCREENSHOT)); bool screenshotRequested = (mainRequestFlags & (1u << REQUEST_SCREENSHOT));
#if defined(LIBOPENUI) #if defined(LIBOPENUI)
mainWindow.run(); MainWindow::instance()->run();
#else #else
if (!refreshNeeded) { if (!refreshNeeded) {
DEBUG_TIMER_START(debugTimerMenus); DEBUG_TIMER_START(debugTimerMenus);
+2 -1
View File
@@ -1902,6 +1902,7 @@ void opentxInit()
TRACE("opentxInit"); TRACE("opentxInit");
#if defined(LIBOPENUI) #if defined(LIBOPENUI)
new MainWindow();
new ViewMain(); new ViewMain();
#elif defined(GUI) #elif defined(GUI)
// TODO add a function for this (duplicated) // TODO add a function for this (duplicated)
@@ -2260,7 +2261,7 @@ uint32_t pwrCheck()
else { else {
#if defined(COLORLCD) #if defined(COLORLCD)
if (pwr_press_time != 0) if (pwr_press_time != 0)
mainWindow.invalidate(); MainWindow::instance()->invalidate();
#endif #endif
pwr_check_state = PWR_CHECK_ON; pwr_check_state = PWR_CHECK_ON;
pwr_press_time = 0; pwr_press_time = 0;