diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-05-31 23:14:10 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-06-17 00:04:03 +0200 |
| commit | 4e60d6a68356aaf12c4ee1aef4d1bf1d15f5384b (patch) | |
| tree | ead3b30b43b021d18c2c41038efa04fd343ad593 /src | |
| parent | 1bea93d20146af11330610ee159ec38c95347b3f (diff) | |
Cleanup: use an enum class.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/config.cc | 14 | ||||
| -rw-r--r-- | src/lib/config.h | 8 | ||||
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 34 | ||||
| -rw-r--r-- | src/wx/player_config_dialog.cc | 12 |
4 files changed, 34 insertions, 34 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 66a0e1a5a..d8402e2ec 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -184,7 +184,7 @@ Config::set_defaults() _christie_password = optional<string>(); _gdc_username = optional<string>(); _gdc_password = optional<string>(); - _player_mode = PLAYER_MODE_WINDOW; + _player_mode = PlayerMode::WINDOW; _player_restricted_menus = false; _playlist_editor_restricted_menus = false; _image_display = 0; @@ -604,11 +604,11 @@ try auto pm = f.optional_string_child("PlayerMode"); if (pm && *pm == "window") { - _player_mode = PLAYER_MODE_WINDOW; + _player_mode = PlayerMode::WINDOW; } else if (pm && *pm == "full") { - _player_mode = PLAYER_MODE_FULL; + _player_mode = PlayerMode::FULL; } else if (pm && *pm == "dual") { - _player_mode = PLAYER_MODE_DUAL; + _player_mode = PlayerMode::DUAL; } _player_restricted_menus = f.optional_bool_child("PlayerRestrictedMenus").get_value_or(false); @@ -1062,13 +1062,13 @@ Config::write_config() const with separate (advanced) controls. */ switch (_player_mode) { - case PLAYER_MODE_WINDOW: + case PlayerMode::WINDOW: cxml::add_text_child(root, "PlayerMode", "window"); break; - case PLAYER_MODE_FULL: + case PlayerMode::FULL: cxml::add_text_child(root, "PlayerMode", "full"); break; - case PLAYER_MODE_DUAL: + case PlayerMode::DUAL: cxml::add_text_child(root, "PlayerMode", "dual"); break; } diff --git a/src/lib/config.h b/src/lib/config.h index c90790ebc..9f6d1c743 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -536,10 +536,10 @@ public: return _gdc_password; } - enum PlayerMode { - PLAYER_MODE_WINDOW, ///< one window containing image and controls - PLAYER_MODE_FULL, ///< just the image filling the screen - PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other + enum class PlayerMode { + WINDOW, ///< one window containing image and controls + FULL, ///< just the image filling the screen + DUAL ///< image on one monitor and extended controls on the other }; PlayerMode player_mode() const { diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index c0f3e29f5..b74124e2c 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -257,7 +257,7 @@ public: Bind(wxEVT_CLOSE_WINDOW, boost::bind(&DOMFrame::close, this, _1)); - if (Config::instance()->player_mode() == Config::PLAYER_MODE_DUAL) { + if (Config::instance()->player_mode() == Config::PlayerMode::DUAL) { auto pc = new PlaylistControls (_overall_panel, _viewer); _controls = pc; pc->ResetFilm.connect (bind(&DOMFrame::reset_film_weak, this, _1)); @@ -347,10 +347,10 @@ public: _main_sizer->Detach(_viewer.panel()); _main_sizer->Detach (_controls); _main_sizer->Detach (_info); - if (mode != Config::PLAYER_MODE_DUAL) { + if (mode != Config::PlayerMode::DUAL) { _main_sizer->Add(_viewer.panel(), 1, wxEXPAND); } - _main_sizer->Add (_controls, mode == Config::PLAYER_MODE_DUAL ? 1 : 0, wxEXPAND | wxALL, 6); + _main_sizer->Add (_controls, mode == Config::PlayerMode::DUAL ? 1 : 0, wxEXPAND | wxALL, 6); _main_sizer->Add (_info, 0, wxEXPAND | wxALL, 6); _overall_panel->SetSizer (_main_sizer); _overall_panel->Layout (); @@ -901,10 +901,10 @@ private: void view_full_screen () { - if (_mode == Config::PLAYER_MODE_FULL) { - _mode = Config::PLAYER_MODE_WINDOW; + if (_mode == Config::PlayerMode::FULL) { + _mode = Config::PlayerMode::WINDOW; } else { - _mode = Config::PLAYER_MODE_FULL; + _mode = Config::PlayerMode::FULL; } setup_screen (); setup_menu (); @@ -912,10 +912,10 @@ private: void view_dual_screen () { - if (_mode == Config::PLAYER_MODE_DUAL) { - _mode = Config::PLAYER_MODE_WINDOW; + if (_mode == Config::PlayerMode::DUAL) { + _mode = Config::PlayerMode::WINDOW; } else { - _mode = Config::PLAYER_MODE_DUAL; + _mode = Config::PlayerMode::DUAL; } setup_screen (); setup_menu (); @@ -924,22 +924,22 @@ private: void setup_menu () { if (_view_full_screen) { - _view_full_screen->Check (_mode == Config::PLAYER_MODE_FULL); + _view_full_screen->Check (_mode == Config::PlayerMode::FULL); } if (_view_dual_screen) { - _view_dual_screen->Check (_mode == Config::PLAYER_MODE_DUAL); + _view_dual_screen->Check (_mode == Config::PlayerMode::DUAL); } } void setup_screen () { - _controls->Show (_mode != Config::PLAYER_MODE_FULL); - _info->Show (_mode != Config::PLAYER_MODE_FULL); - _overall_panel->SetBackgroundColour (_mode == Config::PLAYER_MODE_FULL ? wxColour(0, 0, 0) : wxNullColour); - ShowFullScreen (_mode == Config::PLAYER_MODE_FULL); - _viewer.set_pad_black(_mode != Config::PLAYER_MODE_WINDOW); + _controls->Show (_mode != Config::PlayerMode::FULL); + _info->Show (_mode != Config::PlayerMode::FULL); + _overall_panel->SetBackgroundColour (_mode == Config::PlayerMode::FULL ? wxColour(0, 0, 0) : wxNullColour); + ShowFullScreen (_mode == Config::PlayerMode::FULL); + _viewer.set_pad_black(_mode != Config::PlayerMode::WINDOW); - if (_mode == Config::PLAYER_MODE_DUAL) { + if (_mode == Config::PlayerMode::DUAL) { _dual_screen = new wxFrame(this, wxID_ANY, {}); _dual_screen->SetBackgroundColour (wxColour(0, 0, 0)); _dual_screen->ShowFullScreen (true); diff --git a/src/wx/player_config_dialog.cc b/src/wx/player_config_dialog.cc index e755acf9a..b853503c6 100644 --- a/src/wx/player_config_dialog.cc +++ b/src/wx/player_config_dialog.cc @@ -160,13 +160,13 @@ private: auto config = Config::instance(); switch (config->player_mode()) { - case Config::PLAYER_MODE_WINDOW: + case Config::PlayerMode::WINDOW: checked_set(_player_mode, 0); break; - case Config::PLAYER_MODE_FULL: + case Config::PlayerMode::FULL: checked_set(_player_mode, 1); break; - case Config::PLAYER_MODE_DUAL: + case Config::PlayerMode::DUAL: checked_set(_player_mode, 2); break; } @@ -197,13 +197,13 @@ private: { switch (_player_mode->GetSelection()) { case 0: - Config::instance()->set_player_mode(Config::PLAYER_MODE_WINDOW); + Config::instance()->set_player_mode(Config::PlayerMode::WINDOW); break; case 1: - Config::instance()->set_player_mode(Config::PLAYER_MODE_FULL); + Config::instance()->set_player_mode(Config::PlayerMode::FULL); break; case 2: - Config::instance()->set_player_mode(Config::PLAYER_MODE_DUAL); + Config::instance()->set_player_mode(Config::PlayerMode::DUAL); break; } } |
