diff options
author | Jonathan Marshall <jmarshall@never.you.mind> | 2012-10-15 21:04:04 +1300 |
---|---|---|
committer | Jonathan Marshall <jmarshall@never.you.mind> | 2013-04-05 15:51:47 +1300 |
commit | 8fcb671e0d253f8d85bd8eaa66a0f84e554c3117 (patch) | |
tree | cb685f61395237185ae554e144f0a9c25c034670 | |
parent | ed0775a26edc3ad4f1e1465093b2061c9772e48a (diff) |
allow fullscreen actions such as next subtitle, audio stream, audio/subs delay etc. to be handled in other places
-rw-r--r-- | XBMC-ATV2.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | XBMC-IOS.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | XBMC.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj | 2 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj.filters | 6 | ||||
-rw-r--r-- | xbmc/Application.cpp | 6 | ||||
-rw-r--r-- | xbmc/Application.h | 2 | ||||
-rw-r--r-- | xbmc/video/Makefile | 1 | ||||
-rw-r--r-- | xbmc/video/PlayerController.cpp | 414 | ||||
-rw-r--r-- | xbmc/video/PlayerController.h | 61 | ||||
-rw-r--r-- | xbmc/video/windows/GUIWindowFullScreen.cpp | 357 | ||||
-rw-r--r-- | xbmc/video/windows/GUIWindowFullScreen.h | 18 |
12 files changed, 513 insertions, 372 deletions
diff --git a/XBMC-ATV2.xcodeproj/project.pbxproj b/XBMC-ATV2.xcodeproj/project.pbxproj index 90ad7c785a..5f5cfe14f0 100644 --- a/XBMC-ATV2.xcodeproj/project.pbxproj +++ b/XBMC-ATV2.xcodeproj/project.pbxproj @@ -41,6 +41,7 @@ 7C6EB586155E3EC80080368A /* ImageFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C6EB584155E3EC80080368A /* ImageFile.cpp */; }; 7C6EB708155F3B160080368A /* HTTPImageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C6EB706155F3B160080368A /* HTTPImageHandler.cpp */; }; 7C7CEB4B165629BF0059C9EB /* AELimiter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7CEB49165629BF0059C9EB /* AELimiter.cpp */; }; + 7C87B2EE162CE3F400EF897D /* PlayerController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C87B2EC162CE3F400EF897D /* PlayerController.cpp */; }; 7C89627013B702F3003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89626E13B702F3003631FE /* GUIWindowScreensaverDim.cpp */; }; 7C99B7AA134072CD00FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7A8134072CD00FC2B16 /* GUIDialogPlayEject.cpp */; }; 7CC30DF2162925BE003E7579 /* MusicThumbLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC30DF0162925BE003E7579 /* MusicThumbLoader.cpp */; }; @@ -1107,6 +1108,8 @@ 7C6EB707155F3B160080368A /* HTTPImageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPImageHandler.h; sourceTree = "<group>"; }; 7C7CEB49165629BF0059C9EB /* AELimiter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AELimiter.cpp; sourceTree = "<group>"; }; 7C7CEB4A165629BF0059C9EB /* AELimiter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AELimiter.h; sourceTree = "<group>"; }; + 7C87B2EC162CE3F400EF897D /* PlayerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayerController.cpp; sourceTree = "<group>"; }; + 7C87B2ED162CE3F400EF897D /* PlayerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerController.h; sourceTree = "<group>"; }; 7C89626E13B702F3003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; }; 7C89626F13B702F3003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.h; sourceTree = "<group>"; }; 7C99B7A8134072CD00FC2B16 /* GUIDialogPlayEject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogPlayEject.cpp; sourceTree = "<group>"; }; @@ -5934,6 +5937,8 @@ DF07255416873565008DCAAD /* FFmpegVideoDecoder.h */, F56C779C131EC154000AD0F6 /* GUIViewStateVideo.cpp */, F56C779D131EC154000AD0F6 /* GUIViewStateVideo.h */, + 7C87B2EC162CE3F400EF897D /* PlayerController.cpp */, + 7C87B2ED162CE3F400EF897D /* PlayerController.h */, F56C779E131EC154000AD0F6 /* Teletext.cpp */, F56C779F131EC154000AD0F6 /* Teletext.h */, F56C77A0131EC154000AD0F6 /* TeletextDefines.h */, @@ -7733,6 +7738,7 @@ DF28EDEB170E1ACF005FA9D2 /* ProfilesManager.cpp in Sources */, DF28EDEC170E1ACF005FA9D2 /* GUIWindowSettingsProfile.cpp in Sources */, DF28EE16170E1E8D005FA9D2 /* DisplaySettings.cpp in Sources */, + 7C87B2EE162CE3F400EF897D /* PlayerController.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/XBMC-IOS.xcodeproj/project.pbxproj b/XBMC-IOS.xcodeproj/project.pbxproj index ed18d9e375..b45aea83de 100644 --- a/XBMC-IOS.xcodeproj/project.pbxproj +++ b/XBMC-IOS.xcodeproj/project.pbxproj @@ -45,6 +45,7 @@ 7C6EB570155E3E680080368A /* ImageFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C6EB56E155E3E680080368A /* ImageFile.cpp */; }; 7C6EB71A155F3B330080368A /* HTTPImageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C6EB718155F3B330080368A /* HTTPImageHandler.cpp */; }; 7C7CEB5F165629F90059C9EB /* AELimiter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7CEB5D165629F90059C9EB /* AELimiter.cpp */; }; + 7C87B2DA162CE3C300EF897D /* PlayerController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C87B2D8162CE3C300EF897D /* PlayerController.cpp */; }; 7C89628013B7031E003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89627E13B7031E003631FE /* GUIWindowScreensaverDim.cpp */; }; 7C99B7BE1340730000FC2B16 /* GUIDialogPlayEject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C99B7BC1340730000FC2B16 /* GUIDialogPlayEject.cpp */; }; 7CC30E04162925E6003E7579 /* MusicThumbLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CC30E02162925E6003E7579 /* MusicThumbLoader.cpp */; }; @@ -1124,6 +1125,8 @@ 7C6EB719155F3B330080368A /* HTTPImageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPImageHandler.h; sourceTree = "<group>"; }; 7C7CEB5D165629F90059C9EB /* AELimiter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AELimiter.cpp; sourceTree = "<group>"; }; 7C7CEB5E165629F90059C9EB /* AELimiter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AELimiter.h; sourceTree = "<group>"; }; + 7C87B2D8162CE3C300EF897D /* PlayerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayerController.cpp; sourceTree = "<group>"; }; + 7C87B2D9162CE3C300EF897D /* PlayerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerController.h; sourceTree = "<group>"; }; 7C89627E13B7031E003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; }; 7C89627F13B7031E003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.h; sourceTree = "<group>"; }; 7C99B7BC1340730000FC2B16 /* GUIDialogPlayEject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogPlayEject.cpp; sourceTree = "<group>"; }; @@ -6347,6 +6350,8 @@ DF0725431687352C008DCAAD /* FFmpegVideoDecoder.h */, F56C878B131F42EC000AD0F6 /* GUIViewStateVideo.cpp */, F56C878C131F42EC000AD0F6 /* GUIViewStateVideo.h */, + 7C87B2D8162CE3C300EF897D /* PlayerController.cpp */, + 7C87B2D9162CE3C300EF897D /* PlayerController.h */, F56C878D131F42EC000AD0F6 /* Teletext.cpp */, F56C878E131F42EC000AD0F6 /* Teletext.h */, F56C878F131F42EC000AD0F6 /* TeletextDefines.h */, @@ -7804,6 +7809,7 @@ DF28EDC8170E1A92005FA9D2 /* ProfilesManager.cpp in Sources */, DF28EDC9170E1A92005FA9D2 /* GUIWindowSettingsProfile.cpp in Sources */, DF28EE0C170E1E78005FA9D2 /* DisplaySettings.cpp in Sources */, + 7C87B2DA162CE3C300EF897D /* PlayerController.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index 0b8774e374..5be23e0d31 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -268,6 +268,7 @@ 7C7B2B301134F36400713D6D /* mysqldataset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7B2B2E1134F36400713D6D /* mysqldataset.cpp */; }; 7C7CEAF1165629530059C9EB /* AELimiter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C7CEAEF165629530059C9EB /* AELimiter.cpp */; }; 7C84A59E12FA3C1600CD1714 /* SourcesDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C84A59C12FA3C1600CD1714 /* SourcesDirectory.cpp */; }; + 7C87B2CE162CE39600EF897D /* PlayerController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C87B2CC162CE39600EF897D /* PlayerController.cpp */; }; 7C89619213B6A16F003631FE /* GUIWindowScreensaverDim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89619013B6A16F003631FE /* GUIWindowScreensaverDim.cpp */; }; 7C89674613C03B22003631FE /* InfoBool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89674313C03B22003631FE /* InfoBool.cpp */; }; 7C8A14571154CB2600E5FCFA /* TextureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8A14541154CB2600E5FCFA /* TextureCache.cpp */; }; @@ -1608,6 +1609,8 @@ 7C7CEAF0165629530059C9EB /* AELimiter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AELimiter.h; sourceTree = "<group>"; }; 7C84A59C12FA3C1600CD1714 /* SourcesDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SourcesDirectory.cpp; path = xbmc/filesystem/SourcesDirectory.cpp; sourceTree = SOURCE_ROOT; }; 7C84A59D12FA3C1600CD1714 /* SourcesDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SourcesDirectory.h; path = xbmc/filesystem/SourcesDirectory.h; sourceTree = SOURCE_ROOT; }; + 7C87B2CC162CE39600EF897D /* PlayerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayerController.cpp; sourceTree = "<group>"; }; + 7C87B2CD162CE39600EF897D /* PlayerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerController.h; sourceTree = "<group>"; }; 7C89619013B6A16F003631FE /* GUIWindowScreensaverDim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowScreensaverDim.cpp; sourceTree = "<group>"; }; 7C89619113B6A16F003631FE /* GUIWindowScreensaverDim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowScreensaverDim.h; sourceTree = "<group>"; }; 7C89674313C03B22003631FE /* InfoBool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InfoBool.cpp; sourceTree = "<group>"; }; @@ -4163,6 +4166,8 @@ DF072533168734ED008DCAAD /* FFmpegVideoDecoder.h */, E38E17FF0D25F9FA00618676 /* GUIViewStateVideo.cpp */, E38E18000D25F9FA00618676 /* GUIViewStateVideo.h */, + 7C87B2CC162CE39600EF897D /* PlayerController.cpp */, + 7C87B2CD162CE39600EF897D /* PlayerController.h */, F5E55B6E10741340006E788A /* Teletext.cpp */, F5E55B6D10741340006E788A /* Teletext.h */, F5E55B6F10741340006E788A /* TeletextDefines.h */, @@ -7804,6 +7809,7 @@ DF28EDA7170E1A11005FA9D2 /* ProfilesManager.cpp in Sources */, DF28EDA8170E1A11005FA9D2 /* GUIWindowSettingsProfile.cpp in Sources */, DF28EE03170E1E51005FA9D2 /* DisplaySettings.cpp in Sources */, + 7C87B2CE162CE39600EF897D /* PlayerController.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 58989577c7..54984bcec7 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -1269,6 +1269,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">true</ExcludedFromBuild> </ClCompile> <ClCompile Include="..\..\xbmc\utils\Vector.cpp" /> + <ClCompile Include="..\..\xbmc\video\PlayerController.cpp" /> <ClCompile Include="..\..\xbmc\video\VideoThumbLoader.cpp" /> <ClCompile Include="..\..\xbmc\music\MusicThumbLoader.cpp" /> <ClCompile Include="..\..\xbmc\ThumbnailCache.cpp" /> @@ -2406,6 +2407,7 @@ <ClInclude Include="..\..\xbmc\TextureDatabase.h" /> <ClInclude Include="..\..\xbmc\DatabaseManager.h" /> <ClInclude Include="..\..\xbmc\ThumbLoader.h" /> + <ClInclude Include="..\..\xbmc\video\PlayerController.h" /> <ClInclude Include="..\..\xbmc\video\VideoThumbLoader.h" /> <ClInclude Include="..\..\xbmc\music\MusicThumbLoader.h" /> <ClInclude Include="..\..\xbmc\ThumbnailCache.h" /> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index af63fbdc82..a7dbbde4d0 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -3018,6 +3018,9 @@ <ClCompile Include="..\..\xbmc\utils\Vector.cpp"> <Filter>utils</Filter> </ClCompile> + <ClCompile Include="..\..\xbmc\video\PlayerController.cpp"> + <Filter>video</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\xbmc\win32\pch.h"> @@ -5900,6 +5903,9 @@ <ClInclude Include="..\..\xbmc\utils\Vector.h"> <Filter>utils</Filter> </ClInclude> + <ClInclude Include="..\..\xbmc\video\PlayerController.h"> + <Filter>video</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc"> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 2593287302..092b0fd28c 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -214,6 +214,7 @@ #include "music/dialogs/GUIDialogMusicOverlay.h" #include "video/dialogs/GUIDialogVideoOverlay.h" #include "video/VideoInfoScanner.h" +#include "video/PlayerController.h" // Dialog includes #include "music/dialogs/GUIDialogMusicOSD.h" @@ -393,6 +394,7 @@ CApplication::CApplication(void) , m_videoInfoScanner(new CVideoInfoScanner) , m_musicInfoScanner(new CMusicInfoScanner) , m_seekHandler(new CSeekHandler) + , m_playerController(new CPlayerController) { m_network = NULL; TiXmlBase::SetCondenseWhiteSpace(false); @@ -474,6 +476,7 @@ CApplication::~CApplication(void) delete m_dpms; delete m_seekHandler; + delete m_playerController; delete m_pInertialScrollingHandler; } @@ -2878,6 +2881,9 @@ bool CApplication::OnAction(const CAction &action) return true; } } + + if (m_playerController->OnAction(action)) + return true; } diff --git a/xbmc/Application.h b/xbmc/Application.h index 0b4dc4dad9..978e007123 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -44,6 +44,7 @@ namespace MEDIA_DETECT { class CAutorun; } +class CPlayerController; #include "cores/IPlayerCallback.h" #include "cores/playercorefactory/PlayerCoreFactory.h" @@ -468,6 +469,7 @@ protected: void CreateUserDirs(); CSeekHandler *m_seekHandler; + CPlayerController *m_playerController; CInertialScrollingHandler *m_pInertialScrollingHandler; CNetwork *m_network; #ifdef HAS_PERFORMANCE_SAMPLE diff --git a/xbmc/video/Makefile b/xbmc/video/Makefile index 56449c033e..45b29c642f 100644 --- a/xbmc/video/Makefile +++ b/xbmc/video/Makefile @@ -1,6 +1,7 @@ SRCS=Bookmark.cpp \ FFmpegVideoDecoder.cpp \ GUIViewStateVideo.cpp \ + PlayerController.cpp \ Teletext.cpp \ VideoDatabase.cpp \ VideoDbUrl.cpp \ diff --git a/xbmc/video/PlayerController.cpp b/xbmc/video/PlayerController.cpp new file mode 100644 index 0000000000..d4d8e47d03 --- /dev/null +++ b/xbmc/video/PlayerController.cpp @@ -0,0 +1,414 @@ +/* + * Copyright (C) 2012-2013 Team XBMC + * http://www.xbmc.org + * + * 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/>. + * + */ + +#include "PlayerController.h" +#include "utils/StdString.h" +#include "settings/AdvancedSettings.h" +#include "settings/GUISettings.h" +#include "settings/MediaSettings.h" +#include "settings/DisplaySettings.h" +#include "cores/IPlayer.h" +#include "guilib/Key.h" +#include "guilib/LocalizeStrings.h" +#include "guilib/GUISliderControl.h" +#include "dialogs/GUIDialogKaiToast.h" +#include "video/dialogs/GUIDialogAudioSubtitleSettings.h" +#ifdef HAS_VIDEO_PLAYBACK +#include "cores/VideoRenderers/RenderManager.h" +#endif +#include "Application.h" + +CPlayerController::CPlayerController() +{ + m_sliderAction = 0; +} + +CPlayerController::~CPlayerController() +{ +} + +bool CPlayerController::OnAction(const CAction &action) +{ + const unsigned int MsgTime = 300; + const unsigned int DisplTime = 2000; + + switch (action.GetID()) + { + case ACTION_SHOW_SUBTITLES: + { + if (g_application.m_pPlayer->GetSubtitleCount() == 0) + return true; + + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = !CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn; + g_application.m_pPlayer->SetSubtitleVisible(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); + CStdString sub, lang; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) + { + SPlayerSubtitleStreamInfo info; + g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info); + sub = info.name; + if (sub != info.language) + sub.Format("%s [%s]", sub.c_str(), info.language.c_str()); + } + else + sub = g_localizeStrings.Get(1223); + CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, + g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime); + return true; + } + + case ACTION_NEXT_SUBTITLE: + { + if (g_application.m_pPlayer->GetSubtitleCount() == 0) + return true; + + if(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream < 0) + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream = g_application.m_pPlayer->GetSubtitle(); + + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) + { + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream++; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream >= g_application.m_pPlayer->GetSubtitleCount()) + { + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream = 0; + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = false; + g_application.m_pPlayer->SetSubtitleVisible(false); + } + g_application.m_pPlayer->SetSubtitle(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream); + } + else + { + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = true; + g_application.m_pPlayer->SetSubtitleVisible(true); + } + + CStdString sub, lang; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) + { + SPlayerSubtitleStreamInfo info; + g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info); + sub = info.name; + if (sub != info.language) + sub.Format("%s [%s]", sub.c_str(), info.language.c_str()); + } + else + sub = g_localizeStrings.Get(1223); + CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime); + return true; + } + + case ACTION_SUBTITLE_DELAY_MIN: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay -= 0.1f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay < -g_advancedSettings.m_videoSubsDelayRange) + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = -g_advancedSettings.m_videoSubsDelayRange; + if (g_application.m_pPlayer) + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); + + ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, + -g_advancedSettings.m_videoSubsDelayRange, 0.1f, + g_advancedSettings.m_videoSubsDelayRange); + return true; + } + + case ACTION_SUBTITLE_DELAY_PLUS: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay += 0.1f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay > g_advancedSettings.m_videoSubsDelayRange) + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = g_advancedSettings.m_videoSubsDelayRange; + if (g_application.m_pPlayer) + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); + + ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, + -g_advancedSettings.m_videoSubsDelayRange, 0.1f, + g_advancedSettings.m_videoSubsDelayRange); + return true; + } + + case ACTION_SUBTITLE_DELAY: + { + ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, + -g_advancedSettings.m_videoSubsDelayRange, 0.1f, + g_advancedSettings.m_videoSubsDelayRange, true); + return true; + } + + case ACTION_AUDIO_DELAY: + { + ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, + -g_advancedSettings.m_videoAudioDelayRange, 0.025f, + g_advancedSettings.m_videoAudioDelayRange, true); + return true; + } + + case ACTION_AUDIO_DELAY_MIN: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay -= 0.025f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay < -g_advancedSettings.m_videoAudioDelayRange) + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = -g_advancedSettings.m_videoAudioDelayRange; + if (g_application.m_pPlayer) + g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); + + ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, + -g_advancedSettings.m_videoAudioDelayRange, 0.025f, + g_advancedSettings.m_videoAudioDelayRange); + return true; + } + + case ACTION_AUDIO_DELAY_PLUS: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay += 0.025f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay > g_advancedSettings.m_videoAudioDelayRange) + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = g_advancedSettings.m_videoAudioDelayRange; + if (g_application.m_pPlayer) + g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); + + ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, + -g_advancedSettings.m_videoAudioDelayRange, 0.025f, + g_advancedSettings.m_videoAudioDelayRange); + return true; + } + + case ACTION_AUDIO_NEXT_LANGUAGE: + { + if (g_application.m_pPlayer->GetAudioStreamCount() == 1) + return true; + + if(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream < 0) + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = g_application.m_pPlayer->GetAudioStream(); + + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream++; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream >= g_application.m_pPlayer->GetAudioStreamCount()) + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = 0; + g_application.m_pPlayer->SetAudioStream(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream); // Set the audio stream to the one selected + CStdString aud; + SPlayerAudioStreamInfo info; + g_application.m_pPlayer->GetAudioStreamInfo(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream, info); + aud = info.name; + CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime); + return true; + } + + case ACTION_ZOOM_IN: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount += 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount > 2.f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 2.f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 216, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); + return true; + } + + case ACTION_ZOOM_OUT: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount -= 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount < 0.5f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 0.5f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 216, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); + return true; + } + + case ACTION_INCREASE_PAR: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio += 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio > 2.f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 2.f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 217, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); + return true; + } + + case ACTION_DECREASE_PAR: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio -= 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount < 0.5f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio = 0.5f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 217, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); + return true; + } + + case ACTION_VSHIFT_UP: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift -= 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift < -2.0f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = -2.0f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 225, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); + return true; + } + + case ACTION_VSHIFT_DOWN: + { + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift += 0.01f; + if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift > 2.0f) + CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = 2.0f; + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; + g_renderManager.SetViewMode(ViewModeCustom); + ShowSlider(action.GetID(), 225, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); + return true; + } + + case ACTION_SUBTITLE_VSHIFT_UP: + { + RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()); + int subalign = g_guiSettings.GetInt("subtitles.align"); + if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE)) + { + res_info.iSubtitles ++; + if (res_info.iSubtitles >= res_info.iHeight) + res_info.iSubtitles = res_info.iHeight - 1; + + ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); + } + else + { + res_info.iSubtitles --; + if (res_info.iSubtitles < 0) + res_info.iSubtitles = 0; + + if (subalign == SUBTITLE_ALIGN_MANUAL) + ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); + else + ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f); + } + return true; + } + + case ACTION_SUBTITLE_VSHIFT_DOWN: + { + RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()); + int subalign = g_guiSettings.GetInt("subtitles.align"); + if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE)) + { + res_info.iSubtitles--; + if (res_info.iSubtitles < 0) + res_info.iSubtitles = 0; + + ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); + } + else + { + res_info.iSubtitles++; + if (res_info.iSubtitles >= res_info.iHeight) + res_info.iSubtitles = res_info.iHeight - 1; + + if (subalign == SUBTITLE_ALIGN_MANUAL) + ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); + else + ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f); + } + return true; + } + + case ACTION_SUBTITLE_ALIGN: + { + RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()); + int subalign = g_guiSettings.GetInt("subtitles.align"); + + subalign++; + if (subalign > SUBTITLE_ALIGN_TOP_OUTSIDE) + subalign = SUBTITLE_ALIGN_MANUAL; + + res_info.iSubtitles = res_info.iHeight - 1; + + g_guiSettings.SetInt("subtitles.align", subalign); + CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, + g_localizeStrings.Get(21460), + g_localizeStrings.Get(21461 + subalign), + TOAST_DISPLAY_TIME, false); + return true; + } + + case ACTION_VOLAMP_UP: + case ACTION_VOLAMP_DOWN: + { + float sliderMax = VOLUME_DRC_MAXIMUM / 100.0f; + float sliderMin = VOLUME_DRC_MINIMUM / 100.0f; + + if (action.GetID() == ACTION_VOLAMP_UP) + CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification += 1.0f; + else + CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification -= 1.0f; + + CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification = + std::max(std::min(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMax), sliderMin); + + if (g_application.m_pPlayer) + g_application.m_pPlayer->SetDynamicRangeCompression((long)(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification * 100)); + + ShowSlider(action.GetID(), 660, CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMin, 1.0f, sliderMax); + return true; + } + + default: + break; + } + return false; +} + +void CPlayerController::ShowSlider(int action, int label, float value, float min, float delta, float max, bool modal) +{ + m_sliderAction = action; + if (modal) + CGUIDialogSlider::ShowAndGetInput(g_localizeStrings.Get(label), value, min, delta, max, this); + else + CGUIDialogSlider::Display(label, value, min, delta, max, this); +} + +void CPlayerController::OnSliderChange(void *data, CGUISliderControl *slider) +{ + if (!slider) + return; + + if (m_sliderAction == ACTION_ZOOM_OUT || m_sliderAction == ACTION_ZOOM_IN || + m_sliderAction == ACTION_INCREASE_PAR || m_sliderAction == ACTION_DECREASE_PAR || + m_sliderAction == ACTION_VSHIFT_UP || m_sliderAction == ACTION_VSHIFT_DOWN || + m_sliderAction == ACTION_SUBTITLE_VSHIFT_UP || m_sliderAction == ACTION_SUBTITLE_VSHIFT_DOWN) + { + CStdString strValue; + strValue.Format("%1.2f",slider->GetFloatValue()); + slider->SetTextValue(strValue); + } + else if (m_sliderAction == ACTION_VOLAMP_UP || m_sliderAction == ACTION_VOLAMP_DOWN) + slider->SetTextValue(CGUIDialogAudioSubtitleSettings::FormatDecibel(slider->GetFloatValue(), 1.0f)); + else + slider->SetTextValue(CGUIDialogAudioSubtitleSettings::FormatDelay(slider->GetFloatValue(), 0.025f)); + + if (g_application.m_pPlayer) + { + if (m_sliderAction == ACTION_AUDIO_DELAY) + { + CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = slider->GetFloatValue(); + g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); + } + else if (m_sliderAction == ACTION_SUBTITLE_DELAY) + { + CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = slider->GetFloatValue(); + g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); + } + } +} diff --git a/xbmc/video/PlayerController.h b/xbmc/video/PlayerController.h new file mode 100644 index 0000000000..51ade6aeb2 --- /dev/null +++ b/xbmc/video/PlayerController.h @@ -0,0 +1,61 @@ +#pragma once + +/* + * Copyright (C) 2012 Team XBMC + * http://www.xbmc.org + * + * 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/>. + * + */ + +#include "dialogs/GUIDialogSlider.h" + +/*! \brief Player controller class to handle user actions. + + Handles actions that are normally suited to fullscreen playback, such as + altering subtitles and audio tracks, changing aspect ratio, subtitle placement, + and placement of the video on screen. + */ +class CPlayerController : public ISliderCallback +{ +public: + CPlayerController(); + virtual ~CPlayerController(); + + /*! \brief Perform a player control action if appropriate. + \param action the action to perform. + \return true if the action is considered handled, false if it should be handled elsewhere. + */ + bool OnAction(const CAction &action); + + /*! \brief Callback from the slider dialog. + \sa CGUIDialogSlider + */ + virtual void OnSliderChange(void *data, CGUISliderControl *slider); + +private: + /*! \brief pop up a slider dialog for a particular action + \param action id of the action the slider responds to + \param label id of the label to display + \param value value to set on the slider + \param min minimum value the slider may take + \param delta change value to advance the slider by with each click + \param max maximal value the slider may take + \param modal true if we should wait for the slider to finish. Defaults to false + */ + void ShowSlider(int action, int label, float value, float min, float delta, float max, bool modal = false); + + int m_sliderAction; ///< \brief set to the action id for a slider being displayed \sa ShowSlider +}; diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp index 943e588aac..91daeeff77 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.cpp +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp @@ -37,10 +37,7 @@ #include "guilib/GUIWindowManager.h" #include "guilib/Key.h" #include "video/dialogs/GUIDialogFullScreenInfo.h" -#include "video/dialogs/GUIDialogAudioSubtitleSettings.h" #include "dialogs/GUIDialogNumeric.h" -#include "dialogs/GUIDialogKaiToast.h" -#include "guilib/GUISliderControl.h" #include "settings/DisplaySettings.h" #include "settings/Settings.h" #include "settings/MediaSettings.h" @@ -104,7 +101,6 @@ CGUIWindowFullScreen::CGUIWindowFullScreen(void) m_bShowCurrentTime = false; m_subsLayout = NULL; m_bGroupSelectShow = false; - m_sliderAction = 0; m_loadType = KEEP_IN_MEMORY; // audio // - language @@ -144,9 +140,6 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) } } - const unsigned int MsgTime = 300; - const unsigned int DisplTime = 2000; - switch (action.GetID()) { case ACTION_SHOW_OSD: @@ -220,30 +213,6 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) return true; break; - case ACTION_SHOW_SUBTITLES: - { - if (g_application.m_pPlayer->GetSubtitleCount() == 0) - return true; - - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = !CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn; - g_application.m_pPlayer->SetSubtitleVisible(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn); - CStdString sub, lang; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) - { - SPlayerSubtitleStreamInfo info; - g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info); - sub = info.name; - if (sub != info.language) - sub.Format("%s [%s]", sub.c_str(), info.language.c_str()); - } - else - sub = g_localizeStrings.Get(1223); - CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, - g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime); - } - return true; - break; - case ACTION_SHOW_INFO: { CGUIDialogFullScreenInfo* pDialog = (CGUIDialogFullScreenInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO); @@ -256,127 +225,6 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) break; } - case ACTION_NEXT_SUBTITLE: - { - if (g_application.m_pPlayer->GetSubtitleCount() == 0) - return true; - - if(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream < 0) - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream = g_application.m_pPlayer->GetSubtitle(); - - if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) - { - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream++; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream >= g_application.m_pPlayer->GetSubtitleCount()) - { - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream = 0; - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = false; - g_application.m_pPlayer->SetSubtitleVisible(false); - } - g_application.m_pPlayer->SetSubtitle(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream); - } - else - { - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn = true; - g_application.m_pPlayer->SetSubtitleVisible(true); - } - - CStdString sub, lang; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleOn) - { - SPlayerSubtitleStreamInfo info; - g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info); - sub = info.name; - if (sub != info.language) - sub.Format("%s [%s]", sub.c_str(), info.language.c_str()); - } - else - sub = g_localizeStrings.Get(1223); - CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(287), sub, DisplTime, false, MsgTime); - } - return true; - break; - - case ACTION_SUBTITLE_DELAY_MIN: - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay -= 0.1f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay < -g_advancedSettings.m_videoSubsDelayRange) - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = -g_advancedSettings.m_videoSubsDelayRange; - if (g_application.m_pPlayer) - g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); - - ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, - -g_advancedSettings.m_videoSubsDelayRange, 0.1f, - g_advancedSettings.m_videoSubsDelayRange); - return true; - break; - case ACTION_SUBTITLE_DELAY_PLUS: - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay += 0.1f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay > g_advancedSettings.m_videoSubsDelayRange) - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = g_advancedSettings.m_videoSubsDelayRange; - if (g_application.m_pPlayer) - g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); - - ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, - -g_advancedSettings.m_videoSubsDelayRange, 0.1f, - g_advancedSettings.m_videoSubsDelayRange); - return true; - break; - case ACTION_SUBTITLE_DELAY: - ShowSlider(action.GetID(), 22006, CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay, - -g_advancedSettings.m_videoSubsDelayRange, 0.1f, - g_advancedSettings.m_videoSubsDelayRange, true); - return true; - break; - case ACTION_AUDIO_DELAY: - ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, - -g_advancedSettings.m_videoAudioDelayRange, 0.025f, - g_advancedSettings.m_videoAudioDelayRange, true); - return true; - break; - case ACTION_AUDIO_DELAY_MIN: - CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay -= 0.025f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay < -g_advancedSettings.m_videoAudioDelayRange) - CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = -g_advancedSettings.m_videoAudioDelayRange; - if (g_application.m_pPlayer) - g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); - - ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, - -g_advancedSettings.m_videoAudioDelayRange, 0.025f, - g_advancedSettings.m_videoAudioDelayRange); - return true; - break; - case ACTION_AUDIO_DELAY_PLUS: - CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay += 0.025f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay > g_advancedSettings.m_videoAudioDelayRange) - CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = g_advancedSettings.m_videoAudioDelayRange; - if (g_application.m_pPlayer) - g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); - - ShowSlider(action.GetID(), 297, CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay, - -g_advancedSettings.m_videoAudioDelayRange, 0.025f, - g_advancedSettings.m_videoAudioDelayRange); - return true; - break; - case ACTION_AUDIO_NEXT_LANGUAGE: - { - if (g_application.m_pPlayer->GetAudioStreamCount() == 1) - return true; - - if(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream < 0) - CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = g_application.m_pPlayer->GetAudioStream(); - - CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream++; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream >= g_application.m_pPlayer->GetAudioStreamCount()) - CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = 0; - g_application.m_pPlayer->SetAudioStream(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream); // Set the audio stream to the one selected - CStdString aud; - SPlayerAudioStreamInfo info; - g_application.m_pPlayer->GetAudioStreamInfo(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream, info); - aud = info.name; - CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime); - return true; - } - break; case REMOTE_0: case REMOTE_1: case REMOTE_2: @@ -466,164 +314,6 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) } return true; break; - case ACTION_ZOOM_IN: - { - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount += 0.01f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount > 2.f) - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 2.f; - CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; - g_renderManager.SetViewMode(ViewModeCustom); - ShowSlider(action.GetID(), 216, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); - } - return true; - break; - case ACTION_ZOOM_OUT: - { - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount -= 0.01f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount < 0.5f) - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 0.5f; - CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; - g_renderManager.SetViewMode(ViewModeCustom); - ShowSlider(action.GetID(), 216, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount, 0.5f, 0.1f, 2.0f); - } - return true; - break; - case ACTION_INCREASE_PAR: - { - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio += 0.01f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio > 2.f) - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount = 2.f; - CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; - g_renderManager.SetViewMode(ViewModeCustom); - ShowSlider(action.GetID(), 217, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); - } - return true; - break; - case ACTION_DECREASE_PAR: - { - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio -= 0.01f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomZoomAmount < 0.5f) - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio = 0.5f; - CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; - g_renderManager.SetViewMode(ViewModeCustom); - ShowSlider(action.GetID(), 217, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomPixelRatio, 0.5f, 0.1f, 2.0f); - } - return true; - break; - case ACTION_VSHIFT_UP: - { - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift -= 0.01f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift < -2.0f) - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = -2.0f; - CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; - g_renderManager.SetViewMode(ViewModeCustom); - ShowSlider(action.GetID(), 225, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); - } - return true; - break; - case ACTION_VSHIFT_DOWN: - { - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift += 0.01f; - if (CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift > 2.0f) - CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift = 2.0f; - CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode = ViewModeCustom; - g_renderManager.SetViewMode(ViewModeCustom); - ShowSlider(action.GetID(), 225, CMediaSettings::Get().GetCurrentVideoSettings().m_CustomVerticalShift, -2.0f, 0.1f, 2.0f); - } - return true; - break; - case ACTION_SUBTITLE_VSHIFT_UP: - { - RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()); - int subalign = g_guiSettings.GetInt("subtitles.align"); - if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE)) - { - res_info.iSubtitles ++; - if (res_info.iSubtitles >= res_info.iHeight) - res_info.iSubtitles = res_info.iHeight - 1; - - ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); - } - else - { - res_info.iSubtitles --; - if (res_info.iSubtitles < 0) - res_info.iSubtitles = 0; - - if (subalign == SUBTITLE_ALIGN_MANUAL) - ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); - else - ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f); - } - - break; - } - case ACTION_SUBTITLE_VSHIFT_DOWN: - { - RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()); - int subalign = g_guiSettings.GetInt("subtitles.align"); - if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE)) - { - res_info.iSubtitles--; - if (res_info.iSubtitles < 0) - res_info.iSubtitles = 0; - - ShowSlider(action.GetID(), 274, (float) res_info.iHeight - res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); - } - else - { - res_info.iSubtitles++; - if (res_info.iSubtitles >= res_info.iHeight) - res_info.iSubtitles = res_info.iHeight - 1; - - if (subalign == SUBTITLE_ALIGN_MANUAL) - ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles, 0.0f, 1.0f, (float) res_info.iHeight); - else - ShowSlider(action.GetID(), 274, (float) res_info.iSubtitles - res_info.iHeight, (float) -res_info.iHeight, -1.0f, 0.0f); - } - - break; - } - case ACTION_SUBTITLE_ALIGN: - { - RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()); - int subalign = g_guiSettings.GetInt("subtitles.align"); - - subalign++; - if (subalign > SUBTITLE_ALIGN_TOP_OUTSIDE) - subalign = SUBTITLE_ALIGN_MANUAL; - - res_info.iSubtitles = res_info.iHeight - 1; - - g_guiSettings.SetInt("subtitles.align", subalign); - CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, - g_localizeStrings.Get(21460), - g_localizeStrings.Get(21461 + subalign), - TOAST_DISPLAY_TIME, false); - - break; - } - case ACTION_VOLAMP_UP: - case ACTION_VOLAMP_DOWN: - { - float sliderMax = VOLUME_DRC_MAXIMUM / 100.0f; - float sliderMin = VOLUME_DRC_MINIMUM / 100.0f; - - if (action.GetID() == ACTION_VOLAMP_UP) - CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification += 1.0f; - else - CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification -= 1.0f; - - CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification = - std::max(std::min(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMax), sliderMin); - - if (g_application.m_pPlayer) - g_application.m_pPlayer->SetDynamicRangeCompression((long)(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification * 100)); - - ShowSlider(action.GetID(), 660, CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification, sliderMin, 1.0f, sliderMax); - - break; - } case ACTION_PREVIOUS_CHANNELGROUP: { if (g_application.CurrentFileItem().HasPVRChannelInfoTag()) @@ -736,8 +426,8 @@ bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message) { CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT); if (pDialog) pDialog->Close(true); - CGUIDialogSlider *slider = (CGUIDialogSlider *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER); - if (slider) slider->Close(true); + pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER); + if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD); if (pDialog) pDialog->Close(true); pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO); @@ -1206,49 +896,6 @@ void CGUIWindowFullScreen::SeekChapter(int iChapter) g_infoManager.SetDisplayAfterSeek(); } -void CGUIWindowFullScreen::ShowSlider(int action, int label, float value, float min, float delta, float max, bool modal) -{ - m_sliderAction = action; - if (modal) - CGUIDialogSlider::ShowAndGetInput(g_localizeStrings.Get(label), value, min, delta, max, this); - else - CGUIDialogSlider::Display(label, value, min, delta, max, this); -} - -void CGUIWindowFullScreen::OnSliderChange(void *data, CGUISliderControl *slider) -{ - if (!slider) - return; - - if (m_sliderAction == ACTION_ZOOM_OUT || m_sliderAction == ACTION_ZOOM_IN || - m_sliderAction == ACTION_INCREASE_PAR || m_sliderAction == ACTION_DECREASE_PAR || - m_sliderAction == ACTION_VSHIFT_UP || m_sliderAction == ACTION_VSHIFT_DOWN || - m_sliderAction == ACTION_SUBTITLE_VSHIFT_UP || m_sliderAction == ACTION_SUBTITLE_VSHIFT_DOWN) - { - CStdString strValue; - strValue.Format("%1.2f",slider->GetFloatValue()); - slider->SetTextValue(strValue); - } - else if (m_sliderAction == ACTION_VOLAMP_UP || m_sliderAction == ACTION_VOLAMP_DOWN) - slider->SetTextValue(CGUIDialogAudioSubtitleSettings::FormatDecibel(slider->GetFloatValue(), 1.0f)); - else - slider->SetTextValue(CGUIDialogAudioSubtitleSettings::FormatDelay(slider->GetFloatValue(), 0.025f)); - - if (g_application.m_pPlayer) - { - if (m_sliderAction == ACTION_AUDIO_DELAY) - { - CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay = slider->GetFloatValue(); - g_application.m_pPlayer->SetAVDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay); - } - else if (m_sliderAction == ACTION_SUBTITLE_DELAY) - { - CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay = slider->GetFloatValue(); - g_application.m_pPlayer->SetSubTitleDelay(CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleDelay); - } - } -} - void CGUIWindowFullScreen::FillInTVGroups() { if (!g_PVRManager.IsStarted()) diff --git a/xbmc/video/windows/GUIWindowFullScreen.h b/xbmc/video/windows/GUIWindowFullScreen.h index 73bc06e830..c0df83491f 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.h +++ b/xbmc/video/windows/GUIWindowFullScreen.h @@ -22,12 +22,10 @@ #include "guilib/GUIWindow.h" #include "threads/CriticalSection.h" -#include "dialogs/GUIDialogSlider.h" class CGUITextLayout; // forward -class CGUIWindowFullScreen : - public CGUIWindow, public ISliderCallback +class CGUIWindowFullScreen : public CGUIWindow { public: CGUIWindowFullScreen(void); @@ -41,7 +39,6 @@ public: void ChangetheTimeCode(int remote); void ChangetheTVGroup(bool next); - virtual void OnSliderChange(void *data, CGUISliderControl *slider); protected: virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); @@ -64,17 +61,6 @@ private: */ double GetTimeCodeStamp(); - /*! \brief pop up a slider dialog for a particular action - \param action id of the action the slider responds to - \param label id of the label to display - \param value value to set on the slider - \param min minimum value the slider may take - \param delta change value to advance the slider by with each click - \param max maximal value the slider may take - \param modal true if we should wait for the slider to finish. Defaults to false - */ - void ShowSlider(int action, int label, float value, float min, float delta, float max, bool modal = false); - bool m_bShowViewModeInfo; unsigned int m_dwShowViewModeTimeout; CGUIInfoBool m_showCodec; @@ -87,8 +73,6 @@ private: int m_timeCodeStamp[6]; int m_timeCodePosition; - int m_sliderAction; ///< \brief set to the action id for a slider being displayed \sa ShowSlider - CCriticalSection m_fontLock; CGUITextLayout* m_subsLayout; }; |