feat: Allow the timer count direction to be selected (#2038)

* timer direction: ellapsed or left

* Add AUDIO announcement support

* Storage for showElapsed

* Translations

* Fix storage

* BW implementation

* Different BW implementation

* Companion support

* Color LCD implementation and rebase to lvgl

* Fix problems found by raphaelcoeffic

* chore: Regenerate the YAML files properly

* fix: Remove unused `TR_SHOW` remnant

* chore: Formatting and cleanup

* fix: Timer dir choice was shown in wrong place
Wrong newline used in ce23b50

* Fix cpn ui triggers, remove unnecessary code and some formatting

* fix(colorlcd): Hide timer dir opt if zero value

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
eshifri
2022-08-03 09:22:42 +10:00
committed by GitHub
co-authored by Peter Feerick elecpower
parent 415b566a79
commit be7a6a51ab
50 changed files with 286 additions and 85 deletions
@@ -283,6 +283,7 @@ Node convert<TimerData>::encode(const TimerData& rhs)
node["persistent"] = rhs.persistent;
node["countdownStart"] = rhs.countdownStart;
node["value"] = rhs.pvalue;
node["showElapsed"] = rhs.showElapsed;
return node;
}
@@ -297,6 +298,7 @@ bool convert<TimerData>::decode(const Node& node, TimerData& rhs)
node["persistent"] >> rhs.persistent;
node["countdownStart"] >> rhs.countdownStart;
node["value"] >> rhs.pvalue;
node["showElapsed"] >> rhs.showElapsed;
return true;
}
+23
View File
@@ -180,6 +180,16 @@ QString TimerData::modeToString(const int value)
}
}
QString TimerData::showElapsedToString(const unsigned int value)
{
return (value) ? tr("Show Elapsed") : tr("Show Remaining");
}
QString TimerData::showElapsedToString() const
{
return showElapsedToString(showElapsed);
}
// static
AbstractStaticItemModel * TimerData::countdownBeepItemModel()
{
@@ -235,3 +245,16 @@ AbstractStaticItemModel * TimerData::modeItemModel()
mdl->loadItemList();
return mdl;
}
AbstractStaticItemModel * TimerData::showElapsedItemModel()
{
AbstractStaticItemModel *mdl = new AbstractStaticItemModel();
mdl->setName(AIM_TIMER_SHOWELAPSED);
for (unsigned int i = 0; i < TIMER_SHOW_COUNT; i++) {
mdl->appendToItemList(showElapsedToString(i), i);
}
mdl->loadItemList();
return mdl;
}
+12 -1
View File
@@ -32,6 +32,7 @@ constexpr char AIM_TIMER_COUNTDOWNBEEP[] {"timerdata.countdownBeep"};
constexpr char AIM_TIMER_COUNTDOWNSTART[] {"timerdata.countdownStart"};
constexpr char AIM_TIMER_PERSISTENT[] {"timerdata.persistent"};
constexpr char AIM_TIMER_MODE[] {"timerdata.mode"};
constexpr char AIM_TIMER_SHOWELAPSED[] {"timerdata.showElapsed"};
constexpr int TIMER_NAME_LEN {8};
@@ -74,6 +75,12 @@ class TimerData {
TIMERMODE_MAX = TIMERMODE_COUNT - 1
};
enum TimerShowDirection {
TIMER_SHOW_REMAINING,
TIMER_SHOW_ELAPSED,
TIMER_SHOW_COUNT
};
TimerData() { clear(); }
RawSwitch swtch;
@@ -85,6 +92,7 @@ class TimerData {
unsigned int persistent;
int countdownStart;
int pvalue;
unsigned int showElapsed;
void convert(RadioDataConversionState & cstate);
void clear();
@@ -97,6 +105,8 @@ class TimerData {
QString pvalueToString() const;
QString valToString() const;
QString modeToString() const;
QString showElapsedToString() const;
void countdownBeepChanged();
void modeChanged();
@@ -106,9 +116,10 @@ class TimerData {
static QString pvalueToString(const int value);
static QString valToString(const int value);
static QString modeToString(const int value);
static QString showElapsedToString(const unsigned int value);
static AbstractStaticItemModel * countdownBeepItemModel();
static AbstractStaticItemModel * countdownStartItemModel();
static AbstractStaticItemModel * persistentItemModel();
static AbstractStaticItemModel * modeItemModel();
static AbstractStaticItemModel * showElapsedItemModel();
};