Cleanup: use simpler ownership for FilmViewer.
[dcpomatic.git] / src / wx / system_information_dialog.cc
index 1c8dd8d00c2757defff1c1772739bd32aa4c1aac..79a7f735acb0d878334c48a750a940a631262c1e 100644 (file)
@@ -39,20 +39,17 @@ using std::weak_ptr;
 using std::shared_ptr;
 
 
-SystemInformationDialog::SystemInformationDialog (wxWindow* parent, weak_ptr<FilmViewer> weak_viewer)
+#if wxCHECK_VERSION(3, 1, 0)
+
+SystemInformationDialog::SystemInformationDialog(wxWindow* parent, FilmViewer const& viewer)
        : TableDialog (parent, _("System information"), 2, 1, false)
 {
-       auto viewer = weak_viewer.lock ();
-       shared_ptr<const GLVideoView> gl;
-       if (viewer) {
-               gl = std::dynamic_pointer_cast<const GLVideoView>(viewer->video_view());
-       }
+       auto gl = std::dynamic_pointer_cast<const GLVideoView>(viewer.video_view());
 
        if (!gl) {
                add (_("OpenGL version"), true);
                add (_("unknown (OpenGL not enabled in DCP-o-matic)"), false);
        } else {
-
                auto information = gl->information();
                auto add_string = [this, &information](GLenum name, wxString label) {
                        add (label, true);
@@ -75,3 +72,14 @@ SystemInformationDialog::SystemInformationDialog (wxWindow* parent, weak_ptr<Fil
 
        layout ();
 }
+
+#else
+
+SystemInformationDialog::SystemInformationDialog(wxWindow* parent, FilmViewer&)
+       : TableDialog (parent, _("System information"), 2, 1, false)
+{
+       add (_("OpenGL version"), true);
+       add (_("OpenGL renderer not supported by this DCP-o-matic version"), false);
+}
+
+#endif