summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-04-21 01:00:36 +0100
committerCarl Hetherington <cth@carlh.net>2015-04-21 01:00:36 +0100
commitff96cc9c9e33fbe9dea02ea2d397144f9c9ac8c9 (patch)
tree30182f6187bb2ac4df9499f9b64e42aa9ae862dc /src/wx
parent1a9453df58177ff006da99e9ef1ed77624aa7d42 (diff)
Hand-apply bd7102b476c631b1fa9067f18ce938d86073f6c8; single-file hashes.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/properties_dialog.cc21
-rw-r--r--src/wx/properties_dialog.h4
-rw-r--r--src/wx/wx_util.cc46
-rw-r--r--src/wx/wx_util.h27
4 files changed, 2 insertions, 96 deletions
diff --git a/src/wx/properties_dialog.cc b/src/wx/properties_dialog.cc
index d1627edad..f80d5d693 100644
--- a/src/wx/properties_dialog.cc
+++ b/src/wx/properties_dialog.cc
@@ -42,9 +42,6 @@ PropertiesDialog::PropertiesDialog (wxWindow* parent, shared_ptr<Film> film)
add (_("Disk space required"), true);
_disk = add (new wxStaticText (this, wxID_ANY, wxT ("")));
- add (_("Frames already encoded"), true);
- _encoded = add (new ThreadedStaticText (this, _("counting..."), boost::bind (&PropertiesDialog::frames_already_encoded, this)));
- _encoded_connection = _encoded->Finished.connect (boost::bind (&PropertiesDialog::layout, this));
_frames->SetLabel (std_to_wx (lexical_cast<string> (_film->length().frames (_film->video_frame_rate ()))));
double const disk = double (_film->required_disk_space()) / 1073741824.0f;
SafeStringStream s;
@@ -53,21 +50,3 @@ PropertiesDialog::PropertiesDialog (wxWindow* parent, shared_ptr<Film> film)
layout ();
}
-
-string
-PropertiesDialog::frames_already_encoded () const
-{
- SafeStringStream u;
- try {
- u << _film->encoded_frames ();
- } catch (boost::thread_interrupted &) {
- return "";
- }
-
- uint64_t const frames = _film->length().frames (_film->video_frame_rate ());
- if (frames) {
- /* XXX: encoded_frames() should check which frames have been encoded */
- u << " (" << (_film->encoded_frames() * 100 / frames) << "%)";
- }
- return u.str ();
-}
diff --git a/src/wx/properties_dialog.h b/src/wx/properties_dialog.h
index fe814f7ab..d489754ef 100644
--- a/src/wx/properties_dialog.h
+++ b/src/wx/properties_dialog.h
@@ -21,7 +21,6 @@
#include "table_dialog.h"
class Film;
-class ThreadedStaticText;
class PropertiesDialog : public TableDialog
{
@@ -29,12 +28,9 @@ public:
PropertiesDialog (wxWindow *, boost::shared_ptr<Film>);
private:
- std::string frames_already_encoded () const;
-
boost::shared_ptr<Film> _film;
wxStaticText* _frames;
wxStaticText* _disk;
- ThreadedStaticText* _encoded;
boost::signals2::scoped_connection _encoded_connection;
};
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index c4a7fd5bc..0119799d2 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 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
@@ -117,50 +117,6 @@ std_to_wx (string s)
return wxString (s.c_str(), wxConvUTF8);
}
-int const ThreadedStaticText::_update_event_id = 10000;
-
-/** @param parent Parent for the wxStaticText.
- * @param initial Initial text for the wxStaticText while the computation is being run.
- * @param fn Function which works out what the wxStaticText content should be and returns it.
- */
-ThreadedStaticText::ThreadedStaticText (wxWindow* parent, wxString initial, boost::function<string ()> fn)
- : wxStaticText (parent, wxID_ANY, initial)
-{
- Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ThreadedStaticText::thread_finished, this, _1), _update_event_id);
- _thread = new thread (bind (&ThreadedStaticText::run, this, fn));
-}
-
-ThreadedStaticText::~ThreadedStaticText ()
-{
- _thread->interrupt ();
- _thread->join ();
- delete _thread;
-}
-
-/** Run our thread and post the result to the GUI thread via AddPendingEvent */
-void
-ThreadedStaticText::run (boost::function<string ()> fn)
-try
-{
- wxCommandEvent ev (wxEVT_COMMAND_TEXT_UPDATED, _update_event_id);
- ev.SetString (std_to_wx (fn ()));
- GetEventHandler()->AddPendingEvent (ev);
-}
-catch (...)
-{
- /* Ignore exceptions; marginally better than the program quitting, but
- only marginally.
- */
-}
-
-/** Called in the GUI thread when our worker thread has finished */
-void
-ThreadedStaticText::thread_finished (wxCommandEvent& ev)
-{
- SetLabel (ev.GetString ());
- Finished ();
-}
-
string
string_client_data (wxClientData* o)
{
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index f0e20be95..eeb3fee43 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 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
@@ -64,31 +64,6 @@ extern std::string wx_to_std (wxString);
extern wxString std_to_wx (std::string);
extern void dcpomatic_setup_i18n ();
extern wxString context_translation (wxString);
-
-/** @class ThreadedStaticText
- *
- * @brief A wxStaticText whose content is computed in a separate thread, to avoid holding
- * up the GUI while work is done.
- */
-class ThreadedStaticText : public wxStaticText
-{
-public:
- ThreadedStaticText (wxWindow* parent, wxString initial, boost::function<std::string ()> fn);
- ~ThreadedStaticText ();
-
- /** Emitted in the UI thread when the text has been set up */
- boost::signals2::signal<void()> Finished;
-
-private:
- void run (boost::function<std::string ()> fn);
- void thread_finished (wxCommandEvent& ev);
-
- /** Thread to do our work in */
- boost::thread* _thread;
-
- static const int _update_event_id;
-};
-
extern std::string string_client_data (wxClientData* o);
extern void checked_set (wxFilePickerCtrl* widget, std::string value);