diff options
author | jenkins4kodi <jenkins4kodi@users.noreply.github.com> | 2015-08-31 22:28:00 +0200 |
---|---|---|
committer | jenkins4kodi <jenkins4kodi@users.noreply.github.com> | 2015-08-31 22:28:00 +0200 |
commit | b4afc20387375ad974a2404a11f90cc2c6d7889b (patch) | |
tree | 84c6cacbbabd1fe6126d414c5f0a65f3c0c911ba | |
parent | 23bc0c1a8fb8888a8057de10ff93008ddbd392f3 (diff) | |
parent | 597e015730806047bd37ca6311a0d726059a47c7 (diff) |
Merge pull request #7918 from Montellese/fix_modal_video_refreshing16.0a2-Jarvis
-rw-r--r-- | xbmc/video/VideoLibraryQueue.cpp | 7 | ||||
-rw-r--r-- | xbmc/video/jobs/VideoLibraryProgressJob.cpp | 3 | ||||
-rw-r--r-- | xbmc/video/jobs/VideoLibraryRefreshingJob.cpp | 20 | ||||
-rw-r--r-- | xbmc/video/jobs/VideoLibraryRefreshingJob.h | 3 |
4 files changed, 11 insertions, 22 deletions
diff --git a/xbmc/video/VideoLibraryQueue.cpp b/xbmc/video/VideoLibraryQueue.cpp index 8171b310a2..628e0c7503 100644 --- a/xbmc/video/VideoLibraryQueue.cpp +++ b/xbmc/video/VideoLibraryQueue.cpp @@ -125,9 +125,7 @@ void CVideoLibraryQueue::CleanLibraryModal(const std::set<int>& paths /* = std:: void CVideoLibraryQueue::RefreshItem(CFileItemPtr item, bool ignoreNfo /* = false */, bool forceRefresh /* = true */, bool refreshAll /* = false */, const std::string& searchTitle /* = "" */) { - CVideoLibraryRefreshingJob* refreshingJob = new CVideoLibraryRefreshingJob(item, forceRefresh, refreshAll, ignoreNfo, searchTitle); - refreshingJob->SetShowDialogs(false); - AddJob(refreshingJob); + AddJob(new CVideoLibraryRefreshingJob(item, forceRefresh, refreshAll, ignoreNfo, searchTitle)); } bool CVideoLibraryQueue::RefreshItemModal(CFileItemPtr item, bool forceRefresh /* = true */, bool refreshAll /* = false */) @@ -138,9 +136,8 @@ bool CVideoLibraryQueue::RefreshItemModal(CFileItemPtr item, bool forceRefresh / m_modal = true; CVideoLibraryRefreshingJob refreshingJob(item, forceRefresh, refreshAll); - refreshingJob.SetShowDialogs(true); - bool result = refreshingJob.DoWork(); + bool result = refreshingJob.DoModal(); m_modal = false; return result; diff --git a/xbmc/video/jobs/VideoLibraryProgressJob.cpp b/xbmc/video/jobs/VideoLibraryProgressJob.cpp index 14a93bbaa3..072513d002 100644 --- a/xbmc/video/jobs/VideoLibraryProgressJob.cpp +++ b/xbmc/video/jobs/VideoLibraryProgressJob.cpp @@ -29,11 +29,8 @@ CVideoLibraryProgressJob::~CVideoLibraryProgressJob() bool CVideoLibraryProgressJob::DoWork() { - SetProgress(0.0f); - bool result = CVideoLibraryJob::DoWork(); - SetProgress(100.0f); MarkFinished(); return result; diff --git a/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp b/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp index 1bd0b48d88..382a223dc5 100644 --- a/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp +++ b/xbmc/video/jobs/VideoLibraryRefreshingJob.cpp @@ -40,7 +40,6 @@ CVideoLibraryRefreshingJob::CVideoLibraryRefreshingJob(CFileItemPtr item, bool forceRefresh, bool refreshAll, bool ignoreNfo /* = false */, const std::string& searchTitle /* = "" */) : CVideoLibraryProgressJob(nullptr), m_item(item), - m_showDialogs(false), m_forceRefresh(forceRefresh), m_refreshAll(refreshAll), m_ignoreNfo(ignoreNfo), @@ -87,9 +86,6 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db) bool hasDetails = false; bool ignoreNfo = m_ignoreNfo; - if (m_showDialogs) - SetProgressDialog(static_cast<CGUIDialogProgress*>(g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS))); - // run this in a loop in case we need to refresh again bool failure = false; do @@ -106,7 +102,7 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db) // if we are performing a forced refresh ask the user to choose between using a valid NFO and a valid scraper - if (needsRefresh && m_showDialogs && !scraper->IsNoop() && + if (needsRefresh && IsModal() && !scraper->IsNoop() && (nfoResult == CNfoFile::URL_NFO || nfoResult == CNfoFile::COMBINED_NFO || nfoResult == CNfoFile::FULL_NFO)) { int heading = 20159; @@ -146,15 +142,17 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db) // try to find a matching item MOVIELIST itemResultList; int result = infoDownloader.FindMovie(itemTitle, itemResultList, GetProgressDialog()); + + // close the progress dialog + MarkFinished(); + if (result > 0) { - MarkFinished(); - // there are multiple matches for the item if (!itemResultList.empty()) { // choose the first match - if (!m_showDialogs) + if (!IsModal()) scraperUrl = itemResultList.at(0); else { @@ -201,7 +199,7 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db) // to prompt and ask the user to input a new search title if (!hasDetails && scraperUrl.m_url.empty()) { - if (m_showDialogs) + if (IsModal()) { // ask the user to input a title to use if (!CGUIKeyboardFactory::ShowAndGetInput(itemTitle, g_localizeStrings.Get(scraper->Content() == CONTENT_TVSHOWS ? 20357 : 16009), false)) @@ -300,7 +298,7 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db) MarkFinished(); // check if the user cancelled - if (!IsCancelled() && m_showDialogs) + if (!IsCancelled() && IsModal()) CGUIDialogOK::ShowAndGetInput(195, itemTitle); return false; @@ -325,7 +323,7 @@ bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db) break; } while (needsRefresh); - if (failure && m_showDialogs) + if (failure && IsModal()) CGUIDialogOK::ShowAndGetInput(195, itemTitle); return true; diff --git a/xbmc/video/jobs/VideoLibraryRefreshingJob.h b/xbmc/video/jobs/VideoLibraryRefreshingJob.h index a50e62f3e8..1423d244bb 100644 --- a/xbmc/video/jobs/VideoLibraryRefreshingJob.h +++ b/xbmc/video/jobs/VideoLibraryRefreshingJob.h @@ -47,15 +47,12 @@ public: virtual const char *GetType() const { return "VideoLibraryRefreshingJob"; } virtual bool operator==(const CJob* job) const; - void SetShowDialogs(bool showDialogs) { m_showDialogs = showDialogs; } - protected: // implementation of CVideoLibraryJob virtual bool Work(CVideoDatabase &db); private: CFileItemPtr m_item; - bool m_showDialogs; bool m_forceRefresh; bool m_refreshAll; bool m_ignoreNfo; |