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>
24 #include <boost/signals2.hpp>
33 class RatingDialogPage : public wxPanel
36 RatingDialogPage (wxNotebook* notebook);
37 virtual dcp::Rating get () const = 0;
38 virtual bool set (dcp::Rating rating) = 0;
40 /** Emitted when the page has been changed, the parameter being true if OK
41 * should now be enabled in the main dialogue.
43 boost::signals2::signal<void (bool)> Changed;
47 class StandardRatingDialogPage : public RatingDialogPage
50 StandardRatingDialogPage (wxNotebook* notebook);
52 dcp::Rating get () const override;
53 bool set (dcp::Rating rating) override;
56 void search_changed ();
57 void found_systems_view_selection_changed ();
58 void update_found_system_selection ();
60 wxSearchCtrl* _search;
61 wxListView* _found_systems_view;
62 boost::optional<dcp::RatingSystem> _selected_system;
64 std::vector<dcp::RatingSystem> _found_systems;
68 class CustomRatingDialogPage : public RatingDialogPage
71 CustomRatingDialogPage (wxNotebook* notebook);
73 dcp::Rating get () const override;
74 bool set (dcp::Rating rating) override;
84 class RatingDialog : public wxDialog
87 RatingDialog (wxWindow* parent);
89 void set (dcp::Rating r);
90 dcp::Rating get () const;
93 void setup_sensitivity (bool ok_valid);
96 wxNotebook* _notebook;
98 StandardRatingDialogPage* _standard_page;
99 CustomRatingDialogPage* _custom_page;
100 RatingDialogPage* _active_page;