2015-09-10 14:36:39 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-12-09 12:21:47 -05:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-09-10 14:36:39 -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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_painter.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
2017-04-18 07:55:49 -04:00
|
|
|
#include "ui_transmitter.hpp"
|
2015-09-10 14:36:39 -04:00
|
|
|
#include "message.hpp"
|
|
|
|
#include "transmitter_model.hpp"
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class WhistleView : public View {
|
|
|
|
public:
|
2016-12-09 12:21:47 -05:00
|
|
|
WhistleView(NavigationView& nav);
|
2015-09-10 14:36:39 -04:00
|
|
|
~WhistleView();
|
|
|
|
|
|
|
|
void focus() override;
|
2017-04-18 07:55:49 -04:00
|
|
|
|
|
|
|
std::string title() const override { return "Whistle"; };
|
2015-09-10 14:36:39 -04:00
|
|
|
|
|
|
|
private:
|
2017-04-18 07:55:49 -04:00
|
|
|
void start_tx();
|
|
|
|
void on_tx_progress(const bool done);
|
|
|
|
|
|
|
|
enum tx_modes {
|
|
|
|
IDLE = 0,
|
|
|
|
SINGLE
|
|
|
|
};
|
|
|
|
|
|
|
|
tx_modes tx_mode = IDLE;
|
2015-09-10 14:36:39 -04:00
|
|
|
|
2017-04-18 07:55:49 -04:00
|
|
|
Labels labels {
|
|
|
|
{ { 3 * 8, 4 * 8 }, "Tone frequency: Hz", Color::light_grey() },
|
|
|
|
{ { 22 * 8, 8 * 8 + 4 }, "s.", Color::light_grey() }
|
2015-09-10 14:36:39 -04:00
|
|
|
};
|
|
|
|
|
2017-04-18 07:55:49 -04:00
|
|
|
NumberField field_tone {
|
|
|
|
{ 19 * 8, 4 * 8 },
|
|
|
|
4,
|
|
|
|
{ 1, 9999 },
|
|
|
|
5,
|
|
|
|
' '
|
2015-09-10 14:36:39 -04:00
|
|
|
};
|
|
|
|
|
2017-04-18 07:55:49 -04:00
|
|
|
Checkbox checkbox_stop {
|
|
|
|
{ 5 * 8, 8 * 8 },
|
|
|
|
10,
|
|
|
|
"Stop after"
|
2015-09-10 14:36:39 -04:00
|
|
|
};
|
|
|
|
|
2017-04-18 07:55:49 -04:00
|
|
|
NumberField field_stop {
|
|
|
|
{ 20 * 8, 8 * 8 + 4 },
|
|
|
|
2,
|
|
|
|
{ 1, 99 },
|
|
|
|
1,
|
|
|
|
' '
|
|
|
|
};
|
|
|
|
|
|
|
|
TransmitterView tx_view {
|
|
|
|
16 * 16,
|
|
|
|
10000,
|
|
|
|
12
|
|
|
|
};
|
2015-09-10 14:36:39 -04:00
|
|
|
|
2017-04-18 07:55:49 -04:00
|
|
|
MessageHandlerRegistration message_handler_tx_done {
|
|
|
|
Message::ID::TXDone,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const TXDoneMessage*>(p);
|
|
|
|
this->on_tx_progress(message.done);
|
|
|
|
}
|
2015-09-10 14:36:39 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|