2015-07-08 11:39:24 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UI_NAVIGATION_H__
|
|
|
|
#define __UI_NAVIGATION_H__
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_focus.hpp"
|
|
|
|
#include "ui_menu.hpp"
|
|
|
|
|
|
|
|
#include "ui_rssi.hpp"
|
|
|
|
#include "ui_channel.hpp"
|
|
|
|
#include "ui_audio.hpp"
|
2015-12-01 13:45:34 -05:00
|
|
|
#include "ui_sd_card_status_view.hpp"
|
2015-07-08 11:39:24 -04:00
|
|
|
|
2016-04-22 14:57:46 -04:00
|
|
|
#include "bitmap.hpp"
|
|
|
|
|
2015-07-08 11:39:24 -04:00
|
|
|
#include <vector>
|
2015-12-14 13:22:42 -05:00
|
|
|
#include <utility>
|
2015-07-08 11:39:24 -04:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class SystemStatusView : public View {
|
|
|
|
public:
|
2016-01-25 14:13:19 -05:00
|
|
|
std::function<void(void)> on_back;
|
|
|
|
|
2015-07-08 11:39:24 -04:00
|
|
|
SystemStatusView();
|
|
|
|
|
2016-02-07 13:33:15 -05:00
|
|
|
void set_back_enabled(bool new_value);
|
2016-01-26 16:04:44 -05:00
|
|
|
void set_title(const std::string new_value);
|
2016-01-25 14:13:19 -05:00
|
|
|
|
2015-07-08 11:39:24 -04:00
|
|
|
private:
|
2016-01-26 16:04:44 -05:00
|
|
|
static constexpr auto default_title = "PortaPack";
|
2016-02-07 13:33:15 -05:00
|
|
|
static constexpr auto back_text_enabled = " < ";
|
|
|
|
static constexpr auto back_text_disabled = " * ";
|
2016-01-26 16:04:44 -05:00
|
|
|
|
2016-01-25 14:13:19 -05:00
|
|
|
Button button_back {
|
|
|
|
{ 0 * 8, 0 * 16, 3 * 8, 16 },
|
2016-02-07 13:33:15 -05:00
|
|
|
back_text_disabled,
|
2016-01-25 14:13:19 -05:00
|
|
|
};
|
|
|
|
|
2016-01-26 16:04:44 -05:00
|
|
|
Text title {
|
|
|
|
{ 3 * 8, 0, 16 * 8, 1 * 16 },
|
|
|
|
default_title,
|
2015-07-08 11:39:24 -04:00
|
|
|
};
|
2015-12-01 13:45:34 -05:00
|
|
|
|
2016-02-19 00:35:46 -05:00
|
|
|
ImageButton button_camera {
|
|
|
|
{ 22 * 8, 0, 2 * 8, 1 * 16 },
|
|
|
|
&bitmap_camera,
|
|
|
|
Color::white(),
|
|
|
|
Color::black()
|
|
|
|
};
|
|
|
|
|
2016-02-03 19:04:23 -05:00
|
|
|
ImageButton button_sleep {
|
2016-01-27 23:33:54 -05:00
|
|
|
{ 25 * 8, 0, 2 * 8, 1 * 16 },
|
2016-02-03 19:04:23 -05:00
|
|
|
&bitmap_sleep,
|
|
|
|
Color::white(),
|
|
|
|
Color::black()
|
2016-01-27 23:33:54 -05:00
|
|
|
};
|
|
|
|
|
2016-02-03 18:50:14 -05:00
|
|
|
SDCardStatusView sd_card_status_view {
|
|
|
|
{ 28 * 8, 0 * 16, 2 * 8, 1 * 16 }
|
|
|
|
};
|
2016-02-19 00:35:46 -05:00
|
|
|
|
|
|
|
void on_camera();
|
2015-07-08 11:39:24 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class NavigationView : public View {
|
|
|
|
public:
|
2016-01-26 16:04:44 -05:00
|
|
|
std::function<void(const View&)> on_view_changed;
|
2016-01-25 14:13:19 -05:00
|
|
|
|
2015-12-14 14:12:12 -05:00
|
|
|
NavigationView() { }
|
2015-07-08 11:39:24 -04:00
|
|
|
|
|
|
|
NavigationView(const NavigationView&) = delete;
|
|
|
|
NavigationView(NavigationView&&) = delete;
|
|
|
|
|
2016-01-25 14:13:19 -05:00
|
|
|
bool is_top() const;
|
|
|
|
|
2015-12-14 13:22:42 -05:00
|
|
|
template<class T, class... Args>
|
|
|
|
T* push(Args&&... args) {
|
2015-12-14 14:18:59 -05:00
|
|
|
return reinterpret_cast<T*>(push_view(std::unique_ptr<View>(new T(*this, std::forward<Args>(args)...))));
|
2015-12-14 13:22:42 -05:00
|
|
|
}
|
|
|
|
|
2015-07-08 11:39:24 -04:00
|
|
|
void pop();
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
private:
|
2015-12-14 14:11:49 -05:00
|
|
|
std::vector<std::unique_ptr<View>> view_stack;
|
2015-07-08 11:39:24 -04:00
|
|
|
|
|
|
|
Widget* view() const;
|
2015-12-14 13:22:42 -05:00
|
|
|
|
2015-12-14 13:52:08 -05:00
|
|
|
void free_view();
|
|
|
|
void update_view();
|
2015-12-14 14:11:49 -05:00
|
|
|
View* push_view(std::unique_ptr<View> new_view);
|
2015-07-08 11:39:24 -04:00
|
|
|
};
|
|
|
|
|
2016-01-25 01:38:36 -05:00
|
|
|
class TranspondersMenuView : public MenuView {
|
|
|
|
public:
|
|
|
|
TranspondersMenuView(NavigationView& nav);
|
|
|
|
};
|
|
|
|
|
|
|
|
class ReceiverMenuView : public MenuView {
|
|
|
|
public:
|
|
|
|
ReceiverMenuView(NavigationView& nav);
|
|
|
|
};
|
|
|
|
|
2015-07-08 11:39:24 -04:00
|
|
|
class SystemMenuView : public MenuView {
|
|
|
|
public:
|
|
|
|
SystemMenuView(NavigationView& nav);
|
|
|
|
};
|
|
|
|
|
|
|
|
class SystemView : public View {
|
|
|
|
public:
|
|
|
|
SystemView(
|
|
|
|
Context& context,
|
|
|
|
const Rect parent_rect
|
|
|
|
);
|
|
|
|
|
|
|
|
Context& context() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
SystemStatusView status_view;
|
|
|
|
NavigationView navigation_view;
|
|
|
|
Context& context_;
|
|
|
|
};
|
|
|
|
|
2015-08-01 16:46:15 -04:00
|
|
|
class HackRFFirmwareView : public View {
|
|
|
|
public:
|
|
|
|
HackRFFirmwareView(NavigationView& nav);
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Text text_title {
|
2015-09-01 23:23:11 -04:00
|
|
|
{ 76, 4 * 16, 19 * 8, 16 },
|
|
|
|
"HackRF Mode"
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_description_1 {
|
|
|
|
{ 4, 7 * 16, 19 * 8, 16 },
|
|
|
|
"Run stock HackRF firmware and"
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_description_2 {
|
|
|
|
{ 12, 8 * 16, 19 * 8, 16 },
|
|
|
|
"disable PortaPack until the"
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_description_3 {
|
|
|
|
{ 4, 9 * 16, 19 * 8, 16 },
|
|
|
|
"unit is reset or disconnected"
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_description_4 {
|
|
|
|
{ 76, 10 * 16, 19 * 8, 16 },
|
|
|
|
"from power?"
|
2015-08-01 16:46:15 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Button button_yes {
|
|
|
|
{ 4 * 8, 13 * 16, 8 * 8, 24 },
|
|
|
|
"Yes",
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_no {
|
|
|
|
{ 18 * 8, 13 * 16, 8 * 8, 24 },
|
|
|
|
"No",
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-07-08 11:39:24 -04:00
|
|
|
class NotImplementedView : public View {
|
|
|
|
public:
|
|
|
|
NotImplementedView(NavigationView& nav);
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Text text_title {
|
|
|
|
{ 5 * 8, 7 * 16, 19 * 8, 16 },
|
|
|
|
"Not Yet Implemented"
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_done {
|
|
|
|
{ 10 * 8, 13 * 16, 10 * 8, 24 },
|
|
|
|
"Bummer",
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__UI_NAVIGATION_H__*/
|