2015-07-08 11:39:24 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-12-09 12:21:47 -05:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-07-08 11:39:24 -04:00
|
|
|
*
|
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2018-05-16 04:45:13 -04:00
|
|
|
#ifndef __UI_SETTINGS_H__
|
|
|
|
#define __UI_SETTINGS_H__
|
2015-07-08 11:39:24 -04:00
|
|
|
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_menu.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
2016-07-26 21:03:40 -04:00
|
|
|
#include "ff.h"
|
2015-07-08 11:39:24 -04:00
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
struct SetDateTimeModel {
|
|
|
|
uint16_t year;
|
|
|
|
uint8_t month;
|
|
|
|
uint8_t day;
|
|
|
|
uint8_t hour;
|
|
|
|
uint8_t minute;
|
|
|
|
uint8_t second;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SetDateTimeView : public View {
|
|
|
|
public:
|
|
|
|
SetDateTimeView(NavigationView& nav);
|
|
|
|
|
|
|
|
void focus() override;
|
2018-01-07 18:13:08 -05:00
|
|
|
|
|
|
|
std::string title() const override { return "Set Date/Time"; };
|
2015-07-08 11:39:24 -04:00
|
|
|
|
|
|
|
private:
|
2018-05-16 04:45:13 -04:00
|
|
|
Labels labels {
|
|
|
|
{ { 8 * 8, 9 * 16 }, "/ / : :", Color::light_grey() },
|
|
|
|
{ { 4 * 8, 11 * 16 }, "YYYY/MM/DD HH:MM:SS", Color::light_grey() }
|
|
|
|
};
|
|
|
|
|
2015-07-08 11:39:24 -04:00
|
|
|
NumberField field_year {
|
|
|
|
{ 4 * 8, 9 * 16 },
|
|
|
|
4,
|
|
|
|
{ 2015, 2099 },
|
|
|
|
1,
|
|
|
|
'0',
|
|
|
|
};
|
|
|
|
NumberField field_month {
|
|
|
|
{ 9 * 8, 9 * 16 },
|
|
|
|
2,
|
|
|
|
{ 1, 12 },
|
|
|
|
1,
|
|
|
|
'0',
|
|
|
|
};
|
|
|
|
NumberField field_day {
|
|
|
|
{ 12 * 8, 9 * 16 },
|
|
|
|
2,
|
|
|
|
{ 1, 31 },
|
|
|
|
1,
|
|
|
|
'0',
|
|
|
|
};
|
|
|
|
|
|
|
|
NumberField field_hour {
|
|
|
|
{ 15 * 8, 9 * 16 },
|
|
|
|
2,
|
|
|
|
{ 0, 23 },
|
|
|
|
1,
|
|
|
|
'0',
|
|
|
|
};
|
|
|
|
NumberField field_minute {
|
|
|
|
{ 18 * 8, 9 * 16 },
|
|
|
|
2,
|
|
|
|
{ 0, 59 },
|
|
|
|
1,
|
|
|
|
'0',
|
|
|
|
};
|
|
|
|
NumberField field_second {
|
|
|
|
{ 21 * 8, 9 * 16 },
|
|
|
|
2,
|
|
|
|
{ 0, 59 },
|
|
|
|
1,
|
|
|
|
'0',
|
|
|
|
};
|
|
|
|
|
2018-05-16 04:45:13 -04:00
|
|
|
Button button_done {
|
|
|
|
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
|
|
|
"Done"
|
2015-07-08 11:39:24 -04:00
|
|
|
};
|
|
|
|
Button button_cancel {
|
2018-05-16 04:45:13 -04:00
|
|
|
{ 16 * 8, 16 * 16, 12 * 8, 32 },
|
2015-07-08 11:39:24 -04:00
|
|
|
"Cancel",
|
|
|
|
};
|
|
|
|
|
2016-02-06 19:23:20 -05:00
|
|
|
void form_init(const SetDateTimeModel& model);
|
2015-07-08 11:39:24 -04:00
|
|
|
SetDateTimeModel form_collect();
|
|
|
|
};
|
|
|
|
|
2015-07-26 10:45:24 -04:00
|
|
|
struct SetFrequencyCorrectionModel {
|
|
|
|
int8_t ppm;
|
|
|
|
};
|
|
|
|
|
2018-01-07 18:13:08 -05:00
|
|
|
class SetRadioView : public View {
|
2015-07-26 10:45:24 -04:00
|
|
|
public:
|
2018-01-07 18:13:08 -05:00
|
|
|
SetRadioView(NavigationView& nav);
|
2015-07-26 10:45:24 -04:00
|
|
|
|
|
|
|
void focus() override;
|
2018-01-07 18:13:08 -05:00
|
|
|
|
|
|
|
std::string title() const override { return "Radio settings"; };
|
2015-07-26 10:45:24 -04:00
|
|
|
|
|
|
|
private:
|
2018-01-07 18:13:08 -05:00
|
|
|
Labels labels {
|
|
|
|
{ { 2 * 8, 2 * 16 }, "Frequency correction:", Color::light_grey() },
|
|
|
|
{ { 6 * 8, 3 * 16 }, "PPM", Color::light_grey() },
|
2018-05-16 04:45:13 -04:00
|
|
|
{ { 24, 7 * 16 }, "CAUTION: Ensure that all", Color::red() },
|
|
|
|
{ { 28, 8 * 16 }, "devices attached to the", Color::red() },
|
|
|
|
{ { 8, 9 * 16 }, "antenna connector can accept", Color::red() },
|
|
|
|
{ { 68, 10 * 16 }, "a DC voltage!", Color::red() }
|
2015-07-26 10:45:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
NumberField field_ppm {
|
2018-01-07 18:13:08 -05:00
|
|
|
{ 2 * 8, 3 * 16 },
|
2015-07-26 10:45:24 -04:00
|
|
|
3,
|
|
|
|
{ -50, 50 },
|
|
|
|
1,
|
|
|
|
'0',
|
|
|
|
};
|
2018-01-07 18:13:08 -05:00
|
|
|
|
|
|
|
Checkbox check_bias {
|
|
|
|
{ 28, 12 * 16 },
|
|
|
|
5,
|
|
|
|
"Turn on bias voltage"
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_done {
|
|
|
|
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
|
|
|
"Done"
|
2015-07-26 10:45:24 -04:00
|
|
|
};
|
|
|
|
Button button_cancel {
|
2018-01-07 18:13:08 -05:00
|
|
|
{ 16 * 8, 16 * 16, 12 * 8, 32 },
|
2015-07-26 10:45:24 -04:00
|
|
|
"Cancel",
|
|
|
|
};
|
|
|
|
|
2016-02-06 19:23:20 -05:00
|
|
|
void form_init(const SetFrequencyCorrectionModel& model);
|
2015-07-26 10:45:24 -04:00
|
|
|
SetFrequencyCorrectionModel form_collect();
|
|
|
|
};
|
|
|
|
|
2015-08-22 23:08:38 -04:00
|
|
|
class SetTouchCalibView : public View {
|
|
|
|
public:
|
|
|
|
SetTouchCalibView(NavigationView& nav);
|
|
|
|
void focus() override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
2016-01-07 08:17:39 -05:00
|
|
|
|
2015-08-22 23:08:38 -04:00
|
|
|
private:
|
|
|
|
|
|
|
|
Text text_title {
|
|
|
|
{ 64, 32, 40, 16 },
|
|
|
|
"UL,UR,DL,DR !",
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_debugx {
|
|
|
|
{ 64, 64, 40, 16 },
|
|
|
|
"X",
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_debugy {
|
|
|
|
{ 64, 80, 40, 16 },
|
|
|
|
"Y",
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_ok {
|
|
|
|
{ 72, 192, 96, 24 },
|
|
|
|
"OK"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-02-04 04:27:53 -05:00
|
|
|
class SetUIView : public View {
|
|
|
|
public:
|
|
|
|
SetUIView(NavigationView& nav);
|
2018-01-07 18:13:08 -05:00
|
|
|
|
2016-02-04 04:27:53 -05:00
|
|
|
void focus() override;
|
|
|
|
|
2018-01-07 18:13:08 -05:00
|
|
|
std::string title() const override { return "UI settings"; };
|
|
|
|
|
2016-02-04 04:27:53 -05:00
|
|
|
private:
|
2016-12-09 12:21:47 -05:00
|
|
|
Checkbox checkbox_login {
|
|
|
|
{ 3 * 8, 2 * 16 },
|
|
|
|
20,
|
|
|
|
"Login with play dead"
|
2016-02-04 04:27:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
Checkbox checkbox_bloff {
|
2016-12-09 12:21:47 -05:00
|
|
|
{ 3 * 8, 5 * 16 },
|
2016-02-05 11:40:14 -05:00
|
|
|
20,
|
2016-02-04 04:27:53 -05:00
|
|
|
"Backlight off after:"
|
|
|
|
};
|
|
|
|
|
|
|
|
OptionsField options_bloff {
|
2017-01-17 02:00:42 -05:00
|
|
|
{ 52, 6 * 16 + 8 },
|
2016-02-04 04:27:53 -05:00
|
|
|
10,
|
|
|
|
{
|
2018-01-07 22:47:37 -05:00
|
|
|
{ "5 seconds", 5 },
|
|
|
|
{ "15 seconds", 15 },
|
|
|
|
{ "1 minute", 60 },
|
|
|
|
{ "5 minutes", 300 },
|
|
|
|
{ "10 minutes", 600 }
|
2016-02-04 04:27:53 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
Checkbox checkbox_showsplash {
|
|
|
|
{ 3 * 8, 8 * 16 },
|
|
|
|
11,
|
|
|
|
"Show splash"
|
|
|
|
};
|
|
|
|
|
2016-02-04 04:27:53 -05:00
|
|
|
Button button_ok {
|
2018-05-16 04:45:13 -04:00
|
|
|
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
|
|
|
"OK"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
class SetAudioView : public View {
|
|
|
|
public:
|
|
|
|
SetAudioView(NavigationView& nav);
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Audio settings"; };
|
|
|
|
|
|
|
|
private:
|
|
|
|
Labels labels {
|
|
|
|
{ { 2 * 8, 3 * 16 }, "Tone key mix: %", Color::light_grey() },
|
|
|
|
};
|
|
|
|
|
|
|
|
NumberField field_tone_mix {
|
|
|
|
{ 16 * 8, 3 * 16 },
|
|
|
|
2,
|
|
|
|
{ 10, 99 },
|
|
|
|
1,
|
|
|
|
'0'
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_ok {
|
|
|
|
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
2016-05-29 06:06:47 -04:00
|
|
|
"OK"
|
2016-02-04 04:27:53 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
class SetPlayDeadView : public View {
|
|
|
|
public:
|
|
|
|
SetPlayDeadView(NavigationView& nav);
|
2016-12-09 12:21:47 -05:00
|
|
|
|
2016-02-04 04:27:53 -05:00
|
|
|
void focus() override;
|
2016-12-09 12:21:47 -05:00
|
|
|
|
2018-01-07 18:13:08 -05:00
|
|
|
std::string title() const override { return "Playdead settings"; };
|
|
|
|
|
2016-02-04 04:27:53 -05:00
|
|
|
private:
|
|
|
|
bool entermode = false;
|
2017-02-11 23:05:21 -05:00
|
|
|
uint32_t sequence { 0 };
|
|
|
|
uint8_t keycount { 0 }, key_code { };
|
2016-12-09 12:21:47 -05:00
|
|
|
char sequence_txt[11] = { 0 };
|
2016-02-04 04:27:53 -05:00
|
|
|
|
|
|
|
Text text_sequence {
|
|
|
|
{ 64, 32, 14 * 8, 16 },
|
|
|
|
"Enter sequence",
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_enter {
|
|
|
|
{ 16, 192, 96, 24 },
|
|
|
|
"Enter"
|
|
|
|
};
|
|
|
|
Button button_cancel {
|
|
|
|
{ 128, 192, 96, 24 },
|
|
|
|
"Cancel"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-08-02 06:44:31 -04:00
|
|
|
/*class ModInfoView : public View {
|
2016-02-04 04:27:53 -05:00
|
|
|
public:
|
|
|
|
ModInfoView(NavigationView& nav);
|
|
|
|
void focus() override;
|
|
|
|
void on_show() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void update_infos(uint8_t modn);
|
|
|
|
|
|
|
|
typedef struct moduleinfo_t{
|
|
|
|
char filename[9];
|
|
|
|
uint16_t version;
|
|
|
|
uint32_t size;
|
|
|
|
char md5[16];
|
|
|
|
char name[16];
|
|
|
|
char description[214];
|
|
|
|
} moduleinfo_t;
|
|
|
|
|
|
|
|
moduleinfo_t module_list[8]; // 8 max for now
|
|
|
|
|
2016-05-29 06:06:47 -04:00
|
|
|
uint8_t modules_nb;
|
|
|
|
|
2016-02-04 04:27:53 -05:00
|
|
|
Text text_modcount {
|
|
|
|
{ 2 * 8, 1 * 16, 18 * 8, 16 },
|
|
|
|
"Searching..."
|
|
|
|
};
|
|
|
|
|
|
|
|
OptionsField option_modules {
|
|
|
|
{ 2 * 8, 2 * 16 },
|
|
|
|
24,
|
2016-05-29 06:06:47 -04:00
|
|
|
{
|
|
|
|
{ "-", 0 }
|
2016-02-04 04:27:53 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_name {
|
|
|
|
{ 2 * 8, 4 * 16, 5 * 8, 16 },
|
|
|
|
"Name:"
|
|
|
|
};
|
|
|
|
Text text_namestr {
|
|
|
|
{ 8 * 8, 4 * 16, 16 * 8, 16 },
|
|
|
|
"..."
|
|
|
|
};
|
|
|
|
Text text_size {
|
|
|
|
{ 2 * 8, 5 * 16, 5 * 8, 16 },
|
|
|
|
"Size:"
|
|
|
|
};
|
|
|
|
Text text_sizestr {
|
|
|
|
{ 8 * 8, 5 * 16, 16 * 8, 16 },
|
|
|
|
"..."
|
|
|
|
};
|
|
|
|
Text text_md5 {
|
|
|
|
{ 2 * 8, 6 * 16, 4 * 8, 16 },
|
|
|
|
"MD5:"
|
|
|
|
};
|
|
|
|
Text text_md5_a {
|
|
|
|
{ 7 * 8, 6 * 16, 16 * 8, 16 },
|
|
|
|
"..."
|
|
|
|
};
|
|
|
|
Text text_md5_b {
|
|
|
|
{ 7 * 8, 7 * 16, 16 * 8, 16 },
|
|
|
|
"..."
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_ok {
|
|
|
|
{ 4 * 8, 272, 64, 24 },
|
|
|
|
"Ok"
|
|
|
|
};
|
2016-08-02 06:44:31 -04:00
|
|
|
};*/
|
2016-02-04 04:27:53 -05:00
|
|
|
|
2018-05-16 04:45:13 -04:00
|
|
|
class SettingsMenuView : public MenuView {
|
2015-07-08 11:39:24 -04:00
|
|
|
public:
|
2018-05-16 04:45:13 -04:00
|
|
|
SettingsMenuView(NavigationView& nav);
|
2018-01-07 18:13:08 -05:00
|
|
|
|
|
|
|
std::string title() const override { return "Settings"; };
|
2015-07-08 11:39:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
2018-05-16 04:45:13 -04:00
|
|
|
#endif/*__UI_SETTINGS_H__*/
|