summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-10-09 11:22:47 +0100
committerCarl Hetherington <cth@carlh.net>2015-10-09 13:45:11 +0100
commit49cbd002a4b681d8d2c091b0053ea7fe9430d94a (patch)
treefd35223db14d58ff6037b6d859b75efc25208e9c /src
parentc2ce6455ababea2f1db9fb5d8771fa1327c2fcdb (diff)
Don't create status dialog until it's needed, otherwise we don't get an icon on Linux.
Diffstat (limited to 'src')
-rw-r--r--src/tools/dcpomatic_server.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc
index 1d6c0bef7..e7579f74b 100644
--- a/src/tools/dcpomatic_server.cc
+++ b/src/tools/dcpomatic_server.cc
@@ -27,6 +27,7 @@
#include <wx/taskbar.h>
#include <wx/icon.h>
#include <boost/thread.hpp>
+#include <boost/foreach.hpp>
#include <iostream>
using std::cout;
@@ -49,6 +50,14 @@ class MemoryLog : public Log, public Signaller
{
public:
+ string get () const {
+ string a;
+ BOOST_FOREACH (string const & i, _log) {
+ a += i + "\n";
+ }
+ return a;
+ }
+
string head_and_tail (int) const {
/* Not necessary */
return "";
@@ -60,15 +69,15 @@ public:
private:
void do_log (string m)
{
- _lengths.push_back (m.length ());
+ _log.push_back (m);
emit (boost::bind (boost::ref (Appended), m));
- if (_lengths.size() > log_lines) {
- emit (boost::bind (boost::ref (Removed), _lengths.front()));
- _lengths.pop_front ();
+ if (_log.size() > log_lines) {
+ emit (boost::bind (boost::ref (Removed), _log.front().length()));
+ _log.pop_front ();
}
}
- list<size_t> _lengths;
+ list<string> _log;
};
static shared_ptr<MemoryLog> memory_log (new MemoryLog);
@@ -92,7 +101,7 @@ public:
SetSize (700, height + DCPOMATIC_SIZER_GAP * 2);
_text = new wxTextCtrl (
- this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize (-1, height),
+ this, wxID_ANY, std_to_wx (memory_log->get()), wxDefaultPosition, wxSize (-1, height),
wxTE_READONLY | wxTE_MULTILINE
);
@@ -124,6 +133,7 @@ class TaskBarIcon : public wxTaskBarIcon
{
public:
TaskBarIcon ()
+ : _status (0)
{
#ifdef DCPOMATIC_WINDOWS
wxIcon icon (std_to_wx ("taskbar_icon"));
@@ -136,8 +146,6 @@ public:
SetIcon (icon, std_to_wx ("DCP-o-matic encode server"));
- _status = new StatusDialog ();
-
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&TaskBarIcon::status, this), ID_status);
Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&TaskBarIcon::quit, this), ID_quit);
}
@@ -153,6 +161,7 @@ public:
private:
void status ()
{
+ _status = new StatusDialog ();
_status->Show ();
}