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