diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-01-07 16:47:44 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-01-07 16:47:44 +0000 |
| commit | 16d5c07df7752d093df804d3f1141790f633c24b (patch) | |
| tree | 7f26d3b870f5fc6cea3987c9088d01f21e7c02b3 /src/wx | |
| parent | 185c57d06c9fe5416bb03fad0874ed813db2ffe8 (diff) | |
Various update bits.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/config_dialog.cc | 24 | ||||
| -rw-r--r-- | src/wx/config_dialog.h | 5 | ||||
| -rw-r--r-- | src/wx/update_dialog.cc | 61 | ||||
| -rw-r--r-- | src/wx/update_dialog.h | 27 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
5 files changed, 118 insertions, 0 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 52c08018f..2b07dd1dc 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -135,6 +135,14 @@ ConfigDialog::make_misc_panel () add_label_to_sizer (table, _misc_panel, _("From address for KDM emails"), true); _kdm_from = new wxTextCtrl (_misc_panel, wxID_ANY); table->Add (_kdm_from, 1, wxEXPAND | wxALL); + + _check_for_updates = new wxCheckBox (_misc_panel, wxID_ANY, _("Check for updates on startup")); + table->Add (_check_for_updates, 1, wxEXPAND | wxALL); + table->AddSpacer (0); + + _check_for_test_updates = new wxCheckBox (_misc_panel, wxID_ANY, _("Check for testing updates as well as stable ones")); + table->Add (_check_for_test_updates, 1, wxEXPAND | wxALL); + table->AddSpacer (0); Config* config = Config::instance (); @@ -171,6 +179,10 @@ ConfigDialog::make_misc_panel () _mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::mail_password_changed, this)); _kdm_from->SetValue (std_to_wx (config->kdm_from ())); _kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::kdm_from_changed, this)); + _check_for_updates->SetValue (config->check_for_updates ()); + _check_for_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ConfigDialog::check_for_updates_changed, this)); + _check_for_test_updates->SetValue (config->check_for_test_updates ()); + _check_for_test_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ConfigDialog::check_for_test_updates_changed, this)); } void @@ -578,3 +590,15 @@ ConfigDialog::kdm_email_changed () { Config::instance()->set_kdm_email (wx_to_std (_kdm_email->GetValue ())); } + +void +ConfigDialog::check_for_updates_changed () +{ + Config::instance()->set_check_for_updates (_check_for_updates->GetValue ()); +} + +void +ConfigDialog::check_for_test_updates_changed () +{ + Config::instance()->set_check_for_test_updates (_check_for_test_updates->GetValue ()); +} diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index 49b466bcb..8a17de58d 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -76,6 +76,9 @@ private: void make_colour_conversions_panel (); void make_kdm_email_panel (); + void check_for_updates_changed (); + void check_for_test_updates_changed (); + wxNotebook* _notebook; wxPanel* _misc_panel; wxPanel* _defaults_panel; @@ -110,6 +113,8 @@ private: wxPanel* _kdm_email_panel; wxTextCtrl* _kdm_email; wxCheckBox* _use_any_servers; + wxCheckBox* _check_for_updates; + wxCheckBox* _check_for_test_updates; EditableList<std::string, ServerDialog>* _servers_list; }; diff --git a/src/wx/update_dialog.cc b/src/wx/update_dialog.cc new file mode 100644 index 000000000..271c4174c --- /dev/null +++ b/src/wx/update_dialog.cc @@ -0,0 +1,61 @@ +/* + Copyright (C) 2012 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <wx/hyperlink.h> +#include "update_dialog.h" +#include "wx_util.h" + +using std::string; + +UpdateDialog::UpdateDialog (wxWindow* parent, string stable, string test) + : wxDialog (parent, wxID_ANY, _("Update")) +{ + wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); + + wxStaticText* message; + + if (test.empty ()) { + 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.")); + } + + overall_sizer->Add (message, 1, wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER); + + 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); + 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); + + wxSizer* buttons = CreateButtonSizer (wxOK); + if (buttons) { + overall_sizer->Add (buttons, 1, wxEXPAND | wxALL); + } + + SetSizerAndFit (overall_sizer); +} diff --git a/src/wx/update_dialog.h b/src/wx/update_dialog.h new file mode 100644 index 000000000..d9c7b855d --- /dev/null +++ b/src/wx/update_dialog.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <wx/wx.h> + +class UpdateDialog : public wxDialog +{ +public: + UpdateDialog (wxWindow *, std::string, std::string); +}; + diff --git a/src/wx/wscript b/src/wx/wscript index 26bf32bdc..9de32d39e 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -39,6 +39,7 @@ sources = """ timeline.cc timeline_dialog.cc timing_panel.cc + update_dialog.cc video_panel.cc wx_util.cc wx_ui_signaller.cc |
