No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / wx / update_dialog.cc
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #include <wx/hyperlink.h>
22 #include "update_dialog.h"
23 #include "wx_util.h"
24
25 using std::string;
26 using boost::optional;
27
28 UpdateDialog::UpdateDialog (wxWindow* parent, optional<string> stable, optional<string> test)
29         : wxDialog (parent, wxID_ANY, _("Update"))
30 {
31         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
32
33         wxStaticText* message;
34
35         if ((stable || test) && !(stable && test)) {
36                 message = new wxStaticText (this, wxID_ANY, _("A new version of DCP-o-matic is available."));
37         } else {
38                 message = new wxStaticText (this, wxID_ANY, _("New versions of DCP-o-matic are available."));
39         }
40
41         overall_sizer->Add (message, 1, wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER);
42
43         wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
44
45         if (stable) {
46                 add_label_to_sizer (table, this, _("Stable version ") + std_to_wx (stable.get ()), true);
47                 wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/download", "http://dcpomatic.com/download");
48                 table->Add (h);
49         }
50
51         if (test) {
52                 add_label_to_sizer (table, this, _("Test version ") + std_to_wx (test.get ()), true);
53                 wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/test-download", "http://dcpomatic.com/test-download");
54                 table->Add (h);
55         }
56
57         overall_sizer->Add (table, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_DIALOG_BORDER);
58
59         wxSizer* buttons = CreateButtonSizer (wxOK);
60         if (buttons) {
61                 overall_sizer->Add (buttons, 1, wxEXPAND | wxALL);
62         }
63
64         SetSizerAndFit (overall_sizer);
65 }