summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-23 12:22:34 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-23 12:22:34 +0000
commita0c0e609f7fbff8513135428378cc16684bae937 (patch)
tree25e800debbb1ec6ab60fd0a4fc8e593c81addaea /src
parent90b84151b9817b33381187f678cb2fdd062ed785 (diff)
Remove Content::path(), add Content::path_summary().
Diffstat (limited to 'src')
-rw-r--r--src/lib/content.cc15
-rw-r--r--src/lib/content.h7
-rw-r--r--src/lib/ffmpeg.cc4
-rw-r--r--src/lib/ffmpeg_content.cc2
-rw-r--r--src/lib/image_content.cc7
-rw-r--r--src/lib/sndfile_content.cc2
-rw-r--r--src/lib/sndfile_decoder.cc2
-rw-r--r--src/wx/audio_dialog.cc2
-rw-r--r--src/wx/content_menu.cc2
-rw-r--r--src/wx/hints_dialog.cc2
-rw-r--r--src/wx/timeline.cc2
11 files changed, 29 insertions, 18 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"));
}
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc
index b7c244c9c..78f3deab6 100644
--- a/src/wx/audio_dialog.cc
+++ b/src/wx/audio_dialog.cc
@@ -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
diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc
index 6a8e5cd4a..a6e233973 100644
--- a/src/wx/content_menu.cc
+++ b/src/wx/content_menu.cc
@@ -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));
}
diff --git a/src/wx/hints_dialog.cc b/src/wx/hints_dialog.cc
index df22500d2..18b1f5451 100644
--- a/src/wx/hints_dialog.cc
+++ b/src/wx/hints_dialog.cc
@@ -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;
}
}
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index e04d9ee74..0ac9a1d4b 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -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;