X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_server.cc;h=6cf0a9609d518ddfb2970627abc216286e90607e;hb=3c29aa6531a4046a8db72dcac81189eb8893233c;hp=80d4046a494a9283c7952258e0d08b2494608bfa;hpb=ecc74ec418e060fa163d25d08a62a6e81eece114;p=dcpomatic.git diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 80d4046a4..6cf0a9609 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -29,16 +29,17 @@ #include "lib/signaller.h" #include "lib/cross.h" #include "lib/dcpomatic_log.h" -#include "lib/warnings.h" -DCPOMATIC_DISABLE_WARNINGS -#include -#include +#include +LIBDCP_DISABLE_WARNINGS #include -DCPOMATIC_ENABLE_WARNINGS +#include +#include +LIBDCP_ENABLE_WARNINGS #include #include #include + using std::cout; using std::string; using std::exception; @@ -54,6 +55,7 @@ using std::dynamic_pointer_cast; using namespace boost::placeholders; #endif + enum { ID_status = 1, ID_quit, @@ -87,7 +89,7 @@ public: boost::signals2::signal Removed; private: - void do_log (shared_ptr entry) + void do_log (shared_ptr entry) override { time_t const s = entry->seconds (); struct tm* local = localtime (&s); @@ -211,26 +213,22 @@ private: std::shared_ptr _timer; }; + +static StatusDialog* status_dialog = nullptr; + + class TaskBarIcon : public wxTaskBarIcon { public: TaskBarIcon () { -#ifdef DCPOMATIC_WINDOWS - wxIcon icon (std_to_wx ("id")); -#else - wxBitmap bitmap (bitmap_path("dcpomatic_small_black"), wxBITMAP_TYPE_PNG); - wxIcon icon; - icon.CopyFromBitmap (bitmap); -#endif - - SetIcon (icon, std_to_wx ("DCP-o-matic Encode Server")); + set_icon (); Bind (wxEVT_MENU, boost::bind (&TaskBarIcon::status, this), ID_status); Bind (wxEVT_MENU, boost::bind (&TaskBarIcon::quit, this), ID_quit); } - wxMenu* CreatePopupMenu () + wxMenu* CreatePopupMenu () override { auto menu = new wxMenu; menu->Append (ID_status, std_to_wx ("Status...")); @@ -238,21 +236,33 @@ public: return menu; } + void set_icon () + { +#ifdef DCPOMATIC_WINDOWS + wxIcon icon (std_to_wx("id")); +#else + string const colour = gui_is_dark() ? "white" : "black"; + wxBitmap bitmap ( + bitmap_path(String::compose("dcpomatic_small_%1", colour)), + wxBITMAP_TYPE_PNG + ); + wxIcon icon; + icon.CopyFromBitmap (bitmap); +#endif + + SetIcon (icon, std_to_wx ("DCP-o-matic Encode Server")); + } + private: void status () { - if (!_status) { - _status = new StatusDialog (); - } - _status->Show (); + status_dialog->Show (); } void quit () { wxTheApp->ExitMainLoop (); } - - StatusDialog* _status; }; @@ -265,7 +275,7 @@ public: private: - bool OnInit () + bool OnInit () override { if (!wxApp::OnInit()) { return false; @@ -297,11 +307,12 @@ private: */ Config::instance(); + status_dialog = new StatusDialog (); #ifdef DCPOMATIC_LINUX - StatusDialog* d = new StatusDialog (); - d->Show (); + status_dialog->Show (); #else _icon = new TaskBarIcon; + status_dialog->Bind (wxEVT_SYS_COLOUR_CHANGED, boost::bind(&TaskBarIcon::set_icon, _icon)); #endif _thread = thread (bind (&App::main_thread, this)); @@ -318,7 +329,7 @@ private: return true; } - int OnExit () + int OnExit () override { delete _icon; return wxApp::OnExit ();