mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-25 01:05:08 +03:00
Add data models to setup timers
This commit is contained in:
parent
b4478ea48f
commit
c40136d08a
12 changed files with 179 additions and 137 deletions
|
@ -717,6 +717,16 @@ AbstractItemModel * CompoundItemModelFactory::getItemModel(const int id) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
AbstractItemModel * CompoundItemModelFactory::getItemModel(const QString name) const
|
||||
{
|
||||
foreach (AbstractItemModel * itemModel, registeredItemModels) {
|
||||
if (itemModel->getName() == name)
|
||||
return itemModel;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CompoundItemModelFactory::isItemModelRegistered(const int id) const
|
||||
{
|
||||
foreach (AbstractItemModel * itemModel, registeredItemModels) {
|
||||
|
|
|
@ -363,6 +363,7 @@ class CompoundItemModelFactory
|
|||
void unregisterItemModel(const int id);
|
||||
bool isItemModelRegistered(const int id) const;
|
||||
AbstractItemModel * getItemModel(const int id) const;
|
||||
AbstractItemModel * getItemModel(const QString name) const;
|
||||
void update(const int event = AbstractItemModel::IMUE_SystemRefresh);
|
||||
void dumpAllItemModelContents() const;
|
||||
|
||||
|
|
|
@ -47,3 +47,24 @@ QString DataHelpers::getElementName(const QString & prefix, const unsigned int i
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
QString DataHelpers::timeToString(const int value, const unsigned int mask)
|
||||
{
|
||||
bool negative = value < 0 ? true : false;
|
||||
int val = abs(value);
|
||||
|
||||
QString result = QString("%1").arg(negative ? "-" : ((mask & TIMESTR_MASK_PADSIGN) ? " " : ""));
|
||||
|
||||
if (mask & TIMESTR_MASK_HRSMINS) {
|
||||
int hours = val / 3600;
|
||||
if (hours > 0 || (mask & TIMESTR_MASK_ZEROHRS)) {
|
||||
val -= hours * 3600;
|
||||
result.append(QString("%1:").arg(hours, 2, 10, QLatin1Char('0')));
|
||||
}
|
||||
}
|
||||
|
||||
int minutes = val / 60;
|
||||
int seconds = val % 60;
|
||||
result.append(QString("%1:%2").arg(minutes, 2, 10, QLatin1Char('0')).arg(seconds, 2, 10, QLatin1Char('0')));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,11 @@ class FieldRange
|
|||
QString unit;
|
||||
};
|
||||
|
||||
|
||||
constexpr unsigned int TIMESTR_MASK_HRSMINS { 1 << 1 };
|
||||
constexpr unsigned int TIMESTR_MASK_ZEROHRS { 1 << 2 };
|
||||
constexpr unsigned int TIMESTR_MASK_PADSIGN { 1 << 3 };
|
||||
|
||||
namespace DataHelpers
|
||||
{
|
||||
enum BoolFormat {
|
||||
|
@ -59,5 +64,6 @@ namespace DataHelpers
|
|||
|
||||
QString boolToString(const bool value, const BoolFormat format);
|
||||
QString getElementName(const QString & prefix, const unsigned int index, const char * name = 0, const bool padding = false);
|
||||
QString timeToString(const int value, const unsigned int mask);
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "timerdata.h"
|
||||
#include "radiodataconversionstate.h"
|
||||
#include "compounditemmodels.h"
|
||||
|
||||
void TimerData::convert(RadioDataConversionState & cstate)
|
||||
{
|
||||
|
@ -36,7 +37,7 @@ void TimerData::clear()
|
|||
|
||||
bool TimerData::isEmpty()
|
||||
{
|
||||
return (mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0) && name[0] == '\0' && minuteBeep == 0 && countdownBeep == COUNTDOWN_SILENT && val == 0 && persistent == 0 /*&& pvalue == 0*/);
|
||||
return (mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0) && name[0] == '\0' && minuteBeep == 0 && countdownBeep == COUNTDOWNBEEP_SILENT && val == 0 && persistent == 0 /*&& pvalue == 0*/);
|
||||
}
|
||||
|
||||
bool TimerData::isModeOff()
|
||||
|
@ -59,9 +60,14 @@ QString TimerData::countdownStartToString() const
|
|||
return countdownStartToString(countdownStart);
|
||||
}
|
||||
|
||||
QString TimerData::persistentToString() const
|
||||
QString TimerData::persistentToString(const bool verbose) const
|
||||
{
|
||||
return persistentToString(persistent);
|
||||
return persistentToString(persistent, verbose);
|
||||
}
|
||||
|
||||
QString TimerData::pvalueToString() const
|
||||
{
|
||||
return pvalueToString(pvalue);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -99,25 +105,31 @@ QString TimerData::countdownStartToString(const int value)
|
|||
}
|
||||
|
||||
// static
|
||||
QString TimerData::persistentToString(const int value)
|
||||
QString TimerData::persistentToString(const int value, const bool verbose)
|
||||
{
|
||||
switch(value) {
|
||||
case PERSISTENT_NOT:
|
||||
return tr("Not persistent");
|
||||
return verbose ? tr("Not persistent") : tr("NOT");
|
||||
case PERSISTENT_FLIGHT:
|
||||
return tr("Persistent (flight)");
|
||||
return verbose ? tr("Persistent (flight)") : tr("Flight");
|
||||
case PERSISTENT_MANUALRESET:
|
||||
return tr("Persistent (manual reset)");
|
||||
return verbose ? tr("Persistent (manual reset)") : tr("Manual reset");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
QString TimerData::pvalueToString(const int value)
|
||||
{
|
||||
return DataHelpers::timeToString(value, TIMESTR_MASK_HRSMINS);
|
||||
}
|
||||
|
||||
// static
|
||||
AbstractStaticItemModel * TimerData::countdownBeepItemModel()
|
||||
{
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName("timerdata.countdownBeep");
|
||||
mdl->setName(AIM_TIMER_COUNTDOWNBEEP);
|
||||
|
||||
for (int i = 0; i < COUNTDOWNBEEP_COUNT; i++) {
|
||||
QString str = countdownBeepToString(i);
|
||||
|
@ -131,7 +143,7 @@ AbstractStaticItemModel * TimerData::countdownBeepItemModel()
|
|||
AbstractStaticItemModel * TimerData::countdownStartItemModel()
|
||||
{
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName("timerdata.countdownStart");
|
||||
mdl->setName(AIM_TIMER_COUNTDOWNSTART);
|
||||
|
||||
for (int i = COUNTDOWNSTART_LAST - 1; i >= COUNTDOWNSTART_FIRST; i--) {
|
||||
QString str = countdownStartToString(i);
|
||||
|
@ -145,7 +157,7 @@ AbstractStaticItemModel * TimerData::countdownStartItemModel()
|
|||
AbstractStaticItemModel * TimerData::persistentItemModel()
|
||||
{
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName("timerdata.persistent");
|
||||
mdl->setName(AIM_TIMER_PERSISTENT);
|
||||
|
||||
for (int i = 0; i < PERSISTENT_COUNT; i++) {
|
||||
QString str = persistentToString(i);
|
||||
|
|
|
@ -26,8 +26,13 @@
|
|||
#include <QtCore>
|
||||
|
||||
class RadioDataConversionState;
|
||||
class AbstractStaticItemModel;
|
||||
|
||||
#define TIMER_NAME_LEN 8
|
||||
constexpr char AIM_TIMER_COUNTDOWNBEEP[] {"timerdata.countdownBeep"};
|
||||
constexpr char AIM_TIMER_COUNTDOWNSTART[] {"timerdata.countdownStart"};
|
||||
constexpr char AIM_TIMER_PERSISTENT[] {"timerdata.persistent"};
|
||||
|
||||
constexpr int TIMER_NAME_LEN {8};
|
||||
|
||||
class TimerData {
|
||||
Q_DECLARE_TR_FUNCTIONS(TimerData)
|
||||
|
@ -74,13 +79,15 @@ class TimerData {
|
|||
bool isEmpty();
|
||||
bool isModeOff();
|
||||
QString nameToString(int index) const;
|
||||
QString countdownBeepToString();
|
||||
QString countdownStartToString();
|
||||
QString persistentToString();
|
||||
QString countdownBeepToString() const;
|
||||
QString countdownStartToString() const;
|
||||
QString persistentToString(const bool verbose = true) const;
|
||||
QString pvalueToString() const;
|
||||
|
||||
static QString countdownBeepToString(const int value);
|
||||
static QString countdownStartToString(const int value);
|
||||
static QString persistentToString(const int value);
|
||||
static QString persistentToString(const int value, const bool verbose = true);
|
||||
static QString pvalueToString(const int value);
|
||||
static AbstractStaticItemModel * countdownBeepItemModel();
|
||||
static AbstractStaticItemModel * countdownStartItemModel();
|
||||
static AbstractStaticItemModel * persistentItemModel();
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "ui_setup.h"
|
||||
#include "ui_setup_timer.h"
|
||||
#include "ui_setup_module.h"
|
||||
#include "filtereditemmodels.h"
|
||||
#include "appdata.h"
|
||||
#include "modelprinter.h"
|
||||
#include "multiprotocols.h"
|
||||
|
@ -31,54 +30,51 @@
|
|||
|
||||
#include <QDir>
|
||||
|
||||
constexpr char FIM_TIMERSWITCH[] {"Timer Switch"};
|
||||
constexpr char FIM_THRSOURCE[] {"Throttle Source"};
|
||||
|
||||
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware,
|
||||
QWidget * prevFocus, FilteredItemModel * rawSwitchFilteredModel):
|
||||
QWidget * prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels):
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
timer(timer),
|
||||
ui(new Ui::Timer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connectItemModelEvents(rawSwitchFilteredModel);
|
||||
connectItemModelEvents(panelFilteredModels->getItemModel(FIM_TIMERSWITCH));
|
||||
|
||||
lock = true;
|
||||
|
||||
// Name
|
||||
int length = firmware->getCapability(TimersName);
|
||||
if (length == 0) {
|
||||
if (length == 0)
|
||||
ui->name->hide();
|
||||
}
|
||||
else {
|
||||
ui->name->setMaxLength(length);
|
||||
}
|
||||
else
|
||||
ui->name->setField(timer.name, length, this);
|
||||
|
||||
// Mode
|
||||
ui->mode->setModel(rawSwitchFilteredModel);
|
||||
ui->mode->setModel(panelFilteredModels->getItemModel(FIM_TIMERSWITCH));
|
||||
ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue()));
|
||||
connect(ui->mode, SIGNAL(activated(int)), this, SLOT(onModeChanged(int)));
|
||||
|
||||
ui->countdownBeep->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNBEEP));
|
||||
ui->countdownBeep->setField(timer.countdownBeep, this);
|
||||
|
||||
ui->value->setMaximumTime(firmware->getMaxTimerStart());
|
||||
|
||||
ui->minuteBeep->setField(timer.minuteBeep, this);
|
||||
|
||||
if (!firmware->getCapability(PermTimers)) {
|
||||
ui->persistent->hide();
|
||||
ui->persistentValue->hide();
|
||||
}
|
||||
|
||||
ui->countdownBeep->setField(timer.countdownBeep, this);
|
||||
ui->countdownBeep->addItem(tr("Silent"), TimerData::COUNTDOWN_SILENT);
|
||||
ui->countdownBeep->addItem(tr("Beeps"), TimerData::COUNTDOWN_BEEPS);
|
||||
ui->countdownBeep->addItem(tr("Voice"), TimerData::COUNTDOWN_VOICE);
|
||||
ui->countdownBeep->addItem(tr("Haptic"), TimerData::COUNTDOWN_HAPTIC);
|
||||
|
||||
ui->value->setMaximumTime(firmware->getMaxTimerStart());
|
||||
|
||||
else {
|
||||
ui->persistent->setModel(panelItemModels->getItemModel(AIM_TIMER_PERSISTENT));
|
||||
ui->persistent->setField(timer.persistent, this);
|
||||
ui->persistent->addItem(tr("Not persistent"), 0);
|
||||
ui->persistent->addItem(tr("Persistent (flight)"), 1);
|
||||
ui->persistent->addItem(tr("Persistent (manual reset)"), 2);
|
||||
ui->persistentValue->setText(timer.pvalueToString());
|
||||
}
|
||||
|
||||
ui->countdownStart->setModel(panelItemModels->getItemModel(AIM_TIMER_COUNTDOWNSTART));
|
||||
ui->countdownStart->setField(timer.countdownStart, this);
|
||||
ui->countdownStart->addItem("5s", 1);
|
||||
ui->countdownStart->addItem("10s", 0);
|
||||
ui->countdownStart->addItem("20s", -1);
|
||||
ui->countdownStart->addItem("30s", -2);
|
||||
|
||||
disableMouseScrolling();
|
||||
QWidget::setTabOrder(prevFocus, ui->name);
|
||||
|
@ -102,31 +98,17 @@ void TimerPanel::update()
|
|||
{
|
||||
lock = true;
|
||||
|
||||
ui->name->setText(timer.name);
|
||||
ui->name->updateValue();
|
||||
ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue()));
|
||||
|
||||
int hour = timer.val / 3600;
|
||||
int min = (timer.val - (hour * 3600)) / 60;
|
||||
int sec = (timer.val - (hour * 3600)) % 60;
|
||||
|
||||
ui->mode->setCurrentIndex(ui->mode->findData(timer.mode.toValue()));
|
||||
ui->value->setTime(QTime(hour, min, sec));
|
||||
|
||||
if (firmware->getCapability(PermTimers)) {
|
||||
int sign = 1;
|
||||
int pvalue = timer.pvalue;
|
||||
if (pvalue < 0) {
|
||||
pvalue = -pvalue;
|
||||
sign = -1;
|
||||
}
|
||||
int hours = pvalue / 3600;
|
||||
pvalue -= hours * 3600;
|
||||
int minutes = pvalue / 60;
|
||||
int seconds = pvalue % 60;
|
||||
ui->persistentValue->setText(QString(" %1(%2:%3:%4)").arg(sign < 0 ? "-" :" ").arg(hours, 2, 10, QLatin1Char('0')).arg(minutes, 2, 10, QLatin1Char('0')).arg(seconds, 2, 10, QLatin1Char('0')));
|
||||
}
|
||||
|
||||
ui->countdownBeep->updateValue();
|
||||
ui->minuteBeep->setChecked(timer.minuteBeep);
|
||||
ui->minuteBeep->updateValue();
|
||||
if (firmware->getCapability(PermTimers))
|
||||
ui->persistent->updateValue();
|
||||
ui->countdownStart->updateValue();
|
||||
lock = false;
|
||||
|
@ -139,10 +121,17 @@ QWidget * TimerPanel::getLastFocus()
|
|||
|
||||
void TimerPanel::on_countdownBeep_currentIndexChanged(int index)
|
||||
{
|
||||
if(index == TimerData::COUNTDOWN_SILENT)
|
||||
ui->countdownStart->hide();
|
||||
if (!lock) {
|
||||
const int start = ui->countdownStart->itemData(index).toInt();
|
||||
if (start != timer.countdownStart) {
|
||||
timer.countdownStart = start;
|
||||
emit modified();
|
||||
if(index == TimerData::COUNTDOWNBEEP_SILENT)
|
||||
ui->countdownStart->setEnabled(false);
|
||||
else
|
||||
ui->countdownStart->show();
|
||||
ui->countdownStart->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TimerPanel::on_value_editingFinished()
|
||||
|
@ -197,12 +186,27 @@ void TimerPanel::connectItemModelEvents(const FilteredItemModel * itemModel)
|
|||
void TimerPanel::onItemModelAboutToBeUpdated()
|
||||
{
|
||||
lock = true;
|
||||
modelsUpdateCnt++;
|
||||
}
|
||||
|
||||
void TimerPanel::onItemModelUpdateComplete()
|
||||
{
|
||||
modelsUpdateCnt--;
|
||||
if (modelsUpdateCnt < 1) {
|
||||
update();
|
||||
lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
void TimerPanel::on_countdownStart_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
const int start = ui->countdownStart->itemData(index).toInt();
|
||||
if (start != timer.countdownStart) {
|
||||
timer.countdownStart = start;
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -1023,16 +1027,26 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
rawSwitchFilteredModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch), RawSwitch::TimersContext);
|
||||
connectItemModelEvents(rawSwitchFilteredModel);
|
||||
lock = true;
|
||||
|
||||
thrSourceFilteredModel = new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_ThrSource));
|
||||
connectItemModelEvents(thrSourceFilteredModel);
|
||||
panelFilteredModels = new FilteredItemModelFactory();
|
||||
|
||||
panelFilteredModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSwitch),
|
||||
RawSwitch::TimersContext),
|
||||
FIM_TIMERSWITCH);
|
||||
connectItemModelEvents(panelFilteredModels->getItemModel(FIM_TIMERSWITCH));
|
||||
|
||||
panelFilteredModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_ThrSource)),
|
||||
FIM_THRSOURCE);
|
||||
connectItemModelEvents(panelFilteredModels->getItemModel(FIM_THRSOURCE));
|
||||
|
||||
panelItemModels = new CompoundItemModelFactory(&generalSettings, &model);
|
||||
panelItemModels->registerItemModel(TimerData::countdownBeepItemModel());
|
||||
panelItemModels->registerItemModel(TimerData::countdownStartItemModel());
|
||||
panelItemModels->registerItemModel(TimerData::persistentItemModel());
|
||||
|
||||
Board::Type board = firmware->getBoard();
|
||||
|
||||
lock = true;
|
||||
|
||||
memset(modules, 0, sizeof(modules));
|
||||
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
|
@ -1112,7 +1126,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||
|
||||
for (int i = 0; i < CPN_MAX_TIMERS; i++) {
|
||||
if (i < timersCount) {
|
||||
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware, prevFocus, rawSwitchFilteredModel);
|
||||
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware, prevFocus, panelFilteredModels, panelItemModels);
|
||||
ui->gridLayout->addWidget(timers[i], 1+i, 1);
|
||||
connect(timers[i], &TimerPanel::modified, this, &SetupPanel::modified);
|
||||
connect(timers[i], &TimerPanel::nameChanged, this, &SetupPanel::onTimerNameChanged);
|
||||
|
@ -1279,8 +1293,8 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
|||
SetupPanel::~SetupPanel()
|
||||
{
|
||||
delete ui;
|
||||
delete rawSwitchFilteredModel;
|
||||
delete thrSourceFilteredModel;
|
||||
delete panelFilteredModels;
|
||||
delete panelItemModels;
|
||||
}
|
||||
|
||||
void SetupPanel::on_extendedLimits_toggled(bool checked)
|
||||
|
|
|
@ -18,17 +18,15 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _SETUP_H_
|
||||
#define _SETUP_H_
|
||||
#pragma once
|
||||
|
||||
#include "modeledit.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "compounditemmodels.h"
|
||||
#include "filtereditemmodels.h"
|
||||
|
||||
constexpr char MIMETYPE_TIMER[] = "application/x-companion-timer";
|
||||
|
||||
class CompoundItemModelFactory;
|
||||
class FilteredItemModel;
|
||||
|
||||
namespace Ui {
|
||||
class Setup;
|
||||
class Timer;
|
||||
|
@ -41,7 +39,7 @@ class TimerPanel : public ModelPanel
|
|||
|
||||
public:
|
||||
TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, Firmware * firmware,
|
||||
QWidget *prevFocus, FilteredItemModel * switchModel);
|
||||
QWidget *prevFocus, FilteredItemModelFactory * panelFilteredModels, CompoundItemModelFactory * panelItemModels);
|
||||
virtual ~TimerPanel();
|
||||
|
||||
virtual void update();
|
||||
|
@ -55,6 +53,7 @@ class TimerPanel : public ModelPanel
|
|||
void on_name_editingFinished();
|
||||
void onItemModelAboutToBeUpdated();
|
||||
void onItemModelUpdateComplete();
|
||||
void on_countdownStart_currentIndexChanged(int index);
|
||||
|
||||
signals:
|
||||
void nameChanged();
|
||||
|
@ -63,6 +62,7 @@ class TimerPanel : public ModelPanel
|
|||
TimerData & timer;
|
||||
Ui::Timer * ui;
|
||||
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
||||
int modelsUpdateCnt;
|
||||
};
|
||||
|
||||
class ModulePanel : public ModelPanel
|
||||
|
@ -184,7 +184,7 @@ class SetupPanel : public ModelPanel
|
|||
QVector<QCheckBox *> startupSwitchesCheckboxes;
|
||||
QVector<QCheckBox *> potWarningCheckboxes;
|
||||
QVector<QCheckBox *> centerBeepCheckboxes;
|
||||
ModulePanel * modules[CPN_MAX_MODULES+1];
|
||||
ModulePanel * modules[CPN_MAX_MODULES + 1];
|
||||
TimerPanel * timers[CPN_MAX_TIMERS];
|
||||
void updateStartupSwitches();
|
||||
void updatePotWarnings();
|
||||
|
@ -199,10 +199,8 @@ class SetupPanel : public ModelPanel
|
|||
bool moveTimerUpAllowed() const;
|
||||
void swapTimerData(int idx1, int idx2);
|
||||
CompoundItemModelFactory * sharedItemModels;
|
||||
FilteredItemModel * rawSwitchFilteredModel;
|
||||
FilteredItemModel * thrSourceFilteredModel;
|
||||
void updateItemModels();
|
||||
void connectItemModelEvents(const FilteredItemModel * itemModel);
|
||||
CompoundItemModelFactory * panelItemModels;
|
||||
FilteredItemModelFactory * panelFilteredModels;
|
||||
};
|
||||
|
||||
#endif // _SETUP_H_
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>675</width>
|
||||
<width>874</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="name">
|
||||
<widget class="AutoLineEdit" name="name">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
|
@ -68,11 +68,18 @@
|
|||
<item>
|
||||
<widget class="AutoComboBox" name="countdownBeep"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="countdownStartLabel">
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AutoComboBox" name="countdownStart"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minuteBeep">
|
||||
<widget class="AutoCheckBox" name="minuteBeep">
|
||||
<property name="text">
|
||||
<string>Minute Call</string>
|
||||
</property>
|
||||
|
@ -109,6 +116,16 @@
|
|||
<extends>QComboBox</extends>
|
||||
<header>autocombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AutoLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>autolineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AutoCheckBox</class>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>autocheckbox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -938,36 +938,6 @@ QString ModelPrinter::printFailsafeMode(unsigned int fsmode)
|
|||
}
|
||||
}
|
||||
|
||||
QString ModelPrinter::printTimerCountdownBeep(unsigned int countdownBeep)
|
||||
{
|
||||
switch (countdownBeep) {
|
||||
case TimerData::COUNTDOWN_SILENT:
|
||||
return tr("Silent");
|
||||
case TimerData::COUNTDOWN_BEEPS:
|
||||
return tr("Beeps");
|
||||
case TimerData::COUNTDOWN_VOICE:
|
||||
return tr("Voice");
|
||||
case TimerData::COUNTDOWN_HAPTIC:
|
||||
return tr("Haptic");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
QString ModelPrinter::printTimerPersistent(unsigned int persistent)
|
||||
{
|
||||
switch (persistent) {
|
||||
case 0:
|
||||
return tr("OFF");
|
||||
case 1:
|
||||
return tr("Flight");
|
||||
case 2:
|
||||
return tr("Manual reset");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
QString ModelPrinter::printSettingsTrim()
|
||||
{
|
||||
QStringList str;
|
||||
|
@ -1042,16 +1012,6 @@ QString ModelPrinter::printTimerName(int idx)
|
|||
return result;
|
||||
}
|
||||
|
||||
QString ModelPrinter::printTimerTimeValue(unsigned int val)
|
||||
{
|
||||
return printTimeValue(val, MASK_TIMEVALUE_HRSMINS | MASK_TIMEVALUE_ZEROHRS);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printTimerMinuteBeep(bool mb)
|
||||
{
|
||||
return printBoolean(mb, BOOLEAN_YESNO);
|
||||
}
|
||||
|
||||
QString ModelPrinter::printTelemetryProtocol(unsigned int val)
|
||||
{
|
||||
switch (val) {
|
||||
|
|
|
@ -104,13 +104,9 @@ class ModelPrinter: public QObject
|
|||
QString printFailsafe(int idx);
|
||||
QString printFailsafeMode(unsigned int fsmode);
|
||||
QString printFailsafeValue(int val);
|
||||
QString printTimerCountdownBeep(unsigned int countdownBeep);
|
||||
QString printTimerPersistent(unsigned int persistent);
|
||||
QString printPPMFrameLength(int ppmFL);
|
||||
QString printTimerName(int idx);
|
||||
QString printTimeValue(const int value, const unsigned int mask);
|
||||
QString printTimerMinuteBeep(bool mb);
|
||||
QString printTimerTimeValue(unsigned int val);
|
||||
QString printTelemetryProtocol(unsigned int val);
|
||||
QString printLabelValue(const QString & lbl, const QString & val, const bool sep = false);
|
||||
QString printLabelValues(const QString & lbl, const QStringList & vals, const bool sep = false);
|
||||
|
|
|
@ -341,11 +341,11 @@ QString MultiModelPrinter::printTimers()
|
|||
columns.appendCellStart(20, true);
|
||||
COMPARE(modelPrinter->printTimerName(i));
|
||||
columns.appendCellEnd(true);
|
||||
COMPARECELLWIDTH(modelPrinter->printTimerTimeValue(model->timers[i].val), 15);
|
||||
COMPARECELLWIDTH(DataHelpers::timeToString(model->timers[i].val, TIMESTR_MASK_HRSMINS), 15);
|
||||
COMPARECELLWIDTH(model->timers[i].mode.toString(), 15);
|
||||
COMPARECELLWIDTH(modelPrinter->printTimerCountdownBeep(model->timers[i].countdownBeep), 15);
|
||||
COMPARECELLWIDTH(modelPrinter->printTimerMinuteBeep(model->timers[i].minuteBeep), 15);
|
||||
COMPARECELLWIDTH(modelPrinter->printTimerPersistent(model->timers[i].persistent), 20);
|
||||
COMPARECELLWIDTH(model->timers[i].countdownBeepToString(), 15);
|
||||
COMPARECELLWIDTH(DataHelpers::boolToString(model->timers[i].minuteBeep, DataHelpers::BOOL_FMT_YESNO), 15);
|
||||
COMPARECELLWIDTH(model->timers[i].persistentToString(false), 20);
|
||||
columns.appendRowEnd();
|
||||
}
|
||||
columns.appendTableEnd();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue