summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-18 02:07:59 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-18 02:07:59 +0100
commit3c1b239453936128d1711ffa063ad4e1617b3e40 (patch)
tree060213367c651ca0ddccf1d9470b35886a687f6e /src/tools
parent48794870183ac5c0dd2b4acc1f9c2e5d7349f284 (diff)
Sort of working log window.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/servomatic_cli.cc3
-rw-r--r--src/tools/servomatic_gui.cc55
2 files changed, 48 insertions, 10 deletions
diff --git a/src/tools/servomatic_cli.cc b/src/tools/servomatic_cli.cc
index 1fcd02117..3ad73faf9 100644
--- a/src/tools/servomatic_cli.cc
+++ b/src/tools/servomatic_cli.cc
@@ -44,7 +44,8 @@ int
main ()
{
Scaler::setup_scalers ();
- Server server;
+ FileLog log ("servomatic.log");
+ Server server (&log);
server.run ();
return 0;
}
diff --git a/src/tools/servomatic_gui.cc b/src/tools/servomatic_gui.cc
index d89bd91ad..1d95f498a 100644
--- a/src/tools/servomatic_gui.cc
+++ b/src/tools/servomatic_gui.cc
@@ -24,28 +24,65 @@
#include "lib/util.h"
#include "lib/server.h"
+using namespace std;
using namespace boost;
enum {
ID_status = 1,
- ID_quit
+ ID_quit,
+ ID_timer
};
+class MemoryLog : public Log
+{
+public:
+
+ string get () const {
+ boost::mutex::scoped_lock (_mutex);
+ return _log;
+ }
+
+private:
+ void do_log (string m)
+ {
+ _log = m;
+ }
+
+ string _log;
+};
+
+static MemoryLog memory_log;
+
class StatusDialog : public wxDialog
{
public:
StatusDialog ()
- : wxDialog (0, wxID_ANY, _("DVD-o-matic encode server"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
+ : wxDialog (0, wxID_ANY, _("DVD-o-matic encode server"), wxDefaultPosition, wxSize (600, 40), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+ , _timer (this, ID_timer)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
- table->AddGrowableCol (1, 1);
+ _sizer = new wxFlexGridSizer (1, 6, 6);
+ _sizer->AddGrowableCol (0, 1);
- add_label_to_sizer (table, this, "Hello");
+ _text = new wxTextCtrl (this, wxID_ANY);
+ _sizer->Add (_text, 1, wxEXPAND);
- SetSizer (table);
- table->Layout ();
- table->SetSizeHints (this);
+ SetSizer (_sizer);
+ _sizer->Layout ();
+
+ Connect (ID_timer, wxEVT_TIMER, wxTimerEventHandler (StatusDialog::update));
+ _timer.Start (1000);
}
+
+private:
+ void update (wxTimerEvent &)
+ {
+ _text->ChangeValue (std_to_wx (memory_log.get ()));
+ _sizer->Layout ();
+ }
+
+ wxFlexGridSizer* _sizer;
+ wxTextCtrl* _text;
+ wxTimer _timer;
};
class TaskBarIcon : public wxTaskBarIcon
@@ -103,7 +140,7 @@ private:
void main_thread ()
{
- Server server;
+ Server server (&memory_log);
server.run ();
}