Merge master.
[dcpomatic.git] / src / wx / about_dialog.cc
1 /*
2     Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file  src/wx/about_dialog.cc
21  *  @brief The "about DCP-o-matic" dialogue box.
22  */
23
24 #include <wx/notebook.h>
25 #include <wx/hyperlink.h>
26 #include "lib/version.h"
27 #include "lib/compose.hpp"
28 #include "about_dialog.h"
29 #include "wx_util.h"
30
31 using std::vector;
32
33 AboutDialog::AboutDialog (wxWindow* parent)
34         : wxDialog (parent, wxID_ANY, _("About DCP-o-matic"))
35 {
36         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
37         wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
38         
39         wxFont title_font (*wxNORMAL_FONT);
40         title_font.SetPointSize (title_font.GetPointSize() + 12);
41         title_font.SetWeight (wxFONTWEIGHT_BOLD);
42
43         wxFont subtitle_font (*wxNORMAL_FONT);
44         subtitle_font.SetPointSize (subtitle_font.GetPointSize() + 2);
45
46         wxFont version_font (*wxNORMAL_FONT);
47         version_font.SetWeight (wxFONTWEIGHT_BOLD);
48         
49         wxStaticText* t = new wxStaticText (this, wxID_ANY, _("DCP-o-matic"));
50         t->SetFont (title_font);
51         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 16));
52
53         wxString s;
54         if (strcmp (dcpomatic_git_commit, "release") == 0) {
55                 t = new wxStaticText (this, wxID_ANY, std_to_wx (String::compose ("Version %1", dcpomatic_version)));
56         } else {
57                 t = new wxStaticText (this, wxID_ANY, std_to_wx (String::compose ("Version %1 git %2", dcpomatic_version, dcpomatic_git_commit)));
58         }
59         t->SetFont (version_font);
60         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 2));
61         sizer->AddSpacer (12);
62
63         t = new wxStaticText (
64                 this, wxID_ANY,
65                 _("Free, open-source DCP generation from almost anything."),
66                 wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
67                 );
68         t->SetFont (subtitle_font);
69         
70         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 8));
71
72         wxHyperlinkCtrl* h = new wxHyperlinkCtrl (
73                 this, wxID_ANY,
74                 wxT ("dcpomatic.com"),
75                 wxT ("http://dcpomatic.com")
76                 );
77
78         sizer->Add (h, wxSizerFlags().Centre().Border(wxALL, 8));
79
80         t = new wxStaticText (
81                 this, wxID_ANY,
82                 _("(C) 2012-2014 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen"),
83                 wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
84                 );
85         
86         sizer->Add (t, wxSizerFlags().Centre().Border(wxLEFT | wxRIGHT, 16));
87
88         _notebook = new wxNotebook (this, wxID_ANY);
89
90         wxArrayString written_by;
91         written_by.Add (wxT ("Carl Hetherington"));
92         written_by.Add (wxT ("Terrence Meiczinger"));
93         written_by.Add (wxT ("Paul Davis"));
94         written_by.Add (wxT ("Ole Laursen"));
95         add_section (_("Written by"), written_by);
96
97         wxArrayString translated_by;
98         translated_by.Add (wxT ("Manuel AC"));
99         translated_by.Add (wxT ("Massimiliano Broggi"));
100         translated_by.Add (wxT ("William Fanelli"));
101         translated_by.Add (wxT ("Thierry Journet"));
102         translated_by.Add (wxT ("Adam Klotblixt"));
103         translated_by.Add (wxT ("Lilian Lefranc"));
104         translated_by.Add (wxT ("Olivier Perriere"));
105         translated_by.Add (wxT ("Markus Raab"));
106         translated_by.Add (wxT ("Theo Kooijmans"));
107         translated_by.Add (wxT ("Max Aeschlimann"));
108         translated_by.Add (wxT ("Carsten Kurz"));
109         add_section (_("Translated by"), translated_by);
110
111         wxArrayString artwork_by;
112         artwork_by.Add (wxT ("David Vignoni"));
113         add_section (_("Artwork by"), artwork_by);
114
115         wxArrayString supported_by;
116         supported_by.Add (wxT ("Manual AC"));
117         supported_by.Add (wxT ("Kambiz Afshar"));
118         supported_by.Add (wxT ("Louis Belloisy"));
119         supported_by.Add (wxT ("Mike Blakesley"));
120         supported_by.Add (wxT ("Jeff Boot"));
121         supported_by.Add (wxT ("Kieran Carroll"));
122         supported_by.Add (wxT ("Frank Cianciolo"));
123         supported_by.Add (wxT ("Cinema Clarici"));
124         supported_by.Add (wxT ("Adam Colt"));
125         supported_by.Add (wxT ("Matthias Damm"));
126         supported_by.Add (wxT ("Andres Fink"));
127         supported_by.Add (wxT ("Evan Freeze"));
128         supported_by.Add (wxT ("Silvio Giuliano"));
129         supported_by.Add (wxT ("Flor Guillaume"));
130         supported_by.Add (wxT ("Jonathan Jensen"));
131         supported_by.Add (wxT ("Chris Kay"));
132         supported_by.Add (wxT ("Adam Klotblixt"));
133         supported_by.Add (wxT ("Filip Kovcin"));
134         supported_by.Add (wxT ("Carsten Kurz"));
135         supported_by.Add (wxT ("Lilian Lefranc"));
136         supported_by.Add (wxT ("Sean Leigh"));
137         supported_by.Add (wxT ("Olivier Lemaire"));
138         supported_by.Add (wxT ("Gavin Lewarne"));
139         supported_by.Add (wxT ("Theo Lipfert"));
140         supported_by.Add (wxT ("Mattias Mattsson"));
141         supported_by.Add (wxT ("Kjarten Michaelsen"));
142         supported_by.Add (wxT ("Aldo Midali"));
143         supported_by.Add (wxT ("Sylvain Mielle"));
144         supported_by.Add (wxT ("Lindsay Morris"));
145         supported_by.Add (wxT ("Tim O'Brien"));
146         supported_by.Add (wxT ("Ivan Pullman"));
147         supported_by.Add (wxT ("Mark Rolfe"));
148         supported_by.Add (wxT ("Andrä Steiner"));
149         supported_by.Add (wxT ("Jussi Siponen"));
150         supported_by.Add (wxT ("Lasse Salling"));
151         supported_by.Add (wxT ("Mike Stiebing"));
152         supported_by.Add (wxT ("Randy Stankey"));
153         supported_by.Add (wxT ("Wolfgang Woehl"));
154         supported_by.Add (wxT ("Wolfram Weber"));
155         supported_by.Add (wxT ("Frank de Wulf"));
156         supported_by.Add (wxT ("Pavel Zhdanko"));
157         add_section (_("Supported by"), supported_by);
158
159         wxArrayString tested_by;
160         tested_by.Add (wxT ("Trever Anderson"));
161         tested_by.Add (wxT ("Mike Blakesley"));
162         tested_by.Add (wxT ("David Booty"));
163         tested_by.Add (wxT ("Roop Chand"));
164         tested_by.Add (wxT ("Daniel Chauvet"));
165         tested_by.Add (wxT ("Adam Colt"));
166         tested_by.Add (wxT ("John Convertino"));
167         tested_by.Add (wxT ("Andreas Eli"));
168         tested_by.Add (wxT ("Maurizio Giampà"));
169         tested_by.Add (wxT ("Luke Granger-Brown"));
170         tested_by.Add (wxT ("Sumit Guha"));
171         tested_by.Add (wxT ("Steve Guttag"));
172         tested_by.Add (wxT ("Patrick Haderer"));
173         tested_by.Add (wxT ("Bill Hamell"));
174         tested_by.Add (wxT ("Jonathan Jensen"));
175         tested_by.Add (wxT ("Thierry Journet"));
176         tested_by.Add (wxT ("Ada de Kamper"));
177         tested_by.Add (wxT ("Stefan Karner"));
178         tested_by.Add (wxT ("Adam Keay"));
179         tested_by.Add (wxT ("Simon Kesselman"));
180         tested_by.Add (wxT ("Pepijn Klijs"));
181         tested_by.Add (wxT ("Denzil Kriekenbeek"));
182         tested_by.Add (wxT ("Carsten Kurz"));
183         tested_by.Add (wxT ("Bill Lam"));
184         tested_by.Add (wxT ("Lilian Lefranc"));
185         tested_by.Add (wxT ("Olivier Lemaire"));
186         tested_by.Add (wxT ("Gavin Lewarne"));
187         tested_by.Add (wxT ("Mattias Mattsson"));
188         tested_by.Add (wxT ("Gérald Maruccia"));
189         tested_by.Add (wxT ("Will Meadows"));
190         tested_by.Add (wxT ("Brad Miller"));
191         tested_by.Add (wxT ("Anders Nordentoft-Madsen"));
192         tested_by.Add (wxT ("Mauro Ottonello"));
193         tested_by.Add (wxT ("Peter Puchner"));
194         tested_by.Add (wxT ("Markus Raab"));
195         tested_by.Add (wxT ("Greg Rooke"));
196         tested_by.Add (wxT ("Karim Senoucci"));
197         tested_by.Add (wxT ("Simon Vannarath"));
198         tested_by.Add (wxT ("Andrew Walls"));
199         tested_by.Add (wxT ("Andreas Weiss"));
200         tested_by.Add (wxT ("Paul Willmott"));
201         tested_by.Add (wxT ("Wolfgang Woehl"));
202         add_section (_("Tested by"), tested_by);
203         
204         sizer->Add (_notebook, wxSizerFlags().Centre().Border(wxALL, 16).Expand());
205
206         overall_sizer->Add (sizer);
207
208         wxSizer* buttons = CreateButtonSizer (wxOK);
209         if (buttons) {
210                 overall_sizer->Add (buttons, 1, wxEXPAND | wxALL, 4);
211         }
212         
213         SetSizerAndFit (overall_sizer);
214 }
215
216 /** Add a section of credits.
217  *  @param name Name of section.
218  *  @param credits List of names.
219  */
220 void
221 AboutDialog::add_section (wxString name, wxArrayString credits)
222 {
223         static bool first = true;
224         int const N = 3;
225
226         wxPanel* panel = new wxPanel (_notebook, wxID_ANY);
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 }