Hide warnings triggered by Ubuntu 20.04's gcc.
[dcpomatic.git] / src / wx / about_dialog.cc
1 /*
2     Copyright (C) 2013-2020 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 /** @file  src/wx/about_dialog.cc
22  *  @brief The "about DCP-o-matic" dialogue box.
23  */
24
25 #include "about_dialog.h"
26 #include "wx_util.h"
27 #include "static_text.h"
28 #include "lib/version.h"
29 #include "lib/compose.hpp"
30 #include "lib/warnings.h"
31 DCPOMATIC_DISABLE_WARNINGS
32 #include <wx/notebook.h>
33 #include <wx/hyperlink.h>
34 DCPOMATIC_ENABLE_WARNINGS
35
36 using std::vector;
37
38 AboutDialog::AboutDialog (wxWindow* parent)
39         : wxDialog (parent, wxID_ANY, _("About DCP-o-matic"))
40 {
41         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
42         wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
43
44         wxFont title_font (*wxNORMAL_FONT);
45         title_font.SetPointSize (title_font.GetPointSize() + 12);
46         title_font.SetWeight (wxFONTWEIGHT_BOLD);
47
48         wxFont subtitle_font (*wxNORMAL_FONT);
49         subtitle_font.SetPointSize (subtitle_font.GetPointSize() + 2);
50
51         wxFont version_font (*wxNORMAL_FONT);
52         version_font.SetWeight (wxFONTWEIGHT_BOLD);
53
54         wxStaticText* t = new StaticText (this, _("DCP-o-matic"));
55         t->SetFont (title_font);
56         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 16));
57
58         wxString s;
59         if (strcmp (dcpomatic_git_commit, "release") == 0) {
60                 t = new StaticText (this, std_to_wx(String::compose("Version %1", dcpomatic_version)));
61         } else {
62                 t = new StaticText (this, std_to_wx(String::compose("Version %1 git %2", dcpomatic_version, dcpomatic_git_commit)));
63         }
64         t->SetFont (version_font);
65         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 2));
66         sizer->AddSpacer (12);
67
68         t = new StaticText (
69                 this,
70                 _("Free, open-source DCP creation from almost anything."),
71                 wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
72                 );
73         t->SetFont (subtitle_font);
74
75         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 8));
76
77         wxHyperlinkCtrl* h = new wxHyperlinkCtrl (
78                 this, wxID_ANY,
79                 wxT ("dcpomatic.com"),
80                 wxT ("https://dcpomatic.com")
81                 );
82
83         sizer->Add (h, wxSizerFlags().Centre().Border(wxALL, 8));
84
85         t = new StaticText (
86                 this,
87                 _("(C) 2012-2020 Carl Hetherington, Terrence Meiczinger\n Ole Laursen, Brecht Sanders"),
88                 wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
89                 );
90
91         sizer->Add (t, wxSizerFlags().Centre().Border(wxLEFT | wxRIGHT, 16));
92
93         _notebook = new wxNotebook (this, wxID_ANY);
94
95         wxArrayString written_by;
96         written_by.Add (wxT ("Carl Hetherington"));
97         written_by.Add (wxT ("Terrence Meiczinger"));
98         written_by.Add (wxT ("Mart Jansink"));
99         written_by.Add (wxT ("Ole Laursen"));
100         written_by.Add (wxT ("Brecht Sanders"));
101         written_by.Add (wxT ("Jianguo Huang"));
102         add_section (_("Written by"), written_by);
103
104         wxArrayString with_help_from;
105         with_help_from.Add (wxT ("David Vignoni"));
106         with_help_from.Add (wxT ("Dennis Couzin"));
107         with_help_from.Add (wxT ("Carsten Kurz"));
108         with_help_from.Add (wxT ("Gérald Maruccia"));
109         with_help_from.Add (wxT ("Julian van Mil"));
110         add_section (_("With help from"), with_help_from);
111
112         wxArrayString translated_by;
113         translated_by.Add (wxT ("Manuel AC"));
114         translated_by.Add (wxT ("Max Aeschlimann"));
115         translated_by.Add (wxT ("Thiago Andre"));
116         translated_by.Add (wxT ("Felice D'Andrea"));
117         translated_by.Add (wxT ("Grégoire Ausina"));
118         translated_by.Add (wxT ("Tomáš Begeni"));
119         translated_by.Add (wxT ("Fabio \"Zak\" Belli"));
120         translated_by.Add (wxT ("Cherif Ben Brahim"));
121         translated_by.Add (wxT ("Massimiliano Broggi"));
122         translated_by.Add (wxT ("Dan Cohen"));
123         translated_by.Add (wxT ("Davide Dall'AraCiao"));
124         translated_by.Add (wxT ("William Fanelli"));
125         translated_by.Add (wxT ("Max M. Fuhlendorf"));
126         translated_by.Add (wxT ("Tomáš Hlaváč"));
127         translated_by.Add (wxT ("Thierry Journet"));
128         translated_by.Add (wxT ("Adam Klotblixt"));
129         translated_by.Add (wxT ("Theo Kooijmans"));
130         translated_by.Add (wxT ("Carsten Kurz"));
131         translated_by.Add (wxT ("Lilian Lefranc"));
132         translated_by.Add (wxT ("Gérald Maruccia"));
133         translated_by.Add (wxT ("Mike Mazur"));
134         translated_by.Add (wxT ("Rob van Nieuwkerk"));
135         translated_by.Add (wxT ("Anders Uhl Pedersen"));
136         translated_by.Add (wxT ("Olivier Perriere"));
137         translated_by.Add (wxT ("Markus Raab"));
138         translated_by.Add (wxT ("Tiago Casal Ribeiro"));
139         translated_by.Add (wxT ("Davide Sanvito"));
140         translated_by.Add (wxT ("Marek Skrzelowski"));
141         translated_by.Add (wxT ("Igor Voytovich"));
142         translated_by.Add (wxT ("Rov (若文)"));
143         translated_by.Add (wxT ("刘汉源"));
144         translated_by.Add (wxT ("Gökhan Aksoy"));
145         add_section (_("Translated by"), translated_by);
146
147         wxArrayString patrons;
148         patrons.Add ("Luproduction");
149         patrons.Add ("Lightbender Post");
150         patrons.Add ("Drop-out Cinema");
151         patrons.Add ("Pilotkino LLC");
152         add_section (_("Patrons"), patrons);
153
154         wxArrayString subscribers;
155         #include "subscribers.cc"
156         add_section (_("Subscribers"), subscribers);
157
158         wxArrayString supported_by;
159         #include "supporters.cc"
160         add_section (_("Also supported by"), supported_by);
161
162         wxArrayString tested_by;
163         tested_by.Add (wxT ("Manuel AC"));
164         tested_by.Add (wxT ("Trever Anderson"));
165         tested_by.Add (wxT ("JP Beauviala"));
166         tested_by.Add (wxT ("Mike Blakesley"));
167         tested_by.Add (wxT ("David Booty"));
168         tested_by.Add (wxT ("Antonio Casado"));
169         tested_by.Add (wxT ("Roop Chand"));
170         tested_by.Add (wxT ("Daniel Chauvet"));
171         tested_by.Add (wxT ("Adam Colt"));
172         tested_by.Add (wxT ("John Convertino"));
173         tested_by.Add (wxT ("Andreas Eli"));
174         tested_by.Add (wxT ("Leo Enticknap"));
175         tested_by.Add (wxT ("Jose Angel Velasco Fernandez"));
176         tested_by.Add (wxT ("Maurizio Giampà"));
177         tested_by.Add (wxT ("Luke Granger-Brown"));
178         tested_by.Add (wxT ("Sumit Guha"));
179         tested_by.Add (wxT ("Steve Guttag"));
180         tested_by.Add (wxT ("Patrick Haderer"));
181         tested_by.Add (wxT ("Bill Hamell"));
182         tested_by.Add (wxT ("Jonathan Jensen"));
183         tested_by.Add (wxT ("Thierry Journet"));
184         tested_by.Add (wxT ("Markus Kalb"));
185         tested_by.Add (wxT ("Ada de Kamper"));
186         tested_by.Add (wxT ("Stefan Karner"));
187         tested_by.Add (wxT ("Adam Keay"));
188         tested_by.Add (wxT ("Simon Kesselman"));
189         tested_by.Add (wxT ("Pepijn Klijs"));
190         tested_by.Add (wxT ("Denzil Kriekenbeek"));
191         tested_by.Add (wxT ("Carsten Kurz"));
192         tested_by.Add (wxT ("Bill Lam"));
193         tested_by.Add (wxT ("Lilian Lefranc"));
194         tested_by.Add (wxT ("Sebastian Leitner"));
195         tested_by.Add (wxT ("Olivier Lemaire"));
196         tested_by.Add (wxT ("Gavin Lewarne"));
197         tested_by.Add (wxT ("Gérald Maruccia"));
198         tested_by.Add (wxT ("George Mazarakis"));
199         tested_by.Add (wxT ("Mattias Mattsson"));
200         tested_by.Add (wxT ("Will Meadows"));
201         tested_by.Add (wxT ("Brad Miller"));
202         tested_by.Add (wxT ("Ash Mitchell"));
203         tested_by.Add (wxT ("Rob van Nieuwkerk"));
204         tested_by.Add (wxT ("Anders Nordentoft-Madsen"));
205         tested_by.Add (wxT ("Mauro Ottonello"));
206         tested_by.Add (wxT ("Peter Puchner"));
207         tested_by.Add (wxT ("Markus Raab"));
208         tested_by.Add (wxT ("Michael Reckert"));
209         tested_by.Add (wxT ("Greg Rooke"));
210         tested_by.Add (wxT ("Elad Saad"));
211         tested_by.Add (wxT ("Karim Senoucci"));
212         tested_by.Add (wxT ("Hordur Valgardsson"));
213         tested_by.Add (wxT ("Xenophon the Vampire"));
214         tested_by.Add (wxT ("Simon Vannarath"));
215         tested_by.Add (wxT ("Igor Voytovich"));
216         tested_by.Add (wxT ("Andrew Walls"));
217         tested_by.Add (wxT ("Andreas Weiss"));
218         tested_by.Add (wxT ("Paul Willmott"));
219         tested_by.Add (wxT ("Wolfgang Woehl"));
220         add_section (_("Tested by"), tested_by);
221
222         sizer->Add (_notebook, wxSizerFlags().Centre().Border(wxALL, 16).Expand());
223
224         overall_sizer->Add (sizer);
225
226         wxSizer* buttons = CreateButtonSizer (wxOK);
227         if (buttons) {
228                 overall_sizer->Add (buttons, 1, wxEXPAND | wxALL, 4);
229         }
230
231         SetSizerAndFit (overall_sizer);
232 }
233
234 /** Add a section of credits.
235  *  @param name Name of section.
236  *  @param credits List of names.
237  */
238 void
239 AboutDialog::add_section (wxString name, wxArrayString credits)
240 {
241         static bool first = true;
242         int const N = 4;
243
244         wxScrolledWindow* panel = new wxScrolledWindow (_notebook);
245         panel->SetMaxSize (wxSize (-1, 380));
246         panel->EnableScrolling (false, true);
247         panel->SetScrollRate (0, 32);
248         wxSizer* overall_sizer = new wxBoxSizer (wxHORIZONTAL);
249
250         vector<wxSizer*> sizers;
251
252         for (int i = 0; i < N; ++i) {
253                 sizers.push_back (new wxBoxSizer (wxVERTICAL));
254                 overall_sizer->Add (sizers.back (), 1, wxEXPAND | wxALL, 6);
255         }
256
257         int c = 0;
258         for (size_t i = 0; i < credits.Count(); ++i) {
259                 add_label_to_sizer (sizers[c], panel, credits[i], false);
260                 ++c;
261                 if (c == N) {
262                         c = 0;
263                 }
264         }
265
266         panel->SetSizerAndFit (overall_sizer);
267         _notebook->AddPage (panel, name, first);
268         first = false;
269 }