Use sqlite for cinema and DKDM recipient lists.
[dcpomatic.git] / src / wx / load_config_from_zip_dialog.cc
1 /*
2     Copyright (C) 2024 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
22 #include "load_config_from_zip_dialog.h"
23 #include "wx_util.h"
24 #include "lib/config.h"
25 #include "lib/unzipper.h"
26
27
28 LoadConfigFromZIPDialog::LoadConfigFromZIPDialog(wxWindow* parent, boost::filesystem::path zip_file)
29         : TableDialog(parent, _("Load configuration from ZIP file"), 1, 0, true)
30 {
31         _use_current = add(new wxRadioButton(this, wxID_ANY, _("Copy the cinemas in the ZIP file over the current list at")));
32         auto current_path = add(new wxStaticText(this, wxID_ANY, std_to_wx(Config::instance()->cinemas_file().string())));
33         auto current_path_font = current_path->GetFont();
34         current_path_font.SetFamily(wxFONTFAMILY_TELETYPE);
35         current_path->SetFont(current_path_font);
36
37         _use_zip = add(new wxRadioButton(this, wxID_ANY, _("Copy the cinemas in the ZIP file to the original location at")));
38         auto zip_path = add(new wxStaticText(this, wxID_ANY, std_to_wx(Config::cinemas_file_from_zip(zip_file).string())));
39         auto zip_path_font = zip_path->GetFont();
40         zip_path_font.SetFamily(wxFONTFAMILY_TELETYPE);
41         zip_path->SetFont(zip_path_font);
42
43         _ignore = add(new wxRadioButton(this, wxID_ANY, _("Do not use the cinemas in the ZIP file")));
44
45         layout();
46 }
47
48
49 Config::CinemasAction
50 LoadConfigFromZIPDialog::action() const
51 {
52         if (_use_current->GetValue()) {
53                 return Config::CinemasAction::WRITE_TO_CURRENT_PATH;
54         } else if (_use_zip->GetValue()) {
55                 return Config::CinemasAction::WRITE_TO_PATH_IN_ZIPPED_CONFIG;
56         }
57
58         return Config::CinemasAction::IGNORE;
59 }