Debian Codegraph @

BambooTracker/gui/configuration_dialog.hpp

raw
1 /*
2 * Copyright (C) 2018-2021 Rerrah
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use,
8 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following
11 * conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 #ifndef CONFIGURATION_DIALOG_HPP
27 #define CONFIGURATION_DIALOG_HPP
28
29 #include <memory>
30 #include <unordered_map>
31 #include <vector>
32 #include <string>
33 #include <QDialog>
34 #include <QString>
35 #include <QKeySequenceEdit>
36 #include "configuration.hpp"
37 #include "color_palette.hpp"
38 #include "enum_hash.hpp"
39
40 namespace Ui {
41 class ConfigurationDialog;
42 }
43
44 class AudioStream;
45
46 class ConfigurationDialog : public QDialog
47 {
48 Q_OBJECT
49
50 public:
51 ConfigurationDialog(std::weak_ptr<Configuration> config, std::weak_ptr<ColorPalette> palette,
52 std::weak_ptr<const AudioStream> stream, QWidget *parent = nullptr);
53 ~ConfigurationDialog() override;
54
55 signals:
56 void applyPressed();
57
58 private slots:
59 void on_ConfigurationDialog_accepted();
60
61 private:
62 Ui::ConfigurationDialog *ui;
63 std::weak_ptr<Configuration> config_;
64 std::weak_ptr<ColorPalette> refPalette_;
65 std::weak_ptr<const AudioStream> stream_;
66
67 std::unordered_map<JamKey, QKeySequenceEdit*> customLayoutKeysMap_;
68
69 /***** General *****/
70 private slots:
71 void on_generalSettingsListWidget_itemSelectionChanged();
72 void on_noteNameComboBox_currentIndexChanged(int index);
73
74 /***** Mixer *****/
75 private slots:
76 void on_mixerResetPushButton_clicked();
77
78 /***** Sound *****/
79 private slots:
80 void on_audioApiComboBox_currentIndexChanged(const QString &arg1);
81 void on_midiApiComboBox_currentIndexChanged(const QString &arg1);
82 void onMidiApiChanged(const QString &arg1, bool hasInitialized = true);
83
84 /***** Formats *****/
85 private:
86 std::vector<FMEnvelopeText> fmEnvelopeTexts_;
87
88 private slots:
89 void on_addEnvelopeSetPushButton_clicked();
90 void on_removeEnvelopeSetpushButton_clicked();
91 void on_editEnvelopeSetPushButton_clicked();
92 void on_envelopeSetNameLineEdit_textChanged(const QString &arg1);
93 void on_envelopeTypeListWidget_currentRowChanged(int currentRow);
94 void updateEnvelopeSetUi();
95
96 /***** Keys *****/
97 private slots:
98 void on_keyboardTypeComboBox_currentIndexChanged(int);
99 void on_customLayoutResetButton_clicked();
100
101 private:
102 std::unordered_map<Configuration::ShortcutAction, QKeySequenceEdit*> shortcutsMap_;
103
104 void addShortcutItem(QString action, std::string shortcut);
105 std::string getShortcutString(int row) const;
106 void updateNoteNames();
107
108 /***** Appearance *****/
109 private slots:
110 void on_colorEditPushButton_clicked();
111 void on_colorLoadPushButton_clicked();
112 void on_colorSavePushButton_clicked();
113
114 private:
115 void updateColorTreeFrom(const ColorPalette* const palette);
116 void setPaletteFromColorTree(ColorPalette* const palette);
117 };
118
119 #endif // CONFIGURATION_DIALOG_HPP