void CMusicLibraryQueue::CleanLibrary(bool showDialog /* = false */) { CGUIDialogProgress* progress = NULL; if (showDialog) { progress = g_windowManager.GetWindow<CGUIDialogProgress>(WINDOW_DIALOG_PROGRESS); if (progress) { progress->SetHeading(CVariant{ 700 }); progress->SetPercentage(0); progress->Open(); progress->ShowProgressBar(true); } } CMusicLibraryCleaningJob* cleaningJob = new CMusicLibraryCleaningJob(progress); AddJob(cleaningJob); // Wait for cleaning to complete or be canceled, but render every 20ms so that the // pointer movements work on dialog even when cleaning is reporting progress infrequently if (progress) progress->Wait(20); }
void CMusicLibraryQueue::ExportLibrary(const CLibExportSettings& settings, bool showDialog /* = false */) { CGUIDialogProgress* progress = NULL; if (showDialog) { progress = g_windowManager.GetWindow<CGUIDialogProgress>(WINDOW_DIALOG_PROGRESS); if (progress) { progress->SetHeading(CVariant{ 20196 }); //"Export music library" progress->SetText(CVariant{ 650 }); //"Exporting" progress->SetPercentage(0); progress->Open(); progress->ShowProgressBar(true); } } CMusicLibraryExportJob* exportJob = new CMusicLibraryExportJob(settings, progress); if (showDialog) { AddJob(exportJob); // Wait for export to complete or be canceled, but render every 10ms so that the // pointer movements work on dialog even when export is reporting progress infrequently if (progress) progress->Wait(); } else { m_modal = true; exportJob->DoWork(); delete exportJob; m_modal = false; Refresh(); } }
void CGUIDialogMusicInfo::RefreshInfo() { // Double check we have permission (button should be hidden when not) const CProfilesManager &profileManager = CServiceBroker::GetProfileManager(); if (!profileManager.GetCurrentProfile().canWriteDatabases() && !g_passwordManager.bMasterUser) return; // Check if scanning if (g_application.IsMusicScanning()) { HELPERS::ShowOKDialogText(CVariant{ 189 }, CVariant{ 14057 }); return; } CGUIDialogProgress* dlgProgress = CServiceBroker::GetGUI()->GetWindowManager(). GetWindow<CGUIDialogProgress>(WINDOW_DIALOG_PROGRESS); if (!dlgProgress) return; if (m_bArtistInfo) { // Show dialog box indicating we're searching for the artist dlgProgress->SetHeading(CVariant{ 21889 }); dlgProgress->SetLine(0, CVariant{ m_artist.strArtist }); dlgProgress->SetLine(1, CVariant{ "" }); dlgProgress->SetLine(2, CVariant{ "" }); } else { // Show dialog box indicating we're searching for the album dlgProgress->SetHeading(CVariant{ 185 }); dlgProgress->SetLine(0, CVariant{ m_album.strAlbum }); dlgProgress->SetLine(1, CVariant{ m_album.strArtistDesc }); dlgProgress->SetLine(2, CVariant{ "" }); } dlgProgress->Open(); SetScrapedInfo(false); // Start separate job to scrape info and fill list of art types. CJobManager::GetInstance().AddJob(new CRefreshInfoJob(dlgProgress), nullptr, CJob::PRIORITY_HIGH); // Wait for refresh to complete or be canceled, but render every 10ms so that the // pointer movements works on dialog even when job is reporting progress infrequently if (dlgProgress) dlgProgress->Wait(10); if (dlgProgress->IsCanceled()) { return; } // Show message when scraper was unsuccesfull if (!HasScrapedInfo()) { if (m_bArtistInfo) HELPERS::ShowOKDialogText(CVariant{ 21889 }, CVariant{ 20199 }); else HELPERS::ShowOKDialogText(CVariant{ 185 }, CVariant{ 500 }); return; } // Show new values on screen Update(); m_hasRefreshed = true; if (dlgProgress) dlgProgress->Close(); }