summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-10-04 19:23:40 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-10-04 19:23:40 +0200
commit9a9193d3a2aa3e95efcb36b4903204095e921031 (patch)
tree4439207f0451aa078a84bd6e75c6fb254ededaa7
parentf99190895bed910653303232ec576d10902736c7 (diff)
Force changes instantly.
-rw-r--r--src/filelist.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/filelist.cc b/src/filelist.cc
index b9b1462..da7f399 100644
--- a/src/filelist.cc
+++ b/src/filelist.cc
@@ -63,6 +63,16 @@ public:
if(index.column() == 2)
{
auto w = new QCheckBox(parent);
+ auto audiofile_ids = instrument.getAudioFileList();
+ auto audiofile_id = audiofile_ids.begin() + index.row();
+ auto& audiofile = instrument.getAudioFile(*audiofile_id);
+
+ connect(w, &QCheckBox::stateChanged,
+ [&audiofile](int state)
+ {
+ audiofile.setMainChannel(state == Qt::Checked);
+ });
+
return w;
}
@@ -70,6 +80,16 @@ public:
if(index.column() == 3)
{
auto w = new QLineEdit(parent);
+
+ auto audiofile_ids = instrument.getAudioFileList();
+ auto audiofile_id = audiofile_ids.begin() + index.row();
+ auto& audiofile = instrument.getAudioFile(*audiofile_id);
+
+ connect(w, &QLineEdit::textEdited,
+ [&audiofile](const QString& name)
+ {
+ audiofile.setName(name);
+ });
return w;
}
@@ -84,6 +104,20 @@ public:
const auto& channel = instrument.getProject().getChannel(channel_id);
w->addItem(channel.getChannelName(), channel.getId());
}
+
+ auto audiofile_ids = instrument.getAudioFileList();
+ auto audiofile_id = audiofile_ids.begin() + index.row();
+ auto& audiofile = instrument.getAudioFile(*audiofile_id);
+
+ connect(w,
+ // This wierd line points the compiler to the correct overloaded
+ // version of QComboBox::currentIndexChanged
+ // ie. chooses the (int) version over the (const QString&) version
+ QOverload<int>::of(&QComboBox::currentIndexChanged),
+ [w, &audiofile](int idx)
+ {
+ audiofile.setChannelMapId(w->itemData(idx).toInt());
+ });
return w;
}