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