summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2025-01-04 10:25:25 +0100
committerRoland Reichwein <mail@reichwein.it>2025-01-04 10:25:25 +0100
commitaaafcea7e26791acbf5b9612e3fb396edcdfcc8f (patch)
tree63131edf7b2eafe404a01e7ae01e2680d5f1b1e8 /config.cpp
parent9351c6d9812523b0b8027f2b2e0de54c27004bc2 (diff)
Fill UI
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/config.cpp b/config.cpp
index 2cd061c..04736ea 100644
--- a/config.cpp
+++ b/config.cpp
@@ -30,6 +30,7 @@ void Config::recover()
m_midi_channel = CLICK_CHANNEL;
m_midi_note = CLICK_NOTE;
m_bpm = default_bpm;
+ m_mode = default_mode;
std::string config = Reichwein::File::getFile(config_filename);
@@ -38,12 +39,19 @@ void Config::recover()
for (const auto& i: lines) {
if (i.starts_with("midi_channel=")) {
m_midi_channel = stoul(i.substr(13));
+ signal_channel(m_midi_channel);
}
if (i.starts_with("midi_note=")) {
m_midi_note = stoul(i.substr(10));
+ signal_note(m_midi_note);
}
if (i.starts_with("bpm=")) {
m_bpm = stoul(i.substr(4));
+ signal_bpm(m_bpm);
+ }
+ if (i.starts_with("mode=")) {
+ m_mode = stoul(i.substr(5));
+ signal_mode(m_mode);
}
}
} catch (const std::exception& ex) {
@@ -55,7 +63,8 @@ void Config::persist()
{
std::string config = fmt::format("midi_channel={}\n", m_midi_channel) +
fmt::format("midi_note={}\n", m_midi_note) +
- fmt::format("bpm={}\n", m_bpm);
+ fmt::format("bpm={}\n", m_bpm) +
+ fmt::format("mode={}\n", m_mode);
Reichwein::File::setFile(config_filename, config);
}
@@ -68,6 +77,7 @@ int Config::get_midi_channel()
void Config::set_midi_channel(int channel)
{
m_midi_channel = channel;
+ signal_channel(channel);
}
int Config::get_midi_note()
@@ -78,6 +88,7 @@ int Config::get_midi_note()
void Config::set_midi_note(int note)
{
m_midi_note = note;
+ signal_note(note);
}
int Config::get_bpm()
@@ -88,5 +99,17 @@ int Config::get_bpm()
void Config::set_bpm(int bpm)
{
m_bpm = bpm;
+ signal_bpm(bpm);
+}
+
+int Config::get_mode()
+{
+ return m_mode;
+}
+
+void Config::set_mode(int mode)
+{
+ m_mode = mode;
+ signal_mode(mode);
}