]> git.sesse.net Git - nageru/blob - input_mapping_dialog.h
Release Nageru 1.7.2.
[nageru] / input_mapping_dialog.h
1 #ifndef _INPUT_MAPPING_DIALOG_H
2 #define _INPUT_MAPPING_DIALOG_H
3
4 #include <QDialog>
5 #include <QString>
6 #include <map>
7 #include <vector>
8
9 #include "audio_mixer.h"
10 #include "input_mapping.h"
11
12 class QObject;
13
14 namespace Ui {
15 class InputMappingDialog;
16 }  // namespace Ui
17
18 class QComboBox;
19
20 class InputMappingDialog : public QDialog
21 {
22         Q_OBJECT
23
24 public:
25         InputMappingDialog();
26         ~InputMappingDialog();
27
28 private:
29         void fill_ui_from_mapping(const InputMapping &mapping);
30         void fill_row_from_bus(unsigned row, const InputMapping::Bus &bus);
31         void setup_channel_choices_from_bus(unsigned row, const InputMapping::Bus &bus);
32         void cell_changed(int row, int column);
33         void card_selected(QComboBox *card_combo, unsigned row, int index);
34         void channel_selected(unsigned row, unsigned channel, int index);
35         void ok_clicked();
36         void cancel_clicked();
37         void add_clicked();
38         void remove_clicked();
39         void updown_clicked(int direction);
40         void save_clicked();
41         void load_clicked();
42         void update_button_state();
43
44         Ui::InputMappingDialog *ui;
45         InputMapping mapping;  // Under edit. Will be committed on OK.
46
47         // The old mapping. Will be re-committed on cancel, so that we
48         // unhold all the unused devices (otherwise they would be
49         // held forever).
50         InputMapping old_mapping;
51
52         // One for each bus in the mapping. Edited along with the mapping,
53         // so that old volumes etc. are being kept in place for buses that
54         // existed before.
55         std::vector<AudioMixer::BusSettings> bus_settings;
56
57         std::map<DeviceSpec, DeviceInfo> devices;  // Needs no lock, accessed only on the UI thread.
58         AudioMixer::state_changed_callback_t saved_callback;
59 };
60
61 #endif  // !defined(_INPUT_MAPPING_DIALOG_H)