X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fupdate_dialog.cc;h=e0c08ef158a1356ccf9f06e225fadfa0b02f6a71;hb=aeb835a18c8df347e0ed68fb24631b320abeb611;hp=271c4174c611a441197c889a0dd9a081b490fba1;hpb=16d5c07df7752d093df804d3f1141790f633c24b;p=dcpomatic.git diff --git a/src/wx/update_dialog.cc b/src/wx/update_dialog.cc index 271c4174c..e0c08ef15 100644 --- a/src/wx/update_dialog.cc +++ b/src/wx/update_dialog.cc @@ -22,15 +22,16 @@ #include "wx_util.h" using std::string; +using boost::optional; -UpdateDialog::UpdateDialog (wxWindow* parent, string stable, string test) +UpdateDialog::UpdateDialog (wxWindow* parent, optional stable, optional test) : wxDialog (parent, wxID_ANY, _("Update")) { wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); wxStaticText* message; - if (test.empty ()) { + if ((stable || test) && !(stable && test)) { message = new wxStaticText (this, wxID_ANY, _("A new version of DCP-o-matic is available.")); } else { message = new wxStaticText (this, wxID_ANY, _("New versions of DCP-o-matic are available.")); @@ -40,22 +41,24 @@ UpdateDialog::UpdateDialog (wxWindow* parent, string stable, string test) wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - add_label_to_sizer (table, this, _("Stable version ") + std_to_wx (stable), true); - wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/download", "http://dcpomatic.com/download"); - table->Add (h); - - if (!test.empty ()) { - add_label_to_sizer (table, this, _("Test version ") + std_to_wx (test), true); + if (stable) { + add_label_to_sizer (table, this, _("Stable version ") + std_to_wx (stable.get ()), true); + wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/download", "http://dcpomatic.com/download"); + table->Add (h); + } + + if (test) { + add_label_to_sizer (table, this, _("Test version ") + std_to_wx (test.get ()), true); wxHyperlinkCtrl* h = new wxHyperlinkCtrl (this, wxID_ANY, "dcpomatic.com/test-download", "http://dcpomatic.com/test-download"); table->Add (h); } - - overall_sizer->Add (table, 1, wxEXPAND | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER); + + overall_sizer->Add (table, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_DIALOG_BORDER); wxSizer* buttons = CreateButtonSizer (wxOK); if (buttons) { overall_sizer->Add (buttons, 1, wxEXPAND | wxALL); } - + SetSizerAndFit (overall_sizer); }