diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-11-23 12:22:34 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-11-23 12:22:34 +0000 |
| commit | a0c0e609f7fbff8513135428378cc16684bae937 (patch) | |
| tree | 25e800debbb1ec6ab60fd0a4fc8e593c81addaea /src/lib | |
| parent | 90b84151b9817b33381187f678cb2fdd062ed785 (diff) | |
Remove Content::path(), add Content::path_summary().
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/content.cc | 15 | ||||
| -rw-r--r-- | src/lib/content.h | 7 | ||||
| -rw-r--r-- | src/lib/ffmpeg.cc | 4 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/image_content.cc | 7 | ||||
| -rw-r--r-- | src/lib/sndfile_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/sndfile_decoder.cc | 2 |
7 files changed, 25 insertions, 14 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index a565edb52..16069b7a7 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -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; +} diff --git a/src/lib/content.h b/src/lib/content.h index 5d8100e5d..e569c1431 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -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); diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index dbafba0f0..bc2f67a9d 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -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) { diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index a6f9e6ac8..4ca2ddc29 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -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 diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 9259242a0..14a7c97d5 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -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 diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 31c1b4698..706949964 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -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 diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc index 09ccf4fbc..e10f4f568 100644 --- a/src/lib/sndfile_decoder.cc +++ b/src/lib/sndfile_decoder.cc @@ -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")); } |
