2016-06-02 Carl Hetherington <cth@carlh.net>
+ * Fix broken content properties under translation.
+
* Version 2.8.7 released.
2016-06-01 c.hetherington <cth@carlh.net>
}
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 ())
)
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")
+ )
+ );
}
}
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));
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);
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);
};
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"),
};
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)"),
};
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 ())));
}
}
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;
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
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> ();
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 ();
}
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);
*/
#include "table_dialog.h"
+#include "lib/user_property.h"
#include <boost/shared_ptr.hpp>
#include <list>
#include <map>
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);
};