VirtualBox

Ignore:
Timestamp:
Jun 15, 2017 9:37:52 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116145
Message:

FE/Qt: Selector UI: Tools pane: Snapshot pane: Detach it from the Selector UI event-handling.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r67114 r67419  
    211211}
    212212
    213 void UISelectorWindow::sltHandleChooserPaneIndexChange(bool fRefreshDetails, bool fRefreshSnapshots, bool)
     213void UISelectorWindow::sltHandleChooserPaneIndexChange(bool fUpdateDetails /* = true */,
     214                                                       bool fUpdateTools /* = true */)
    214215{
    215216    /* Get current item: */
     
    237238    updateActionsAppearance();
    238239
    239     /* Refresh details-pane even if there are no items selected: */
    240     if (fRefreshDetails)
     240    /* Update Details-pane: */
     241    if (fUpdateDetails)
    241242        m_pPaneDetails->setItems(currentItems());
    242243
     
    244245    if (pItem && pItem->accessible())
    245246    {
    246         /* Make sure at least details pane raised: */
     247        /* Make sure at least Details-pane raised: */
    247248        if (m_pContainerDetails->currentWidget() == m_pPaneDesktop)
    248249            m_pContainerDetails->setCurrentWidget(m_pPaneDetails);
    249250
    250         if (fRefreshSnapshots)
    251         {
    252             updateSnapshots(pItem, pItem->machine());
    253             /* Always hide snapshots-view if
    254              * single group or more than one machine is selected: */
    255             if (currentItems().size() > 1 || m_pPaneChooser->isSingleGroupSelected())
    256                 lockSnapshots();
    257         }
     251        /* Refresh Tools-pane if requested: */
     252        if (fUpdateTools)
     253            m_pPaneTools->setMachine(pItem->machine());
    258254    }
    259255    else
    260256    {
    261         /* Make sure desktop pane raised: */
     257        /* Make sure Desktop-pane raised: */
    262258        if (m_pContainerDetails->currentWidget() != m_pPaneDesktop)
    263259            m_pContainerDetails->setCurrentWidget(m_pPaneDesktop);
     
    290286        }
    291287
    292         /* Empty and disable other tabs: */
    293         updateSnapshots(0, CMachine());
     288        /* Refresh Tools-pane in any case: */
     289        m_pPaneTools->setMachine(CMachine());
    294290    }
    295291}
     
    409405}
    410406
    411 void UISelectorWindow::sltHandleSnapshotChange(QString strID)
    412 {
    413     /* Get current item: */
    414     UIVMItem *pItem = currentItem();
    415 
    416     /* Make sure current item present: */
    417     if (!pItem)
    418         return;
    419 
    420     /* If signal is for the current item: */
    421     if (pItem->id() == strID)
    422         updateSnapshots(pItem, pItem->machine());
    423 }
    424 
    425407void UISelectorWindow::sltOpenVirtualMediumManagerWindow()
    426408{
     
    10841066    else
    10851067    {
    1086         /* Raise the desktop pane with welcome text or error details: */
     1068        /* Raise the Desktop-pane with welcome text or error details: */
    10871069        m_pContainerDetails->setCurrentWidget(m_pPaneDesktop);
    10881070    }
     
    11261108{
    11271109    return m_pPaneChooser->currentItems();
    1128 }
    1129 
    1130 void UISelectorWindow::updateSnapshots(UIVMItem * /* pItem */, const CMachine &comMachine)
    1131 {
    1132     /* Update snapshot pane availability: */
    1133     if (comMachine.isNotNull())
    1134         m_pSegmentedButton->setEnabled(SegmentType_Tools, true);
    1135     else
    1136         lockSnapshots();
    1137 
    1138     /* Update tools pane finally: */
    1139     m_pPaneTools->setMachine(comMachine);
    1140 }
    1141 
    1142 void UISelectorWindow::lockSnapshots()
    1143 {
    1144     /* First switch to details pane: */
    1145     sltPerformSegmentedButtonSwitchToDetails();
    1146     /* Then lock the snapshot pane: */
    1147     m_pSegmentedButton->setEnabled(SegmentType_Tools, false);
    11481110}
    11491111
     
    11681130
    11691131    /* Make sure details and snapshot panes are updated: */
    1170     sltHandleChooserPaneIndexChange();
     1132    sltHandleChooserPaneIndexChange(false /* update details? */, false /* update snapshots? */);
    11711133
    11721134#if defined(VBOX_WS_MAC) && QT_VERSION < 0x050000
     
    13321294#endif /* VBOX_WS_MAC */
    13331295
    1334 //#ifdef VBOX_WS_MAC
    1335 //    /* Cocoa stuff should be async..
    1336 //     * Do not ask me why but otherwise
    1337 //     * it conflicts with native handlers. */
    1338 //    QMetaObject::invokeMethod(this, "sltPerformSegmentedButtonSwitchToDetails", Qt::QueuedConnection);
    1339 //#else /* !VBOX_WS_MAC */
     1296    /* Switch segmented-button to Details-pane: */
    13401297    sltPerformSegmentedButtonSwitchToDetails();
    1341 //#endif /* !VBOX_WS_MAC */
     1298
     1299    /* Make sure current Chooser-pane index fetched: */
     1300    sltHandleChooserPaneIndexChange();
    13421301}
    13431302
     
    18151774#endif
    18161775
    1817     /* Prepare graphics VM list: */
     1776    /* Prepare Chooser-pane: */
    18181777    m_pPaneChooser = new UIGChooser(this);
    18191778
    1820     /* Prepare graphics details: */
     1779    /* Prepare Details-pane: */
    18211780    m_pPaneDetails = new UIGDetails(this);
    18221781
     
    18251784                                 m_pPaneDetails->palette().color(QPalette::Active, QPalette::Window));
    18261785
    1827     /* Prepare desktop pane: */
     1786    /* Prepare Desktop-pane: */
    18281787    m_pPaneDesktop = new UIDesktopPane(actionPool()->action(UIActionIndexST_M_Group_S_Refresh), this);
    18291788
    1830     /* Prepare tools pane: */
     1789    /* Prepare Tools-pane: */
    18311790    m_pPaneTools = new UIToolsPane(this);
    18321791
     
    19651924    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltHandleStateChange(QString)));
    19661925    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltHandleStateChange(QString)));
    1967     connect(gVBoxEvents, SIGNAL(sigSnapshotTake(QString, QString)), this, SLOT(sltHandleSnapshotChange(QString)));
    1968     connect(gVBoxEvents, SIGNAL(sigSnapshotDelete(QString, QString)), this, SLOT(sltHandleSnapshotChange(QString)));
    1969     connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltHandleSnapshotChange(QString)));
    1970     connect(gVBoxEvents, SIGNAL(sigSnapshotRestore(QString, QString)), this, SLOT(sltHandleSnapshotChange(QString)));
    19711926}
    19721927
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h

    r67114 r67419  
    9494
    9595    /** Handles signal about Chooser-pane index change.
    96       * @param fRefreshDetails     brings whether details should be updated.
    97       * @param fRefreshSnapshots   brings whether snapshots should be updated.
    98       * @param fRefreshDescription brings whether description should be updated. */
    99     void sltHandleChooserPaneIndexChange(bool fRefreshDetails = true, bool fRefreshSnapshots = true, bool fRefreshDescription = true);
     96      * @param  fUpdateDetails  Brings whether details should be updated.
     97      * @param  fUpdateTools    Brings whether tools should be updated. */
     98    void sltHandleChooserPaneIndexChange(bool fUpdateDetails = true,
     99                                         bool fUpdateTools = true);
    100100
    101101    /** Handles signal about medium-enumeration finished. */
     
    117117        /** Handles CVirtualBox event about state change for machine with @a strID. */
    118118        void sltHandleStateChange(QString strID);
    119         /** Handles CVirtualBox event about snapshot change for machine with @a strID. */
    120         void sltHandleSnapshotChange(QString strID);
    121119    /** @} */
    122120
     
    216214    QList<UIVMItem*> currentItems() const;
    217215
    218     /** Updates snapshot related controls for passed @a pItem and @a comMachine. */
    219     void updateSnapshots(UIVMItem *pItem, const CMachine &comMachine);
    220     /** Locks snapshot related controls. */
    221     void lockSnapshots();
    222 
    223216    /** @name Event handling stuff.
    224217      * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp

    r67275 r67419  
    580580}
    581581
    582 void UISnapshotPane::sltMachineDataChange(QString strMachineID)
     582void UISnapshotPane::sltHandleMachineDataChange(QString strMachineID)
    583583{
    584584    /* Make sure it's our VM: */
     
    593593}
    594594
    595 void UISnapshotPane::sltMachineStateChange(QString strMachineID, KMachineState enmState)
     595void UISnapshotPane::sltHandleMachineStateChange(QString strMachineID, KMachineState enmState)
    596596{
    597597    /* Make sure it's our VM: */
     
    607607}
    608608
    609 void UISnapshotPane::sltSessionStateChange(QString strMachineID, KSessionState enmState)
     609void UISnapshotPane::sltHandleSessionStateChange(QString strMachineID, KSessionState enmState)
    610610{
    611611    /* Make sure it's our VM: */
     
    621621    /* Update action states: */
    622622    updateActionStates();
     623}
     624
     625void UISnapshotPane::sltHandleSnapshotChange(QString strMachineID)
     626{
     627    /* Make sure it's our VM: */
     628    if (strMachineID != m_strMachineID)
     629        return;
     630
     631    // TODO: Refresh only necessary bits.
     632    /* Refresh everything: */
     633    refreshAll();
    623634}
    624635
     
    839850    /* Configure Main event connections: */
    840851    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange,
    841             this, &UISnapshotPane::sltMachineDataChange);
     852            this, &UISnapshotPane::sltHandleMachineDataChange);
    842853    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange,
    843             this, &UISnapshotPane::sltMachineStateChange);
     854            this, &UISnapshotPane::sltHandleMachineStateChange);
    844855    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSessionStateChange,
    845             this, &UISnapshotPane::sltSessionStateChange);
     856            this, &UISnapshotPane::sltHandleSessionStateChange);
     857    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotTake,
     858            this, &UISnapshotPane::sltHandleSnapshotChange);
     859    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotDelete,
     860            this, &UISnapshotPane::sltHandleSnapshotChange);
     861    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotChange,
     862            this, &UISnapshotPane::sltHandleSnapshotChange);
     863    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotRestore,
     864            this, &UISnapshotPane::sltHandleSnapshotChange);
    846865
    847866    /* Create read-write locker: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h

    r67275 r67419  
    8686      * @{ */
    8787        /** Handles machine data change for machine with @a strMachineID. */
    88         void sltMachineDataChange(QString strMachineID);
     88        void sltHandleMachineDataChange(QString strMachineID);
    8989        /** Handles machine @a enmState change for machine with @a strMachineID. */
    90         void sltMachineStateChange(QString strMachineID, KMachineState enmState);
     90        void sltHandleMachineStateChange(QString strMachineID, KMachineState enmState);
     91
    9192        /** Handles session @a enmState change for machine with @a strMachineID. */
    92         void sltSessionStateChange(QString strMachineID, KSessionState enmState);
     93        void sltHandleSessionStateChange(QString strMachineID, KSessionState enmState);
     94
     95        /** Handles any snapshot change for machine with @a strMachineID. */
     96        void sltHandleSnapshotChange(QString strMachineID);
    9397    /** @} */
    9498
Note: See TracChangeset for help on using the changeset viewer.

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