Merge.
[dcpomatic.git] / src / wx / about_dialog.cc
1 /*
2     Copyright (C) 2013 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 #include <wx/notebook.h>
21 #include <wx/hyperlink.h>
22 #include "lib/version.h"
23 #include "lib/compose.hpp"
24 #include "about_dialog.h"
25 #include "wx_util.h"
26
27 using std::vector;
28
29 AboutDialog::AboutDialog (wxWindow* parent)
30         : wxDialog (parent, wxID_ANY, _("About DCP-o-matic"))
31 {
32         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
33         wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
34         
35         wxFont title_font (*wxNORMAL_FONT);
36         title_font.SetPointSize (title_font.GetPointSize() + 12);
37         title_font.SetWeight (wxFONTWEIGHT_BOLD);
38
39         wxFont subtitle_font (*wxNORMAL_FONT);
40         subtitle_font.SetPointSize (subtitle_font.GetPointSize() + 2);
41
42         wxFont version_font (*wxNORMAL_FONT);
43         version_font.SetWeight (wxFONTWEIGHT_BOLD);
44         
45         wxStaticText* t = new wxStaticText (this, wxID_ANY, _("DCP-o-matic"));
46         t->SetFont (title_font);
47         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 16));
48
49         wxString s;
50         if (strcmp (dcpomatic_git_commit, "release") == 0) {
51                 t = new wxStaticText (this, wxID_ANY, std_to_wx (String::compose ("Version %1", dcpomatic_version)));
52         } else {
53                 t = new wxStaticText (this, wxID_ANY, std_to_wx (String::compose ("Version %1 git %2", dcpomatic_version, dcpomatic_git_commit)));
54         }
55         t->SetFont (version_font);
56         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 2));
57         sizer->AddSpacer (12);
58
59         t = new wxStaticText (
60                 this, wxID_ANY,
61                 _("Free, open-source DCP generation from almost anything."),
62                 wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
63                 );
64         t->SetFont (subtitle_font);
65         
66         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 8));
67
68         wxHyperlinkCtrl* h = new wxHyperlinkCtrl (
69                 this, wxID_ANY,
70                 wxT ("dcpomatic.com"),
71                 wxT ("http://dcpomatic.com")
72                 );
73
74         sizer->Add (h, wxSizerFlags().Centre().Border(wxALL, 8));
75
76         t = new wxStaticText (
77                 this, wxID_ANY,
78                 _("(C) 2012-2014 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen"),
79                 wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
80                 );
81         
82         sizer->Add (t, wxSizerFlags().Centre().Border(wxLEFT | wxRIGHT, 16));
83
84         _notebook = new wxNotebook (this, wxID_ANY);
85
86         wxArrayString written_by;
87         written_by.Add (wxT ("Carl Hetherington"));
88         written_by.Add (wxT ("Terrence Meiczinger"));
89         written_by.Add (wxT ("Paul Davis"));
90         written_by.Add (wxT ("Ole Laursen"));
91         add_section (_("Written by"), written_by);
92
93         wxArrayString translated_by;
94         translated_by.Add (wxT ("Manuel AC"));
95         translated_by.Add (wxT ("Massimiliano Broggi"));
96         translated_by.Add (wxT ("William Fanelli"));
97         translated_by.Add (wxT ("Thierry Journet"));
98         translated_by.Add (wxT ("Adam Klotblixt"));
99         translated_by.Add (wxT ("Lilian Lefranc"));
100         translated_by.Add (wxT ("Olivier Perriere"));
101         translated_by.Add (wxT ("Markus Raab"));
102         translated_by.Add (wxT ("Theo Kooijmans"));
103         translated_by.Add (wxT ("Max Aeschlimann"));
104         translated_by.Add (wxT ("Carsten Kurz"));
105         add_section (_("Translated by"), translated_by);
106
107         wxArrayString artwork_by;
108         artwork_by.Add (wxT ("David Vignoni"));
109         add_section (_("Artwork by"), artwork_by);
110
111         wxArrayString supported_by;
112         supported_by.Add (wxT ("Manual AC"));
113         supported_by.Add (wxT ("Kambiz Afshar"));
114         supported_by.Add (wxT ("Louis Belloisy"));
115         supported_by.Add (wxT ("Mike Blakesley"));
116         supported_by.Add (wxT ("Jeff Boot"));
117         supported_by.Add (wxT ("Kieran Carroll"));
118         supported_by.Add (wxT ("Frank Cianciolo"));
119         supported_by.Add (wxT ("Cinema Clarici"));
120         supported_by.Add (wxT ("Adam Colt"));
121         supported_by.Add (wxT ("Matthias Damm"));
122         supported_by.Add (wxT ("Andres Fink"));
123         supported_by.Add (wxT ("Evan Freeze"));
124         supported_by.Add (wxT ("Silvio Giuliano"));
125         supported_by.Add (wxT ("Flor Guillaume"));
126         supported_by.Add (wxT ("Jonathan Jensen"));
127         supported_by.Add (wxT ("Chris Kay"));
128         supported_by.Add (wxT ("Adam Klotblixt"));
129         supported_by.Add (wxT ("Filip Kovcin"));
130         supported_by.Add (wxT ("Carsten Kurz"));
131         supported_by.Add (wxT ("Lilian Lefranc"));
132         supported_by.Add (wxT ("Sean Leigh"));
133         supported_by.Add (wxT ("Olivier Lemaire"));
134         supported_by.Add (wxT ("Gavin Lewarne"));
135         supported_by.Add (wxT ("Theo Lipfert"));
136         supported_by.Add (wxT ("Mattias Mattsson"));
137         supported_by.Add (wxT ("Kjarten Michaelsen"));
138         supported_by.Add (wxT ("Aldo Midali"));
139         supported_by.Add (wxT ("Sylvain Mielle"));
140         supported_by.Add (wxT ("Lindsay Morris"));
141         supported_by.Add (wxT ("Tim O'Brien"));
142         supported_by.Add (wxT ("Ivan Pullman"));
143         supported_by.Add (wxT ("Mark Rolfe"));
144         supported_by.Add (wxT ("Andrä Steiner"));
145         supported_by.Add (wxT ("Jussi Siponen"));
146         supported_by.Add (wxT ("Lasse Salling"));
147         supported_by.Add (wxT ("Mike Stiebing"));
148         supported_by.Add (wxT ("Randy Stankey"));
149         supported_by.Add (wxT ("Wolfgang Woehl"));
150         supported_by.Add (wxT ("Wolfram Weber"));
151         supported_by.Add (wxT ("Frank de Wulf"));
152         supported_by.Add (wxT ("Pavel Zhdanko"));
153         add_section (_("Supported by"), supported_by);
154
155         wxArrayString tested_by;
156         tested_by.Add (wxT ("Trever Anderson"));
157         tested_by.Add (wxT ("Mike Blakesley"));
158         tested_by.Add (wxT ("David Booty"));
159         tested_by.Add (wxT ("Roop Chand"));
160         tested_by.Add (wxT ("Daniel Chauvet"));
161         tested_by.Add (wxT ("Adam Colt"));
162         tested_by.Add (wxT ("John Convertino"));
163         tested_by.Add (wxT ("Andreas Eli"));
164         tested_by.Add (wxT ("Maurizio Giampà"));
165         tested_by.Add (wxT ("Luke Granger-Brown"));
166         tested_by.Add (wxT ("Sumit Guha"));
167         tested_by.Add (wxT ("Steve Guttag"));
168         tested_by.Add (wxT ("Patrick Haderer"));
169         tested_by.Add (wxT ("Bill Hamell"));
170         tested_by.Add (wxT ("Jonathan Jensen"));
171         tested_by.Add (wxT ("Thierry Journet"));
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 ("Mattias Mattsson"));
184         tested_by.Add (wxT ("Gérald Maruccia"));
185         tested_by.Add (wxT ("Will Meadows"));
186         tested_by.Add (wxT ("Brad Miller"));
187         tested_by.Add (wxT ("Anders Nordentoft-Madsen"));
188         tested_by.Add (wxT ("Mauro Ottonello"));
189         tested_by.Add (wxT ("Peter Puchner"));
190         tested_by.Add (wxT ("Markus Raab"));
191         tested_by.Add (wxT ("Greg Rooke"));
192         tested_by.Add (wxT ("Karim Senoucci"));
193         tested_by.Add (wxT ("Simon Vannarath"));
194         tested_by.Add (wxT ("Andrew Walls"));
195         tested_by.Add (wxT ("Andreas Weiss"));
196         tested_by.Add (wxT ("Paul Willmott"));
197         tested_by.Add (wxT ("Wolfgang Woehl"));
198         add_section (_("Tested by"), tested_by);
199         
200         sizer->Add (_notebook, wxSizerFlags().Centre().Border(wxALL, 16).Expand());
201
202         overall_sizer->Add (sizer);
203
204         wxSizer* buttons = CreateButtonSizer (wxOK);
205         if (buttons) {
206                 overall_sizer->Add (buttons, 1, wxEXPAND | wxALL, 4);
207         }
208         
209         SetSizerAndFit (overall_sizer);
210 }
211
212 void
213 AboutDialog::add_section (wxString name, wxArrayString credits)
214 {
215         static bool first = true;
216         int const N = 3;
217
218         wxPanel* panel = new wxPanel (_notebook, wxID_ANY);
219         wxSizer* overall_sizer = new wxBoxSizer (wxHORIZONTAL);
220
221         vector<wxSizer*> sizers;
222         
223         for (int i = 0; i < N; ++i) {
224                 sizers.push_back (new wxBoxSizer (wxVERTICAL));
225                 overall_sizer->Add (sizers.back (), 1, wxEXPAND | wxALL, 6);
226         }
227
228         int c = 0;
229         for (size_t i = 0; i < credits.Count(); ++i) {
230                 add_label_to_sizer (sizers[c], panel, credits[i], false);
231                 ++c;
232                 if (c == N) {
233                         c = 0;
234                 }
235         }
236
237         panel->SetSizerAndFit (overall_sizer);
238         _notebook->AddPage (panel, name, first);
239         first = false;
240 }