#include "config.h"
#include "check_hashes_job.h"
#include "version.h"
+#include "ui_signaller.h"
using namespace std;
using namespace boost;
Film::signal_changed (Property p)
{
_dirty = true;
- Changed (p);
+ ui_signaller->emit (boost::bind (boost::ref (Changed), p));
}
int
--- /dev/null
+/*
+ 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 "ui_signaller.h"
+
+UISignaller* ui_signaller = 0;
+
--- /dev/null
+/*
+ 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.
+
+*/
+
+#ifndef DVDOMATIC_UI_SIGNALLER_H
+#define DVDOMATIC_UI_SIGNALLER_H
+
+#include <boost/bind.hpp>
+#include <boost/asio.hpp>
+
+class UISignaller
+{
+public:
+ UISignaller ()
+ : _work (_service)
+ {}
+
+ template <class S>
+ void emit (S signal) {
+ _service.post (boost::bind (boost::ref (signal)));
+ }
+
+ void ui_idle () {
+ _service.poll ();
+ }
+
+ virtual void wake_ui () = 0;
+
+private:
+ boost::asio::io_service _service;
+ boost::asio::io_service::work _work;
+};
+
+extern UISignaller* ui_signaller;
+
+#endif
timer.cc
transcode_job.cc
transcoder.cc
+ ui_signaller.cc
util.cc
version.cc
"""
#include "wx/wx_util.h"
#include "wx/new_film_dialog.h"
#include "wx/properties_dialog.h"
+#include "wx/wx_ui_signaller.h"
#include "lib/film.h"
#include "lib/format.h"
#include "lib/config.h"
#include "lib/scaler.h"
#include "lib/exceptions.h"
#include "lib/version.h"
+#include "lib/ui_signaller.h"
using namespace std;
using namespace boost;
SetTopWindow (f);
f->Maximize ();
f->Show ();
+
+ ui_signaller = new wxUISignaller (this);
+ this->Connect (-1, wxEVT_IDLE, wxIdleEventHandler (App::idle));
+
return true;
}
+
+ void idle (wxIdleEvent &)
+ {
+ ui_signaller->ui_idle ();
+ }
};
IMPLEMENT_APP (App)
properties_dialog.cc
server_dialog.cc
wx_util.cc
+ wx_ui_signaller.cc
"""
# alignment.cc
--- /dev/null
+/*
+ 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/wx.h>
+#include "wx_ui_signaller.h"
+
+wxUISignaller::wxUISignaller (wxEvtHandler* h)
+ : _handler (h)
+{
+
+}
+
+void
+wxUISignaller::wake_ui ()
+{
+ wxCommandEvent event (-1, -1);
+ _handler->AddPendingEvent (event);
+}
--- /dev/null
+/*
+ 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 "ui_signaller.h"
+
+class wxEvtHandler;
+
+class wxUISignaller : public UISignaller
+{
+public:
+ wxUISignaller (wxEvtHandler *);
+ void wake_ui ();
+
+private:
+ wxEvtHandler* _handler;
+};