ac6f918a0591b4c9b4f0a020ba144a4b3450cd8c
[dcpomatic.git] / src / wx / initial_setup_dialog.cc
1 /*
2     Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
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.
10
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.
15
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/>.
18
19 */
20
21 #include "initial_setup_dialog.h"
22 #include "lib/config.h"
23 #include <boost/bind.hpp>
24
25 InitialSetupDialog::InitialSetupDialog ()
26         : wxDialog (0, wxID_ANY, _("DCP-o-matic setup"))
27 {
28         wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
29         wxStaticText* text1 = new wxStaticText (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(600, -1));
30         sizer->Add (text1, 1, wxEXPAND | wxALL, 12);
31
32         text1->SetLabelMarkup (
33                 _(
34                         "<span weight=\"bold\" size=\"larger\">Welcome to DCP-o-matic!</span>\n\n"
35                         "DCP-o-matic can work in two modes: '<i>simple</i>' or '<i>full</i>'.\n\n"
36                         "<i>Simple mode</i> is ideal for producing straightforward DCPs without too many confusing "
37                         "options.\n\n"
38                         "<i>Full mode</i> gives you the most control over the DCPs you make.\n\n"
39                         "Please choose which mode you would like to start DCP-o-matic in:"
40                         )
41                 );
42
43         wxBoxSizer* mode_sizer = new wxBoxSizer (wxVERTICAL);
44
45         _simple = new wxRadioButton (this, wxID_ANY, _("Simple mode"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
46         mode_sizer->Add (_simple, 0, wxTOP, 12);
47         _full = new wxRadioButton (this, wxID_ANY, _("Full mode"));
48         mode_sizer->Add (_full, 0, wxTOP, 8);
49
50         sizer->Add (mode_sizer, 0, wxLEFT, 24);
51
52         if (Config::instance()->interface_complexity() == Config::INTERFACE_SIMPLE) {
53                 _simple->SetValue (true);
54         } else {
55                 _full->SetValue (true);
56         }
57
58         wxStaticText* text2 = new wxStaticText (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(400, -1));
59         sizer->Add (text2, 0, wxEXPAND | wxALL, 12);
60
61         text2->SetLabelMarkup (_("\nYou can change the mode at any time from the General page of Preferences."));
62
63         _simple->Bind (wxEVT_RADIOBUTTON, boost::bind(&InitialSetupDialog::interface_complexity_changed, this));
64         _full->Bind (wxEVT_RADIOBUTTON, boost::bind(&InitialSetupDialog::interface_complexity_changed, this));
65
66         wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
67         if (buttons) {
68                 sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
69         }
70
71         sizer->Layout ();
72         SetSizerAndFit (sizer);
73 }
74
75 void
76 InitialSetupDialog::interface_complexity_changed ()
77 {
78         if (_simple->GetValue()) {
79                 Config::instance()->set_interface_complexity (Config::INTERFACE_SIMPLE);
80         } else {
81                 Config::instance()->set_interface_complexity (Config::INTERFACE_FULL);
82         }
83 }