// Called when the selection changes void CLibraryFileView::CheckDynamicBar() { bool bIsMusicBrainz = false; ClearServicePages(); CLibraryFrame* pFrame = GetFrame(); if ( _tcscmp( pFrame->GetDynamicBarName(), L"WebServices.MusicBrainz" ) == 0 ) bIsMusicBrainz = true; if ( GetSelectedCount() != 1 ) { if ( bIsMusicBrainz ) { pFrame->SetDynamicBar( NULL ); m_bRequestingService = FALSE; // ToDo: Abort operation } return; } CSingleLock pLock( &Library.m_pSection, TRUE ); CLibraryFile* pFile = GetSelectedFile(); if ( pFile == NULL ) // Ghost file { pFrame->SetDynamicBar( NULL ); m_bRequestingService = FALSE; return; } if ( ! pFile->IsSchemaURI( CSchema::uriAudio ) || pFile->m_pMetadata == NULL ) { if ( bIsMusicBrainz ) pFrame->SetDynamicBar( NULL ); m_bRequestingService = FALSE; // ToDo: Abort operation return; } CMetaList* pMetaList = new CMetaList(); pMetaList->Setup( pFile->m_pSchema, FALSE ); pMetaList->Combine( pFile->m_pMetadata ); pLock.Unlock(); if ( ! pMetaList->IsMusicBrainz() && bIsMusicBrainz ) pFrame->SetDynamicBar( NULL ); else pFrame->HideDynamicBar(); m_bRequestingService = FALSE; // ToDo: Abort operation delete pMetaList; }
void CLibraryFileView::OnMusicBrainzLookup() { CLibraryFrame* pFrame = GetFrame(); pFrame->SetDynamicBar( L"WebServices.MusicBrainz" ); }