Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
optionspageenvironmenttuningpage.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2015 Haye Hinrichsen, Christoph Wick
3  *
4  * This file is part of Entropy Piano Tuner.
5  *
6  * Entropy Piano Tuner is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * Entropy Piano Tuner is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * Entropy Piano Tuner. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
22 #include "../../settingsforqt.h"
23 #include "preferredtextsizelabel.h"
24 #include <QGridLayout>
25 
26 namespace options {
27 
29 {
30  QGridLayout *layout = new QGridLayout;
31  mCentralWidget->setLayout(layout);
32  layout->setColumnStretch(1, 1);
33 
34  mSynthesizerModeComboBox = new QComboBox;
35  mSynthesizerModeComboBox->addItem(tr("Disabled"), QVariant(SoundGenerator::SGM_DEACTIVATED));
36  mSynthesizerModeComboBox->addItem(tr("Synthesized key sound"), QVariant(SoundGenerator::SGM_SYNTHESIZE_KEY));
37  mSynthesizerModeComboBox->addItem(tr("Reference key"), QVariant(SoundGenerator::SGM_REFERENCE_TONE));
38  layout->addWidget(new QLabel(tr("Synthesizer mode")), 0, 0);
39  layout->addWidget(mSynthesizerModeComboBox, 0, 1);
40 
41  mSynthesizerVolumeDynamicCheckBox = new QCheckBox;
42  QLabel *synthesizerVolumeDynamicLabel = new PreferredTextSizeLabel(tr("Dynamic synthesizer volume"));
43  synthesizerVolumeDynamicLabel->setWordWrap(true);
44  layout->addWidget(synthesizerVolumeDynamicLabel, 1, 0);
45  layout->addWidget(mSynthesizerVolumeDynamicCheckBox, 1, 1);
46 
47  mStroboscopeCheckBox = new QCheckBox;
48  QLabel *stroboscopeLabel = new PreferredTextSizeLabel(tr("Stroboscopic tuning indicator"));
49  stroboscopeLabel->setWordWrap(true);
50  layout->addWidget(stroboscopeLabel, 2, 0);
51  layout->addWidget(mStroboscopeCheckBox, 2, 1);
52 
54  QLabel *disableAutomaticKeySelectionLabel = new PreferredTextSizeLabel(tr("Disable automatic key selection"));
55  disableAutomaticKeySelectionLabel->setWordWrap(true);
56  layout->addWidget(disableAutomaticKeySelectionLabel, 3, 0);
57  layout->addWidget(mDisableAutomaticKeySelecetionCheckBox, 3, 1);
58 
59  layout->setRowStretch(5, 1);
60 
61  mSynthesizerModeComboBox->setCurrentIndex(mSynthesizerModeComboBox->findData(QVariant(SettingsForQt::getSingleton().getSoundGeneratorMode())));
62  mSynthesizerVolumeDynamicCheckBox->setChecked(SettingsForQt::getSingleton().isSoundGeneratorVolumeDynamic());
63  mStroboscopeCheckBox->setChecked(SettingsForQt::getSingleton().isStroboscopeActive());
64  mDisableAutomaticKeySelecetionCheckBox->setChecked(SettingsForQt::getSingleton().isAutomaticKeySelectionDisabled());
65 
66  QObject::connect(mSynthesizerModeComboBox, SIGNAL(currentIndexChanged(int)), optionsDialog, SLOT(onChangesMade()));
67  QObject::connect(mSynthesizerVolumeDynamicCheckBox, SIGNAL(toggled(bool)), optionsDialog, SLOT(onChangesMade()));
68  QObject::connect(mStroboscopeCheckBox, SIGNAL(toggled(bool)), optionsDialog, SLOT(onChangesMade()));
69  QObject::connect(mDisableAutomaticKeySelecetionCheckBox, SIGNAL(toggled(bool)), optionsDialog, SLOT(onChangesMade()));
70 }
71 
73 {
75  static_cast<SoundGenerator::SoundGeneratorMode>(mSynthesizerModeComboBox->currentData().toInt()));
79 
80 }
81 
82 } // namespace options
83 
virtual void setSoundGeneratorVolumeDynamic(bool dynamic) overridefinal
Set flag for dynamic volume adaption in the tuning mode.
virtual void setStroboscopeMode(bool enable) overridefinal
Set flag indicating the stroboscopic mode of the tuning indicator.
virtual void setDisableAutomaticKeySelection(bool disable) overridefinal
Set flag disabling automatic selection of the key during tuning.
virtual void setSoundGeneratorMode(SoundGenerator::SoundGeneratorMode mode) overridefinal
Set the last operation mode of the sound generator.
PageEnvironmentTuning(OptionsDialog *optionsDialog)
Produce a sound which imitates the string.
Produce a simple sine wave as reference.
static SettingsForQt & getSingleton()
Getter function for the singleton.