Merge remote-tracking branch 'origin/raphaelcoeffic/getmainzone' into raphaelcoeffic/getmainzone
This commit is contained in:
@@ -78,7 +78,7 @@ void loadDefaultLayout()
|
||||
strcpy(screenData.layoutName, defaultLayout->getName());
|
||||
screen = defaultLayout->create(&screenData.layoutData);
|
||||
if (screen) {
|
||||
screen->attach(ViewMain::instance);
|
||||
screen->attach(ViewMain::instance());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ void loadCustomScreens()
|
||||
&g_model.screenData[i].layoutData);
|
||||
|
||||
if (screen) {
|
||||
screen->attach(ViewMain::instance);
|
||||
screen->attach(ViewMain::instance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ TabsGroupHeader::TabsGroupHeader(TabsGroup * parent, uint8_t icon):
|
||||
back(this, { 0, 0, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH }, ICON_BACK,
|
||||
[=]() -> uint8_t {
|
||||
parent->deleteLater();
|
||||
ViewMain::instance->setFocus((SET_FOCUS_DEFAULT));
|
||||
ViewMain::instance()->setFocus((SET_FOCUS_DEFAULT));
|
||||
return 1;
|
||||
}, NO_FOCUS),
|
||||
#endif
|
||||
@@ -160,7 +160,7 @@ void TabsGroup::onEvent(event_t event)
|
||||
}
|
||||
else if (event == EVT_KEY_LONG(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) {
|
||||
killEvents(event);
|
||||
ViewMain::instance->setFocus(SET_FOCUS_DEFAULT);
|
||||
ViewMain::instance()->setFocus(SET_FOCUS_DEFAULT);
|
||||
deleteLater();
|
||||
}
|
||||
else if (parent) {
|
||||
|
||||
@@ -56,38 +56,35 @@ int getMainViewsCount()
|
||||
return MAX_CUSTOM_SCREENS;
|
||||
}
|
||||
|
||||
ViewMain * ViewMain::instance = nullptr;
|
||||
ViewMain * ViewMain::_instance = nullptr;
|
||||
|
||||
ViewMain::ViewMain(bool icons):
|
||||
ViewMain::ViewMain():
|
||||
FormWindow(MainWindow::instance(), { 0, 0, LCD_W, LCD_H })
|
||||
{
|
||||
instance = this;
|
||||
|
||||
#if defined(HARDWARE_TOUCH) && !defined(HARDWARE_KEYS)
|
||||
if (icons) {
|
||||
new FabButton(this, 50, 100, ICON_MODEL,
|
||||
[=]() -> uint8_t {
|
||||
new ModelMenu();
|
||||
return 0;
|
||||
});
|
||||
new FabButton(this, 50, 100, ICON_MODEL,
|
||||
[=]() -> uint8_t {
|
||||
new ModelMenu();
|
||||
return 0;
|
||||
});
|
||||
|
||||
new FabButton(this, LCD_W / 2, 100, ICON_RADIO,
|
||||
[=]() -> uint8_t {
|
||||
new RadioMenu();
|
||||
return 0;
|
||||
});
|
||||
new FabButton(this, LCD_W / 2, 100, ICON_RADIO,
|
||||
[=]() -> uint8_t {
|
||||
new RadioMenu();
|
||||
return 0;
|
||||
});
|
||||
|
||||
new FabButton(this, LCD_W - 50, 100, ICON_THEME,
|
||||
[=]() -> uint8_t {
|
||||
new ScreenMenu();
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
new FabButton(this, LCD_W - 50, 100, ICON_THEME,
|
||||
[=]() -> uint8_t {
|
||||
new ScreenMenu();
|
||||
return 0;
|
||||
});
|
||||
|
||||
new IconButton(this, {0, 0, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH}, ICON_BACK,
|
||||
[=]() -> uint8_t {
|
||||
openMenu();
|
||||
return 0;
|
||||
openMenu();
|
||||
return 0;
|
||||
}, NO_FOCUS);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -23,12 +23,22 @@
|
||||
|
||||
#include "form.h"
|
||||
|
||||
class ViewMain: public FormWindow {
|
||||
public:
|
||||
explicit ViewMain(bool icons = true);
|
||||
class ViewMain: public FormWindow
|
||||
{
|
||||
// singleton
|
||||
explicit ViewMain();
|
||||
|
||||
public:
|
||||
~ViewMain() override;
|
||||
|
||||
static ViewMain * instance()
|
||||
{
|
||||
if (!_instance)
|
||||
_instance = new ViewMain();
|
||||
|
||||
return _instance;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override
|
||||
{
|
||||
@@ -36,9 +46,9 @@ class ViewMain: public FormWindow {
|
||||
}
|
||||
#endif
|
||||
|
||||
static ViewMain * instance;
|
||||
|
||||
protected:
|
||||
static ViewMain * _instance;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
@@ -1896,10 +1896,7 @@ void opentxInit()
|
||||
{
|
||||
TRACE("opentxInit");
|
||||
|
||||
#if defined(LIBOPENUI)
|
||||
new MainWindow();
|
||||
new ViewMain();
|
||||
#elif defined(GUI)
|
||||
#if defined(GUI) && !defined(LIBOPENUI)
|
||||
// TODO add a function for this (duplicated)
|
||||
menuHandlers[0] = menuMainView;
|
||||
#if MENUS_LOCK != 2/*no menus*/
|
||||
|
||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 2d57320ce3...bf5632d53b
Reference in New Issue
Block a user