diff options
34 files changed, 411 insertions, 233 deletions
diff --git a/.gitignore b/.gitignore index cf8cbb292e..93d21756bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1194,3 +1194,33 @@ project/Win32BuildSetup/dependencies/libcdio-10.dll /xbmc/visualizations/XBMCProjectM/libprojectM/config.inp /xbmc/win32/git_rev.h + +/system/players/dvdplayer/libdts.dll +/system/players/dvdplayer/libfaad.dll +/system/players/paplayer/AC3Codec.dll +/xbmc/cores/dvdplayer/Codecs/libdts/vc++/Debug/vs2010/libdts.lib +/xbmc/cores/dvdplayer/Codecs/libfaad2/libfaad/DebugDLL/vs2010/libfaad2.lib +/xbmc/cores/dvdplayer/Codecs/libmad/msvc++/libmad.lib +/xbmc/cores/paplayer/AC3Codec/vc++/Debug/vs2010/AC3Codec.lib +/xbmc/cores/paplayer/ADPCMCodec/adpcm.lib +/xbmc/cores/paplayer/YMCodec/StSoundLibrary/Debug/vs2010/StSoundLibrary.lib +/xbmc/lib/cmyth/Win32/Debug/vs2010/libcmyth.lib +/xbmc/lib/cximage-6.0/Debug/vs2010/cximagecrtd.lib +/xbmc/lib/libPython/Python/PC/pythonnt_rc.h +/xbmc/lib/libexif/libexif.lib +/system/players/dvdplayer/libdts.dll +/system/players/dvdplayer/libfaad.dll +/system/players/paplayer/AC3Codec.dll +/xbmc/cores/dvdplayer/Codecs/libdts/vc++/Debug/vs2010/libdts.lib +/xbmc/cores/dvdplayer/Codecs/libfaad2/libfaad/DebugDLL/vs2010/libfaad2.lib +/xbmc/cores/dvdplayer/Codecs/libmad/msvc++/libmad.lib +/xbmc/cores/paplayer/AC3Codec/vc++/Debug/vs2010/AC3Codec.lib +/xbmc/cores/paplayer/ADPCMCodec/adpcm.lib +/xbmc/cores/paplayer/YMCodec/StSoundLibrary/Debug/vs2010/StSoundLibrary.lib +/xbmc/lib/cmyth/Win32/Debug/vs2010/libcmyth.lib +/xbmc/lib/cximage-6.0/Debug/vs2010/cximagecrtd.lib +/xbmc/lib/libPython/Python/PC/pythonnt_rc.h +/xbmc/lib/libexif/libexif.lib +/system/players/dvdplayer/libdts.dll +/system/players/dvdplayer/libfaad.dll +/system/players/paplayer/AC3Codec.dll
\ No newline at end of file diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 6383f120cd..f74dd009be 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -691,6 +691,7 @@ <ClCompile Include="..\..\xbmc\rendering\RenderSystem.cpp" /> <ClCompile Include="..\..\xbmc\SectionLoader.cpp" /> <ClCompile Include="..\..\xbmc\settings\AdvancedSettings.cpp" /> + <ClCompile Include="..\..\xbmc\settings\AppParamParser.cpp" /> <ClCompile Include="..\..\xbmc\settings\GUIDialogContentSettings.cpp" /> <ClCompile Include="..\..\xbmc\settings\GUIDialogLockSettings.cpp" /> <ClCompile Include="..\..\xbmc\settings\GUIDialogProfileSettings.cpp" /> @@ -1522,6 +1523,7 @@ <ClInclude Include="..\..\xbmc\rendering\RenderSystem.h" /> <ClInclude Include="..\..\xbmc\SectionLoader.h" /> <ClInclude Include="..\..\xbmc\settings\AdvancedSettings.h" /> + <ClInclude Include="..\..\xbmc\settings\AppParamParser.h" /> <ClInclude Include="..\..\xbmc\settings\GUIDialogContentSettings.h" /> <ClInclude Include="..\..\xbmc\settings\GUIDialogLockSettings.h" /> <ClInclude Include="..\..\xbmc\settings\GUIDialogProfileSettings.h" /> @@ -2041,5 +2043,5 @@ <UserProperties RESOURCE_FILE="XBMC_PC.rc" /> </VisualStudio> </ProjectExtensions> - <Import Project="$(SolutionDir)\$(ProjectFileName).targets.user" Condition="Exists('$(SolutionDir)\$(ProjectFileName).targets.user')" /> -</Project> + <Import Project="$(SolutionDir)\$(ProjectFileName).targets.user" Condition="Exists('$(SolutionDir)\$(ProjectFileName).targets.user')" /> +</Project>
\ No newline at end of file diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index ed1eb85114..a6629fc85d 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -855,9 +855,6 @@ <ClCompile Include="..\..\xbmc\FileSystem\VirtualDirectory.cpp"> <Filter>filesystem</Filter> </ClCompile> - <ClCompile Include="..\..\xbmc\FileSystem\VirtualPathDirectory.cpp"> - <Filter>filesystem</Filter> - </ClCompile> <ClCompile Include="..\..\xbmc\FileSystem\VTPDirectory.cpp"> <Filter>filesystem</Filter> </ClCompile> @@ -2454,6 +2451,8 @@ <ClCompile Include="..\..\xbmc\utils\JSONVariantWriter.cpp"> <Filter>utils</Filter> </ClCompile> + <ClCompile Include="..\..\xbmc\settings\AppParamParser.cpp"> + <Filter>settings</Filter> </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\xbmc\win32\pch.h"> @@ -3179,9 +3178,6 @@ <ClInclude Include="..\..\xbmc\FileSystem\VideoDatabaseDirectory.h"> <Filter>filesystem</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\FileSystem\VirtualPathDirectory.h"> - <Filter>filesystem</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\FileSystem\VTPDirectory.h"> <Filter>filesystem</Filter> </ClInclude> @@ -4913,6 +4909,8 @@ <ClInclude Include="..\..\xbmc\utils\JSONVariantWriter.h"> <Filter>utils</Filter> </ClInclude> + <ClInclude Include="..\..\xbmc\settings\AppParamParser.h"> + <Filter>settings</Filter> </ClInclude> </ItemGroup> <ItemGroup> <None Include="..\..\xbmc\win32\XBMC.ico"> @@ -4929,4 +4927,4 @@ <Filter>win32</Filter> </CustomBuild> </ItemGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index c1edf30791..7a46770fd9 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -379,8 +379,7 @@ bool CApplication::OnEvent(XBMC_Event& newEvent) g_application.ProcessMouse(); break; case XBMC_VIDEORESIZE: - if (!g_application.m_bInitializing && - !g_advancedSettings.m_fullScreen) + if (!g_application.m_bInitializing && !g_advancedSettings.IsInFullScreen()) { g_Windowing.SetWindowResolution(newEvent.resize.w, newEvent.resize.h); g_graphicsContext.SetVideoResolution(RES_WINDOW, true); @@ -664,7 +663,7 @@ bool CApplication::Create() // update the window resolution g_Windowing.SetWindowResolution(g_guiSettings.GetInt("window.width"), g_guiSettings.GetInt("window.height")); - if (g_advancedSettings.m_startFullScreen && g_guiSettings.m_LookAndFeelResolution == RES_WINDOW) + if (g_advancedSettings.StartFullScreen() && g_guiSettings.m_LookAndFeelResolution == RES_WINDOW) g_guiSettings.m_LookAndFeelResolution = RES_DESKTOP; if (!g_graphicsContext.IsValidResolution(g_guiSettings.m_LookAndFeelResolution)) @@ -701,7 +700,7 @@ bool CApplication::Create() // set GUI res and force the clear of the screen g_graphicsContext.SetVideoResolution(g_guiSettings.m_LookAndFeelResolution); - if (g_advancedSettings.m_splashImage) + if (g_advancedSettings.ShowSplash()) { CStdString strUserSplash = "special://home/media/Splash.png"; if (CFile::Exists(strUserSplash)) @@ -1130,7 +1129,7 @@ bool CApplication::Initialize() FatalErrorHandler(true, true, true); } - if (g_advancedSettings.m_splashImage) + if (g_advancedSettings.ShowSplash()) SAFE_DELETE(m_splash); if (g_guiSettings.GetBool("masterlock.startuplock") && diff --git a/xbmc/Favourites.cpp b/xbmc/Favourites.cpp index 1527812266..399d42647b 100644 --- a/xbmc/Favourites.cpp +++ b/xbmc/Favourites.cpp @@ -170,8 +170,7 @@ bool CFavourites::TestParamify() CStdString CFavourites::GetExecutePath(const CFileItem *item, int contextWindow) { CStdString execute; - if (item->m_bIsFolder && (g_advancedSettings.m_playlistAsFolders || - !(item->IsSmartPlayList() || item->IsPlayList()))) + if (item->m_bIsFolder && (g_advancedSettings.ShowPlaylistAsFolders() || !(item->IsSmartPlayList() || item->IsPlayList()))) execute.Format("ActivateWindow(%i,%s)", contextWindow, Paramify(item->m_strPath)); else if (item->m_strPath.Left(9).Equals("script://")) execute.Format("RunScript(%s)", Paramify(item->m_strPath.Mid(9))); diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index 2330c0ea35..3d6fc12f84 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -607,7 +607,7 @@ bool CFileItem::IsFileFolder() const { return ( IsSmartPlayList() || - (IsPlayList() && g_advancedSettings.m_playlistAsFolders) || + (IsPlayList() && g_advancedSettings.ShowPlaylistAsFolders()) || IsZIP() || IsRAR() || IsRSS() || diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 03d9c789c6..b3361bd686 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -1824,7 +1824,7 @@ bool CGUIInfoManager::GetBool(int condition1, int contextWindow, const CGUIListI else if (condition == SYSTEM_LOGGEDON) bReturn = !(g_windowManager.GetActiveWindow() == WINDOW_LOGIN_SCREEN); else if (condition == SYSTEM_SHOW_EXIT_BUTTON) - bReturn = g_advancedSettings.m_showExitButton; + bReturn = g_advancedSettings.CanQuit(); else if (condition == SYSTEM_HAS_LOGINSCREEN) bReturn = g_settings.UsingLoginScreen(); else if (condition == WEATHER_IS_FETCHED) diff --git a/xbmc/GUIViewState.cpp b/xbmc/GUIViewState.cpp index 66c6593aa5..8a7b6b3c0e 100644 --- a/xbmc/GUIViewState.cpp +++ b/xbmc/GUIViewState.cpp @@ -350,7 +350,7 @@ VECSOURCES& CGUIViewState::GetSources() void CGUIViewState::AddAddonsSource(const CStdString &content, const CStdString &label, const CStdString &thumb) { - if (!g_advancedSettings.m_bVirtualShares) + if (!g_advancedSettings.CanUseVirtualShares()) return; CFileItemList items; diff --git a/xbmc/TextureCache.cpp b/xbmc/TextureCache.cpp index d0b7296da7..0392a40ccd 100644 --- a/xbmc/TextureCache.cpp +++ b/xbmc/TextureCache.cpp @@ -186,7 +186,7 @@ CStdString CTextureCache::CheckAndCacheImage(const CStdString &url, bool returnD CStdString ddsPath = URIUtils::ReplaceExtension(path, ".dds"); if (CFile::Exists(ddsPath)) return ddsPath; - if (g_advancedSettings.m_useDDSFanart) + if (g_advancedSettings.UseDDSFanArt()) AddJob(new CDDSJob(path)); } return path; @@ -240,7 +240,7 @@ CStdString CTextureCache::CheckAndCacheImage(const CStdString &url, bool returnD if (!hash.IsEmpty()) { AddCachedTexture(url, originalFile, hash); - if (g_advancedSettings.m_useDDSFanart) + if (g_advancedSettings.UseDDSFanArt()) AddJob(new CDDSJob(GetCachedPath(originalFile))); return GetCachedPath(originalFile); } @@ -328,7 +328,7 @@ void CTextureCache::OnJobComplete(unsigned int jobID, bool success, CJob *job) CCacheJob *cacheJob = (CCacheJob *)job; AddCachedTexture(cacheJob->m_url, cacheJob->m_original, cacheJob->m_hash); // TODO: call back to the UI indicating that it can update it's image... - if (g_advancedSettings.m_useDDSFanart) + if (g_advancedSettings.UseDDSFanArt()) AddJob(new CDDSJob(GetCachedPath(cacheJob->m_original))); } return CJobQueue::OnJobComplete(jobID, success, job); diff --git a/xbmc/cores/DummyVideoPlayer.cpp b/xbmc/cores/DummyVideoPlayer.cpp index e6f9a10435..a4799e4c21 100644 --- a/xbmc/cores/DummyVideoPlayer.cpp +++ b/xbmc/cores/DummyVideoPlayer.cpp @@ -143,7 +143,7 @@ bool CDummyVideoPlayer::CanSeek() void CDummyVideoPlayer::Seek(bool bPlus, bool bLargeStep) { - if (g_advancedSettings.m_videoUseTimeSeeking && GetTotalTime() > 2*g_advancedSettings.m_videoTimeSeekForwardBig) + if (g_advancedSettings.CanVideoUseTimeSeeking() && GetTotalTime() > 2*g_advancedSettings.m_videoTimeSeekForwardBig) { int seek = 0; if (bLargeStep) diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index c8699aa491..f672fb317e 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -359,7 +359,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput) // the advancedsetting is for allowing the user to force outputting the // 44.1 kHz DTS wav file as PCM, so that an A/V receiver can decode // it (this is temporary until we handle 44.1 kHz passthrough properly) - if (trySPDIFonly || (iformat && strcmp(iformat->name, "wav") == 0 && !g_advancedSettings.m_dvdplayerIgnoreDTSinWAV)) + if (trySPDIFonly || (iformat && strcmp(iformat->name, "wav") == 0 && !g_advancedSettings.DVDPlayerIgnoreDTSInWav())) { // check for spdif and dts // This is used with wav files and audio CDs that may contain diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index 3deae7794f..7fd2d6eecd 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -2241,7 +2241,7 @@ void CDVDPlayer::Seek(bool bPlus, bool bLargeStep) } __int64 seek; - if (g_advancedSettings.m_videoUseTimeSeeking && GetTotalTime() > 2*g_advancedSettings.m_videoTimeSeekForwardBig) + if (g_advancedSettings.CanVideoUseTimeSeeking() && GetTotalTime() > 2*g_advancedSettings.m_videoTimeSeekForwardBig) { if (bLargeStep) seek = bPlus ? g_advancedSettings.m_videoTimeSeekForwardBig : g_advancedSettings.m_videoTimeSeekBackwardBig; diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp index 6f3fc9f1a0..bea0945a36 100644 --- a/xbmc/cores/paplayer/PAPlayer.cpp +++ b/xbmc/cores/paplayer/PAPlayer.cpp @@ -837,7 +837,7 @@ bool PAPlayer::CanSeek() void PAPlayer::Seek(bool bPlus, bool bLargeStep) { __int64 seek; - if (g_advancedSettings.m_musicUseTimeSeeking && GetTotalTime() > 2*g_advancedSettings.m_musicTimeSeekForwardBig) + if (g_advancedSettings.CanMusicUseTimeSeeking() && GetTotalTime() > 2*g_advancedSettings.m_musicTimeSeekForwardBig) { if (bLargeStep) seek = bPlus ? g_advancedSettings.m_musicTimeSeekForwardBig : g_advancedSettings.m_musicTimeSeekBackwardBig; diff --git a/xbmc/filesystem/FactoryFileDirectory.cpp b/xbmc/filesystem/FactoryFileDirectory.cpp index 765bf01241..c12e1fc2bb 100644 --- a/xbmc/filesystem/FactoryFileDirectory.cpp +++ b/xbmc/filesystem/FactoryFileDirectory.cpp @@ -199,7 +199,7 @@ IFileDirectory* CFactoryFileDirectory::Create(const CStdString& strPath, CFileIt IFileDirectory* pDir=new CSmartPlaylistDirectory; return pDir; // treat as directory } - if (g_advancedSettings.m_playlistAsFolders && CPlayListFactory::IsPlaylist(strPath)) + if (g_advancedSettings.ShowPlaylistAsFolders() && CPlayListFactory::IsPlaylist(strPath)) { // Playlist file // currently we only return the directory if it contains // more than one file. Reason is that .pls and .m3u may be used diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp index 0cab11d27a..792d08f39d 100644 --- a/xbmc/guilib/GraphicContext.cpp +++ b/xbmc/guilib/GraphicContext.cpp @@ -311,15 +311,11 @@ void CGraphicContext::SetVideoResolution(RESOLUTION res, bool forceUpdate) // If the user asked us to guess, go with desktop if (res == RES_AUTORES || !IsValidResolution(res)) - { res = RES_DESKTOP; - } // If we are switching to the same resolution and same window/full-screen, no need to do anything - if (!forceUpdate && res == lastRes && m_bFullScreenRoot == g_advancedSettings.m_fullScreen) - { + if (!forceUpdate && res == lastRes && m_bFullScreenRoot == g_advancedSettings.IsInFullScreen()) return; - } //only pause when switching monitor resolution/refreshrate, //not when switching between fullscreen and windowed or when resizing the window @@ -336,16 +332,8 @@ void CGraphicContext::SetVideoResolution(RESOLUTION res, bool forceUpdate) } } - if (res >= RES_DESKTOP) - { - g_advancedSettings.m_fullScreen = true; - m_bFullScreenRoot = true; - } - else - { - g_advancedSettings.m_fullScreen = false; - m_bFullScreenRoot = false; - } + g_advancedSettings.SetFullScreenState(res >= RES_DESKTOP); + m_bFullScreenRoot = res >= RES_DESKTOP; Lock(); @@ -357,7 +345,7 @@ void CGraphicContext::SetVideoResolution(RESOLUTION res, bool forceUpdate) //tell the videoreferenceclock that we're about to change the refreshrate g_VideoReferenceClock.RefreshChanged(); - if (g_advancedSettings.m_fullScreen) + if (g_advancedSettings.IsInFullScreen()) { #if defined (__APPLE__) || defined (_WIN32) bool blankOtherDisplays = g_guiSettings.GetBool("videoscreen.blankdisplays"); diff --git a/xbmc/interfaces/json-rpc/JSONRPC.cpp b/xbmc/interfaces/json-rpc/JSONRPC.cpp index 1ddbc27eed..36d09c415f 100644 --- a/xbmc/interfaces/json-rpc/JSONRPC.cpp +++ b/xbmc/interfaces/json-rpc/JSONRPC.cpp @@ -346,7 +346,7 @@ CStdString CJSONRPC::MethodCall(const CStdString &inputString, ITransportLayer * hasResponse = true; } - CStdString str = hasResponse ? CJSONVariantWriter::Write(outputroot, g_advancedSettings.m_jsonOutputCompact) : ""; + CStdString str = hasResponse ? CJSONVariantWriter::Write(outputroot, g_advancedSettings.OutputCompactJSON()) : ""; return str; } diff --git a/xbmc/music/GUIViewStateMusic.cpp b/xbmc/music/GUIViewStateMusic.cpp index dfb6b088cb..0b84617218 100644 --- a/xbmc/music/GUIViewStateMusic.cpp +++ b/xbmc/music/GUIViewStateMusic.cpp @@ -553,7 +553,7 @@ void CGUIViewStateWindowMusicNav::SaveViewState() void CGUIViewStateWindowMusicNav::AddOnlineShares() { - if (!g_advancedSettings.m_bVirtualShares) return; + if (!g_advancedSettings.CanUseVirtualShares()) return; for (int i = 0; i < (int)g_settings.m_musicSources.size(); ++i) { CMediaSource share = g_settings.m_musicSources.at(i); diff --git a/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp b/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp index 99db6b498d..6f782c6f3d 100644 --- a/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp +++ b/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp @@ -145,7 +145,7 @@ void CGUIWindowKaraokeLyrics::newSong(CKaraokeLyrics * lyrics) m_Lyrics->GetVideoParameters( path, offset ); m_Background->StartVideo( path, offset ); } - else if ( m_Lyrics->HasBackground() && g_advancedSettings.m_karaokeAlwaysEmptyOnCdgs ) + else if ( m_Lyrics->HasBackground() && g_advancedSettings.KaraokeAlwaysEmptyOnCDGs() ) { m_Background->StartEmpty(); } diff --git a/xbmc/music/karaoke/karaokelyrics.cpp b/xbmc/music/karaoke/karaokelyrics.cpp index d9c42fd68b..8d2caf4b52 100644 --- a/xbmc/music/karaoke/karaokelyrics.cpp +++ b/xbmc/music/karaoke/karaokelyrics.cpp @@ -46,7 +46,7 @@ CKaraokeLyrics::~CKaraokeLyrics() void CKaraokeLyrics::Shutdown() { // Update the song-specific delay in the database - if ( m_idSong && m_avOrigDelay != m_avDelay && g_advancedSettings.m_karaokeKeepDelay ) + if ( m_idSong && m_avOrigDelay != m_avDelay && g_advancedSettings.KaraokeKeepDelay() ) { // If the song is in karaoke db, get the delay CMusicDatabase musicdatabase; @@ -80,7 +80,7 @@ void CKaraokeLyrics::initData( const CStdString & songPath ) CMusicDatabase musicdatabase; // Get song-specific delay from the database - if ( g_advancedSettings.m_karaokeKeepDelay && musicdatabase.Open() ) + if ( g_advancedSettings.KaraokeKeepDelay() && musicdatabase.Open() ) { CSong song; if ( musicdatabase.GetSongByFileName( songPath, song) ) diff --git a/xbmc/music/karaoke/karaokelyricscdg.cpp b/xbmc/music/karaoke/karaokelyricscdg.cpp index 4b499bc301..4cbdec8c66 100644 --- a/xbmc/music/karaoke/karaokelyricscdg.cpp +++ b/xbmc/music/karaoke/karaokelyricscdg.cpp @@ -91,8 +91,8 @@ void CKaraokeLyricsCDG::setPixel( int x, int y, BYTE color ) if ( x < 0 || y < 0 || offset > CDG_FULL_HEIGHT * CDG_FULL_WIDTH ) { - CLog::Log( LOGERROR, "CDG renderer: set pixel (%d,%d) is out of boundary", x, y ); - return; + CLog::Log( LOGERROR, "CDG renderer: set pixel (%d,%d) is out of boundary", x, y ); + return; } m_cdgScreen[offset] = color; @@ -102,18 +102,11 @@ void CKaraokeLyricsCDG::setPixel( int x, int y, BYTE color ) bool CKaraokeLyricsCDG::InitGraphics() { // set the background to be completely transparent if we use visualisations, or completely solid if not - if ( g_advancedSettings.m_karaokeAlwaysEmptyOnCdgs ) - m_bgAlpha = 0xff000000; - else - m_bgAlpha = 0; + m_bgAlpha = g_advancedSettings.KaraokeAlwaysEmptyOnCDGs() ? 0xff000000 : 0; if (!m_pCdgTexture) { - m_pCdgTexture = new CTexture( CDG_FULL_WIDTH, CDG_FULL_HEIGHT, XB_FMT_A8R8G8B8 ); - } - - if ( !m_pCdgTexture ) - { + m_pCdgTexture = new CTexture( CDG_FULL_WIDTH, CDG_FULL_HEIGHT, XB_FMT_A8R8G8B8 ); CLog::Log(LOGERROR, "CDG renderer: failed to create texture" ); return false; } diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index 1f5805a57c..b8a45f3bd2 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -888,8 +888,7 @@ void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &but buttons.Add(CONTEXT_BUTTON_QUEUE_ITEM, 13347); //queue // allow a folder to be ad-hoc queued and played by the default player - if (item->m_bIsFolder || (item->IsPlayList() && - !g_advancedSettings.m_playlistAsFolders)) + if (item->m_bIsFolder || (item->IsPlayList() && !g_advancedSettings.ShowPlaylistAsFolders())) { buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 208); // Play } diff --git a/xbmc/network/TCPServer.cpp b/xbmc/network/TCPServer.cpp index fdb0894624..9666e2542a 100644 --- a/xbmc/network/TCPServer.cpp +++ b/xbmc/network/TCPServer.cpp @@ -161,7 +161,7 @@ int CTCPServer::GetCapabilities() void CTCPServer::Announce(EAnnouncementFlag flag, const char *sender, const char *message, const CVariant &data) { - std::string str = AnnouncementToJSON(flag, sender, message, data, g_advancedSettings.m_jsonOutputCompact); + std::string str = AnnouncementToJSON(flag, sender, message, data, g_advancedSettings.OutputCompactJSON()); for (unsigned int i = 0; i < m_connections.size(); i++) { diff --git a/xbmc/rendering/dx/RenderSystemDX.cpp b/xbmc/rendering/dx/RenderSystemDX.cpp index ffc51262b1..5329e239ff 100644 --- a/xbmc/rendering/dx/RenderSystemDX.cpp +++ b/xbmc/rendering/dx/RenderSystemDX.cpp @@ -97,7 +97,7 @@ bool CRenderSystemDX::InitRenderSystem() { m_bVSync = true; - m_useD3D9Ex = (g_advancedSettings.m_AllowD3D9Ex && g_sysinfo.IsVistaOrHigher() && LoadD3D9Ex()); + m_useD3D9Ex = (g_advancedSettings.AllowD3D9Ex() && g_sysinfo.IsVistaOrHigher() && LoadD3D9Ex()); m_pD3D = NULL; if (m_useD3D9Ex) @@ -114,7 +114,7 @@ bool CRenderSystemDX::InitRenderSystem() memset(&caps, 0, sizeof(caps)); m_pD3D->GetDeviceCaps(D3DADAPTER_DEFAULT, m_devType, &caps); // Evaluate if the driver is WDDM - this detection method is not guaranteed 100% - if (!g_advancedSettings.m_ForceD3D9Ex && (!(caps.Caps2 & D3DCAPS2_CANSHARERESOURCE) || !(caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES))) + if (!g_advancedSettings.ForceD3D9Ex() && (!(caps.Caps2 & D3DCAPS2_CANSHARERESOURCE) || !(caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES))) { CLog::Log(LOGDEBUG, __FUNCTION__" - driver looks like XPDM or earlier, falling back to D3D9"); m_useD3D9Ex = false; @@ -450,7 +450,7 @@ bool CRenderSystemDX::CreateDevice() m_maxTextureSize = min(caps.MaxTextureWidth, caps.MaxTextureHeight); - if (g_advancedSettings.m_AllowDynamicTextures && m_useD3D9Ex && (caps.Caps2 & D3DCAPS2_DYNAMICTEXTURES)) + if (g_advancedSettings.AllowDynamicTextures() && m_useD3D9Ex && (caps.Caps2 & D3DCAPS2_DYNAMICTEXTURES)) { m_defaultD3DUsage = D3DUSAGE_DYNAMIC; m_defaultD3DPool = D3DPOOL_DEFAULT; diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp index b888bcb2c3..d288d62c21 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -237,8 +237,6 @@ void CAdvancedSettings::Initialize() //with ipv6. m_fullScreen = m_startFullScreen = false; - m_showExitButton = true; - m_splashImage = true; m_playlistRetries = 100; m_playlistTimeout = 20; // 20 seconds timeout @@ -249,7 +247,7 @@ void CAdvancedSettings::Initialize() m_AllowDynamicTextures = true; m_RestrictCapsMask = 0; m_sleepBeforeFlip = 0; - m_bVirtualShares = true; + m_useVirtualShares = true; //caused lots of jerks //#ifdef _WIN32 @@ -278,6 +276,10 @@ void CAdvancedSettings::Initialize() m_jsonTcpPort = 9090; m_enableMultimediaKeys = false; + + m_canQuit = true; + m_canWindowed = true; + m_showSplash = true; } bool CAdvancedSettings::Load() @@ -286,37 +288,45 @@ bool CAdvancedSettings::Load() // it should instead use the versions of GetString/Integer/Float that // don't take defaults in. Defaults are set in the constructor above Initialize(); // In case of profile switch. - CStdString advancedSettingsXML; - advancedSettingsXML = g_settings.GetUserDataItem("advancedsettings.xml"); + CStdString advancedSettingsXML = g_settings.GetUserDataItem("advancedsettings.xml"); + ParseSettingsFile("special://xbmc/system/advancedsettings.xml"); + ParseSettingsFile(advancedSettingsXML); + for (unsigned int i = 0; i < m_settingsFiles.size(); i++) + ParseSettingsFile(m_settingsFiles[i]); + return true; +} + +void CAdvancedSettings::ParseSettingsFile(CStdString file) +{ TiXmlDocument advancedXML; - if (!CFile::Exists(advancedSettingsXML)) - { // tell the user it doesn't exist - CLog::Log(LOGNOTICE, "No advancedsettings.xml to load (%s)", advancedSettingsXML.c_str()); - return false; + if (!CFile::Exists(file)) + { + CLog::Log(LOGNOTICE, "No settings file to load to load (%s)", file.c_str()); + return; } - if (!advancedXML.LoadFile(advancedSettingsXML)) + if (!advancedXML.LoadFile(file)) { - CLog::Log(LOGERROR, "Error loading %s, Line %d\n%s", advancedSettingsXML.c_str(), advancedXML.ErrorRow(), advancedXML.ErrorDesc()); - return false; + CLog::Log(LOGERROR, "Error loading %s, Line %d\n%s", file.c_str(), advancedXML.ErrorRow(), advancedXML.ErrorDesc()); + return; } TiXmlElement *pRootElement = advancedXML.RootElement(); if (!pRootElement || strcmpi(pRootElement->Value(),"advancedsettings") != 0) { - CLog::Log(LOGERROR, "Error loading %s, no <advancedsettings> node", advancedSettingsXML.c_str()); - return false; + CLog::Log(LOGERROR, "Error loading %s, no <advancedsettings> node", file.c_str()); + return; } // succeeded - tell the user it worked - CLog::Log(LOGNOTICE, "Loaded advancedsettings.xml from %s", advancedSettingsXML.c_str()); + CLog::Log(LOGNOTICE, "Loaded settings file from %s", file.c_str()); // Dump contents of AS.xml to debug log TiXmlPrinter printer; printer.SetLineBreak("\n"); printer.SetIndent(" "); advancedXML.Accept(&printer); - CLog::Log(LOGNOTICE, "Contents of %s are...\n%s", advancedSettingsXML.c_str(), printer.CStr()); + CLog::Log(LOGNOTICE, "Contents of %s are...\n%s", file.c_str(), printer.CStr()); TiXmlElement *pElement = pRootElement->FirstChildElement("audio"); if (pElement) @@ -636,9 +646,9 @@ bool CAdvancedSettings::Load() #ifdef HAS_SDL XMLUtils::GetBoolean(pRootElement, "fullscreen", m_startFullScreen); #endif - XMLUtils::GetBoolean(pRootElement, "splash", m_splashImage); - XMLUtils::GetBoolean(pRootElement, "showexitbutton", m_showExitButton); - + XMLUtils::GetBoolean(pRootElement, "showsplash", m_showSplash); + XMLUtils::GetBoolean(pRootElement, "canquit", m_canQuit); + XMLUtils::GetBoolean(pRootElement, "canwindowed", m_canWindowed); XMLUtils::GetInt(pRootElement, "songinfoduration", m_songInfoDuration, 0, INT_MAX); XMLUtils::GetInt(pRootElement, "busydialogdelay", m_busyDialogDelay, 0, 5000); XMLUtils::GetInt(pRootElement, "playlistretries", m_playlistRetries, -1, 5000); @@ -654,7 +664,7 @@ bool CAdvancedSettings::Load() XMLUtils::GetBoolean(pRootElement,"allowdynamictextures", m_AllowDynamicTextures); XMLUtils::GetUInt(pRootElement,"restrictcapsmask", m_RestrictCapsMask); XMLUtils::GetFloat(pRootElement,"sleepbeforeflip", m_sleepBeforeFlip, 0.0f, 1.0f); - XMLUtils::GetBoolean(pRootElement,"virtualshares", m_bVirtualShares); + XMLUtils::GetBoolean(pRootElement,"virtualshares", m_useVirtualShares); //Tuxbox pElement = pRootElement->FirstChildElement("tuxbox"); @@ -884,8 +894,6 @@ bool CAdvancedSettings::Load() // load in the GUISettings overrides: g_guiSettings.LoadXML(pRootElement, true); // true to hide the settings we read in - - return true; } void CAdvancedSettings::Clear() @@ -1007,3 +1015,7 @@ void CAdvancedSettings::GetCustomExtensions(TiXmlElement *pRootElement, CStdStri } } +void CAdvancedSettings::AddSettingsFile(CStdString filename) +{ + m_settingsFiles.push_back("special://xbmc/system/" + filename); +} diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h index fcfbba36e8..24a72b2255 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h @@ -68,7 +68,7 @@ class CAdvancedSettings static CAdvancedSettings* getInstance(); void Initialize(); - + void AddSettingsFile(CStdString filename); bool Load(); void Clear(); @@ -81,14 +81,16 @@ class CAdvancedSettings float m_ac3Gain; CStdString m_audioDefaultPlayer; float m_audioPlayCountMinimumPercent; - bool m_dvdplayerIgnoreDTSinWAV; + bool DVDPlayerIgnoreDTSInWav() { return m_dvdplayerIgnoreDTSinWAV; }; float m_videoSubsDelayRange; float m_videoAudioDelayRange; int m_videoSmallStepBackSeconds; int m_videoSmallStepBackTries; int m_videoSmallStepBackDelay; - bool m_videoUseTimeSeeking; + + bool CanVideoUseTimeSeeking() { return m_videoUseTimeSeeking; }; + int m_videoTimeSeekForward; int m_videoTimeSeekBackward; int m_videoTimeSeekForwardBig; @@ -99,7 +101,9 @@ class CAdvancedSettings int m_videoPercentSeekBackwardBig; CStdString m_videoPPFFmpegDeint; CStdString m_videoPPFFmpegPostProc; - bool m_musicUseTimeSeeking; + bool CanMusicUseTimeSeeking() { return m_musicUseTimeSeeking; }; + + int m_musicTimeSeekForward; int m_musicTimeSeekBackward; int m_musicTimeSeekForwardBig; @@ -138,9 +142,9 @@ class CAdvancedSettings int m_lcdAddress2; int m_lcdAddress3; int m_lcdAddress4; - bool m_lcdHeartbeat; bool m_lcdDimOnScreenSave; int m_lcdScrolldelay; + bool m_lcdHeartbeat; CStdString m_lcdHostName; int m_autoDetectPingTime; @@ -173,12 +177,12 @@ class CAdvancedSettings int m_remoteDelay; ///< \brief number of remote messages to ignore before repeating float m_controllerDeadzone; - bool m_playlistAsFolders; + bool ShowPlaylistAsFolders() { return m_playlistAsFolders; }; bool m_detectAsUdf; int m_thumbSize; int m_fanartHeight; - bool m_useDDSFanart; + bool UseDDSFanArt() { return m_useDDSFanart; }; int m_sambaclienttimeout; CStdString m_sambadoscodepage; @@ -246,30 +250,28 @@ class CAdvancedSettings int m_curlretries; bool m_curlDisableIPV6; - bool m_fullScreen; - bool m_startFullScreen; - bool m_showExitButton; /* Ideal for appliances to hide a 'useless' button */ - bool m_splashImage; - bool m_alwaysOnTop; /* makes xbmc to run always on top .. osx/win32 only .. */ + + bool AlwaysOnTop() { return m_alwaysOnTop; }; /* makes xbmc to run always on top .. osx/win32 only .. */ int m_playlistRetries; int m_playlistTimeout; - bool m_GLRectangleHack; + bool UseGLRectangeHack() { return m_GLRectangleHack; }; int m_iSkipLoopFilter; float m_ForcedSwapTime; /* if nonzero, set's the explicit time in ms to allocate for buffer swap */ - bool m_AllowD3D9Ex; - bool m_ForceD3D9Ex; - bool m_AllowDynamicTextures; + bool AllowD3D9Ex() { return m_AllowD3D9Ex; }; + bool ForceD3D9Ex() { return m_ForceD3D9Ex; }; + bool AllowDynamicTextures() { return m_AllowDynamicTextures; }; unsigned int m_RestrictCapsMask; float m_sleepBeforeFlip; ///< if greather than zero, XBMC waits for raster to be this amount through the frame prior to calling the flip - bool m_bVirtualShares; + + bool CanUseVirtualShares() { return m_useVirtualShares; }; float m_karaokeSyncDelayCDG; // seems like different delay is needed for CDG and MP3s float m_karaokeSyncDelayLRC; bool m_karaokeChangeGenreForKaraokeSongs; - bool m_karaokeKeepDelay; // store user-changed song delay in the database + bool KaraokeKeepDelay() { return m_karaokeKeepDelay; }; // store user-changed song delay in the database int m_karaokeStartIndex; // auto-assign numbering start from this value - bool m_karaokeAlwaysEmptyOnCdgs; // always have empty background on CDG files + bool KaraokeAlwaysEmptyOnCDGs() { return m_karaokeAlwaysEmptyOnCdgs; }; // always have empty background on CDG files bool m_karaokeUseSongSpecificBackground; // use song-specific video or image if available instead of default CStdString m_karaokeDefaultBackgroundType; // empty string or "vis", "image" or "video" CStdString m_karaokeDefaultBackgroundFilePath; // only for "image" or "video" types above @@ -278,18 +280,50 @@ class CAdvancedSettings CStdString m_gpuTempCmd; int m_bgInfoLoaderMaxThreads; - bool m_measureRefreshrate; //when true the videoreferenceclock will measure the refreshrate when direct3d is used - //otherwise it will use the windows refreshrate + bool MeasureRefreshRate() { return m_measureRefreshrate; }; //when true the videoreferenceclock will measure the refreshrate when direct3d is used + //otherwise it will use the windows refreshrate DatabaseSettings m_databaseMusic; // advanced music database setup DatabaseSettings m_databaseVideo; // advanced video database setup unsigned int m_cacheMemBufferSize; - - bool m_jsonOutputCompact; unsigned int m_jsonTcpPort; + bool IsInFullScreen() { return m_fullScreen; }; + void SetFullScreenState(bool isFullScreen) { m_fullScreen = isFullScreen; }; + bool StartFullScreen() { return m_startFullScreen; }; + void SetStartFullScreen(bool startFullScreen) { m_startFullScreen = startFullScreen; }; + bool OutputCompactJSON() { return m_jsonOutputCompact; }; + bool EnableMultimediaKeys() { return m_enableMultimediaKeys; }; + bool CanQuit() { return m_canQuit; }; + bool CanWindowed() { return m_canWindowed; }; + bool ShowSplash() { return m_showSplash; }; + private: + bool m_videoUseTimeSeeking; + bool m_musicUseTimeSeeking; + bool m_measureRefreshrate; + bool m_fullScreen; + bool m_startFullScreen; + bool m_jsonOutputCompact; bool m_enableMultimediaKeys; + bool m_canQuit; + bool m_canWindowed; + bool m_showSplash; + bool m_useVirtualShares; + bool m_alwaysOnTop; + bool m_GLRectangleHack; + bool m_AllowD3D9Ex; + bool m_ForceD3D9Ex; + bool m_AllowDynamicTextures; + bool m_playlistAsFolders; + bool m_useDDSFanart; + bool m_dvdplayerIgnoreDTSinWAV; + /* Karaoke Settings */ + bool m_karaokeAlwaysEmptyOnCdgs; + bool m_karaokeKeepDelay; + + std::vector<CStdString> m_settingsFiles; + void ParseSettingsFile(CStdString file); }; -XBMC_GLOBAL(CAdvancedSettings,g_advancedSettings); +XBMC_GLOBAL(CAdvancedSettings,g_advancedSettings);
\ No newline at end of file diff --git a/xbmc/settings/AppParamParser.cpp b/xbmc/settings/AppParamParser.cpp new file mode 100644 index 0000000000..3409a7af31 --- /dev/null +++ b/xbmc/settings/AppParamParser.cpp @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://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, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "AppParamParser.h" +#include "AdvancedSettings.h" +#include "PlayListPlayer.h" +#include "FileItem.h" +#include "Application.h" +#include "log.h" +#include "utils/CharsetConverter.h" +#ifdef _WIN32 +#include "WIN32Util.h" +#endif +#ifdef HAS_LIRC +#include "input/linux/LIRC.h" +#endif + +CAppParamParser::CAppParamParser() +{ + m_testmode = false; +} + +#ifdef _WIN32 +void CAppParamParser::Parse(LPWSTR *szArglist, int nArgs) +{ + if (szArglist != NULL) + { + for (int i=0;i<nArgs;i++) + { + CStdString strArg; + g_charsetConverter.wToUTF8(szArglist[i], strArg); + ParseArg(strArg); + if (strArg.Equals("-d")) + { + if (++i < nArgs) + { + int iSleep = _wtoi(szArglist[i]); + if (iSleep > 0 && iSleep < 360) + Sleep(iSleep*1000); + else + --i; + } + } + } + LocalFree(szArglist); + } + PlayPlaylist(); +} +#else +void CAppParamParser::Parse(char* argv[], int nArgs) +{ + if (nArgs > 1) + { + for (int i = 1; i < nArgs; i++) + { + ParseArg(argv[i]); +#ifdef HAS_LIRC + if (strnicmp(argv[i], "-l", 2) == 0 || strnicmp(argv[i], "--lircdev", 9) == 0) + { + // check the next arg with the proper value. + int next=i+1; + if (next < nArgs) + { + if ((argv[next][0] != '-' ) && (argv[next][0] == '/' )) + { + g_RemoteControl.setDeviceName(argv[next]); + i++; + } + } + } + else if (strnicmp(argv[i], "-n", 2) == 0 || strnicmp(argv[i], "--nolirc", 8) == 0) + g_RemoteControl.setUsed(false); +#endif + } + } + PlayPlaylist(); +} +#endif + +void CAppParamParser::DisplayHelp() +{ + printf("Usage: xbmc [OPTION]... [FILE]...\n\n"); + printf("Arguments:\n"); + printf(" -fs\t\t\tRuns XBMC in full screen\n"); + printf(" --standalone\t\tXBMC runs in a stand alone environment without a window \n"); + printf("\t\t\tmanager and supporting applications. For example, that\n"); + printf("\t\t\tenables network settings.\n"); + printf(" -p or --portable\tXBMC will look for configurations in install folder instead of ~/.xbmc\n"); + printf(" --legacy-res\t\tEnables screen resolutions such as PAL, NTSC, etc.\n"); +#ifdef HAS_LIRC + printf(" -l or --lircdev\tLircDevice to use default is "LIRC_DEVICE" .\n"); + printf(" -n or --nolirc\tdo not use Lirc, i.e. no remote input.\n"); +#endif + printf(" --debug\t\tEnable debug logging\n"); + printf(" --test\t\tEnable test mode. [FILE] required.\n"); + printf(" --settings=<filename>\t\tLoads specified file after advancedsettings.xml replacing any settings specified\n"); + printf(" \t\t\t\tspecified file must exist in special://xbmc/system/\n"); + exit(0); +} + +void CAppParamParser::EnableDebugMode() +{ + g_advancedSettings.m_logLevel = LOG_LEVEL_DEBUG; + g_advancedSettings.m_logLevelHint = LOG_LEVEL_DEBUG; + CLog::SetLogLevel(g_advancedSettings.m_logLevel); +} + +void CAppParamParser::SetStartFullScreen() +{ + g_advancedSettings.SetStartFullScreen(true); +} + +void CAppParamParser::SetIsStandalone() +{ + g_application.SetStandAlone(true); +} + +void CAppParamParser::SetPortable() +{ + g_application.EnablePlatformDirectories(false); +} + +void CAppParamParser::ParseArg(CStdString arg) +{ + if (arg == "-fs" || arg == "--fullscreen") + SetStartFullScreen(); + else if (arg == "-h" || arg == "--help") + DisplayHelp(); + else if (arg == "--standalone") + SetIsStandalone(); + else if (arg == "-p" || arg == "--portable") + SetPortable(); + else if (arg == "--debug") + EnableDebugMode(); + else if (arg == "--legacy-res") + g_application.SetEnableLegacyRes(true); + else if (arg == "--test") + m_testmode = true; + else if (arg.substr(0, 11) == "--settings=") + { + g_advancedSettings.AddSettingsFile(arg.substr(11)); + } + else if (arg.length() != 0 && arg[0] != '-') + { + if (m_testmode) + g_application.SetEnableTestMode(true); + CFileItemPtr pItem(new CFileItem(arg)); + pItem->m_strPath = arg; + m_playlist.Add(pItem); + } +} + +void CAppParamParser::PlayPlaylist() +{ + if (m_playlist.Size() > 0) + { + g_playlistPlayer.Add(0, m_playlist); + g_playlistPlayer.SetCurrentPlaylist(0); + } + + ThreadMessage tMsg = {TMSG_PLAYLISTPLAYER_PLAY, (DWORD) -1}; + g_application.getApplicationMessenger().SendMessage(tMsg, false); +} diff --git a/xbmc/settings/AppParamParser.h b/xbmc/settings/AppParamParser.h new file mode 100644 index 0000000000..02483efe95 --- /dev/null +++ b/xbmc/settings/AppParamParser.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://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, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#ifdef _WIN32 +#include "WIN32Util.h" +#endif +#include "PlayListPlayer.h" +#include "FileItem.h" + +class CAppParamParser +{ + public: + CAppParamParser(); +#ifdef _WIN32 + void Parse(LPWSTR *szArglist, int nArgs); +#else + void Parse(char* argv[], int nArgs); +#endif + private: + bool m_testmode; + CFileItemList m_playlist; + void ParseArg(CStdString arg); + void DisplayHelp(); + void EnableDebugMode(); + void SetStartFullScreen(); + void SetIsStandalone(); + void SetPortable(); + void PlayPlaylist(); +};
\ No newline at end of file diff --git a/xbmc/settings/GUIWindowSettingsCategory.cpp b/xbmc/settings/GUIWindowSettingsCategory.cpp index c7f68366cf..88e1dda697 100644 --- a/xbmc/settings/GUIWindowSettingsCategory.cpp +++ b/xbmc/settings/GUIWindowSettingsCategory.cpp @@ -2322,7 +2322,8 @@ DisplayMode CGUIWindowSettingsCategory::FillInScreens(CStdString strSetting, RES pControl->Clear(); CStdString strScreen; - pControl->AddLabel(g_localizeStrings.Get(242), -1); + if (g_advancedSettings.CanWindowed()) + pControl->AddLabel(g_localizeStrings.Get(242), -1); for (int idx = 0; idx < g_Windowing.GetNumScreens(); idx++) { diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp index 07fed65ed5..0215093647 100644 --- a/xbmc/video/VideoReferenceClock.cpp +++ b/xbmc/video/VideoReferenceClock.cpp @@ -659,7 +659,7 @@ bool CVideoReferenceClock::SetupD3D() //forced update of windows refreshrate UpdateRefreshrate(true); - if (g_advancedSettings.m_measureRefreshrate) + if (g_advancedSettings.MeasureRefreshRate()) { //measure the refreshrate a couple times list<double> Measures; diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index d4dae281ad..aefa29453c 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -1092,13 +1092,12 @@ void CGUIWindowVideoBase::GetContextButtons(int itemNumber, CContextButtons &but } // allow a folder to be ad-hoc queued and played by the default player - if (item->m_bIsFolder || (item->IsPlayList() && - !g_advancedSettings.m_playlistAsFolders)) + if (item->m_bIsFolder || (item->IsPlayList() && !g_advancedSettings.ShowPlaylistAsFolders())) { buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 208); } } - if (!item->m_bIsFolder && !(item->IsPlayList() && !g_advancedSettings.m_playlistAsFolders)) + if (!item->m_bIsFolder && !(item->IsPlayList() && !g_advancedSettings.ShowPlaylistAsFolders())) { // get players VECPLAYERCORES vecCores; if (item->IsVideoDb()) diff --git a/xbmc/win32/XBMC_PC.cpp b/xbmc/win32/XBMC_PC.cpp index 4e98e120cc..dcf3134bb4 100644 --- a/xbmc/win32/XBMC_PC.cpp +++ b/xbmc/win32/XBMC_PC.cpp @@ -20,6 +20,7 @@ */ #include "settings/AdvancedSettings.h" +#include "settings/AppParamParser.h" #include "utils/log.h" #include "WIN32Util.h" #include "shellapi.h" @@ -151,35 +152,10 @@ INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR commandLine, INT ) setlocale(LC_NUMERIC, "C"); g_advancedSettings.Initialize(); szArglist = CommandLineToArgvW(strcl.c_str(), &nArgs); - if(szArglist != NULL) - { - for(int i=0;i<nArgs;i++) - { - CStdStringW strArgW(szArglist[i]); - if(strArgW.Equals(L"-fs")) - g_advancedSettings.m_startFullScreen = true; - else if(strArgW.Equals(L"-p") || strArgW.Equals(L"--portable")) - g_application.EnablePlatformDirectories(false); - else if(strArgW.Equals(L"-d")) - { - if(++i < nArgs) - { - int iSleep = _wtoi(szArglist[i]); - if(iSleep > 0 && iSleep < 360) - Sleep(iSleep*1000); - else - --i; - } - } - else if(strArgW.Equals(L"--debug")) - { - g_advancedSettings.m_logLevel = LOG_LEVEL_DEBUG; - g_advancedSettings.m_logLevelHint = LOG_LEVEL_DEBUG; - CLog::SetLogLevel(g_advancedSettings.m_logLevel); - } - } - LocalFree(szArglist); - } +#ifdef _WIN32 + CAppParamParser appParamParser = CAppParamParser(); + appParamParser.Parse(szArglist, nArgs); +#endif WSADATA wd; WSAStartup(MAKEWORD(2,2), &wd); diff --git a/xbmc/windowing/windows/WinEventsWin32.cpp b/xbmc/windowing/windows/WinEventsWin32.cpp index 755c4bdb0c..6f8a4c6653 100644 --- a/xbmc/windowing/windows/WinEventsWin32.cpp +++ b/xbmc/windowing/windows/WinEventsWin32.cpp @@ -202,7 +202,7 @@ void DIB_InitOSKeymap() // Only include the multimedia keys if they have been enabled in the // advanced settings - if (g_advancedSettings.m_enableMultimediaKeys) + if (g_advancedSettings.EnableMultimediaKeys()) { VK_keymap[VK_BROWSER_BACK] = XBMCK_BROWSER_BACK; VK_keymap[VK_BROWSER_FORWARD] = XBMCK_BROWSER_FORWARD; diff --git a/xbmc/windowing/windows/WinSystemWin32.cpp b/xbmc/windowing/windows/WinSystemWin32.cpp index d4b3cac6c8..101e8edbc9 100644 --- a/xbmc/windowing/windows/WinSystemWin32.cpp +++ b/xbmc/windowing/windows/WinSystemWin32.cpp @@ -377,7 +377,7 @@ bool CWinSystemWin32::ResizeInternal(bool forceRefresh) else { dwStyle |= WS_OVERLAPPEDWINDOW; - windowAfter = g_advancedSettings.m_alwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST; + windowAfter = g_advancedSettings.AlwaysOnTop() ? HWND_TOPMOST : HWND_NOTOPMOST; if(m_nTop <= 0 || m_nLeft <= 0) CenterWindow(); @@ -665,7 +665,7 @@ bool CWinSystemWin32::Show(bool raise) if (m_bFullScreen) windowAfter = HWND_TOP; else - windowAfter = g_advancedSettings.m_alwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST; + windowAfter = g_advancedSettings.AlwaysOnTop() ? HWND_TOPMOST : HWND_NOTOPMOST; } SetWindowPos(m_hWnd, windowAfter, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); diff --git a/xbmc/xbmc.cpp b/xbmc/xbmc.cpp index a960c7eabd..f0c6268d93 100644 --- a/xbmc/xbmc.cpp +++ b/xbmc/xbmc.cpp @@ -28,6 +28,7 @@ // #include "system.h" +#include "settings/AppParamParser.h" #include "settings/AdvancedSettings.h" #include "FileItem.h" #include "Application.h" @@ -58,7 +59,6 @@ int main(int argc, char* argv[]) #endif CLog::SetLogLevel(g_advancedSettings.m_logLevel); - CFileItemList playlist; #ifdef _LINUX #if defined(DEBUG) struct rlimit rlim; @@ -76,82 +76,11 @@ int main(int argc, char* argv[]) #endif setlocale(LC_NUMERIC, "C"); g_advancedSettings.Initialize(); - bool testmode = 0; - if (argc > 1) - { - for (int i = 1; i < argc; i++) - { - if (strnicmp(argv[i], "-fs", 3) == 0 || strnicmp(argv[i], "--fullscreen", 12) == 0) - { - g_advancedSettings.m_startFullScreen = true; - } - else if (strnicmp(argv[i], "-h", 2) == 0 || strnicmp(argv[i], "--help", 6) == 0) - { - printf("Usage: %s [OPTION]... [FILE]...\n\n", argv[0]); - printf("Arguments:\n"); - printf(" -fs\t\t\tRuns XBMC in full screen\n"); - printf(" --standalone\t\tXBMC runs in a stand alone environment without a window \n"); - printf("\t\t\tmanager and supporting applications. For example, that\n"); - printf("\t\t\tenables network settings.\n"); - printf(" -p or --portable\tXBMC will look for configurations in install folder instead of ~/.xbmc\n"); - printf(" --legacy-res\t\tEnables screen resolutions such as PAL, NTSC, etc.\n"); -#ifdef HAS_LIRC - printf(" -l or --lircdev\tLircDevice to use default is "LIRC_DEVICE" .\n"); - printf(" -n or --nolirc\tdo not use Lirc, aka no remote input.\n"); + +#ifndef _WIN32 + CAppParamParser appParamParser = CAppParamParser(); + appParamParser.Parse(argv); #endif - printf(" --debug\t\tEnable debug logging\n"); - printf(" --test\t\tEnable test mode. [FILE] required.\n"); - exit(0); - } - else if (strnicmp(argv[i], "--standalone", 12) == 0) - { - g_application.SetStandAlone(true); - } - else if (strnicmp(argv[i], "-p", 2) == 0 || strnicmp(argv[i], "--portable", 10) == 0) - { - g_application.EnablePlatformDirectories(false); - } - else if (strnicmp(argv[i], "--legacy-res", 12) == 0) - { - g_application.SetEnableLegacyRes(true); - } - else if (strnicmp(argv[i], "--test", 6) == 0) - { - testmode=1; - } -#ifdef HAS_LIRC - else if (strnicmp(argv[i], "-l", 2) == 0 || strnicmp(argv[i], "--lircdev", 9) == 0) - { - // check the next arg with the proper value. - int next=i+1; - if (next < argc) - { - if ((argv[next][0] != '-' ) && (argv[next][0] == '/' )) - { - g_RemoteControl.setDeviceName(argv[next]); - i++; - } - } - } - else if (strnicmp(argv[i], "-n", 2) == 0 || strnicmp(argv[i], "--nolirc", 8) == 0) - g_RemoteControl.setUsed(false); -#endif - else if (strnicmp(argv[i], "--debug", 7) == 0) - { - g_advancedSettings.m_logLevel = LOG_LEVEL_DEBUG; - g_advancedSettings.m_logLevelHint = LOG_LEVEL_DEBUG; - CLog::SetLogLevel(g_advancedSettings.m_logLevel); - } - else if (strlen(argv[i]) != 0 && argv[i][0] != '-') - { - CFileItemPtr pItem(new CFileItem(argv[i])); - pItem->m_strPath = argv[i]; - if (testmode) g_application.SetEnableTestMode(true); - playlist.Add(pItem); - } - } - } - g_application.Preflight(); if (!g_application.Create()) { @@ -159,15 +88,6 @@ int main(int argc, char* argv[]) return status; } - if (playlist.Size() > 0) - { - g_playlistPlayer.Add(0,playlist); - g_playlistPlayer.SetCurrentPlaylist(0); - } - - ThreadMessage tMsg = {TMSG_PLAYLISTPLAYER_PLAY, (DWORD) -1}; - g_application.getApplicationMessenger().SendMessage(tMsg, false); - try { status = g_application.Run(); |