Initial stuff; mostly ok but some hints are still not implemented as warnings.
[dcpomatic.git] / src / wx / content_panel.cc
index cefb5b0d90dc795f1bc9a09362490baf031033f3..654378248b3f61433a505909b6788a14215a3e59 100644 (file)
@@ -46,6 +46,7 @@ using std::list;
 using std::string;
 using std::cout;
 using std::vector;
+using std::exception;
 using boost::shared_ptr;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
@@ -311,7 +312,15 @@ ContentPanel::add_folder_clicked ()
                return;
        }
 
-       shared_ptr<Content> content = content_factory (_film, path);
+       shared_ptr<Content> content;
+
+       try {
+               content = content_factory (_film, path);
+       } catch (exception& e) {
+               error_dialog (_parent, e.what());
+               return;
+       }
+
        if (!content) {
                error_dialog (_parent, _("No content found in this folder."));
                return;
@@ -334,14 +343,15 @@ ContentPanel::add_folder_clicked ()
        _film->examine_and_add_content (content);
 }
 
-void
+/** @return true if this remove "click" should be ignored */
+bool
 ContentPanel::remove_clicked (bool hotkey)
 {
        /* If the method was called because Delete was pressed check that our notebook page
           is visible and that the content list is focussed.
        */
        if (hotkey && (_parent->GetCurrentPage() != _panel || !_content->HasFocus())) {
-               return;
+               return true;
        }
 
        BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
@@ -349,6 +359,7 @@ ContentPanel::remove_clicked (bool hotkey)
        }
 
        selection_changed ();
+       return false;
 }
 
 void