2 Copyright (C) 2019-2022 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include <dcp/rating.h>
23 #include <dcp/warnings.h>
24 LIBDCP_DISABLE_WARNINGS
26 LIBDCP_ENABLE_WARNINGS
27 #include <boost/signals2.hpp>
36 class RatingDialogPage : public wxPanel
39 RatingDialogPage (wxNotebook* notebook);
40 virtual dcp::Rating get () const = 0;
41 virtual bool set (dcp::Rating rating) = 0;
43 /** Emitted when the page has been changed, the parameter being true if OK
44 * should now be enabled in the main dialogue.
46 boost::signals2::signal<void (bool)> Changed;
50 class StandardRatingDialogPage : public RatingDialogPage
53 StandardRatingDialogPage (wxNotebook* notebook);
55 dcp::Rating get () const override;
56 bool set (dcp::Rating rating) override;
59 void search_changed ();
60 void found_systems_view_selection_changed ();
61 void update_found_system_selection ();
63 wxSearchCtrl* _search;
64 wxListView* _found_systems_view;
65 boost::optional<dcp::RatingSystem> _selected_system;
67 std::vector<dcp::RatingSystem> _found_systems;
71 class CustomRatingDialogPage : public RatingDialogPage
74 CustomRatingDialogPage (wxNotebook* notebook);
76 dcp::Rating get () const override;
77 bool set (dcp::Rating rating) override;
87 class RatingDialog : public wxDialog
90 RatingDialog (wxWindow* parent);
92 void set (dcp::Rating r);
93 boost::optional<dcp::Rating> get () const;
96 void setup_sensitivity (bool ok_valid);
99 wxNotebook* _notebook;
101 StandardRatingDialogPage* _standard_page;
102 CustomRatingDialogPage* _custom_page;
103 RatingDialogPage* _active_page;