summaryrefslogtreecommitdiff
path: root/src/wx/rating_dialog.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-03-01 22:41:56 +0100
committerCarl Hetherington <cth@carlh.net>2022-03-09 17:04:02 +0100
commit47d83b296248119d04b9226fd51a67e2fd3faac5 (patch)
treed9516f352dc28f1c42cc6e16247295611637ad42 /src/wx/rating_dialog.h
parent161f7c27bd1aff63938a9512ab991de886691f97 (diff)
Improve ratings dialog to allow only valid values (#2199).
Diffstat (limited to 'src/wx/rating_dialog.h')
-rw-r--r--src/wx/rating_dialog.h79
1 files changed, 73 insertions, 6 deletions
diff --git a/src/wx/rating_dialog.h b/src/wx/rating_dialog.h
index 51869c0ab..27887baa2 100644
--- a/src/wx/rating_dialog.h
+++ b/src/wx/rating_dialog.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2022 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -18,10 +18,70 @@
*/
-#include "table_dialog.h"
-#include <dcp/types.h>
-class RatingDialog : public TableDialog
+#include <dcp/rating.h>
+#include <wx/wx.h>
+#include <boost/signals2.hpp>
+
+
+class wxChoice;
+class wxListView;
+class wxNotebook;
+class wxSearchCtrl;
+
+
+class RatingDialogPage : public wxPanel
+{
+public:
+ RatingDialogPage (wxNotebook* notebook);
+ virtual dcp::Rating get () const = 0;
+ virtual bool set (dcp::Rating rating) = 0;
+
+ /** Emitted when the page has been changed, the parameter being true if OK
+ * should now be enabled in the main dialogue.
+ */
+ boost::signals2::signal<void (bool)> Changed;
+};
+
+
+class StandardRatingDialogPage : public RatingDialogPage
+{
+public:
+ StandardRatingDialogPage (wxNotebook* notebook);
+
+ dcp::Rating get () const override;
+ bool set (dcp::Rating rating) override;
+
+private:
+ void search_changed ();
+ void found_systems_view_selection_changed ();
+ void update_found_system_selection ();
+
+ wxSearchCtrl* _search;
+ wxListView* _found_systems_view;
+ boost::optional<dcp::RatingSystem> _selected_system;
+ wxChoice* _rating;
+ std::vector<dcp::RatingSystem> _found_systems;
+};
+
+
+class CustomRatingDialogPage : public RatingDialogPage
+{
+public:
+ CustomRatingDialogPage (wxNotebook* notebook);
+
+ dcp::Rating get () const override;
+ bool set (dcp::Rating rating) override;
+
+private:
+ void changed ();
+
+ wxTextCtrl* _agency;
+ wxTextCtrl* _rating;
+};
+
+
+class RatingDialog : public wxDialog
{
public:
RatingDialog (wxWindow* parent);
@@ -30,6 +90,13 @@ public:
dcp::Rating get () const;
private:
- wxTextCtrl* _agency;
- wxTextCtrl* _label;
+ void setup_sensitivity (bool ok_valid);
+ void page_changed ();
+
+ wxNotebook* _notebook;
+
+ StandardRatingDialogPage* _standard_page;
+ CustomRatingDialogPage* _custom_page;
+ RatingDialogPage* _active_page;
};
+