summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-01-07 15:06:15 +0000
committerCarl Hetherington <cth@carlh.net>2014-01-07 15:06:15 +0000
commit4983b57d7ccba4ea0b393cf3a40043c1ed5c6b77 (patch)
tree485144028325765093e2268d779ea23eb42eaa38 /src/tools
parent95faa6568854b5f861db07e9b8697169aaceec3c (diff)
Basic dialog reporting of manual update checks.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic.cc40
-rw-r--r--src/tools/update_dialog.cc0
-rw-r--r--src/tools/update_dialog.h31
3 files changed, 65 insertions, 6 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index b69385e24..fcb47f2d1 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -536,8 +536,7 @@ private:
void tools_check_for_updates ()
{
- UpdateChecker c;
- c.run ();
+ UpdateChecker::instance()->run (false);
}
void help_about ()
@@ -646,10 +645,12 @@ class App : public wxApp
film->set_name (boost::filesystem::path (film_to_create).filename().generic_string ());
}
- Frame* f = new Frame (_("DCP-o-matic"));
- SetTopWindow (f);
- f->Maximize ();
- f->Show ();
+ _frame = new Frame (_("DCP-o-matic"));
+ SetTopWindow (_frame);
+ _frame->Maximize ();
+ _frame->Show ();
+
+ UpdateChecker::instance()->StateChanged.connect (boost::bind (&App::update_checker_state_changed, this));
ui_signaller = new wxUISignaller (this);
Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
@@ -704,6 +705,33 @@ class App : public wxApp
}
}
+ void update_checker_state_changed ()
+ {
+ switch (UpdateChecker::instance()->state ()) {
+ case UpdateChecker::YES:
+ error_dialog (
+ _frame,
+ wxString::Format (
+ _("A new version %s of DCP-o-matic is available from http://dcpomatic.com/download"),
+ std_to_wx (UpdateChecker::instance()->stable()).wx_str ()
+ )
+ );
+ break;
+ case UpdateChecker::NO:
+ if (!UpdateChecker::instance()->startup ()) {
+ error_dialog (_frame, _("There are no new versions of DCP-o-matic available."));
+ }
+ break;
+ case UpdateChecker::FAILED:
+ if (!UpdateChecker::instance()->startup ()) {
+ error_dialog (_frame, _("The DCP-o-matic download server could not be contacted."));
+ }
+ default:
+ break;
+ }
+ }
+
+ wxFrame* _frame;
shared_ptr<wxTimer> _timer;
};
diff --git a/src/tools/update_dialog.cc b/src/tools/update_dialog.cc
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/tools/update_dialog.cc
diff --git a/src/tools/update_dialog.h b/src/tools/update_dialog.h
new file mode 100644
index 000000000..8b499ebcc
--- /dev/null
+++ b/src/tools/update_dialog.h
@@ -0,0 +1,31 @@
+/*
+ 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.
+
+*/
+
+class UpdateDialog
+{
+public:
+ UpdateDialog (wxWindow *);
+
+private:
+ wxGauge* _gauge;
+ wxStaticText* _message;
+ boost::thread* _thread;
+ boost::optional<UpdateChecker::Result> _result;
+ std::string _stable;
+};