Browse Source

Can change startup sound using options

dynamic_words_list
squeaky otter 5 years ago
parent
commit
14965c1e38
Signed by: dashie GPG Key ID: C2D57B325840B755
  1. 2
      MainWindow.cpp
  2. 11
      Morse.cpp
  3. 3
      Morse.h
  4. 7
      Prefs.cpp
  5. 3
      Prefs.h
  6. 1
      cutecw.cfg.sample

2
MainWindow.cpp

@ -85,7 +85,7 @@ MainWindow::startIt()
m_morse->clearList();
if (m_morse->startSound()) {
m_morse->add("de ws6z");
m_morse->add(m_morse->startSoundStr());
m_morse->playSequence();
}
}

11
Morse.cpp

@ -114,6 +114,7 @@ void Morse::saveSettings() {
settings.setValue("Tone", m_tone);
settings.setValue("StartSound", m_startSound);
settings.setValue("Lang", m_lang);
settings.setValue("StartSoundStr", m_startSoundStr);
//settings.setValue("LetterWeighting", int(m_badLetterWeighting));
for(int i = PLAY; i <= maximumTrainingMode; i++) {
@ -136,6 +137,8 @@ void Morse::loadSettings() {
m_tone = settings.value("Tone", DEFAULT_TONE).toInt();
m_startSound = settings.value("StartSound", true).toBool();
m_lang = settings.value("Lang", "en").toString();
m_startSoundStr = settings.value("StartSoundStr", "de WS6Z").toString();
for(int i = PLAY; i <= maximumTrainingMode; i++) {
if (! m_modes.contains((TrainingMode) i))
continue;
@ -638,6 +641,10 @@ QString Morse::lang() {
return m_lang;
}
QString Morse::startSoundStr() {
return m_startSoundStr;
}
void Morse::setWPMGoal(int wpmGoal)
{
m_currentWPMGoal = wpmGoal;
@ -661,6 +668,10 @@ void Morse::setLang(QString lang) {
m_lang = lang;
}
void Morse::setStartSoundStr(QString str) {
m_startSoundStr = str;
}
float Morse::dahSecsF()
{
return m_dahSecs;

3
Morse.h

@ -98,12 +98,14 @@ public:
int tone();
bool startSound();
QString lang();
QString startSoundStr();
void setWPMGoal(int wpmGoal);
void setWPMAccept(int wpmAccept);
void setTone(int tone);
void setStartSound(bool state);
void setLang(QString lang);
void setStartSoundStr(QString str);
AudioMode audioMode();
void setAudioMode(AudioMode newmode);
@ -166,6 +168,7 @@ private:
int m_tone;
bool m_startSound;
QString m_lang;
QString m_startSoundStr;
QTime m_leadInPause;
QSignalMapper *m_signalMapper;

7
Prefs.cpp

@ -44,9 +44,13 @@ Prefs::Prefs(Morse *morse, QWidget *parent) :
int langIndex = m_Lang->findData(QVariant(m_morse->lang()));
m_Lang->setCurrentIndex(langIndex);
genericForm->addRow(tr("App language"), m_Lang);
m_StartSoundStr = new QLineEdit();
m_StartSoundStr->setText(m_morse->startSoundStr());
genericForm->addRow(tr("Startup sound string"), m_StartSoundStr);
tabWidget->addTab(genericPrefs, tr("General"));
topLayout->addWidget(tabWidget);
@ -87,6 +91,7 @@ void Prefs::ok()
QMessageBox::information(this, tr("Language change"), tr("Please restart CuteCW to apply language change."));
m_morse->setLang(newLang);
m_morse->setStartSoundStr(m_StartSoundStr->text());
m_morse->saveSettings();
m_morse->loadSettings();

3
Prefs.h

@ -5,6 +5,7 @@
#include <QSpinBox>
#include <QCheckBox>
#include <QComboBox>
#include <QLineEdit>
namespace Ui {
class Prefs;
@ -32,6 +33,8 @@ private:
QCheckBox *m_StartSound;
QComboBox *m_Lang;
QLineEdit *m_StartSoundStr;
int m_oldTone;
int m_oldRate;
};

1
cutecw.cfg.sample

@ -1,6 +1,7 @@
[General]
Lang=fr
StartSound=true
StartSoundStr=de WS6Z
Tone=700
[Grouping%20Training]

Loading…
Cancel
Save