2016-07-25 14:21:27 +00: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-26 00:31:38 +00:00
|
|
|
#include "ui_receiver.hpp"
|
|
|
|
#include "ui_textentry.hpp"
|
|
|
|
#include "freqman.hpp"
|
|
|
|
#include "time.hpp"
|
2016-07-25 14:21:27 +00:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
2016-12-06 12:31:38 +00:00
|
|
|
class FrequencySaveView : public View {
|
|
|
|
public:
|
|
|
|
FrequencySaveView(NavigationView& nav, const rf::Frequency value);
|
2016-12-26 00:31:38 +00:00
|
|
|
~FrequencySaveView();
|
2016-12-06 12:31:38 +00:00
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Save frequency"; };
|
|
|
|
|
2016-12-09 17:21:47 +00:00
|
|
|
private:
|
2016-12-26 00:31:38 +00:00
|
|
|
NavigationView& nav_;
|
|
|
|
bool error = false;
|
|
|
|
char desc_buffer[32] = { 0 };
|
|
|
|
rtc::RTC datetime;
|
|
|
|
rf::Frequency value_;
|
|
|
|
|
|
|
|
void on_save_name(NavigationView& nav);
|
|
|
|
void on_save_timestamp(NavigationView& nav);
|
|
|
|
void on_tick_second();
|
|
|
|
|
|
|
|
std::vector<freqman_entry> frequencies;
|
|
|
|
|
|
|
|
SignalToken signal_token_tick_second;
|
|
|
|
|
2016-12-09 17:21:47 +00:00
|
|
|
BigFrequency big_display {
|
|
|
|
{ 4, 2 * 16, 28 * 8, 32 },
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_save {
|
2016-12-26 00:31:38 +00:00
|
|
|
{ 88, 120, 8 * 8, 16 },
|
|
|
|
"Save as:",
|
2016-12-09 17:21:47 +00:00
|
|
|
};
|
|
|
|
Button button_save_name {
|
|
|
|
{ 72, 144, 96, 32 },
|
2016-12-26 00:31:38 +00:00
|
|
|
"Name (set)"
|
2016-12-09 17:21:47 +00:00
|
|
|
};
|
|
|
|
Button button_save_timestamp {
|
|
|
|
{ 72, 184, 96, 32 },
|
2016-12-26 00:31:38 +00:00
|
|
|
"Timestamp:"
|
|
|
|
};
|
|
|
|
Text text_timestamp {
|
|
|
|
{ 76, 220, 11 * 8, 16 },
|
|
|
|
"MM/DD HH:MM",
|
2016-12-09 17:21:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Button button_cancel {
|
|
|
|
{ 72, 264, 96, 32 },
|
|
|
|
"Cancel"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
class FrequencyLoadView : public View {
|
|
|
|
public:
|
2016-12-26 00:31:38 +00:00
|
|
|
std::function<void(rf::Frequency)> on_changed;
|
|
|
|
|
|
|
|
FrequencyLoadView(NavigationView& nav);
|
2016-12-09 17:21:47 +00:00
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Load frequency"; };
|
|
|
|
|
2016-12-06 12:31:38 +00:00
|
|
|
private:
|
2016-12-26 00:31:38 +00:00
|
|
|
NavigationView& nav_;
|
|
|
|
bool error = false;
|
|
|
|
|
|
|
|
void on_frequency_select();
|
|
|
|
void setup_list();
|
|
|
|
|
|
|
|
std::vector<freqman_entry> frequencies;
|
|
|
|
|
|
|
|
MenuView menu_view;
|
|
|
|
|
|
|
|
Button button_cancel {
|
2016-12-06 12:31:38 +00:00
|
|
|
{ 72, 264, 96, 32 },
|
2016-12-26 00:31:38 +00:00
|
|
|
"Cancel"
|
2016-12-06 12:31:38 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-07-25 14:21:27 +00:00
|
|
|
class FreqManView : public View {
|
|
|
|
public:
|
|
|
|
FreqManView(NavigationView& nav);
|
2016-12-26 00:31:38 +00:00
|
|
|
~FreqManView();
|
2016-12-05 11:56:41 +00:00
|
|
|
|
2016-12-06 12:31:38 +00:00
|
|
|
void focus() override;
|
2016-07-25 14:21:27 +00:00
|
|
|
|
2016-12-06 12:31:38 +00:00
|
|
|
std::string title() const override { return "Freq. manager"; };
|
2016-07-25 14:21:27 +00:00
|
|
|
|
|
|
|
private:
|
2016-12-26 00:31:38 +00:00
|
|
|
NavigationView& nav_;
|
|
|
|
bool error = false;
|
|
|
|
|
|
|
|
void on_frequency_select();
|
|
|
|
void on_edit_freq(rf::Frequency f);
|
|
|
|
void on_edit_desc(NavigationView& nav);
|
|
|
|
void on_delete();
|
|
|
|
void setup_list();
|
|
|
|
|
|
|
|
std::vector<freqman_entry> frequencies;
|
|
|
|
|
|
|
|
MenuView menu_view { true };
|
2016-07-25 14:21:27 +00:00
|
|
|
|
2016-12-26 00:31:38 +00:00
|
|
|
Button button_edit_freq {
|
|
|
|
{ 52, 194, 106, 30 },
|
|
|
|
"Edit freq."
|
|
|
|
};
|
|
|
|
Button button_edit_desc {
|
|
|
|
{ 52, 192 + 32, 106, 30 },
|
|
|
|
"Edit desc."
|
|
|
|
};
|
|
|
|
Button button_del {
|
|
|
|
{ 168, 192, 64, 64 },
|
|
|
|
"Del"
|
|
|
|
};
|
|
|
|
|
2016-12-06 12:31:38 +00:00
|
|
|
Button button_exit {
|
2016-12-26 00:31:38 +00:00
|
|
|
{ 168, 264, 64, 32 },
|
2016-12-06 12:31:38 +00:00
|
|
|
"Exit"
|
2016-07-25 14:21:27 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|