VirtualBox

Ignore:
Timestamp:
Feb 16, 2023 3:51:22 PM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Rework Information Dialog a bit to use UIMachine directly instead of UIMachineWindow.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r98605 r98606  
    16121612
    16131613    if (!m_pVMInformationDialog)
    1614         m_pVMInformationDialog = new UIVMInformationDialog(activeMachineWindow());
     1614        m_pVMInformationDialog = new UIVMInformationDialog(uimachine());
    16151615
    16161616    if (m_pVMInformationDialog)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp

    r98385 r98606  
    4444#include "UIMachine.h"
    4545#include "UIMachineView.h"
    46 #include "UIMachineWindow.h"
    4746#include "UIMessageCenter.h"
    4847#include "UIVMActivityMonitor.h"
     
    6867#include <iprt/time.h>
    6968
    70 UIVMInformationDialog::UIVMInformationDialog(UIMachineWindow *pMachineWindow)
     69UIVMInformationDialog::UIVMInformationDialog(UIMachine *pMachine)
    7170    : QMainWindowWithRestorableGeometryAndRetranslateUi(0)
     71    , m_pMachine(pMachine)
    7272    , m_pTabWidget(0)
    73     , m_pMachineWindow(pMachineWindow)
    7473    , m_fCloseEmitted(false)
    7574    , m_iGeometrySaveTimerId(-1)
    7675{
    77     if (m_pMachineWindow && !m_pMachineWindow->console().isNull())
    78     {
    79         CMachine comMachine = m_pMachineWindow->console().GetMachine();
    80         m_uMachineId = comMachine.GetId();
    81     }
    82     /* Prepare: */
    8376    prepare();
    84     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange,
    85             this, &UIVMInformationDialog::sltMachineStateChange);
    86 }
    87 
    88 UIVMInformationDialog::~UIVMInformationDialog()
    89 {
    9077}
    9178
     
    9885{
    9986    /* Setup dialog title: */
    100     setWindowTitle(tr("%1 - Session Information").arg(m_pMachineWindow->machine().GetName()));
     87    setWindowTitle(tr("%1 - Session Information").arg(m_strMachineName));
    10188
    10289    /* Translate tabs: */
     
    185172void UIVMInformationDialog::prepare()
    186173{
    187     /* Prepare dialog: */
    188     prepareThis();
    189     /* Load settings: */
    190     loadDialogGeometry();
    191 }
    192 
    193 void UIVMInformationDialog::prepareThis()
    194 {
     174    /* Load and clear: */
     175    AssertPtrReturnVoid(m_pMachine);
     176
     177    /// @todo to be encapsulated in UIMachine soon
     178    CMachine comMachine = m_pMachine->uisession()->machine();
     179    m_uMachineId = comMachine.GetId();
     180    m_strMachineName = comMachine.GetName();
     181
    195182#ifdef VBOX_WS_MAC
    196183    /* No window-icon on Mac OS X, because it acts as proxy icon which isn't necessary here. */
     
    201188#endif
    202189
    203     /* Prepare central-widget: */
     190    /* Prepare stuff: */
    204191    prepareCentralWidget();
    205 
    206     /* Retranslate: */
     192    prepareConnections();
     193
     194    /* Apply language settings: */
    207195    retranslateUi();
     196
     197    /* Load settings: */
     198    loadDialogGeometry();
    208199}
    209200
     
    238229        /* Create Configuration Details tab: */
    239230        UIInformationConfiguration *pInformationConfigurationWidget =
    240             new UIInformationConfiguration(this, m_pMachineWindow->machine(), m_pMachineWindow->console());
     231            new UIInformationConfiguration(this, m_pMachine->uisession()->machine(), m_pMachine->uisession()->console());
    241232        if (pInformationConfigurationWidget)
    242233        {
     
    247238        /* Create Runtime Information tab: */
    248239        UIInformationRuntime *pInformationRuntimeWidget =
    249             new UIInformationRuntime(this, m_pMachineWindow->machine(), m_pMachineWindow->console(), m_pMachineWindow->uimachine());
     240            new UIInformationRuntime(this, m_pMachine->uisession()->machine(), m_pMachine->uisession()->console(), m_pMachine);
    250241        if (pInformationRuntimeWidget)
    251242        {
     
    256247        /* Create Performance Monitor tab: */
    257248        UIVMActivityMonitor *pVMActivityMonitorWidget =
    258             new UIVMActivityMonitor(EmbedTo_Dialog, this, m_pMachineWindow->machine());
     249            new UIVMActivityMonitor(EmbedTo_Dialog, this, m_pMachine->uisession()->machine());
    259250        if (pVMActivityMonitorWidget)
    260251        {
    261             connect(m_pMachineWindow->uimachine(), &UIMachine::sigAdditionsStateChange,
     252            connect(m_pMachine, &UIMachine::sigAdditionsStateChange,
    262253                    pVMActivityMonitorWidget, &UIVMActivityMonitor::sltGuestAdditionsStateChange);
    263254            m_tabs.insert(Tabs_ActivityMonitor, pVMActivityMonitorWidget);
     
    266257
    267258        /* Create Guest Process Control tab: */
    268         QString strMachineName;
    269         if (m_pMachineWindow && m_pMachineWindow->console().isOk())
    270         {
    271             CMachine comMachine = m_pMachineWindow->console().GetMachine();
    272             if (comMachine.isOk())
    273                 strMachineName = comMachine.GetName();
    274         }
    275259        UIGuestProcessControlWidget *pGuestProcessControlWidget =
    276             new UIGuestProcessControlWidget(EmbedTo_Dialog, m_pMachineWindow->console().GetGuest(),
    277                                             this, strMachineName, false /* fShowToolbar */);
     260            new UIGuestProcessControlWidget(EmbedTo_Dialog, m_pMachine->uisession()->guest(),
     261                                            this, m_strMachineName, false /* fShowToolbar */);
    278262        if (pGuestProcessControlWidget)
    279263        {
     
    311295}
    312296
     297void UIVMInformationDialog::prepareConnections()
     298{
     299    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange,
     300            this, &UIVMInformationDialog::sltMachineStateChange);
     301}
     302
    313303void UIVMInformationDialog::loadDialogGeometry()
    314304{
    315     const QRect geo = gEDataManager->sessionInformationDialogGeometry(this, m_pMachineWindow);
     305    const QRect geo = gEDataManager->sessionInformationDialogGeometry(this, m_pMachine->activeWindow());
    316306    LogRel2(("GUI: UIVMInformationDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n",
    317307             geo.x(), geo.y(), geo.width(), geo.height()));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h

    r98103 r98606  
    4646class QITabWidget;
    4747class QIDialogButtonBox;
    48 class UIMachineWindow;
     48class UIMachine;
    4949
    5050/* Type definitions: */
     
    6565public:
    6666
    67     /** Constructs information dialog for passed @a pMachineWindow. */
    68     UIVMInformationDialog(UIMachineWindow *pMachineWindow);
    69     /** Destructs information dialog. */
    70     ~UIVMInformationDialog();
     67    /** Constructs information dialog for passed @a pMachine. */
     68    UIVMInformationDialog(UIMachine *pMachine);
    7169
    7270    /** Returns whether the dialog should be maximized when geometry being restored. */
     
    9694    /** Prepares all. */
    9795    void prepare();
    98     /** Prepares this. */
    99     void prepareThis();
    10096    /** Prepares central-widget. */
    10197    void prepareCentralWidget();
     
    106102    /** Prepares button-box. */
    107103    void prepareButtonBox();
     104    /** Prepares connections: */
     105    void prepareConnections();
    108106    void loadDialogGeometry();
    109107    void saveDialogGeometry();
     108
     109    /** Holds the machine UI reference. */
     110    UIMachine *m_pMachine;
    110111
    111112    /** @name Widget variables.
     
    117118       /** Holds the dialog button-box instance. */
    118119       QIDialogButtonBox            *m_pButtonBox;
    119        /** Holds the machine-window reference. */
    120        UIMachineWindow              *m_pMachineWindow;
    121120    /** @} */
    122121    bool m_fCloseEmitted;
    123122    int m_iGeometrySaveTimerId;
    124123    QUuid m_uMachineId;
     124    QString m_strMachineName;
    125125};
    126126
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