VirtualBox

Changeset 88100 in vbox


Ignore:
Timestamp:
Mar 12, 2021 1:17:47 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8694: UIMessageCenter: Missed HiDPI support for UIProgressDialog pixmap; Aand cleanup for include mess for free.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r87699 r88100  
    55
    66/*
    7  * Copyright (C) 2006-2020 Oracle Corporation
     7 * Copyright (C) 2006-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121#include <QFileInfo>
    2222#include <QLocale>
     23#include <QProcess>
    2324#include <QThread>
    24 #include <QProcess>
    2525#ifdef VBOX_WS_MAC
    2626# include <QPushButton>
     
    3131#include "UICommon.h"
    3232#include "UIConverter.h"
     33#include "UIErrorString.h"
     34#include "UIExtraDataManager.h"
    3335#include "UIHelpBrowserDialog.h"
     36#include "UIHostComboEditor.h"
     37#include "UIIconPool.h"
     38#include "UIMedium.h"
    3439#include "UIMessageCenter.h"
     40#include "UIModalWindowManager.h"
    3541#include "UIProgressDialog.h"
    36 #include "UIErrorString.h"
     42#include "VBoxAboutDlg.h"
    3743#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    3844# include "UINetworkRequestManager.h"
    3945# include "UINetworkRequestManagerWindow.h"
    40 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    41 #include "UIModalWindowManager.h"
    42 #include "UIExtraDataManager.h"
    43 #include "UIMedium.h"
     46#endif
    4447#ifdef VBOX_OSE
    4548# include "UIDownloaderUserManual.h"
    46 #endif /* VBOX_OSE */
    47 #include "VBoxAboutDlg.h"
    48 #include "UIHostComboEditor.h"
     49#endif
    4950#ifdef VBOX_WS_MAC
    5051# include "VBoxUtils-darwin.h"
     
    5556
    5657/* COM includes: */
     58#include "CAppliance.h"
    5759#include "CAudioAdapter.h"
    5860#include "CBooleanFormValue.h"
     
    6365#include "CCloudProvider.h"
    6466#include "CCloudProviderManager.h"
     67#include "CConsole.h"
    6568#include "CDHCPServer.h"
     69#include "CExtPack.h"
     70#include "CExtPackFile.h"
     71#include "CExtPackManager.h"
    6672#include "CForm.h"
    6773#include "CGraphicsAdapter.h"
     74#include "CHostNetworkInterface.h"
     75#include "CMachine.h"
     76#include "CMediumAttachment.h"
     77#include "CMediumFormat.h"
    6878#include "CNATEngine.h"
    6979#include "CNATNetwork.h"
     
    7585#include "CStorageController.h"
    7686#include "CStringFormValue.h"
    77 #include "CConsole.h"
    78 #include "CMachine.h"
    7987#include "CSystemProperties.h"
    80 #include "CVirtualBoxErrorInfo.h"
    81 #include "CMediumAttachment.h"
    82 #include "CMediumFormat.h"
    83 #include "CAppliance.h"
    84 #include "CExtPack.h"
    85 #include "CExtPackManager.h"
    86 #include "CExtPackFile.h"
    87 #include "CHostNetworkInterface.h"
    8888#include "CUnattended.h"
    8989#include "CVFSExplorer.h"
     90#include "CVirtualBoxErrorInfo.h"
    9091#include "CVirtualSystemDescription.h"
    9192#include "CVirtualSystemDescriptionForm.h"
    9293#ifdef VBOX_WITH_DRAG_AND_DROP
    93 # include "CGuest.h"
    9494# include "CDnDSource.h"
    9595# include "CDnDTarget.h"
    96 #endif /* VBOX_WITH_DRAG_AND_DROP */
     96# include "CGuest.h"
     97#endif
    9798
    9899/* Other VBox includes: */
     100#include <iprt/errcore.h>
    99101#include <iprt/param.h>
    100102#include <iprt/path.h>
    101 
    102 #include <iprt/errcore.h>
    103103
    104104
     
    365365                                              int cMinDuration /* = 2000 */)
    366366{
     367    /* Prepare result: */
     368    bool fRc = false;
     369
     370    /* Gather suitable dialog parent: */
     371    QWidget *pDlgParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
     372    AssertPtrReturn(pDlgParent, fRc);
     373
    367374    /* Prepare pixmap: */
    368     QPixmap *pPixmap = NULL;
     375    QPixmap pixmap;
    369376    if (!strImage.isEmpty())
    370         pPixmap = new QPixmap(strImage);
     377        pixmap = UIIconPool::iconSet(strImage).pixmap(pDlgParent->windowHandle(), QSize(90, 90));
    371378
    372379    /* Create progress-dialog: */
    373     QWidget *pDlgParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
    374     QPointer<UIProgressDialog> pProgressDlg = new UIProgressDialog(progress, strTitle, pPixmap, cMinDuration, pDlgParent);
    375     windowManager().registerNewParent(pProgressDlg, pDlgParent);
    376 
    377     /* Run the dialog with the 350 ms refresh interval. */
    378     pProgressDlg->run(350);
    379 
    380     /* Make sure progress-dialog still valid: */
    381     bool fRc;
     380    QPointer<UIProgressDialog> pProgressDlg = new UIProgressDialog(progress, strTitle, &pixmap, cMinDuration, pDlgParent);
    382381    if (pProgressDlg)
    383382    {
    384         /* Delete progress-dialog: */
    385         delete pProgressDlg;
    386 
    387         fRc = true;
     383        /* Register it as new parent: */
     384        windowManager().registerNewParent(pProgressDlg, pDlgParent);
     385
     386        /* Run the dialog with the 350 ms refresh interval. */
     387        pProgressDlg->run(350);
     388
     389        /* Make sure progress-dialog still valid: */
     390        if (pProgressDlg)
     391        {
     392            /* Delete progress-dialog: */
     393            delete pProgressDlg;
     394            fRc = true;
     395        }
    388396    }
    389     else
    390         fRc = false;
    391 
    392     /* Cleanup pixmap: */
    393     if (pPixmap)
    394         delete pPixmap;
    395 
     397
     398    /* Return result: */
    396399    return fRc;
    397400}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette