No-op: remove all trailing whitespace.
[dcpomatic.git] / src / wx / update_dialog.cc
1 /*
2     Copyright (C) 2012 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/hyperlink.h>
21 #include "update_dialog.h"
22 #include "wx_util.h"
23
24 using std::string;
25 using boost::optional;
26
27 UpdateDialog::UpdateDialog (wxWindow* parent, optional<string> stable, optional<string> test)
28         : wxDialog (parent, wxID_ANY, _("Update"))
29 {
30         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
31
32         wxStaticText* message;
33
34         if ((stable || test) && !(stable && test)) {
35                 message = new wxStaticText (this, wxID_ANY, _("A new version of DCP-o-matic is available."));
36         } else {
37                 message = new wxStaticText (this, wxID_ANY, _("New versions of DCP-o-matic are available."));
38         }
39
40         overall_sizer->Add (message, 1, wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER);
41
42         wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
43
44         if (stable) {
45                 add_label_to_sizer (table, this, _("Stable version ") + std_to_wx (stable.get ()), true);
46                 wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/download", "http://dcpomatic.com/download");
47                 table->Add (h);
48         }
49
50         if (test) {
51                 add_label_to_sizer (table, this, _("Test version ") + std_to_wx (test.get ()), true);
52                 wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/test-download", "http://dcpomatic.com/test-download");
53                 table->Add (h);
54         }
55
56         overall_sizer->Add (table, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_DIALOG_BORDER);
57
58         wxSizer* buttons = CreateButtonSizer (wxOK);
59         if (buttons) {
60                 overall_sizer->Add (buttons, 1, wxEXPAND | wxALL);
61         }
62
63         SetSizerAndFit (overall_sizer);
64 }