feat: Timer Voice & Haptic option, show elapsed speak time value when countdown (#2711)
* fix "odd" elapsed time announcement * announce elapsed seconds * Add support for "Beeps and Haptic" and "Voice and Haptic" for timer countdown.
This commit is contained in:
@@ -274,17 +274,27 @@ namespace YAML
|
||||
{
|
||||
Node convert<TimerData>::encode(const TimerData& rhs)
|
||||
{
|
||||
unsigned int countdownBeep = rhs.countdownBeep;
|
||||
unsigned int extraHaptic = rhs.extraHaptic;
|
||||
if (countdownBeep > TimerData::COUNTDOWNBEEP_VOICE + 1) {
|
||||
extraHaptic = 1;
|
||||
countdownBeep -= TimerData::COUNTDOWNBEEP_VOICE + 1;
|
||||
}
|
||||
else {
|
||||
extraHaptic = 0;
|
||||
}
|
||||
Node node;
|
||||
node["swtch"] = rhs.swtch;
|
||||
node["mode"] = timerModeLut << rhs.mode;
|
||||
node["name"] = rhs.name;
|
||||
node["minuteBeep"] = (int)rhs.minuteBeep;
|
||||
node["countdownBeep"] = rhs.countdownBeep;
|
||||
node["countdownBeep"] = countdownBeep;
|
||||
node["start"] = rhs.val;
|
||||
node["persistent"] = rhs.persistent;
|
||||
node["countdownStart"] = rhs.countdownStart;
|
||||
node["value"] = rhs.pvalue;
|
||||
node["showElapsed"] = rhs.showElapsed;
|
||||
node["extraHaptic"] = extraHaptic;
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -300,6 +310,11 @@ bool convert<TimerData>::decode(const Node& node, TimerData& rhs)
|
||||
node["countdownStart"] >> rhs.countdownStart;
|
||||
node["value"] >> rhs.pvalue;
|
||||
node["showElapsed"] >> rhs.showElapsed;
|
||||
node["extraHaptic"] >> rhs.extraHaptic;
|
||||
|
||||
if (rhs.extraHaptic)
|
||||
rhs.countdownBeep += TimerData::COUNTDOWNBEEP_VOICE + 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,10 @@ QString TimerData::countdownBeepToString(const int value)
|
||||
return tr("Voice");
|
||||
case COUNTDOWNBEEP_HAPTIC:
|
||||
return tr("Haptic");
|
||||
case COUNTDOWNBEEP_BEEPS_AND_HAPTIC:
|
||||
return tr("Beeps and Haptic");
|
||||
case COUNTDOWNBEEP_VOICE_AND_HAPTIC:
|
||||
return tr("Voice and Haptic");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
|
||||
@@ -40,86 +40,90 @@ class TimerData {
|
||||
Q_DECLARE_TR_FUNCTIONS(TimerData)
|
||||
|
||||
public:
|
||||
enum CountDownBeepType {
|
||||
COUNTDOWNBEEP_SILENT,
|
||||
COUNTDOWNBEEP_BEEPS,
|
||||
COUNTDOWNBEEP_VOICE,
|
||||
COUNTDOWNBEEP_HAPTIC,
|
||||
COUNTDOWNBEEP_COUNT
|
||||
};
|
||||
enum CountDownBeepType {
|
||||
COUNTDOWNBEEP_SILENT,
|
||||
COUNTDOWNBEEP_BEEPS,
|
||||
COUNTDOWNBEEP_VOICE,
|
||||
COUNTDOWNBEEP_HAPTIC,
|
||||
COUNTDOWNBEEP_BEEPS_AND_HAPTIC,
|
||||
COUNTDOWNBEEP_VOICE_AND_HAPTIC,
|
||||
COUNTDOWNBEEP_COUNT
|
||||
};
|
||||
|
||||
enum CountDownStart {
|
||||
COUNTDOWNSTART_5 = -2,
|
||||
COUNTDOWNSTART_FIRST = COUNTDOWNSTART_5,
|
||||
COUNTDOWNSTART_10,
|
||||
COUNTDOWNSTART_20,
|
||||
COUNTDOWNSTART_30,
|
||||
COUNTDOWNSTART_LAST = COUNTDOWNSTART_30
|
||||
};
|
||||
enum CountDownStart {
|
||||
COUNTDOWNSTART_5 = -2,
|
||||
COUNTDOWNSTART_FIRST = COUNTDOWNSTART_5,
|
||||
COUNTDOWNSTART_10,
|
||||
COUNTDOWNSTART_20,
|
||||
COUNTDOWNSTART_30,
|
||||
COUNTDOWNSTART_LAST = COUNTDOWNSTART_30
|
||||
};
|
||||
|
||||
enum PersistentType {
|
||||
PERSISTENT_NOT,
|
||||
PERSISTENT_FLIGHT,
|
||||
PERSISTENT_MANUALRESET,
|
||||
PERSISTENT_COUNT
|
||||
};
|
||||
enum PersistentType {
|
||||
PERSISTENT_NOT,
|
||||
PERSISTENT_FLIGHT,
|
||||
PERSISTENT_MANUALRESET,
|
||||
PERSISTENT_COUNT
|
||||
};
|
||||
|
||||
enum TimerMode {
|
||||
TIMERMODE_OFF,
|
||||
TIMERMODE_ON,
|
||||
TIMERMODE_START,
|
||||
TIMERMODE_THR,
|
||||
TIMERMODE_THR_REL,
|
||||
TIMERMODE_THR_START,
|
||||
TIMERMODE_COUNT,
|
||||
TIMERMODE_MAX = TIMERMODE_COUNT - 1
|
||||
};
|
||||
enum TimerMode {
|
||||
TIMERMODE_OFF,
|
||||
TIMERMODE_ON,
|
||||
TIMERMODE_START,
|
||||
TIMERMODE_THR,
|
||||
TIMERMODE_THR_REL,
|
||||
TIMERMODE_THR_START,
|
||||
TIMERMODE_COUNT,
|
||||
TIMERMODE_MAX = TIMERMODE_COUNT - 1
|
||||
};
|
||||
|
||||
enum TimerShowDirection {
|
||||
TIMER_SHOW_REMAINING,
|
||||
TIMER_SHOW_ELAPSED,
|
||||
TIMER_SHOW_COUNT
|
||||
};
|
||||
enum TimerShowDirection {
|
||||
TIMER_SHOW_REMAINING,
|
||||
TIMER_SHOW_ELAPSED,
|
||||
TIMER_SHOW_COUNT
|
||||
};
|
||||
|
||||
TimerData() { clear(); }
|
||||
TimerData() { clear(); }
|
||||
|
||||
RawSwitch swtch;
|
||||
unsigned int mode;
|
||||
char name[TIMER_NAME_LEN + 1];
|
||||
bool minuteBeep;
|
||||
unsigned int countdownBeep;
|
||||
unsigned int val;
|
||||
unsigned int persistent;
|
||||
int countdownStart;
|
||||
int pvalue;
|
||||
unsigned int showElapsed;
|
||||
RawSwitch swtch;
|
||||
unsigned int mode;
|
||||
char name[TIMER_NAME_LEN + 1];
|
||||
bool minuteBeep;
|
||||
unsigned int countdownBeep;
|
||||
unsigned int val;
|
||||
unsigned int persistent;
|
||||
int countdownStart;
|
||||
int pvalue;
|
||||
unsigned int showElapsed;
|
||||
unsigned int extraHaptic;
|
||||
|
||||
void convert(RadioDataConversionState & cstate);
|
||||
void clear();
|
||||
bool isEmpty() const;
|
||||
bool isModeOff();
|
||||
QString nameToString(int index) const;
|
||||
QString countdownBeepToString() const;
|
||||
QString countdownStartToString() const;
|
||||
QString persistentToString(const bool verbose = true) const;
|
||||
QString pvalueToString() const;
|
||||
QString valToString() const;
|
||||
QString modeToString() const;
|
||||
QString showElapsedToString() const;
|
||||
void convert(RadioDataConversionState& cstate);
|
||||
void clear();
|
||||
bool isEmpty() const;
|
||||
bool isModeOff();
|
||||
QString nameToString(int index) const;
|
||||
QString countdownBeepToString() const;
|
||||
QString countdownStartToString() const;
|
||||
QString persistentToString(const bool verbose = true) const;
|
||||
QString pvalueToString() const;
|
||||
QString valToString() const;
|
||||
QString modeToString() const;
|
||||
QString showElapsedToString() const;
|
||||
|
||||
void countdownBeepChanged();
|
||||
void modeChanged();
|
||||
void countdownBeepChanged();
|
||||
void modeChanged();
|
||||
|
||||
static QString countdownBeepToString(const int value);
|
||||
static QString countdownStartToString(const int value);
|
||||
static QString persistentToString(const int value, const bool verbose = true);
|
||||
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();
|
||||
static QString countdownBeepToString(const int value);
|
||||
static QString countdownStartToString(const int value);
|
||||
static QString persistentToString(const int value,
|
||||
const bool verbose = true);
|
||||
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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user