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:
eshifri
2023-01-23 20:00:12 +10:00
committed by GitHub
parent 0b8e4c6003
commit 8e8e78671a
45 changed files with 243 additions and 136 deletions
+77 -73
View File
@@ -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();
};