Remove Content::path(), add Content::path_summary().
authorCarl Hetherington <cth@carlh.net>
Sat, 23 Nov 2013 12:22:34 +0000 (12:22 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 23 Nov 2013 12:22:34 +0000 (12:22 +0000)
src/lib/content.cc
src/lib/content.h
src/lib/ffmpeg.cc
src/lib/ffmpeg_content.cc
src/lib/image_content.cc
src/lib/sndfile_content.cc
src/lib/sndfile_decoder.cc
src/wx/audio_dialog.cc
src/wx/content_menu.cc
src/wx/hints_dialog.cc
src/wx/timeline.cc

index a565edb527c7339096c6accd932289e806e87c45..16069b7a7967b52a1200c40d241e2a6e91ff20eb 100644 (file)
@@ -169,7 +169,7 @@ Content::clone () const
 string
 Content::technical_summary () const
 {
-       return String::compose ("%1 %2 %3", path(), digest(), position());
+       return String::compose ("%1 %2 %3", path_summary(), digest(), position());
 }
 
 Time
@@ -217,4 +217,15 @@ Content::set_path (boost::filesystem::path path)
        signal_changed (ContentProperty::PATH);
 }
 
-       
+string
+Content::path_summary () const
+{
+       /* XXX: should handle multiple paths more gracefully */
+
+       string s = path(0).filename().string ();
+       if (number_of_paths() > 1) {
+               s += " ...";
+       }
+
+       return s;
+}
index 5d8100e5db825e021dfd1ca7a09b6909ce830ef6..e569c1431a7907064150ede6f72f82829edaceb2 100644 (file)
@@ -65,11 +65,8 @@ public:
        boost::shared_ptr<Content> clone () const;
 
        void set_path (boost::filesystem::path);
-       
-       boost::filesystem::path path () const {
-               boost::mutex::scoped_lock lm (_mutex);
-               return _paths.front ();
-       }
+
+       std::string path_summary () const;
 
        size_t number_of_paths () const {
                boost::mutex::scoped_lock lm (_mutex);
index dbafba0f03a8bfe8e741e3a2f7a08c3e95ec7b2d..bc2f67a9d868266ad67058feb4bbe863a4b957e0 100644 (file)
@@ -79,8 +79,8 @@ FFmpeg::setup_general (bool long_probe)
                av_dict_set (&options, "probesize", lexical_cast<string> (5 * 60 * 1e6).c_str(), 0);
        }
        
-       if (avformat_open_input (&_format_context, _ffmpeg_content->path().string().c_str(), 0, &options) < 0) {
-               throw OpenFileError (_ffmpeg_content->path().string ());
+       if (avformat_open_input (&_format_context, _ffmpeg_content->path(0).string().c_str(), 0, &options) < 0) {
+               throw OpenFileError (_ffmpeg_content->path(0).string ());
        }
 
        if (avformat_find_stream_info (_format_context, 0) < 0) {
index a6f9e6ac89140fb967ec7e1fa51aedd77978698f..4ca2ddc2933ff34e7a323c0a9b038c2a22d5e52f 100644 (file)
@@ -167,7 +167,7 @@ string
 FFmpegContent::summary () const
 {
        /* Get the string() here so that the name does not have quotes around it */
-       return String::compose (_("%1 [movie]"), path().filename().string());
+       return String::compose (_("%1 [movie]"), path_summary ());
 }
 
 string
index 9259242a04f442dc9d4340d6302e1a867e07af02..14a7c97d5c32511f5f7df2cd8580d86036bf5abf 100644 (file)
@@ -60,12 +60,15 @@ ImageContent::ImageContent (shared_ptr<const Film> f, shared_ptr<const cxml::Nod
 string
 ImageContent::summary () const
 {
+       string s = path_summary () + " ";
        /* Get the string() here so that the name does not have quotes around it */
        if (still ()) {
-               return String::compose (_("%1 [still]"), path().filename().string());
+               s += _("[still]");
+       } else {
+               s += _("[moving images]");
        }
 
-       return String::compose (_("%1 [moving images]"), path().filename().string());
+       return s;
 }
 
 string
index 31c1b4698da19ce3d83cf4ae0b6d052b61ea984f..7069499641933bbb266a21532d72f2a0ce977d77 100644 (file)
@@ -57,7 +57,7 @@ string
 SndfileContent::summary () const
 {
        /* Get the string() here so that the name does not have quotes around it */
-       return String::compose (_("%1 [audio]"), path().filename().string());
+       return String::compose (_("%1 [audio]"), path_summary ());
 }
 
 string
index 09ccf4fbc1fd9ba5d2bcf3eac9d3aa2ae135b45b..e10f4f568430d08dd86d1d5db38d2116606fbbbb 100644 (file)
@@ -40,7 +40,7 @@ SndfileDecoder::SndfileDecoder (shared_ptr<const Film> f, shared_ptr<const Sndfi
        , _deinterleave_buffer (0)
 {
        _info.format = 0;
-       _sndfile = sf_open (_sndfile_content->path().string().c_str(), SFM_READ, &_info);
+       _sndfile = sf_open (_sndfile_content->path(0).string().c_str(), SFM_READ, &_info);
        if (!_sndfile) {
                throw DecodeError (_("could not open audio file for reading"));
        }
index b7c244c9c51341d8c3625004e4f9ac6df45b1d89..78f3deab655b36eca6a956fc72cfb5b553b807e3 100644 (file)
@@ -95,7 +95,7 @@ AudioDialog::set_content (shared_ptr<AudioContent> c)
 
        _content_changed_connection = _content->Changed.connect (bind (&AudioDialog::content_changed, this, _2));
 
-       SetTitle (wxString::Format (_("DCP-o-matic audio - %s"), std_to_wx(_content->path().filename().string()).data()));
+       SetTitle (wxString::Format (_("DCP-o-matic audio - %s"), std_to_wx(_content->path_summary()).data()));
 }
 
 void
index 6a8e5cd4a76a3fa08c4e98f81857bd2794041c55..a6e2339731b0a5bbb2e657bcf833a040e236e236 100644 (file)
@@ -180,5 +180,5 @@ ContentMenu::maybe_found_missing (weak_ptr<Job> j, weak_ptr<Content> oc, weak_pt
                return;
        }
 
-       old_content->set_path (new_content->path ());
+       old_content->set_path (new_content->path (0));
 }
index df22500d2ca6b6a1f8eca51913f1202a8000656a..18b1f5451dc4bb460ba6265ea03841d7780c0040 100644 (file)
@@ -80,7 +80,7 @@ HintsDialog::film_changed ()
        ContentList content = film->content ();
        int vob = 0;
        for (ContentList::const_iterator i = content.begin(); i != content.end(); ++i) {
-               if (boost::algorithm::starts_with ((*i)->path().filename().string(), "VTS_")) {
+               if (boost::algorithm::starts_with ((*i)->path(0).filename().string(), "VTS_")) {
                        ++vob;
                }
        }
index e04d9ee744e94f83f4cf5354cfc6e150f65d5910..0ac9a1d4bb6d513e6fa3bedbfe96eeae66441777 100644 (file)
@@ -162,7 +162,7 @@ private:
                gc->StrokePath (path);
                gc->FillPath (path);
 
-               wxString name = wxString::Format (wxT ("%s [%s]"), std_to_wx (cont->path().filename().string()).data(), type().data());
+               wxString name = wxString::Format (wxT ("%s [%s]"), std_to_wx (cont->path_summary()).data(), type().data());
                wxDouble name_width;
                wxDouble name_height;
                wxDouble name_descent;