X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_server.cc;h=382f867cac214bd72dc245cab00f2670a15f651a;hb=1858190cff2f960f3d1f0a5cc02c69da86088f5b;hp=bcd5c8df6481254223d8c489c5759c255aec13d7;hpb=90ec60c9e5b45453525368842345ad1a6498fa61;p=dcpomatic.git diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index bcd5c8df6..382f867ca 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington 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 @@ -17,13 +17,15 @@ */ -#include -#include -#include #include "wx/wx_util.h" #include "lib/util.h" #include "lib/server.h" #include "lib/config.h" +#include "lib/log.h" +#include +#include +#include +#include using std::cout; using std::string; @@ -47,12 +49,12 @@ public: return _log; } - string head_and_tail () const { - if (_log.size () < 2048) { + string head_and_tail (int amount = 1024) const { + if (int (_log.size ()) < (2 * amount)) { return _log; } - return _log.substr (0, 1024) + _log.substr (_log.size() - 1025, 1024); + return _log.substr (0, amount) + _log.substr (_log.size() - amount - 1, amount); } private: @@ -61,7 +63,7 @@ private: _log = m; } - string _log; + string _log; }; static shared_ptr memory_log (new MemoryLog); @@ -103,24 +105,24 @@ class TaskBarIcon : public wxTaskBarIcon public: TaskBarIcon () { -#ifdef __WXMSW__ +#ifdef __WXMSW__ wxIcon icon (std_to_wx ("taskbar_icon")); #endif #ifdef __WXGTK__ wxInitAllImageHandlers(); - wxBitmap bitmap (wxString::Format (wxT ("%s/taskbar_icon.png"), POSIX_ICON_PREFIX), wxBITMAP_TYPE_PNG); + wxBitmap bitmap (wxString::Format (wxT ("%s/taskbar_icon.png"), LINUX_SHARE_PREFIX), wxBITMAP_TYPE_PNG); wxIcon icon; icon.CopyFromBitmap (bitmap); #endif #ifndef __WXOSX__ /* XXX: fix this for OS X */ SetIcon (icon, std_to_wx ("DCP-o-matic encode server")); -#endif +#endif Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&TaskBarIcon::status, this), ID_status); Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&TaskBarIcon::quit, this), ID_quit); } - + wxMenu* CreatePopupMenu () { wxMenu* menu = new wxMenu; @@ -151,14 +153,15 @@ public: , _icon (0) {} -private: - +private: + bool OnInit () { if (!wxApp::OnInit ()) { return false; } - + + dcpomatic_setup_path_encoding (); dcpomatic_setup (); _icon = new TaskBarIcon; @@ -167,7 +170,7 @@ private: Bind (wxEVT_TIMER, boost::bind (&App::check, this)); _timer.reset (new wxTimer (this)); _timer->Start (1000); - + return true; }