/*
- 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;
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:
_log = m;
}
- string _log;
+ string _log;
};
static shared_ptr<MemoryLog> memory_log (new MemoryLog);
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;
, _icon (0)
{}
-private:
-
+private:
+
bool OnInit ()
{
if (!wxApp::OnInit ()) {
return false;
}
-
+
+ dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
_icon = new TaskBarIcon;
Bind (wxEVT_TIMER, boost::bind (&App::check, this));
_timer.reset (new wxTimer (this));
_timer->Start (1000);
-
+
return true;
}