Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show busy dialog if progress dialog is active while calling a plugin #14225

Merged
merged 1 commit into from
Jul 26, 2018

Conversation

AkariDN
Copy link
Contributor

@AkariDN AkariDN commented Jul 25, 2018

Description

Applies only for calling plugins from the main thread. If execution of a plugin takes some time then CGUIDialogBusy automatically opens. But if we already have topmost modal CGUIDialogProgress then additional busy dialog is no longer needed - we can use progress dialog's render loop and handle "cancel" action. Especially in case of sequentially plugin calling.

Motivation and Context

There is no need to show two status dialogs simultaneously.

How Has This Been Tested?

Build and functionality tested on Windows and Android.

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@@ -48,6 +48,7 @@ class CGUIDialogProgress :
\return true if the dialog is closed, false if the user cancels early.
*/
bool Wait(int progresstime = 10);
bool WaitOnEvent(CEvent& event, int progresstime = 10);

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@AkariDN AkariDN force-pushed the busydlg branch 2 times, most recently from cc2a8f4 to 8f22b1e Compare July 25, 2018 15:23
@AkariDN
Copy link
Contributor Author

AkariDN commented Jul 25, 2018

Thanks for clarifying. Fixed.

return WaitOnEvent(m_done, progresstime);
}

bool CGUIDialogProgress::WaitOnEvent(CEvent& event, int progresstime /*= 10*/)

This comment was marked as spam.

@@ -48,6 +48,7 @@ class CGUIDialogProgress :
\return true if the dialog is closed, false if the user cancels early.
*/
bool Wait(int progresstime = 10);
bool WaitOnEvent(CEvent& event, int progresstime);

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

if (!CGUIDialogBusy::WaitOnEvent(m_fetchComplete, 200))
{
CGUIWindowManager& wm = CServiceBroker::GetGUI()->GetWindowManager();
CGUIDialogProgress* progress = wm.IsModalDialogTopmost(WINDOW_DIALOG_PROGRESS) ? wm.GetWindow<CGUIDialogProgress>(WINDOW_DIALOG_PROGRESS) : nullptr;

This comment was marked as spam.

This comment was marked as spam.

@AkariDN AkariDN force-pushed the busydlg branch 2 times, most recently from 095a60a to 620dffa Compare July 25, 2018 18:19

bool CGUIDialogProgress::WaitOnEvent(CEvent& event, int progresstime)
{
while (!event.WaitMSec(progresstime) && m_active && !m_bCanceled)

This comment was marked as spam.

}
else if (!CGUIDialogBusy::WaitOnEvent(m_fetchComplete, 200))
m_cancelled = true;
scriptObs.Abort();

This comment was marked as spam.

@AkariDN
Copy link
Contributor Author

AkariDN commented Jul 25, 2018

Thank you for detailed explanations. Fixed.

@hudokkow
Copy link
Member

Jenkins commands only work for team members. This build already shows some failures. I'll start a new build, if failures are not code related.

Thank you for your contributions, btw! 👍

@Rechi
Copy link
Member

Rechi commented Jul 25, 2018

For some reason the command works for non team members too.
No platform failed in that jenkins run yet.

@hudokkow
Copy link
Member

Weird! It never worked for non-team members before. And of course, you're right, all is good. First run failed on some platforms but re-run shows all is well. Great work @AkariDN

@AkariDN
Copy link
Contributor Author

AkariDN commented Jul 26, 2018

@FernetMenta according to your remarks I would like to keep old code unchanged and set 1ms blocking interval only to new function. And should I handle closing of progress dialog without canceling? This should not happen in normal mode but somehow dialog can be closed e.g. from other thread.

@FernetMenta
Copy link
Contributor

new code looks good to me

@FernetMenta
Copy link
Contributor

jenkins build this please

@FernetMenta FernetMenta merged commit 9ec10b9 into xbmc:master Jul 26, 2018
@Rechi Rechi added Type: Improvement non-breaking change which improves existing functionality v18 Leia labels Jul 26, 2018
@Rechi Rechi added this to the Leia 18.0-alpha3 milestone Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement non-breaking change which improves existing functionality v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants