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(); }
void CMediaSettingsPage::OnOK() { UpdateData(); Settings.MediaPlayer.EnablePlay = ( m_bEnablePlay != FALSE ); Settings.MediaPlayer.EnableEnqueue = ( m_bEnableEnqueue != FALSE ); Settings.MediaPlayer.ServicePath.clear(); // Re-add previous external mediaplayers. ToDo: Some way to clear them? int nSelected = m_wndServices.GetCurSel(); if ( nSelected == CUSTOM_INDEX ) nSelected = INTERNAL_INDEX; const 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 += L'*'; // SELECTED_PLAYER_TOKEN Settings.MediaPlayer.ServicePath.insert( *psPlayer ); } Settings.MediaPlayer.ShortPaths = ( nSelected != INTERNAL_INDEX ); // No MAX_LENGTH issues with internal service only? CSettingsSheet* pSheet = GetSheet(); for ( INT_PTR nPage = 0; nPage < pSheet->GetPageCount(); nPage++ ) { if ( CSettingsPage* pPage = pSheet->GetPage( nPage ) ) { CString strClass( pPage->GetRuntimeClass()->m_lpszClassName ); if ( strClass == L"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.IsEmpty() ) Settings.MediaPlayer.FileTypes.insert( str ); } CSettingsPage::OnOK(); }