2 Copyright (C) 2018-2021 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 "i18n_hook.h"
23 #include "send_i18n_dialog.h"
25 #include <dcp/warnings.h>
26 LIBDCP_DISABLE_WARNINGS
27 #include <wx/listctrl.h>
28 LIBDCP_ENABLE_WARNINGS
35 SendI18NDialog::SendI18NDialog (wxWindow* parent)
36 : wxDialog (parent, wxID_ANY, _("Send translations"))
38 auto overall_sizer = new wxBoxSizer (wxVERTICAL);
40 auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
41 table->AddGrowableCol (1, 1);
43 add_label_to_sizer (table, this, _("Your name"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
44 _name = new wxTextCtrl (this, wxID_ANY);
45 table->Add (_name, 0, wxEXPAND);
47 add_label_to_sizer (table, this, _("Your email"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
48 _email = new wxTextCtrl (this, wxID_ANY);
49 table->Add (_email, 0, wxEXPAND);
51 add_label_to_sizer (table, this, _("Language"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
52 _language = new wxTextCtrl (this, wxID_ANY);
53 table->Add (_language, 0, wxEXPAND);
55 auto list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize(800, -1), wxLC_REPORT | wxLC_NO_HEADER);
56 list->AppendColumn(wxT(""), wxLIST_FORMAT_LEFT, 400);
57 list->AppendColumn(wxT(""), wxLIST_FORMAT_LEFT, 400);
59 auto translations = I18NHook::translations ();
61 for (auto const& i: translations) {
65 it.SetText(std_to_wx(i.first));
68 it.SetText(std_to_wx(i.second));
73 overall_sizer->Add (table, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP);
74 overall_sizer->Add (list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_GAP);
76 auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
78 overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
81 SetSizerAndFit (overall_sizer);