summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-02 21:03:03 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-02 21:03:03 +0100
commit31150ddd0fafac4426d11a758be9d77699b7377c (patch)
treeaa0ac01afb3295f2aa326e394e37247c68d7a431 /src
parentcec71ef08475af291b968873757979c5e977facb (diff)
Fix missing content properties when using translations.
Diffstat (limited to 'src')
-rw-r--r--src/lib/audio_content.cc14
-rw-r--r--src/lib/content.cc8
-rw-r--r--src/lib/ffmpeg_content.cc23
-rw-r--r--src/lib/user_property.h11
-rw-r--r--src/lib/video_content.cc4
-rw-r--r--src/wx/content_properties_dialog.cc32
-rw-r--r--src/wx/content_properties_dialog.h3
7 files changed, 63 insertions, 32 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index b159aa50d..2b402991c 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -292,34 +292,34 @@ AudioContent::add_properties (list<UserProperty>& p) const
}
if (stream) {
- p.push_back (UserProperty (_("Audio"), _("Channels"), stream->channels ()));
- p.push_back (UserProperty (_("Audio"), _("Content audio sample rate"), stream->frame_rate(), _("Hz")));
+ p.push_back (UserProperty (UserProperty::AUDIO, _("Channels"), stream->channels ()));
+ p.push_back (UserProperty (UserProperty::AUDIO, _("Content audio sample rate"), stream->frame_rate(), _("Hz")));
}
FrameRateChange const frc (_parent->active_video_frame_rate(), _parent->film()->video_frame_rate());
ContentTime const c (_parent->full_length(), frc);
p.push_back (
- UserProperty (_("Length"), _("Full length in video frames at content rate"), c.frames_round(frc.source))
+ UserProperty (UserProperty::LENGTH, _("Full length in video frames at content rate"), c.frames_round(frc.source))
);
if (stream) {
p.push_back (
UserProperty (
- _("Length"),
+ UserProperty::LENGTH,
_("Full length in audio samples at content rate"),
c.frames_round (stream->frame_rate ())
)
);
}
- p.push_back (UserProperty (_("Audio"), _("DCP frame rate"), resampled_frame_rate (), _("Hz")));
- p.push_back (UserProperty (_("Length"), _("Full length in video frames at DCP rate"), c.frames_round (frc.dcp)));
+ p.push_back (UserProperty (UserProperty::AUDIO, _("DCP frame rate"), resampled_frame_rate (), _("Hz")));
+ p.push_back (UserProperty (UserProperty::LENGTH, _("Full length in video frames at DCP rate"), c.frames_round (frc.dcp)));
if (stream) {
p.push_back (
UserProperty (
- _("Length"),
+ UserProperty::LENGTH,
_("Full length in audio samples at DCP rate"),
c.frames_round (resampled_frame_rate ())
)
diff --git a/src/lib/content.cc b/src/lib/content.cc
index 66b0d477e..b8e7f8ad2 100644
--- a/src/lib/content.cc
+++ b/src/lib/content.cc
@@ -359,9 +359,13 @@ Content::active_video_frame_rate () const
void
Content::add_properties (list<UserProperty>& p) const
{
- p.push_back (UserProperty (_("General"), _("Filename"), path(0).string ()));
+ p.push_back (UserProperty (UserProperty::GENERAL, _("Filename"), path(0).string ()));
if (_video_frame_rate) {
- p.push_back (UserProperty (_("General"), _("Video frame rate"), raw_convert<string> (_video_frame_rate.get(), 5), _("frames per second")));
+ p.push_back (
+ UserProperty (
+ UserProperty::GENERAL, _("Video frame rate"), raw_convert<string> (_video_frame_rate.get(), 5), _("frames per second")
+ )
+ );
}
}
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index cc6a703ba..0f66180d0 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -122,6 +122,9 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no
FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<boost::shared_ptr<Content> > c)
: Content (film, c)
{
+ /* XXX: this should look at c to decide which of video/audio/subtitle
+ get created.
+ */
video.reset (new VideoContent (this, c));
audio.reset (new AudioContent (this, c));
subtitle.reset (new SubtitleContent (this, c));
@@ -434,21 +437,21 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
case AVCOL_RANGE_UNSPECIFIED:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is unknown (not specified in the file).
- p.push_back (UserProperty (_("Video"), _("Colour range"), _("Unspecified")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), _("Unspecified")));
break;
case AVCOL_RANGE_MPEG:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is limited, so that not all possible values are valid.
p.push_back (
UserProperty (
- _("Video"), _("Colour range"), String::compose (_("Limited (%1-%2)"), (total - sub) / 2, (total + sub) / 2)
+ UserProperty::VIDEO, _("Colour range"), String::compose (_("Limited (%1-%2)"), (total - sub) / 2, (total + sub) / 2)
)
);
break;
case AVCOL_RANGE_JPEG:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is full, so that all possible pixel values are valid.
- p.push_back (UserProperty (_("Video"), _("Colour range"), String::compose (_("Full (0-%1)"), total)));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), String::compose (_("Full (0-%1)"), total)));
break;
default:
DCPOMATIC_ASSERT (false);
@@ -458,17 +461,17 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
case AVCOL_RANGE_UNSPECIFIED:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is unknown (not specified in the file).
- p.push_back (UserProperty (_("Video"), _("Colour range"), _("Unspecified")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), _("Unspecified")));
break;
case AVCOL_RANGE_MPEG:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is limited, so that not all possible values are valid.
- p.push_back (UserProperty (_("Video"), _("Colour range"), _("Limited")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), _("Limited")));
break;
case AVCOL_RANGE_JPEG:
/// TRANSLATORS: this means that the range of pixel values used in this
/// file is full, so that all possible pixel values are valid.
- p.push_back (UserProperty (_("Video"), _("Colour range"), _("Full")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), _("Full")));
break;
default:
DCPOMATIC_ASSERT (false);
@@ -490,7 +493,7 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
};
DCPOMATIC_ASSERT (AVCOL_PRI_NB <= 11);
- p.push_back (UserProperty (_("Video"), _("Colour primaries"), primaries[_color_primaries]));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour primaries"), primaries[_color_primaries]));
char const * transfers[] = {
_("Unspecified"),
@@ -514,7 +517,7 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
};
DCPOMATIC_ASSERT (AVCOL_TRC_NB <= 18);
- p.push_back (UserProperty (_("Video"), _("Colour transfer characteristic"), transfers[_color_trc]));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colour transfer characteristic"), transfers[_color_trc]));
char const * spaces[] = {
_("RGB / sRGB (IEC61966-2-1)"),
@@ -531,10 +534,10 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
};
DCPOMATIC_ASSERT (AVCOL_SPC_NB == 11);
- p.push_back (UserProperty (_("Video"), _("Colourspace"), spaces[_colorspace]));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Colourspace"), spaces[_colorspace]));
if (_bits_per_pixel) {
- p.push_back (UserProperty (_("Video"), _("Bits per pixel"), raw_convert<string> (_bits_per_pixel.get ())));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Bits per pixel"), raw_convert<string> (_bits_per_pixel.get ())));
}
}
diff --git a/src/lib/user_property.h b/src/lib/user_property.h
index b27cd4151..a7a6f63da 100644
--- a/src/lib/user_property.h
+++ b/src/lib/user_property.h
@@ -26,15 +26,22 @@
class UserProperty
{
public:
+ enum Category {
+ GENERAL,
+ VIDEO,
+ AUDIO,
+ LENGTH
+ };
+
template <class T>
- UserProperty (std::string category_, std::string key_, T value_, std::string unit_ = "")
+ UserProperty (Category category_, std::string key_, T value_, std::string unit_ = "")
: category (category_)
, key (key_)
, value (raw_convert<std::string> (value_))
, unit (unit_)
{}
- std::string category;
+ Category category;
std::string key;
std::string value;
std::string unit;
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 9ffc63c5d..473bd784c 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -419,8 +419,8 @@ VideoContent::processing_description () const
void
VideoContent::add_properties (list<UserProperty>& p) const
{
- p.push_back (UserProperty (_("Video"), _("Length"), raw_convert<string> (length ()), _("video frames")));
- p.push_back (UserProperty (_("Video"), _("Size"), raw_convert<string> (size().width) + "x" + raw_convert<string> (size().height)));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Length"), raw_convert<string> (length ()), _("video frames")));
+ p.push_back (UserProperty (UserProperty::VIDEO, _("Size"), raw_convert<string> (size().width) + "x" + raw_convert<string> (size().height)));
}
void
diff --git a/src/wx/content_properties_dialog.cc b/src/wx/content_properties_dialog.cc
index 8bb0a6b1f..bd20d48e6 100644
--- a/src/wx/content_properties_dialog.cc
+++ b/src/wx/content_properties_dialog.cc
@@ -37,7 +37,7 @@ using boost::dynamic_pointer_cast;
ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<Content> content)
: TableDialog (parent, _("Content Properties"), 2, 1, false)
{
- map<string, list<UserProperty> > grouped;
+ map<UserProperty::Category, list<UserProperty> > grouped;
BOOST_FOREACH (UserProperty i, content->user_properties()) {
if (grouped.find(i.category) == grouped.end()) {
grouped[i.category] = list<UserProperty> ();
@@ -45,10 +45,10 @@ ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<C
grouped[i.category].push_back (i);
}
- maybe_add_group (grouped, wx_to_std (_("General")));
- maybe_add_group (grouped, wx_to_std (_("Video")));
- maybe_add_group (grouped, wx_to_std (_("Audio")));
- maybe_add_group (grouped, wx_to_std (_("Length")));
+ maybe_add_group (grouped, UserProperty::GENERAL);
+ maybe_add_group (grouped, UserProperty::VIDEO);
+ maybe_add_group (grouped, UserProperty::AUDIO);
+ maybe_add_group (grouped, UserProperty::LENGTH);
layout ();
@@ -60,14 +60,30 @@ ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<C
}
void
-ContentPropertiesDialog::maybe_add_group (map<string, list<UserProperty> > const & groups, string name)
+ContentPropertiesDialog::maybe_add_group (map<UserProperty::Category, list<UserProperty> > const & groups, UserProperty::Category category)
{
- map<string, list<UserProperty> >::const_iterator i = groups.find (name);
+ map<UserProperty::Category, list<UserProperty> >::const_iterator i = groups.find (category);
if (i == groups.end()) {
return;
}
- wxStaticText* m = new wxStaticText (this, wxID_ANY, std_to_wx (i->first));
+ wxString category_name;
+ switch (i->first) {
+ case UserProperty::GENERAL:
+ category_name = _("General");
+ break;
+ case UserProperty::VIDEO:
+ category_name = _("Video");
+ break;
+ case UserProperty::AUDIO:
+ category_name = _("Audio");
+ break;
+ case UserProperty::LENGTH:
+ category_name = _("Length");
+ break;
+ }
+
+ wxStaticText* m = new wxStaticText (this, wxID_ANY, category_name);
wxFont font (*wxNORMAL_FONT);
font.SetWeight (wxFONTWEIGHT_BOLD);
m->SetFont (font);
diff --git a/src/wx/content_properties_dialog.h b/src/wx/content_properties_dialog.h
index eb6f11ddb..92aa5c6d7 100644
--- a/src/wx/content_properties_dialog.h
+++ b/src/wx/content_properties_dialog.h
@@ -19,6 +19,7 @@
*/
#include "table_dialog.h"
+#include "lib/user_property.h"
#include <boost/shared_ptr.hpp>
#include <list>
#include <map>
@@ -32,5 +33,5 @@ public:
ContentPropertiesDialog (wxWindow* parent, boost::shared_ptr<Content> content);
private:
- void maybe_add_group (std::map<std::string, std::list<UserProperty> > const & groups, std::string name);
+ void maybe_add_group (std::map<UserProperty::Category, std::list<UserProperty> > const & groups, UserProperty::Category category);
};