Changeset 69004 in vbox
- Timestamp:
- Oct 6, 2017 2:22:50 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
-
UIProgressDialog.cpp (modified) (4 diffs)
-
UIProgressDialog.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp
r69000 r69004 29 29 30 30 /* GUI includes: */ 31 # include "UIProgressDialog.h"32 # include "UIErrorString.h"33 # include "UISpecialControls.h"34 # include "UIModalWindowManager.h"35 31 # include "QIDialogButtonBox.h" 36 32 # include "QILabel.h" 33 # include "UIErrorString.h" 34 # include "UIModalWindowManager.h" 35 # include "UIProgressDialog.h" 36 # include "UISpecialControls.h" 37 37 # include "VBoxGlobal.h" 38 38 # ifdef VBOX_WS_MAC … … 45 45 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 46 46 47 48 /********************************************************************************************************************************* 49 * Class UIProgressDialog implementation. * 50 *********************************************************************************************************************************/ 47 51 48 52 const char *UIProgressDialog::m_spcszOpDescTpl = "%1 ... (%2/%3)"; … … 400 404 } 401 405 406 void UIProgressDialog::closeProgressDialog() 407 { 408 /* If window is on the top of the stack: */ 409 if (windowManager().isWindowOnTheTopOfTheModalWindowStack(this)) 410 { 411 /* Progress completed? */ 412 if (m_comProgress.isOk()) 413 done(Accepted); 414 /* Or aborted? */ 415 else 416 done(Rejected); 417 418 /* Mark progress-dialog finished: */ 419 m_fEnded = true; 420 } 421 } 422 402 423 void UIProgressDialog::handleTimerEvent() 403 424 { 404 /* We should hide progress-dialog 405 * if it was already finalized but not yet closed. 406 * This could happens in case of some other 407 * modal dialog prevents our event-loop from 408 * being exit overlapping 'this'. */ 409 if (m_fEnded && !isHidden() && windowManager().isWindowOnTheTopOfTheModalWindowStack(this)) 410 { 411 hide(); 425 /* If progress-dialog is ended: */ 426 if (m_fEnded) 427 { 428 // WORKAROUND: 429 // We should hide progress-dialog if it was already ended but not yet closed. This could happen 430 // in case if some other modal dialog prevents our event-loop from being exit overlapping 'this'. 431 /* If window is on the top of the stack and still shown: */ 432 if (!isHidden() && windowManager().isWindowOnTheTopOfTheModalWindowStack(this)) 433 hide(); 434 412 435 return; 413 436 } 414 else if (m_fEnded) 415 return; 416 417 if (!m_fEnded && (!m_comProgress.isOk() || m_comProgress.GetCompleted())) 418 { 419 /* Is this progress-dialog a top-level modal-dialog now? */ 420 if (windowManager().isWindowOnTheTopOfTheModalWindowStack(this)) 421 { 422 /* Progress finished: */ 423 if (m_comProgress.isOk()) 424 { 425 m_pProgressBar->setValue(100); 426 done(Accepted); 427 } 428 /* Progress is not valid: */ 429 else 430 done(Rejected); 431 432 /* Request to exit loop: */ 433 m_fEnded = true; 434 return; 435 } 436 437 /* Else we should wait until all the subsequent 438 * top-level modal-dialog(s) will be dismissed: */ 439 return; 437 438 /* If progress-dialog is not yet ended but progress is aborted or completed: */ 439 if (!m_comProgress.isOk() || m_comProgress.GetCompleted()) 440 { 441 /* Set progress to 100%: */ 442 m_pProgressBar->setValue(100); 443 444 /* Try to close the dialog: */ 445 return closeProgressDialog(); 440 446 } 441 447 … … 445 451 } 446 452 453 454 /********************************************************************************************************************************* 455 * Class UIProgress implementation. * 456 *********************************************************************************************************************************/ 447 457 448 458 UIProgress::UIProgress(CProgress &progress, QObject *pParent /* = 0 */) -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h
r69000 r69004 24 24 25 25 /* Forward declarations: */ 26 class QLabel; 26 27 class QProgressBar; 27 class QLabel;28 28 class QILabel; 29 29 class UIMiniCancelButton; … … 104 104 /** Updates progress-dialog percentage. */ 105 105 void updateProgressPercentage(int iPercent = -1); 106 107 /** Closes progress dialog (if possible). */ 108 void closeProgressDialog(); 106 109 107 110 /** Performes timer event handling. */
Note:
See TracChangeset
for help on using the changeset viewer.

