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