diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-16 17:35:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-29 01:44:15 +0200 |
| commit | 04f8ba59d17e726570b4c1f361f10c7548fbe5c2 (patch) | |
| tree | 921748170f4c000d5c7bd5ce3440bbfb149e3c08 | |
| parent | 3cbc5434edfd0eff96d4e25313d1dfcde478070c (diff) | |
Put * in the title bar when the DCP-o-matic project is modified (#1938).
| -rw-r--r-- | src/lib/film.cc | 8 | ||||
| -rw-r--r-- | src/lib/film.h | 6 | ||||
| -rw-r--r-- | src/tools/dcpomatic.cc | 10 |
3 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 1ea03a8d9..e49b7f78e 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -482,7 +482,7 @@ Film::write_metadata (boost::filesystem::path path) const /** Write state to our `metadata' file */ void -Film::write_metadata () const +Film::write_metadata () { DCPOMATIC_ASSERT (directory()); boost::filesystem::create_directories (directory().get()); @@ -2178,8 +2178,12 @@ Film::set_sign_language_video_language (optional<dcp::LanguageTag> lang) void -Film::set_dirty (bool dirty) const +Film::set_dirty (bool dirty) { + auto const changed = dirty != _dirty; _dirty = dirty; + if (changed) { + emit (boost::bind(boost::ref(DirtyChange), _dirty)); + } } diff --git a/src/lib/film.h b/src/lib/film.h index 9be6c5771..d42eb5626 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -131,7 +131,7 @@ public: void use_template (std::string name); std::list<std::string> read_metadata (boost::optional<boost::filesystem::path> path = boost::optional<boost::filesystem::path> ()); - void write_metadata () const; + void write_metadata (); void write_metadata (boost::filesystem::path path) const; void write_template (boost::filesystem::path path) const; std::shared_ptr<xmlpp::Document> metadata (bool with_content_paths = true) const; @@ -481,6 +481,8 @@ public: */ mutable boost::signals2::signal<void ()> LengthChange; + boost::signals2::signal<void (bool)> DirtyChange; + /** Emitted when we have something important to tell the user */ boost::signals2::signal<void (std::string)> Message; @@ -507,7 +509,7 @@ private: void audio_analysis_finished (); void check_settings_consistency (); void maybe_set_container_and_resolution (); - void set_dirty (bool dirty) const; + void set_dirty (bool dirty); /** Log to write to */ std::shared_ptr<Log> _log; diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index a14a27343..8455163bb 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -495,6 +495,7 @@ public: if (_film) { _film->Change.connect (boost::bind (&DOMFrame::film_change, this, _1)); _film->Message.connect (boost::bind(&DOMFrame::film_message, this, _1)); + _film->DirtyChange.connect (boost::bind(&DOMFrame::set_title, this)); dcpomatic_log = _film->log (); } set_title (); @@ -1528,8 +1529,13 @@ private: void set_title () { auto s = wx_to_std(_("DCP-o-matic")); - if (_film && _film->directory()) { - s += " - " + _film->directory()->string(); + if (_film) { + if (_film->directory()) { + s += " - " + _film->directory()->string(); + } + if (_film->dirty()) { + s += " *"; + } } SetTitle (std_to_wx(s)); |
