2016-07-25 10:21:27 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2016 Furrtek
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_painter.hpp"
|
|
|
|
#include "ui_menu.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
2016-12-25 19:31:38 -05:00
|
|
|
#include "ui_receiver.hpp"
|
|
|
|
#include "ui_textentry.hpp"
|
|
|
|
#include "freqman.hpp"
|
2017-01-15 22:45:44 -05:00
|
|
|
#include "rtc_time.hpp"
|
2016-07-25 10:21:27 -04:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
2016-12-06 07:31:38 -05:00
|
|
|
class FrequencySaveView : public View {
|
|
|
|
public:
|
|
|
|
FrequencySaveView(NavigationView& nav, const rf::Frequency value);
|
2016-12-25 19:31:38 -05:00
|
|
|
~FrequencySaveView();
|
2016-12-06 07:31:38 -05:00
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Save frequency"; };
|
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
private:
|
2016-12-25 19:31:38 -05:00
|
|
|
NavigationView& nav_;
|
2017-01-29 20:09:00 -05:00
|
|
|
freqman_error error { NO_ERROR };
|
2017-04-18 13:12:32 -04:00
|
|
|
std::string desc_buffer { "-" };
|
2017-01-29 20:09:00 -05:00
|
|
|
rtc::RTC datetime { };
|
|
|
|
rf::Frequency value_ { };
|
2017-01-15 22:45:44 -05:00
|
|
|
std::string str_timestamp { };
|
2017-02-03 10:10:27 -05:00
|
|
|
//int32_t category_id_ { -1 };
|
2016-12-25 19:31:38 -05:00
|
|
|
|
2017-04-18 13:12:32 -04:00
|
|
|
void on_save_name(std::string& name);
|
2017-02-03 11:22:12 -05:00
|
|
|
void on_save_timestamp();
|
2016-12-25 19:31:38 -05:00
|
|
|
void on_tick_second();
|
|
|
|
|
2017-02-03 10:10:27 -05:00
|
|
|
freqman_db database { };
|
2016-12-25 19:31:38 -05:00
|
|
|
|
2017-01-29 20:09:00 -05:00
|
|
|
SignalToken signal_token_tick_second { };
|
2016-12-25 19:31:38 -05:00
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
BigFrequency big_display {
|
|
|
|
{ 4, 2 * 16, 28 * 8, 32 },
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_save {
|
2017-02-03 10:10:27 -05:00
|
|
|
{ 4 * 8, 15 * 8, 8 * 8, 16 },
|
2016-12-25 19:31:38 -05:00
|
|
|
"Save as:",
|
2016-12-09 12:21:47 -05:00
|
|
|
};
|
|
|
|
Button button_save_name {
|
2017-02-03 10:10:27 -05:00
|
|
|
{ 4 * 8, 18 * 8, 12 * 8, 32 },
|
2016-12-25 19:31:38 -05:00
|
|
|
"Name (set)"
|
2016-12-09 12:21:47 -05:00
|
|
|
};
|
|
|
|
Button button_save_timestamp {
|
2017-02-03 10:10:27 -05:00
|
|
|
{ 4 * 8, 23 * 8, 12 * 8, 32 },
|
2016-12-25 19:31:38 -05:00
|
|
|
"Timestamp:"
|
|
|
|
};
|
|
|
|
Text text_timestamp {
|
2017-02-03 10:10:27 -05:00
|
|
|
{ 17 * 8, 24 * 8, 11 * 8, 16 },
|
2016-12-25 19:31:38 -05:00
|
|
|
"MM/DD HH:MM",
|
2016-12-09 12:21:47 -05:00
|
|
|
};
|
2017-02-03 10:10:27 -05:00
|
|
|
|
|
|
|
Text text_category {
|
|
|
|
{ 4 * 8, 28 * 8, 12 * 8, 16 },
|
|
|
|
"In category:",
|
|
|
|
};
|
|
|
|
OptionsField options_category {
|
|
|
|
{ 17 * 8, 28 * 8 },
|
|
|
|
8,
|
|
|
|
{ }
|
|
|
|
};
|
2016-12-09 12:21:47 -05:00
|
|
|
|
|
|
|
Button button_cancel {
|
|
|
|
{ 72, 264, 96, 32 },
|
|
|
|
"Cancel"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
class FrequencyLoadView : public View {
|
|
|
|
public:
|
2017-01-29 20:09:00 -05:00
|
|
|
std::function<void(rf::Frequency)> on_changed { };
|
2016-12-25 19:31:38 -05:00
|
|
|
|
|
|
|
FrequencyLoadView(NavigationView& nav);
|
2016-12-09 12:21:47 -05:00
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Load frequency"; };
|
|
|
|
|
2016-12-06 07:31:38 -05:00
|
|
|
private:
|
2016-12-25 19:31:38 -05:00
|
|
|
NavigationView& nav_;
|
2017-01-29 20:09:00 -05:00
|
|
|
freqman_error error { NO_ERROR };
|
2016-12-25 19:31:38 -05:00
|
|
|
|
|
|
|
void on_frequency_select();
|
|
|
|
void setup_list();
|
|
|
|
|
2017-02-03 10:10:27 -05:00
|
|
|
freqman_db database { };
|
2016-12-25 19:31:38 -05:00
|
|
|
|
2017-02-03 10:10:27 -05:00
|
|
|
MenuView menu_view {
|
|
|
|
{ 0, 0, 240, 216 },
|
|
|
|
false
|
|
|
|
};
|
2016-12-25 19:31:38 -05:00
|
|
|
|
|
|
|
Button button_cancel {
|
2016-12-06 07:31:38 -05:00
|
|
|
{ 72, 264, 96, 32 },
|
2016-12-25 19:31:38 -05:00
|
|
|
"Cancel"
|
2016-12-06 07:31:38 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-07-25 10:21:27 -04:00
|
|
|
class FreqManView : public View {
|
|
|
|
public:
|
|
|
|
FreqManView(NavigationView& nav);
|
2016-12-25 19:31:38 -05:00
|
|
|
~FreqManView();
|
2016-12-05 06:56:41 -05:00
|
|
|
|
2016-12-06 07:31:38 -05:00
|
|
|
void focus() override;
|
2016-07-25 10:21:27 -04:00
|
|
|
|
2016-12-06 07:31:38 -05:00
|
|
|
std::string title() const override { return "Freq. manager"; };
|
2016-07-25 10:21:27 -04:00
|
|
|
|
|
|
|
private:
|
2016-12-25 19:31:38 -05:00
|
|
|
NavigationView& nav_;
|
2017-01-29 20:09:00 -05:00
|
|
|
|
|
|
|
freqman_error error { NO_ERROR };
|
2017-04-18 13:12:32 -04:00
|
|
|
std::string desc_buffer { "-" };
|
2016-12-25 19:31:38 -05:00
|
|
|
|
|
|
|
void on_frequency_select();
|
|
|
|
void on_edit_freq(rf::Frequency f);
|
|
|
|
void on_edit_desc(NavigationView& nav);
|
|
|
|
void on_delete();
|
2017-02-03 10:10:27 -05:00
|
|
|
void on_edit_category(int32_t category_id);
|
2016-12-25 19:31:38 -05:00
|
|
|
void setup_list();
|
|
|
|
|
2017-02-03 10:10:27 -05:00
|
|
|
freqman_db database { };
|
2016-12-25 19:31:38 -05:00
|
|
|
|
2017-02-03 10:10:27 -05:00
|
|
|
MenuView menu_view {
|
|
|
|
{ 0, 0, 240, 168 },
|
|
|
|
true
|
|
|
|
};
|
2017-02-13 00:35:13 -05:00
|
|
|
|
|
|
|
Labels label {
|
|
|
|
{ { 2 * 8, 24 * 8 }, "Edit:", Color::light_grey() },
|
|
|
|
{ { 2 * 8, 35 * 8 }, "Category:", Color::light_grey() }
|
2017-01-30 08:10:30 -05:00
|
|
|
};
|
2017-02-13 00:35:13 -05:00
|
|
|
|
2016-12-25 19:31:38 -05:00
|
|
|
Button button_edit_freq {
|
2017-02-03 10:10:27 -05:00
|
|
|
{ 2 * 8, 26 * 8, 14 * 8, 32 },
|
2017-01-30 08:10:30 -05:00
|
|
|
"Frequency"
|
2016-12-25 19:31:38 -05:00
|
|
|
};
|
|
|
|
Button button_edit_desc {
|
2017-02-03 10:10:27 -05:00
|
|
|
{ 2 * 8, 30 * 8 + 4, 14 * 8, 32 },
|
2017-01-30 08:10:30 -05:00
|
|
|
"Description"
|
2016-12-25 19:31:38 -05:00
|
|
|
};
|
2017-02-13 00:35:13 -05:00
|
|
|
|
2017-02-03 10:10:27 -05:00
|
|
|
OptionsField options_category {
|
|
|
|
{ 12 * 8, 35 * 8 },
|
|
|
|
8,
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2016-12-25 19:31:38 -05:00
|
|
|
Button button_del {
|
2017-02-03 10:10:27 -05:00
|
|
|
{ 20 * 8, 24 * 8, 9 * 8, 48 },
|
2017-01-30 08:10:30 -05:00
|
|
|
"Delete"
|
2016-12-25 19:31:38 -05:00
|
|
|
};
|
|
|
|
|
2016-12-06 07:31:38 -05:00
|
|
|
Button button_exit {
|
2017-02-03 10:10:27 -05:00
|
|
|
{ 20 * 8, 33 * 8, 9 * 8, 40 },
|
2016-12-06 07:31:38 -05:00
|
|
|
"Exit"
|
2016-07-25 10:21:27 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|