CSettingsPage* CSettingsSheet::GetPage(LPCTSTR pszClass) const { for ( int nPage = 0 ; nPage < GetPageCount() ; nPage++ ) { CSettingsPage* pPage = GetPage( nPage ); if ( _tcscmp( CString( pPage->GetRuntimeClass()->m_lpszClassName ), pszClass ) == 0 ) return pPage; } return NULL; }
void CMediaSettingsPage::OnOK() { UpdateData(); Settings.MediaPlayer.EnablePlay = ( m_bEnablePlay != FALSE ); Settings.MediaPlayer.EnableEnqueue = ( m_bEnableEnqueue != FALSE ); int nSelected = m_wndServices.GetCurSel(); if ( nSelected == nCustomIndex ) nSelected = nSnareazaIndex; Settings.MediaPlayer.ServicePath.clear(); int nCount = m_wndServices.GetCount(); for( int i = 0; i < nCount; ++i ) { CString* psPlayer = (CString*)m_wndServices.GetItemDataPtr( i ); if ( ! psPlayer ) continue; if ( i == nSelected ) *psPlayer += _T("*"); Settings.MediaPlayer.ServicePath.insert( *psPlayer ); } if ( nSelected == nSnareazaIndex ) // Shareaza Media Player is selected Settings.MediaPlayer.ShortPaths = FALSE; CSettingsSheet* pSheet = GetSheet(); for ( INT_PTR nPage = 0 ; nPage < pSheet->GetPageCount() ; nPage++ ) { CSettingsPage* pPage = pSheet->GetPage( nPage ); if ( pPage ) { CString strClass( pPage->GetRuntimeClass()->m_lpszClassName ); if ( strClass == _T("CPluginsSettingsPage") ) { CPluginsSettingsPage* pPluginPage = static_cast< CPluginsSettingsPage* >( pPage ); pPluginPage->UpdateList(); break; } } } Settings.MediaPlayer.FileTypes.clear(); for ( int nItem = 0 ; nItem < m_wndList.GetCount() ; nItem++ ) { CString str; m_wndList.GetLBText( nItem, str ); if ( str.GetLength() ) { Settings.MediaPlayer.FileTypes.insert( str ); } } CSettingsPage::OnOK(); }