VirtualBox

Changeset 67573 in vbox


Ignore:
Timestamp:
Jun 23, 2017 8:59:10 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116327
Message:

FE/Qt: Extension: QIManagerDialog: Extend API with more subclass injections, add Reset/Save buttons.

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

Legend:

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

    r67017 r67573  
    3232#  include "UIWindowMenuManager.h"
    3333# endif /* VBOX_WS_MAC */
    34 # include "UIMessageCenter.h"
    3534# include "VBoxGlobal.h"
    3635
     
    6968    , m_pButtonBox(0)
    7069{
    71 }
    72 
    73 void QIManagerDialog::closeEvent(QCloseEvent *pEvent)
    74 {
    75     /* Ignore the event itself: */
    76     pEvent->ignore();
    77     /* But tell the listener to close us: */
    78     emit sigClose();
    7970}
    8071
     
    10091    resize(proposedSize);
    10192
    102     /* Prepare dialog: */
    103     prepareDialog();
     93    /* Configure: */
     94    configure();
     95
    10496    /* Prepare central-widget: */
    10597    prepareCentralWidget();
     
    110102    prepareToolBar();
    111103#endif
     104
     105    /* Finalize: */
     106    finalize();
    112107
    113108    /* Center according requested widget: */
     
    129124            centralWidget()->layout()->setSpacing(10);
    130125
    131             /* Prepare widget: */
    132             prepareWidget();
     126            /* Configure central-widget: */
     127            configureCentralWidget();
     128
    133129            /* Prepare button-box: */
    134130            prepareButtonBox();
     
    144140    {
    145141        /* Configure button-box: */
    146         m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Close);
     142        m_pButtonBox->setStandardButtons(QDialogButtonBox::Reset | QDialogButtonBox::Save | QDialogButtonBox::Close);
    147143        m_pButtonBox->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape);
    148         connect(m_pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog()));
     144        m_pButtonBox->button(QDialogButtonBox::Reset)->hide();
     145        m_pButtonBox->button(QDialogButtonBox::Save)->hide();
     146        m_pButtonBox->button(QDialogButtonBox::Reset)->setEnabled(false);
     147        m_pButtonBox->button(QDialogButtonBox::Save)->setEnabled(false);
    149148        connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &QIManagerDialog::sigClose);
     149
     150        /* Configure button-box: */
     151        configureButtonBox();
    150152
    151153        /* Add into layout: */
     
    192194}
    193195
     196void QIManagerDialog::closeEvent(QCloseEvent *pEvent)
     197{
     198    /* Ignore the event itself: */
     199    pEvent->ignore();
     200    /* But tell the listener to close us: */
     201    emit sigClose();
     202}
     203
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIManagerDialog.h

    r67075 r67573  
    8080    /** @name Prepare/cleanup cascade.
    8181      * @{ */
    82         /** Prepares dialog. */
    83         virtual void prepareDialog() {}
    84         /** Prepares widget. */
    85         virtual void prepareWidget() {}
     82        /** Prepares all.
     83          * @note Normally you no need to reimplement it. */
     84        void prepare();
     85        /** Configures all.
     86          * @note Injected into prepare(), reimplement to configure all there. */
     87        virtual void configure() {}
     88        /** Prepares central-widget.
     89          * @note Injected into prepare(), normally you no need to reimplement it. */
     90        void prepareCentralWidget();
     91        /** Configures central-widget.
     92          * @note Injected into prepareCentralWidget(), reimplement to configure central-widget there. */
     93        virtual void configureCentralWidget() {}
     94        /** Prepares button-box.
     95          * @note Injected into prepareCentralWidget(), normally you no need to reimplement it. */
     96        void prepareButtonBox();
     97        /** Configures button-box.
     98          * @note Injected into prepareButtonBox(), reimplement to configure button-box there. */
     99        virtual void configureButtonBox() {}
     100        /** Prepares menu-bar.
     101          * @note Injected into prepare(), normally you no need to reimplement it. */
     102        void prepareMenuBar();
     103#ifdef VBOX_WS_MAC
     104        /** Prepares toolbar.
     105          * @note Injected into prepare(), normally you no need to reimplement it. */
     106        void prepareToolBar();
     107#endif
     108        /** Performs final preparations.
     109          * @note Injected into prepare(), reimplement to postprocess all there. */
     110        virtual void finalize() {}
     111
     112        /** Cleanup menu-bar.
     113          * @note Injected into cleanup(), normally you no need to reimplement it. */
     114        void cleanupMenuBar();
     115        /** Cleanups all.
     116          * @note Normally you no need to reimplement it. */
     117        void cleanup();
    86118    /** @} */
    87119
     
    96128        void setWidgetToolbar(UIToolBar *pWidgetToolbar) { m_pWidgetToolbar = pWidgetToolbar; }
    97129#endif
     130
     131        /** Returns the widget. */
     132        virtual QWidget *widget() { return m_pWidget; }
     133        /** Returns the button-box instance. */
     134        QIDialogButtonBox *buttonBox() { return m_pButtonBox; }
    98135    /** @} */
    99136
     
    105142
    106143private:
    107 
    108     /** @name Prepare/cleanup cascade.
    109       * @{ */
    110         /** Prepares all. */
    111         void prepare();
    112         /** Prepares central-widget. */
    113         void prepareCentralWidget();
    114         /** Prepares button-box. */
    115         void prepareButtonBox();
    116         /** Prepares menu-bar. */
    117         void prepareMenuBar();
    118 #ifdef VBOX_WS_MAC
    119         /** Prepares toolbar. */
    120         void prepareToolBar();
    121 #endif
    122 
    123         /** Cleanup menu-bar. */
    124         void cleanupMenuBar();
    125         /** Cleanups all. */
    126         void cleanup();
    127     /** @} */
    128144
    129145    /** @name General stuff.
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.cpp

    r67452 r67573  
    10491049}
    10501050
    1051 void UIHostNetworkManager::prepareDialog()
     1051void UIHostNetworkManager::configure()
    10521052{
    10531053    /* Apply window icons: */
    10541054    setWindowIcon(UIIconPool::iconSetFull(":/host_iface_manager_32px.png", ":/host_iface_manager_16px.png"));
    1055 
    1056     /* Apply language settings: */
    1057     retranslateUi();
    1058 }
    1059 
    1060 void UIHostNetworkManager::prepareWidget()
     1055}
     1056
     1057void UIHostNetworkManager::configureCentralWidget()
    10611058{
    10621059    /* Create widget: */
     
    10751072}
    10761073
     1074void UIHostNetworkManager::finalize()
     1075{
     1076    /* Apply language settings: */
     1077    retranslateUi();
     1078}
     1079
     1080UIHostNetworkManagerWidget *UIHostNetworkManager::widget()
     1081{
     1082    return qobject_cast<UIHostNetworkManagerWidget*>(QIManagerDialog::widget());
     1083}
     1084
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.h

    r67251 r67573  
    197197    /** @name Prepare/cleanup cascade.
    198198      * @{ */
    199         /** Prepares dialog. */
    200         void prepareDialog();
    201         /** Prepares widget. */
    202         void prepareWidget();
     199        /** Configures all. */
     200        virtual void configure() /* override */;
     201        /** Configures central-widget. */
     202        virtual void configureCentralWidget() /* override */;
     203        /** Perform final preparations. */
     204        virtual void finalize() /* override */;
     205    /** @} */
     206
     207    /** @name Widget stuff.
     208      * @{ */
     209        /** Returns the widget. */
     210        virtual UIHostNetworkManagerWidget *widget() /* override */;
    203211    /** @} */
    204212
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r67250 r67573  
    22992299}
    23002300
    2301 void UIMediumManager::prepareDialog()
     2301void UIMediumManager::configure()
    23022302{
    23032303    /* Apply window icons: */
    23042304    setWindowIcon(UIIconPool::iconSetFull(":/diskimage_32px.png", ":/diskimage_16px.png"));
    2305 
    2306     /* Apply language settings: */
    2307     retranslateUi();
    2308 }
    2309 
    2310 void UIMediumManager::prepareWidget()
     2305}
     2306
     2307void UIMediumManager::configureCentralWidget()
    23112308{
    23122309    /* Create widget: */
     
    23252322}
    23262323
     2324void UIMediumManager::finalize()
     2325{
     2326    /* Apply language settings: */
     2327    retranslateUi();
     2328}
     2329
     2330UIMediumManagerWidget *UIMediumManager::widget()
     2331{
     2332    return qobject_cast<UIMediumManagerWidget*>(QIManagerDialog::widget());
     2333}
     2334
    23272335#include "UIMediumManager.moc"
    23282336
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r67250 r67573  
    357357    /** @name Prepare/cleanup cascade.
    358358      * @{ */
    359         /** Prepares dialog. */
    360         void prepareDialog();
    361         /** Prepares widget. */
    362         void prepareWidget();
     359        /** Configures all. */
     360        virtual void configure() /* override */;
     361        /** Configures central-widget. */
     362        virtual void configureCentralWidget() /* override */;
     363        /** Perform final preparations. */
     364        virtual void finalize() /* override */;
     365    /** @} */
     366
     367    /** @name Widget stuff.
     368      * @{ */
     369        /** Returns the widget. */
     370        virtual UIMediumManagerWidget *widget() /* override */;
    363371    /** @} */
    364372
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