Merge branch '1.0' of /home/carl/git/dvdomatic into 1.0
[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* sizer = new wxBoxSizer (wxVERTICAL);
33         
34         wxFont title_font (*wxNORMAL_FONT);
35         title_font.SetPointSize (title_font.GetPointSize() + 12);
36         title_font.SetWeight (wxFONTWEIGHT_BOLD);
37
38         wxFont subtitle_font (*wxNORMAL_FONT);
39         subtitle_font.SetPointSize (subtitle_font.GetPointSize() + 2);
40
41         wxFont version_font (*wxNORMAL_FONT);
42         version_font.SetWeight (wxFONTWEIGHT_BOLD);
43         
44         wxStaticText* t = new wxStaticText (this, wxID_ANY, _("DCP-o-matic"));
45         t->SetFont (title_font);
46         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 16));
47
48         wxString s;
49         if (strcmp (dcpomatic_git_commit, "release") == 0) {
50                 t = new wxStaticText (this, wxID_ANY, std_to_wx (String::compose ("Version %1", dcpomatic_version)));
51         } else {
52                 t = new wxStaticText (this, wxID_ANY, std_to_wx (String::compose ("Version %1 git %2", dcpomatic_version, dcpomatic_git_commit)));
53         }
54         t->SetFont (version_font);
55         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 2));
56         sizer->AddSpacer (12);
57
58         t = new wxStaticText (
59                 this, wxID_ANY,
60                 _("Free, open-source DCP generation from almost anything."),
61                 wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
62                 );
63         t->SetFont (subtitle_font);
64         
65         sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 8));
66
67         wxHyperlinkCtrl* h = new wxHyperlinkCtrl (
68                 this, wxID_ANY,
69                 wxT ("dcpomatic.com"),
70                 wxT ("http://dcpomatic.com")
71                 );
72
73         sizer->Add (h, wxSizerFlags().Centre().Border(wxALL, 8));
74
75         t = new wxStaticText (
76                 this, wxID_ANY,
77                 _("(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen"),
78                 wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER
79                 );
80         
81         sizer->Add (t, wxSizerFlags().Centre().Border(wxLEFT | wxRIGHT, 16));
82
83         _notebook = new wxNotebook (this, wxID_ANY);
84
85         wxArrayString written_by;
86         written_by.Add (wxT ("Carl Hetherington"));
87         written_by.Add (wxT ("Terrence Meiczinger"));
88         written_by.Add (wxT ("Paul Davis"));
89         written_by.Add (wxT ("Ole Laursen"));
90         add_section (_("Written by"), written_by);
91
92         wxArrayString translated_by;
93         translated_by.Add (wxT ("Olivier Perriere"));
94         translated_by.Add (wxT ("Lilian Lefranc"));
95         translated_by.Add (wxT ("Thierry Journet"));
96         translated_by.Add (wxT ("Massimiliano Broggi"));
97         translated_by.Add (wxT ("Manuel AC"));
98         translated_by.Add (wxT ("Adam Klotblixt"));
99         add_section (_("Translated by"), translated_by);
100
101         wxArrayString supported_by;
102         supported_by.Add (wxT ("Carsten Kurz"));
103         supported_by.Add (wxT ("Wolfgang Woehl"));
104         supported_by.Add (wxT ("Manual AC"));
105         supported_by.Add (wxT ("Theo Lipfert"));
106         supported_by.Add (wxT ("Olivier Lemaire"));
107         supported_by.Add (wxT ("Andrä Steiner"));
108         supported_by.Add (wxT ("Jonathan Jensen"));
109         supported_by.Add (wxT ("Kjarten Michaelsen"));
110         supported_by.Add (wxT ("Jussi Siponen"));
111         supported_by.Add (wxT ("Cinema Clarici"));
112         supported_by.Add (wxT ("Evan Freeze"));
113         supported_by.Add (wxT ("Flor Guillaume"));
114         supported_by.Add (wxT ("Adam Klotblixt "));
115         supported_by.Add (wxT ("Lilian Lefranc"));
116         supported_by.Add (wxT ("Gavin Lewarne"));
117         supported_by.Add (wxT ("Lasse Salling"));
118         supported_by.Add (wxT ("Andres Fink"));
119         supported_by.Add (wxT ("Kieran Carroll"));
120         add_section (_("Supported by"), supported_by);
121
122         sizer->Add (_notebook, wxSizerFlags().Centre().Border(wxALL, 16).Expand());
123         
124         SetSizerAndFit (sizer);
125 }
126
127 void
128 AboutDialog::add_section (wxString name, wxArrayString credits)
129 {
130         static bool first = true;
131         int const N = 3;
132
133         wxPanel* panel = new wxPanel (_notebook, wxID_ANY);
134         wxSizer* overall_sizer = new wxBoxSizer (wxHORIZONTAL);
135
136         vector<wxSizer*> sizers;
137         
138         for (int i = 0; i < N; ++i) {
139                 sizers.push_back (new wxBoxSizer (wxVERTICAL));
140                 overall_sizer->Add (sizers.back (), 1, wxEXPAND | wxALL, 6);
141         }
142
143         int c = 0;
144         for (size_t i = 0; i < credits.Count(); ++i) {
145                 add_label_to_sizer (sizers[c], panel, credits[i], false);
146                 ++c;
147                 if (c == N) {
148                         c = 0;
149                 }
150         }
151
152         panel->SetSizerAndFit (overall_sizer);
153         _notebook->AddPage (panel, name, first);
154         first = false;
155 }