本文整理汇总了C++中CGUIDialogProgress::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogProgress::Open方法的具体用法?C++ CGUIDialogProgress::Open怎么用?C++ CGUIDialogProgress::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogProgress
的用法示例。
在下文中一共展示了CGUIDialogProgress::Open方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: progress
/*! \brief Progress callback from rar manager.
\return true to continue processing, false to cancel.
*/
bool progress(int progress, const char *text)
{
bool cont(true);
if ((shown || showTime.IsTimePast()) && g_application.IsCurrentThread())
{
// grab the busy and show it
CGUIDialogProgress* dlg = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (dlg)
{
if (!shown)
{
dlg->SetHeading(CVariant{heading});
dlg->Open();
}
if (progress >= 0)
{
dlg->ShowProgressBar(true);
dlg->SetPercentage(progress);
}
if (text)
dlg->SetLine(1, CVariant{text});
cont = !dlg->IsCanceled();
shown = true;
// tell render loop to spin
dlg->Progress();
}
}
return cont;
};
示例2: OnInitWindow
void CGUIWindowPVRBase::OnInitWindow(void)
{
if (!g_PVRManager.IsStarted() || !g_PVRClients->HasConnectedClients())
{
// wait until the PVR manager has been started
CGUIDialogProgress* dialog = static_cast<CGUIDialogProgress*>(g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS));
if (dialog)
{
dialog->SetHeading(CVariant{19235});
dialog->SetText(CVariant{19045});
dialog->ShowProgressBar(false);
dialog->Open();
// do not block the gfx context while waiting
CSingleExit exit(g_graphicsContext);
CEvent event(true);
while(!event.WaitMSec(1))
{
if (g_PVRManager.IsStarted() && g_PVRClients->HasConnectedClients())
event.Set();
if (dialog->IsCanceled())
{
// return to previous window if canceled
dialog->Close();
g_windowManager.PreviousWindow();
return;
}
g_windowManager.ProcessRenderLoop(false);
}
dialog->Close();
}
}
{
// set window group to playing group
CPVRChannelGroupPtr group = g_PVRManager.GetPlayingGroup(m_bRadio);
CSingleLock lock(m_critSection);
if (m_group != group)
m_viewControl.SetSelectedItem(0);
m_group = group;
}
SetProperty("IsRadio", m_bRadio ? "true" : "");
m_vecItems->SetPath(GetDirectoryPath());
CGUIMediaWindow::OnInitWindow();
// mark item as selected by channel path
m_viewControl.SetSelectedItem(GetSelectedItemPath(m_bRadio));
}
示例3: SaveList
void CGUIDialogPVRChannelManager::SaveList(void)
{
if (!m_bContainsChanges)
return;
/* display the progress dialog */
CGUIDialogProgress* pDlgProgress = g_windowManager.GetWindow<CGUIDialogProgress>(WINDOW_DIALOG_PROGRESS);
pDlgProgress->SetHeading(CVariant{190});
pDlgProgress->SetLine(0, CVariant{""});
pDlgProgress->SetLine(1, CVariant{328});
pDlgProgress->SetLine(2, CVariant{""});
pDlgProgress->Open();
pDlgProgress->Progress();
pDlgProgress->SetPercentage(0);
/* persist all channels */
unsigned int iNextChannelNumber(0);
CPVRChannelGroupPtr group = CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAll(m_bIsRadio);
if (!group)
return;
for (int iListPtr = 0; iListPtr < m_channelItems->Size(); ++iListPtr)
{
CFileItemPtr pItem = m_channelItems->Get(iListPtr);
if (!pItem->HasPVRChannelInfoTag())
continue;
if (pItem->GetProperty("SupportsSettings").asBoolean())
RenameChannel(pItem);
PersistChannel(pItem, group, &iNextChannelNumber);
pDlgProgress->SetPercentage(iListPtr * 100 / m_channelItems->Size());
}
group->SortAndRenumber();
group->Persist();
m_bContainsChanges = false;
SetItemsUnchanged();
pDlgProgress->Close();
}
示例4: OnPrepareFileItems
void CGUIWindowPVRSearch::OnPrepareFileItems(CFileItemList &items)
{
bool bAddSpecialSearchItem = items.IsEmpty();
if (m_bSearchConfirmed)
{
m_bSearchConfirmed = false;
bAddSpecialSearchItem = true;
CGUIDialogProgress* dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (dlgProgress)
{
dlgProgress->SetHeading(CVariant{194}); // "Searching..."
dlgProgress->SetText(CVariant{m_searchfilter.m_strSearchTerm});
dlgProgress->Open();
dlgProgress->Progress();
}
// TODO should we limit the find similar search to the selected group?
g_EpgContainer.GetEPGSearch(items, m_searchfilter);
if (dlgProgress)
dlgProgress->Close();
if (items.IsEmpty())
CGUIDialogOK::ShowAndGetInput(CVariant{194}, // "Searching..."
CVariant{284}); // "No results found"
}
if (bAddSpecialSearchItem)
{
CFileItemPtr item(new CFileItem("pvr://guide/searchresults/search/", true));
item->SetLabel(g_localizeStrings.Get(19140)); // "Search..."
item->SetLabelPreformated(true);
item->SetSpecialSort(SortSpecialOnTop);
items.Add(item);
}
}
示例5: CleanLibrary
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);
}
示例6: ExportLibrary
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();
}
}
示例7: CleanLibraryModal
void CMusicLibraryQueue::CleanLibraryModal()
{
// We can't perform a modal library cleaning if other jobs are running
if (IsRunning())
return;
CGUIDialogProgress* progress = nullptr;
progress = g_windowManager.GetWindow<CGUIDialogProgress>(WINDOW_DIALOG_PROGRESS);
if (progress)
{
progress->SetHeading(CVariant{ 700 });
progress->SetPercentage(0);
progress->Open();
progress->ShowProgressBar(true);
}
m_modal = true;
m_cleaning = true;
CMusicLibraryCleaningJob cleaningJob(progress);
cleaningJob.DoWork();
m_cleaning = false;
m_modal = false;
Refresh();
}
示例8: OnPopupMenu
//.........这里部分代码省略.........
choices.Add(CONTROL_BTNFAVOURITES, XFILE::CFavouritesDirectory::IsFavourite(pItem.get(), GetID()) ? 14077 : 14076); // Add/Remove Favourite
if (players.size() > 1)
choices.Add(CONTROL_BTNPLAYWITH, 15213);
if (CanRename(list) && !pItem->IsParentFolder())
choices.Add(CONTROL_BTNRENAME, 118);
if (CanDelete(list) && showEntry)
choices.Add(CONTROL_BTNDELETE, 117);
if (CanCopy(list) && showEntry)
choices.Add(CONTROL_BTNCOPY, 115);
if (CanMove(list) && showEntry)
choices.Add(CONTROL_BTNMOVE, 116);
}
if (CanNewFolder(list))
choices.Add(CONTROL_BTNNEWFOLDER, 20309);
if (item >= 0 && pItem->m_bIsFolder && !pItem->IsParentFolder())
choices.Add(CONTROL_BTNCALCSIZE, 13393);
choices.Add(CONTROL_BTNGOTOROOT, 20128);
choices.Add(CONTROL_BTNSWITCHMEDIA, 523);
if (CJobManager::GetInstance().IsProcessing("filemanager"))
choices.Add(CONTROL_BTNCANCELJOB, 167);
int btnid = CGUIDialogContextMenu::ShowAndGetChoice(choices);
if (btnid == CONTROL_BTNSELECTALL)
{
OnSelectAll(list);
bDeselect=false;
}
if (btnid == CONTROL_BTNFAVOURITES)
{
XFILE::CFavouritesDirectory::AddOrRemove(pItem.get(), GetID());
return;
}
if (btnid == CONTROL_BTNPLAYWITH)
{
std::vector<std::string>players;
CPlayerCoreFactory::GetInstance().GetPlayers(*pItem, players);
std::string player = CPlayerCoreFactory::GetInstance().SelectPlayerDialog(players);
if (!player.empty())
OnStart(pItem.get(), player);
}
if (btnid == CONTROL_BTNRENAME)
OnRename(list);
if (btnid == CONTROL_BTNDELETE)
OnDelete(list);
if (btnid == CONTROL_BTNCOPY)
OnCopy(list);
if (btnid == CONTROL_BTNMOVE)
OnMove(list);
if (btnid == CONTROL_BTNNEWFOLDER)
OnNewFolder(list);
if (btnid == CONTROL_BTNCALCSIZE)
{
// setup the progress dialog, and show it
CGUIDialogProgress *progress = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (progress)
{
progress->SetHeading(CVariant{13394});
for (int i=0; i < 3; i++)
progress->SetLine(i, CVariant{""});
progress->Open();
}
// Calculate folder size for each selected item
for (int i=0; i<m_vecItems[list]->Size(); ++i)
{
CFileItemPtr pItem2=m_vecItems[list]->Get(i);
if (pItem2->m_bIsFolder && pItem2->IsSelected())
{
int64_t folderSize = CalculateFolderSize(pItem2->GetPath(), progress);
if (folderSize >= 0)
{
pItem2->m_dwSize = folderSize;
if (folderSize == 0)
pItem2->SetLabel2(StringUtils::SizeToString(folderSize));
else
pItem2->SetFileSizeLabel();
}
}
}
if (progress)
progress->Close();
}
if (btnid == CONTROL_BTNGOTOROOT)
{
Update(list,"");
return;
}
if (btnid == CONTROL_BTNSWITCHMEDIA)
{
CGUIDialogContextMenu::SwitchMedia("files", m_vecItems[list]->GetPath());
return;
}
if (btnid == CONTROL_BTNCANCELJOB)
CancelJobs();
if (bDeselect && item >= 0 && item < m_vecItems[list]->Size())
{ // deselect item as we didn't do anything
pItem->Select(false);
}
}
示例9: GetDirectory
bool CMultiPathDirectory::GetDirectory(const CURL& url, CFileItemList &items)
{
CLog::Log(LOGDEBUG,"CMultiPathDirectory::GetDirectory(%s)", url.GetRedacted().c_str());
std::vector<std::string> vecPaths;
if (!GetPaths(url, vecPaths))
return false;
XbmcThreads::EndTime progressTime(3000); // 3 seconds before showing progress bar
CGUIDialogProgress* dlgProgress = NULL;
unsigned int iFailures = 0;
for (unsigned int i = 0; i < vecPaths.size(); ++i)
{
// show the progress dialog if we have passed our time limit
if (progressTime.IsTimePast() && !dlgProgress)
{
dlgProgress = g_windowManager.GetWindow<CGUIDialogProgress>(WINDOW_DIALOG_PROGRESS);
if (dlgProgress)
{
dlgProgress->SetHeading(CVariant{15310});
dlgProgress->SetLine(0, CVariant{15311});
dlgProgress->SetLine(1, CVariant{""});
dlgProgress->SetLine(2, CVariant{""});
dlgProgress->Open();
dlgProgress->ShowProgressBar(true);
dlgProgress->SetProgressMax((int)vecPaths.size()*2);
dlgProgress->Progress();
}
}
if (dlgProgress)
{
CURL url(vecPaths[i]);
dlgProgress->SetLine(1, CVariant{url.GetWithoutUserDetails()});
dlgProgress->SetProgressAdvance();
dlgProgress->Progress();
}
CFileItemList tempItems;
CLog::Log(LOGDEBUG,"Getting Directory (%s)", vecPaths[i].c_str());
if (CDirectory::GetDirectory(vecPaths[i], tempItems, m_strFileMask, m_flags))
items.Append(tempItems);
else
{
CLog::Log(LOGERROR,"Error Getting Directory (%s)", vecPaths[i].c_str());
iFailures++;
}
if (dlgProgress)
{
dlgProgress->SetProgressAdvance();
dlgProgress->Progress();
}
}
if (dlgProgress)
dlgProgress->Close();
if (iFailures == vecPaths.size())
return false;
// merge like-named folders into a sub multipath:// style url
MergeItems(items);
return true;
}
示例10: ResetDatabase
void CPVRManager::ResetDatabase(bool bResetEPGOnly /* = false */)
{
CLog::Log(LOGNOTICE,"PVRManager - %s - clearing the PVR database", __FUNCTION__);
g_EpgContainer.Stop();
CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
pDlgProgress->SetHeading(CVariant{313});
pDlgProgress->SetLine(0, CVariant{g_localizeStrings.Get(19187)}); // All data in the PVR database is being erased
pDlgProgress->SetLine(1, CVariant{""});
pDlgProgress->SetLine(2, CVariant{""});
pDlgProgress->Open();
pDlgProgress->Progress();
if (m_addons->IsPlaying())
{
CLog::Log(LOGNOTICE,"PVRManager - %s - stopping playback", __FUNCTION__);
CApplicationMessenger::GetInstance().SendMsg(TMSG_MEDIA_STOP);
}
pDlgProgress->SetPercentage(10);
pDlgProgress->Progress();
/* reset the EPG pointers */
if (m_database)
m_database->ResetEPG();
/* stop the thread */
Stop();
pDlgProgress->SetPercentage(20);
pDlgProgress->Progress();
if (!m_database)
m_database = new CPVRDatabase;
if (m_database && m_database->Open())
{
/* clean the EPG database */
g_EpgContainer.Reset();
pDlgProgress->SetPercentage(30);
pDlgProgress->Progress();
if (!bResetEPGOnly)
{
m_database->DeleteChannelGroups();
pDlgProgress->SetPercentage(50);
pDlgProgress->Progress();
/* delete all channels */
m_database->DeleteChannels();
pDlgProgress->SetPercentage(70);
pDlgProgress->Progress();
/* delete all channel and recording settings */
CVideoDatabase videoDatabase;
if (videoDatabase.Open())
{
videoDatabase.EraseVideoSettings("pvr://channels/");
videoDatabase.EraseVideoSettings(CPVRRecordingsPath::PATH_RECORDINGS);
videoDatabase.Close();
}
pDlgProgress->SetPercentage(80);
pDlgProgress->Progress();
/* delete all client information */
pDlgProgress->SetPercentage(90);
pDlgProgress->Progress();
}
m_database->Close();
}
CLog::Log(LOGNOTICE,"PVRManager - %s - %s database cleared", __FUNCTION__, bResetEPGOnly ? "EPG" : "PVR and EPG");
CLog::Log(LOGNOTICE,"PVRManager - %s - restarting the PVRManager", __FUNCTION__);
m_database->Open();
Cleanup();
Start();
pDlgProgress->SetPercentage(100);
pDlgProgress->Close();
}
示例11: OnPopupMenu
//.........这里部分代码省略.........
choices.Add(2, XFILE::CFavouritesDirectory::IsFavourite(pItem.get(), GetID()) ? 14077 : 14076); // Add/Remove Favourite
if (vecCores.size() > 1)
choices.Add(3, 15213); // Play Using...
if (CanRename(list) && !pItem->IsParentFolder())
choices.Add(4, 118); // Rename
if (CanDelete(list) && showEntry)
choices.Add(5, 117); // Delete
if (CanCopy(list) && showEntry)
choices.Add(6, 115); // Copy
if (CanMove(list) && showEntry)
choices.Add(7, 116); // Move
}
if (CanNewFolder(list))
choices.Add(8, 20309); // New Folder
if (item >= 0 && pItem->m_bIsFolder && !pItem->IsParentFolder())
choices.Add(9, 13393); // Calculate Size
choices.Add(11, 20128); // Go To Root
choices.Add(12, 523); // switch media
if (CJobManager::GetInstance().IsProcessing("filemanager"))
choices.Add(13, 167);
int btnid = CGUIDialogContextMenu::ShowAndGetChoice(choices);
if (btnid == 1)
{
OnSelectAll(list);
bDeselect=false;
}
if (btnid == 2)
{
XFILE::CFavouritesDirectory::AddOrRemove(pItem.get(), GetID());
return;
}
if (btnid == 3)
{
VECPLAYERCORES vecCores;
CPlayerCoreFactory::Get().GetPlayers(*pItem, vecCores);
g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().SelectPlayerDialog(vecCores);
if (g_application.m_eForcedNextPlayer != EPC_NONE)
OnStart(pItem.get());
}
if (btnid == 4)
OnRename(list);
if (btnid == 5)
OnDelete(list);
if (btnid == 6)
OnCopy(list);
if (btnid == 7)
OnMove(list);
if (btnid == 8)
OnNewFolder(list);
if (btnid == 9)
{
// setup the progress dialog, and show it
CGUIDialogProgress *progress = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (progress)
{
progress->SetHeading(CVariant{13394});
for (int i=0; i < 3; i++)
progress->SetLine(i, CVariant{""});
progress->Open();
}
// Calculate folder size for each selected item
for (int i=0; i<m_vecItems[list]->Size(); ++i)
{
CFileItemPtr pItem2=m_vecItems[list]->Get(i);
if (pItem2->m_bIsFolder && pItem2->IsSelected())
{
int64_t folderSize = CalculateFolderSize(pItem2->GetPath(), progress);
if (folderSize >= 0)
{
pItem2->m_dwSize = folderSize;
if (folderSize == 0)
pItem2->SetLabel2(StringUtils::SizeToString(folderSize));
else
pItem2->SetFileSizeLabel();
}
}
}
if (progress)
progress->Close();
}
if (btnid == 11)
{
Update(list,"");
return;
}
if (btnid == 12)
{
CGUIDialogContextMenu::SwitchMedia("files", m_vecItems[list]->GetPath());
return;
}
if (btnid == 13)
CancelJobs();
if (bDeselect && item >= 0 && item < m_vecItems[list]->Size())
{ // deselect item as we didn't do anything
pItem->Select(false);
}
}
示例12: Enable
bool CPartyModeManager::Enable(PartyModeContext context /*= PARTYMODECONTEXT_MUSIC*/, const std::string& strXspPath /*= ""*/)
{
// Filter using our PartyMode xml file
CSmartPlaylist playlist;
std::string partyModePath;
bool playlistLoaded;
m_bIsVideo = context == PARTYMODECONTEXT_VIDEO;
if (!strXspPath.empty()) //if a path to a smartplaylist is supplied use it
partyModePath = strXspPath;
else if (m_bIsVideo)
partyModePath = CProfilesManager::Get().GetUserDataItem("PartyMode-Video.xsp");
else
partyModePath = CProfilesManager::Get().GetUserDataItem("PartyMode.xsp");
playlistLoaded=playlist.Load(partyModePath);
if ( playlistLoaded )
{
m_type = playlist.GetType();
if (context == PARTYMODECONTEXT_UNKNOWN)
{
//get it from the xsp file
m_bIsVideo = (StringUtils::EqualsNoCase(m_type, "video") ||
StringUtils::EqualsNoCase(m_type, "musicvideos") ||
StringUtils::EqualsNoCase(m_type, "mixed"));
}
if (StringUtils::EqualsNoCase(m_type, "mixed"))
playlist.SetType("songs");
if (StringUtils::EqualsNoCase(m_type, "mixed"))
playlist.SetType("video");
playlist.SetType(m_type);
}
else
{
m_strCurrentFilterMusic.clear();
m_strCurrentFilterVideo.clear();
m_type = m_bIsVideo ? "musicvideos" : "songs";
}
CGUIDialogProgress* pDialog = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
int iHeading = (m_bIsVideo ? 20250 : 20121);
int iLine0 = (m_bIsVideo ? 20251 : 20123);
pDialog->SetHeading(CVariant{iHeading});
pDialog->SetLine(0, CVariant{iLine0});
pDialog->SetLine(1, CVariant{""});
pDialog->SetLine(2, CVariant{""});
pDialog->Open();
ClearState();
unsigned int time = XbmcThreads::SystemClockMillis();
vector< pair<int,int> > songIDs;
if (StringUtils::EqualsNoCase(m_type, "songs") ||
StringUtils::EqualsNoCase(m_type, "mixed"))
{
CMusicDatabase db;
if (db.Open())
{
set<std::string> playlists;
if ( playlistLoaded )
m_strCurrentFilterMusic = playlist.GetWhereClause(db, playlists);
CLog::Log(LOGINFO, "PARTY MODE MANAGER: Registering filter:[%s]", m_strCurrentFilterMusic.c_str());
m_iMatchingSongs = (int)db.GetSongIDs(m_strCurrentFilterMusic, songIDs);
if (m_iMatchingSongs < 1 && StringUtils::EqualsNoCase(m_type, "songs"))
{
pDialog->Close();
db.Close();
OnError(16031, (std::string)"Party mode found no matching songs. Aborting.");
return false;
}
}
else
{
pDialog->Close();
OnError(16033, (std::string)"Party mode could not open database. Aborting.");
return false;
}
db.Close();
}
if (StringUtils::EqualsNoCase(m_type, "musicvideos") ||
StringUtils::EqualsNoCase(m_type, "mixed"))
{
vector< pair<int,int> > songIDs2;
CVideoDatabase db;
if (db.Open())
{
set<std::string> playlists;
if ( playlistLoaded )
m_strCurrentFilterVideo = playlist.GetWhereClause(db, playlists);
CLog::Log(LOGINFO, "PARTY MODE MANAGER: Registering filter:[%s]", m_strCurrentFilterVideo.c_str());
m_iMatchingSongs += (int)db.GetMusicVideoIDs(m_strCurrentFilterVideo, songIDs2);
if (m_iMatchingSongs < 1)
{
pDialog->Close();
//.........这里部分代码省略.........
示例13: WaitOnScriptResult
bool CPluginDirectory::WaitOnScriptResult(const std::string &scriptPath, int scriptId, const std::string &scriptName, bool retrievingDir)
{
const unsigned int timeBeforeProgressBar = 1500;
const unsigned int timeToKillScript = 1000;
unsigned int startTime = XbmcThreads::SystemClockMillis();
CGUIDialogProgress *progressBar = NULL;
bool cancelled = false;
bool inMainAppThread = g_application.IsCurrentThread();
CLog::Log(LOGDEBUG, "%s - waiting on the %s (id=%d) plugin...", __FUNCTION__, scriptName.c_str(), scriptId);
while (true)
{
{
CSingleExit ex(g_graphicsContext);
// check if the python script is finished
if (m_fetchComplete.WaitMSec(20))
{ // python has returned
CLog::Log(LOGDEBUG, "%s- plugin returned %s", __FUNCTION__, m_success ? "successfully" : "failure");
break;
}
}
// check our script is still running
if (!CScriptInvocationManager::Get().IsRunning(scriptId))
{ // check whether we exited normally
if (!m_fetchComplete.WaitMSec(0))
{ // python didn't return correctly
CLog::Log(LOGDEBUG, " %s - plugin exited prematurely - terminating", __FUNCTION__);
m_success = false;
}
break;
}
// check whether we should pop up the progress dialog
if (!retrievingDir && !progressBar && XbmcThreads::SystemClockMillis() - startTime > timeBeforeProgressBar)
{ // loading takes more then 1.5 secs, show a progress dialog
progressBar = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
// if script has shown progressbar don't override it
if (progressBar && progressBar->IsActive())
{
startTime = XbmcThreads::SystemClockMillis();
progressBar = NULL;
}
if (progressBar)
{
progressBar->SetHeading(CVariant{scriptName});
progressBar->SetLine(0, CVariant{10214});
progressBar->SetLine(1, CVariant{""});
progressBar->SetLine(2, CVariant{""});
progressBar->ShowProgressBar(false);
progressBar->Open();
}
}
if (progressBar)
{ // update the progress bar and check for user cancel
progressBar->Progress();
if (progressBar->IsCanceled())
{ // user has cancelled our process - cancel our process
m_cancelled = true;
}
}
else // if the progressBar exists and we call StartModal or Progress we get the
// ProcessRenderLoop call anyway.
if (inMainAppThread)
g_windowManager.ProcessRenderLoop();
if (!cancelled && m_cancelled)
{
cancelled = true;
startTime = XbmcThreads::SystemClockMillis();
}
if ((cancelled && XbmcThreads::SystemClockMillis() - startTime > timeToKillScript) || g_application.m_bStop)
{ // cancel our script
if (scriptId != -1 && CScriptInvocationManager::Get().IsRunning(scriptId))
{
CLog::Log(LOGDEBUG, "%s- cancelling plugin %s (id=%d)", __FUNCTION__, scriptName.c_str(), scriptId);
CScriptInvocationManager::Get().Stop(scriptId);
break;
}
}
}
if (progressBar)
CApplicationMessenger::Get().PostMsg(TMSG_GUI_WINDOW_CLOSE, -1, 0, static_cast<void*>(progressBar));
return !cancelled && m_success;
}