VirtualBox

Changeset 102731 in vbox for trunk/src


Ignore:
Timestamp:
Dec 29, 2023 4:30:17 PM (13 months ago)
Author:
vboxsync
Message:

FE/Qt: Extend QIManagerDialog facility with stuff to embed manager dialog to UIVirtualBoxManager tool stack.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIManagerDialog.cpp

    r102728 r102731  
    180180                                         | QDialogButtonBox::Apply
    181181#endif
     182                                         | QDialogButtonBox::Cancel
    182183                                         | QDialogButtonBox::Close
    183184                                         | QDialogButtonBox::Help);
     
    188189        m_buttons[ButtonType_Apply] = m_pButtonBox->button(QDialogButtonBox::Apply);
    189190#endif
     191        m_buttons[ButtonType_Embed] = m_pButtonBox->button(QDialogButtonBox::Cancel);
    190192        m_buttons[ButtonType_Close] = m_pButtonBox->button(QDialogButtonBox::Close);
    191193        m_buttons[ButtonType_Help] = m_pButtonBox->button(QDialogButtonBox::Help);
     
    198200        button(ButtonType_Reset)->hide();
    199201        button(ButtonType_Apply)->hide();
     202        button(ButtonType_Embed)->hide();
    200203        /* Disable some of buttons initially: */
    201204        button(ButtonType_Reset)->setEnabled(false);
    202205        button(ButtonType_Apply)->setEnabled(false);
     206        button(ButtonType_Embed)->setEnabled(false);
    203207
    204208        /* Configure connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIManagerDialog.h

    r99946 r102731  
    6666    ButtonType_Reset   = RT_BIT(0),
    6767    ButtonType_Apply   = RT_BIT(1),
    68     ButtonType_Close   = RT_BIT(2),
    69     ButtonType_Help    = RT_BIT(3)
     68    ButtonType_Embed   = RT_BIT(2),
     69    ButtonType_Close   = RT_BIT(3),
     70    ButtonType_Help    = RT_BIT(4),
    7071};
    7172
     
    103104signals:
    104105
     106    /** Notifies listeners about dialog should be embedded. */
     107    void sigEmbed();
    105108    /** Notifies listeners about dialog should be closed. */
    106109    void sigClose();
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r102723 r102731  
    10511051        }
    10521052
     1053        connect(m_managers[enmType], &QIManagerDialog::sigEmbed,
     1054                this, &UIVirtualBoxManager::sltEmbedManagerWindowDefault);
    10531055        connect(m_managers[enmType], &QIManagerDialog::sigClose,
    10541056                this, &UIVirtualBoxManager::sltCloseManagerWindowDefault);
     
    10571059    /* Expose instance: */
    10581060    UIDesktopWidgetWatchdog::restoreWidget(m_managers.value(enmType));
     1061}
     1062
     1063void UIVirtualBoxManager::sltEmbedManagerWindow(UIToolType enmType /* = UIToolType_Invalid */)
     1064{
     1065    /* Determine actual tool type if possible: */
     1066    if (enmType == UIToolType_Invalid)
     1067    {
     1068        if (   sender()
     1069            && sender()->inherits("QIManagerDialog"))
     1070        {
     1071            QIManagerDialog *pManager = qobject_cast<QIManagerDialog*>(sender());
     1072            AssertPtrReturnVoid(pManager);
     1073            enmType = m_managers.key(pManager);
     1074        }
     1075    }
     1076
     1077    /* Make sure type is valid: */
     1078    AssertReturnVoid(enmType != UIToolType_Invalid);
     1079
     1080    /* Make sure corresponding manager window is closed (if any): */
     1081    sltCloseManagerWindow(enmType);
     1082
     1083    /// @todo add tools which can be embedded ..
    10591084}
    10601085
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r102723 r102731  
    193193        /** Handles call to open Manager window by default. */
    194194        void sltOpenManagerWindowDefault() { sltOpenManagerWindow(); }
     195        /** Handles call to embed Manager window of certain @a enmType. */
     196        void sltEmbedManagerWindow(UIToolType enmType = UIToolType_Invalid);
    195197        /** Handles call to close Manager window of certain @a enmType. */
    196198        void sltCloseManagerWindow(UIToolType enmType = UIToolType_Invalid);
     199        /** Handles call to embed Manager window by default. */
     200        void sltEmbedManagerWindowDefault() { sltEmbedManagerWindow(); }
    197201        /** Handles call to close Manager window by default. */
    198202        void sltCloseManagerWindowDefault() { sltCloseManagerWindow(); }
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