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