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