Lots of #include <iostream>s for Arch.
[dcpomatic.git] / src / tools / dcpomatic_server.cc
index bcd5c8df6481254223d8c489c5759c255aec13d7..382f867cac214bd72dc245cab00f2670a15f651a 100644 (file)
@@ -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
 
 */
 
-#include <boost/thread.hpp>
-#include <wx/taskbar.h>
-#include <wx/icon.h>
 #include "wx/wx_util.h"
 #include "lib/util.h"
 #include "lib/server.h"
 #include "lib/config.h"
+#include "lib/log.h"
+#include <wx/taskbar.h>
+#include <wx/icon.h>
+#include <boost/thread.hpp>
+#include <iostream>
 
 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<MemoryLog> 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;
        }