Changed "About" screen

This commit is contained in:
Raphael Coeffic
2021-06-23 16:26:40 +02:00
parent 68cb9c2d92
commit efc947da63
22 changed files with 81 additions and 1162 deletions
+1
View File
@@ -55,6 +55,7 @@ set(GUI_SRC
radio_diagkeys.cpp
radio_diaganas.cpp
radio_calibration.cpp
view_about.cpp
view_main.cpp
view_main_menu.cpp
view_main_decoration.cpp
+25 -124
View File
@@ -1,7 +1,8 @@
/*
* Copyright (C) OpenTX
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
@@ -18,136 +19,36 @@
* GNU General Public License for more details.
*/
#include "view_about.h"
#include "opentx.h"
enum AboutScreens {
ABOUT_OPENTX,
ABOUT_HARDWARE,
ABOUT_BERTRAND,
ABOUT_ANDRE,
ABOUT_MIKE,
ABOUT_KJELL,
ABOUT_MARTIN,
ABOUT_ROMOLO,
ABOUT_ROB,
ABOUT_PARENTS,
ABOUT_END,
ABOUT_COUNT,
const uint8_t mask_qrcode[] = {
#include "mask_qrcode.lbm"
};
#define ABOUT_X 62
#define ABOUT_INDENT 16
constexpr coord_t ABOUT_WIDTH = 220;
bool menuAboutView(event_t event)
AboutUs::AboutUs() :
MessageDialog(MainWindow::instance(), STR_ABOUT_US, "")
{
static uint8_t screenIndex = 0;
static uint8_t greyIndex = 0;
content->setRect({(LCD_W - ABOUT_WIDTH) / 2, 20, ABOUT_WIDTH, LCD_H - 40});
switch (event) {
case EVT_ENTRY:
screenIndex = 0;
greyIndex = 0;
break;
#if defined(PCBX12S)
case EVT_KEY_FIRST(KEY_PGDN):
#elif defined(PCBX10)
case EVT_KEY_BREAK(KEY_PGDN):
#endif
screenIndex < ABOUT_PARENTS ? screenIndex++ : screenIndex = ABOUT_OPENTX;
greyIndex = 0;
break;
case EVT_KEY_FIRST(KEY_PGUP):
#if defined(PCBX10)
case EVT_KEY_LONG(KEY_PGDN):
#endif
screenIndex > ABOUT_OPENTX ? screenIndex-- : screenIndex = ABOUT_PARENTS;
greyIndex = 0;
killEvents(event);
break;
case EVT_KEY_FIRST(KEY_EXIT):
chainMenu(menuMainView);
break;
}
messageWidget->setTextFlags(CENTERED | FONT(BOLD) | DEFAULT_COLOR);
messageWidget->setTop(content->top() + 40);
messageWidget->setHeight(2*PAGE_LINE_HEIGHT);
theme->drawBackground();
theme->drawTopbarBackground(0);
messageWidget->setText("EdgeTX Endeavour (2.4.0)\n"
"Copyright (C) 2021 EdgeTX");
uint8_t screenDuration = 150;
switch (screenIndex) {
case ABOUT_OPENTX:
case ABOUT_END:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_OPENTX_1);
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP + FH, STR_ABOUT_OPENTX_2);
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_OPENTX_3);
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_OPENTX_4);
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP + 4*FH, STR_ABOUT_OPENTX_5);
screenDuration = 255;
break;
case ABOUT_BERTRAND:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_BERTRAND_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_BERTRAND_2);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_BERTRAND_3);
break;
case ABOUT_ANDRE:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_ANDRE_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ANDRE_2);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_ANDRE_3);
break;
case ABOUT_MIKE:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_MIKE_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_MIKE_2);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_MIKE_3);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_MIKE_4);
break;
case ABOUT_KJELL:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_KJELL_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_KJELL_2);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_KJELL_3);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_KJELL_4);
break;
case ABOUT_MARTIN:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_MARTIN_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_MARTIN_2);
break;
case ABOUT_ROMOLO:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_ROMOLO_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ROMOLO_2);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_ROMOLO_3);
break;
case ABOUT_ROB:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_ROB_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ROB_2);
break;
case ABOUT_HARDWARE:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_HARDWARE_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_HARDWARE_2);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_HARDWARE_3);
break;
case ABOUT_PARENTS:
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_PARENTS_1, INVERS);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_PARENTS_2);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_PARENTS_3);
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_PARENTS_4);
screenDuration = 255;
break;
}
if (++greyIndex == screenDuration) {
greyIndex = 0;
if (++screenIndex == ABOUT_COUNT) {
chainMenu(menuMainView);
}
}
return true;
qrcode = BitmapBuffer::load8bitMaskOnBackground(mask_qrcode, DEFAULT_COLOR,
DEFAULT_BGCOLOR);
new StaticBitmap(content,
rect_t{ content->width() / 2 - qrcode->width() / 2, 80,
qrcode->width(), qrcode->height()},
qrcode);
}
AboutUs::~AboutUs()
{
delete qrcode;
}
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "libopenui.h"
class AboutUs : public MessageDialog
{
BitmapBuffer* qrcode = nullptr;
public:
AboutUs();
~AboutUs();
};
+2 -1
View File
@@ -26,6 +26,7 @@
#include "menu_model.h"
#include "menu_radio.h"
#include "menu_screen.h"
#include "view_about.h"
#include "view_channels.h"
#include "view_statistics.h"
#include "select_fab_carousel.h"
@@ -101,7 +102,7 @@ ViewMainMenu::ViewMainMenu(Window* parent) :
carousel->addButton(ICON_OPENTX, "About\nEdgeTX", [=]() -> uint8_t {
deleteLater();
//TODO: new AboutUs();
new AboutUs();
return 0;
});