From 2441f82be7e40bdf3104fbc110844c86acee0776 Mon Sep 17 00:00:00 2001 From: enen92 <92enen@gmail.com> Date: Tue, 14 Dec 2021 16:47:54 +0000 Subject: [PATCH] [Settings][VideoOSD] Add autoclose setting --- .../resources/strings.po | 33 +++++++++++++++++++ system/settings/settings.xml | 25 ++++++++++++++ xbmc/settings/Settings.cpp | 2 ++ xbmc/settings/Settings.h | 2 ++ xbmc/video/dialogs/GUIDialogVideoOSD.cpp | 15 +++++++++ xbmc/video/dialogs/GUIDialogVideoOSD.h | 1 + 6 files changed, 78 insertions(+) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 033dce9f6bdda..c37a33ce24f54 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -674,6 +674,7 @@ msgid "Free" msgstr "" #: addons/skin.estuary/xml/Includes.xml +#: system/settings/settings.xml msgctxt "#157" msgid "Video" msgstr "" @@ -2227,6 +2228,8 @@ msgctxt "#477" msgid "Unable to load playlist" msgstr "" +#. label for "OSD" setting category +#: system/settings/settings.xml msgctxt "#478" msgid "OSD" msgstr "" @@ -22905,3 +22908,33 @@ msgstr "" msgctxt "#39174" msgid "Display supported HDR types" msgstr "" + +#. Description of settings category "OSD" with label #478 +#: system/settings/settings.xml +msgctxt "#39175" +msgid "This category contains all the on screen display (OSD) related settings." +msgstr "" + +#. Automatically close video OSD bool setting in Settings/Interface/OSD +#: system/settings/settings.xml +msgctxt "#39176" +msgid "Automatically close video OSD" +msgstr "" + +#. Help text for "Automatically close video OSD" setting in Settings/Interface/OSD +#: system/settings/settings.xml +msgctxt "#39177" +msgid "The video OSD window will be automatically closed if visible after a specified time" +msgstr "" + +#. Video OSD autoclose time (seconds) in Settings/Interface/OSD +#: system/settings/settings.xml +msgctxt "#39178" +msgid "Video OSD autoclose time (seconds)" +msgstr "" + +#. Help text for setting "Video OSD autoclose time (seconds)" of label #39178 +#: system/settings/settings.xml +msgctxt "#39179" +msgid "The time in seconds for the video OSD to be automatically closed" +msgstr "" diff --git a/system/settings/settings.xml b/system/settings/settings.xml index a596f91b1f7cc..a50c9509916b7 100755 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -3700,6 +3700,31 @@ + + + + 0 + true + + + + + + + 2 + 5 + + 2 + 1 + 60 + + + true + + + + + diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index 824b839ac70c4..02420efb89617 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -447,6 +447,8 @@ constexpr const char* CSettings::SETTING_GENERAL_ADDONBROKENFILTER; constexpr const char* CSettings::SETTING_SOURCE_VIDEOS; constexpr const char* CSettings::SETTING_SOURCE_MUSIC; constexpr const char* CSettings::SETTING_SOURCE_PICTURES; +constexpr const char* CSettings::SETTING_OSD_AUTOCLOSEVIDEOOSD; +constexpr const char* CSettings::SETTING_OSD_AUTOCLOSEVIDEOOSDTIME; //! @todo: remove in c++17 bool CSettings::Initialize() diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h index 7c5f6d20d3366..1227b306eec56 100644 --- a/xbmc/settings/Settings.h +++ b/xbmc/settings/Settings.h @@ -65,6 +65,8 @@ class CSettings : public CSettingsBase, public CSettingCreator, public CSettingC static constexpr auto SETTING_SCREENSAVER_TIME = "screensaver.time"; static constexpr auto SETTING_SCREENSAVER_USEMUSICVISINSTEAD = "screensaver.usemusicvisinstead"; static constexpr auto SETTING_SCREENSAVER_USEDIMONPAUSE = "screensaver.usedimonpause"; + static constexpr auto SETTING_OSD_AUTOCLOSEVIDEOOSD = "osd.autoclosevideoosd"; + static constexpr auto SETTING_OSD_AUTOCLOSEVIDEOOSDTIME = "osd.autoclosevideoosdtime"; static constexpr auto SETTING_WINDOW_WIDTH = "window.width"; static constexpr auto SETTING_WINDOW_HEIGHT = "window.height"; static constexpr auto SETTING_VIDEOLIBRARY_SHOWUNWATCHEDPLOTS = "videolibrary.showunwatchedplots"; diff --git a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp index 37c5ed909eeec..0b028ebafea7d 100644 --- a/xbmc/video/dialogs/GUIDialogVideoOSD.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoOSD.cpp @@ -16,6 +16,8 @@ #include "guilib/WindowIDs.h" #include "input/InputManager.h" #include "input/actions/ActionIDs.h" +#include "settings/Settings.h" +#include "settings/SettingsComponent.h" using namespace PVR; @@ -58,6 +60,19 @@ bool CGUIDialogVideoOSD::OnAction(const CAction &action) return CGUIDialog::OnAction(action); } +void CGUIDialogVideoOSD::OnInitWindow() +{ + std::shared_ptr settings = CServiceBroker::GetSettingsComponent()->GetSettings(); + if (settings) + { + if (settings->GetBool(CSettings::SETTING_OSD_AUTOCLOSEVIDEOOSD)) + { + SetAutoClose(settings->GetInt(CSettings::SETTING_OSD_AUTOCLOSEVIDEOOSDTIME) * 1000); + } + } + CGUIDialog::OnInitWindow(); +} + EVENT_RESULT CGUIDialogVideoOSD::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_WHEEL_UP) diff --git a/xbmc/video/dialogs/GUIDialogVideoOSD.h b/xbmc/video/dialogs/GUIDialogVideoOSD.h index 95cfc9f14dfcc..dbce5da9b172c 100644 --- a/xbmc/video/dialogs/GUIDialogVideoOSD.h +++ b/xbmc/video/dialogs/GUIDialogVideoOSD.h @@ -18,6 +18,7 @@ class CGUIDialogVideoOSD : public CGUIDialog ~CGUIDialogVideoOSD(void) override; void FrameMove() override; + void OnInitWindow() override; bool OnMessage(CGUIMessage& message) override; bool OnAction(const CAction &action) override; protected: