diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-11-23 23:53:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-09-28 19:49:26 +0200 |
| commit | f3275bba73347eef03bbe6f7982e8ca25f2aced6 (patch) | |
| tree | 872667cdb63a4e3372b5cd5235d82c5b868fac3b /src/lib/config.cc | |
| parent | eda4ed548e51ab1c231205ec141dac3dd6be2ac4 (diff) | |
Save window metrics in the config file (#1575).
Perhaps these should be in a separate GUI file, like how it's done for
Films, but I can't really see a big advantage (and there already
GUI-only details in there).
In this commit we also save the hints dialog size/position and
start it a bit larger (#2892).
Diffstat (limited to 'src/lib/config.cc')
| -rw-r--r-- | src/lib/config.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index af97c7af7..a69f953bf 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -683,6 +683,13 @@ try #endif _export.read(f.optional_node_child("Export")); + + for (auto metrics: f.node_children("WindowMetrics")) { + _window_metrics[metrics->string_attribute("name")] = { + { metrics->number_attribute<int>("x"), metrics->number_attribute<int>("y") }, + { metrics->number_attribute<int>("width"), metrics->number_attribute<int>("height") } + }; + } } catch (...) { if (have_existing("config.xml")) { @@ -1171,6 +1178,15 @@ Config::write_config() const _export.write(cxml::add_child(root, "Export")); + for (auto metrics: _window_metrics) { + auto m = cxml::add_child(root, "WindowMetrics"); + m->set_attribute("name", metrics.first); + m->set_attribute("x", fmt::to_string(metrics.second.first.x)); + m->set_attribute("y", fmt::to_string(metrics.second.first.y)); + m->set_attribute("width", fmt::to_string(metrics.second.second.width)); + m->set_attribute("height", fmt::to_string(metrics.second.second.height)); + } + auto target = config_write_file(); try { @@ -1756,6 +1772,26 @@ Config::cinemas_file() const } +optional<std::pair<Position<int>, dcp::Size>> +Config::window_metrics(string name) const +{ + auto iter = _window_metrics.find(name); + if (iter != _window_metrics.end()) { + return iter->second; + } + + return {}; +} + + +void +Config::set_window_metrics(string name, Position<int> position, dcp::Size size) +{ + _window_metrics[name] = { position, size }; + changed(OTHER); +} + + #ifdef DCPOMATIC_GROK Config::Grok::Grok() |
