Merge master.
[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
26 UpdateDialog::UpdateDialog (wxWindow* parent, string stable, string test)
27         : wxDialog (parent, wxID_ANY, _("Update"))
28 {
29         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
30
31         wxStaticText* message;
32
33         if (test.empty ()) {
34                 message = new wxStaticText (this, wxID_ANY, _("A new version of DCP-o-matic is available."));
35         } else {
36                 message = new wxStaticText (this, wxID_ANY, _("New versions of DCP-o-matic are available."));
37         }
38
39         overall_sizer->Add (message, 1, wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER);
40
41         wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
42
43         add_label_to_sizer (table, this, _("Stable version ") + std_to_wx (stable), true);
44         wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/download", "http://dcpomatic.com/download");
45         table->Add (h);
46         
47         if (!test.empty ()) {
48                 add_label_to_sizer (table, this, _("Test version ") + std_to_wx (test), true);
49                 wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/test-download", "http://dcpomatic.com/test-download");
50                 table->Add (h);
51         }
52         
53         overall_sizer->Add (table, 1, wxEXPAND | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER);
54
55         wxSizer* buttons = CreateButtonSizer (wxOK);
56         if (buttons) {
57                 overall_sizer->Add (buttons, 1, wxEXPAND | wxALL);
58         }
59         
60         SetSizerAndFit (overall_sizer);
61 }