xmlpp::Document doc;
xmlpp::Node* node = doc.create_root_node ("Content");
as_xml (node);
- return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version);
+
+ /* notes is unused here (we assume) */
+ list<string> notes;
+ return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version, notes);
}
string
#include "util.h"
using std::string;
+using std::list;
using boost::shared_ptr;
shared_ptr<Content>
-content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version)
+content_factory (shared_ptr<const Film> film, cxml::NodePtr node, int version, list<string>& notes)
{
string const type = node->string_child ("Type");
boost::shared_ptr<Content> content;
if (type == "FFmpeg") {
- content.reset (new FFmpegContent (film, node, version));
+ content.reset (new FFmpegContent (film, node, version, notes));
} else if (type == "Image") {
content.reset (new ImageContent (film, node, version));
} else if (type == "Sndfile") {
class Film;
-extern boost::shared_ptr<Content> content_factory (boost::shared_ptr<const Film>, cxml::NodePtr, int);
+extern boost::shared_ptr<Content> content_factory (boost::shared_ptr<const Film>, cxml::NodePtr, int, std::list<std::string> &);
extern boost::shared_ptr<Content> content_factory (boost::shared_ptr<const Film>, boost::filesystem::path);
}
-FFmpegContent::FFmpegContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int version)
+FFmpegContent::FFmpegContent (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node, int version, list<string>& notes)
: Content (f, node)
, VideoContent (f, node, version)
, AudioContent (f, node)
c = node->node_children ("Filter");
for (list<cxml::NodePtr>::iterator i = c.begin(); i != c.end(); ++i) {
- _filters.push_back (Filter::from_id ((*i)->content ()));
+ Filter const * f = Filter::from_id ((*i)->content ());
+ if (f) {
+ _filters.push_back (f);
+ } else {
+ notes.push_back (String::compose (_("DCP-o-matic no longer supports the `%1' filter, so it has been turned off."), (*i)->content()));
+ }
}
_first_video = node->optional_number_child<double> ("FirstVideo");
{
public:
FFmpegContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- FFmpegContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>, int version);
+ FFmpegContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>, int version, std::list<std::string> &);
FFmpegContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
boost::shared_ptr<FFmpegContent> shared_from_this () {
_dirty = false;
}
-/** Read state from our metadata file */
-void
+/** Read state from our metadata file.
+ * @return Notes about things that the user should know about, or empty.
+ */
+list<string>
Film::read_metadata ()
{
LocaleGuard lg;
_three_d = f.bool_child ("ThreeD");
_interop = f.bool_child ("Interop");
_key = libdcp::Key (f.string_child ("Key"));
- _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version);
+
+ list<string> notes;
+ /* This method is the only one that can return notes (so far) */
+ _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes);
_dirty = false;
+ return notes;
}
/** Given a directory name, return its full path within the Film's directory.
boost::filesystem::path file (boost::filesystem::path f) const;
boost::filesystem::path dir (boost::filesystem::path d) const;
- void read_metadata ();
+ std::list<std::string> read_metadata ();
void write_metadata () const;
boost::shared_ptr<xmlpp::Document> metadata () const;
/** @param node <Playlist> node */
void
-Playlist::set_from_xml (shared_ptr<const Film> film, shared_ptr<const cxml::Node> node, int version)
+Playlist::set_from_xml (shared_ptr<const Film> film, shared_ptr<const cxml::Node> node, int version, list<string>& notes)
{
list<cxml::NodePtr> c = node->node_children ("Content");
for (list<cxml::NodePtr>::iterator i = c.begin(); i != c.end(); ++i) {
- _content.push_back (content_factory (film, *i, version));
+ _content.push_back (content_factory (film, *i, version, notes));
}
sort (_content.begin(), _content.end(), ContentSorter ());
~Playlist ();
void as_xml (xmlpp::Node *);
- void set_from_xml (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>, int);
+ void set_from_xml (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>, int, std::list<std::string> &);
void add (boost::shared_ptr<Content>);
void remove (boost::shared_ptr<Content>);
};
-void
+static void
maybe_save_then_delete_film ()
{
if (!film) {
film.reset ();
}
+static void
+check_film_state_version (int v)
+{
+ if (v == 4) {
+ error_dialog (
+ 0,
+ _("This film was created with an old version of DVD-o-matic and may not load correctly "
+ "in this version. Please check the film's settings carefully.")
+ );
+ }
+}
+
+static void
+load_film (boost::filesystem::path file)
+{
+ film.reset (new Film (file));
+ list<string> const notes = film->read_metadata ();
+ check_film_state_version (film->state_version ());
+ for (list<string>::const_iterator i = notes.begin(); i != notes.end(); ++i) {
+ error_dialog (0, std_to_wx (*i));
+ }
+ film->log()->set_level (log_level);
+}
+
#define ALWAYS 0x0
#define NEEDS_FILM 0x1
#define NOT_DURING_DCP_CREATION 0x2
map<wxMenuItem*, int> menu_items;
-void
+static void
add_item (wxMenu* menu, wxString text, int id, int sens)
{
wxMenuItem* item = menu->Append (id, text);
menu_items.insert (make_pair (item, sens));
}
-void
+static void
set_menu_sensitivity ()
{
list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
ID_tools_check_for_updates
};
-void
+static void
setup_menu (wxMenuBar* m)
{
wxMenu* file = new wxMenu;
overall_panel->SetSizer (main_sizer);
}
- void check_film_state_version (int v)
- {
- if (v == 4) {
- error_dialog (
- this,
- _("This film was created with an old version of DVD-o-matic and may not load correctly "
- "in this version. Please check the film's settings carefully.")
- );
- }
- }
-
private:
void set_film ()
if (r == wxID_OK) {
maybe_save_then_delete_film ();
try {
- film.reset (new Film (wx_to_std (c->GetPath ())));
- film->read_metadata ();
- check_film_state_version (film->state_version ());
- film->log()->set_level (log_level);
+ load_film (wx_to_std (c->GetPath ()));
set_film ();
} catch (std::exception& e) {
wxString p = c->GetPath ();
if (!film_to_load.empty() && boost::filesystem::is_directory (film_to_load)) {
try {
- film.reset (new Film (film_to_load));
- film->read_metadata ();
- film->log()->set_level (log_level);
+ load_film (film_to_load);
} catch (exception& e) {
error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load film %1 (%2)")), film_to_load, e.what())));
}
_timer->Start (1000);
if (film) {
- _frame->check_film_state_version (film->state_version ());
+ check_film_state_version (film->state_version ());
}
UpdateChecker::instance()->StateChanged.connect (boost::bind (&App::update_checker_state_changed, this));