Make player/KDM creator and main DCP-o-matic all behave the same with respect to...
[dcpomatic.git] / src / wx / wx_util.cc
index e12443dd34bc7b27c147604f3828c9d95a3a4fa0..dd4ec3948765bbcdbf9946c8d0a923c3a669f24e 100644 (file)
 #include "file_picker_ctrl.h"
 #include "lib/config.h"
 #include "lib/util.h"
-#include <dcp/raw_convert.h>
+#include "lib/cross.h"
+#include <dcp/locale_convert.h>
 #include <wx/spinctrl.h>
+#include <wx/splash.h>
 #include <boost/thread.hpp>
 
 using namespace std;
 using namespace boost;
+using dcp::locale_convert;
 
 /** Add a wxStaticText to a wxSizer, aligning it at vertical centre.
  *  @param s Sizer to add to.
@@ -365,19 +368,39 @@ setup_audio_channels_choice (wxChoice* choice, int minimum)
        vector<pair<string, string> > items;
        for (int i = minimum; i <= 16; i += 2) {
                if (i == 2) {
-                       items.push_back (make_pair (wx_to_std (_("2 - stereo")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("2 - stereo")), locale_convert<string> (i)));
                } else if (i == 4) {
-                       items.push_back (make_pair (wx_to_std (_("4 - L/C/R/Lfe")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("4 - L/C/R/Lfe")), locale_convert<string> (i)));
                } else if (i == 6) {
-                       items.push_back (make_pair (wx_to_std (_("6 - 5.1")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("6 - 5.1")), locale_convert<string> (i)));
                } else if (i == 8) {
-                       items.push_back (make_pair (wx_to_std (_("8 - 5.1/HI/VI")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("8 - 5.1/HI/VI")), locale_convert<string> (i)));
                } else if (i == 12) {
-                       items.push_back (make_pair (wx_to_std (_("12 - 7.1/HI/VI")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("12 - 7.1/HI/VI")), locale_convert<string> (i)));
                } else {
-                       items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (locale_convert<string> (i), locale_convert<string> (i)));
                }
        }
 
        checked_set (choice, items);
 }
+
+wxSplashScreen *
+maybe_show_splash ()
+{
+       wxSplashScreen* splash = 0;
+       try {
+               if (!Config::have_existing ("config.xml")) {
+                       wxBitmap bitmap;
+                       boost::filesystem::path p = shared_path () / "splash.png";
+                       if (bitmap.LoadFile (std_to_wx (p.string ()), wxBITMAP_TYPE_PNG)) {
+                               splash = new wxSplashScreen (bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, 0, -1);
+                               wxYield ();
+                       }
+               }
+       } catch (boost::filesystem::filesystem_error& e) {
+               /* Maybe we couldn't find the splash image; never mind */
+       }
+
+       return splash;
+}