VirtualBox

Changeset 77430 in vbox


Ignore:
Timestamp:
Feb 22, 2019 1:24:07 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128993
Message:

FE/Qt: bugref:9241: VirtualBox Manager UI: Chooser pane: Wipe out sliding functionality for now, it will be implemented another way.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserHandlerKeyboard.cpp

    r77269 r77430  
    6363        case Qt::Key_Home:
    6464        {
    65             /* Not during sliding: */
    66             if (model()->isSlidingInProgress())
    67                 return false;
    68 
    6965            /* Was control modifier pressed? */
    7066#ifdef VBOX_WS_MAC
     
    160156        case Qt::Key_End:
    161157        {
    162             /* Not during sliding: */
    163             if (model()->isSlidingInProgress())
    164                 return false;
    165 
    166158            /* Was control modifier pressed? */
    167159#ifdef VBOX_WS_MAC
     
    252244            return false;
    253245        }
    254         /* Key LEFT? */
    255         case Qt::Key_Left:
    256         {
    257 #if 0
    258             /* If there is a focus item: */
    259             if (UIChooserItem *pFocusItem = model()->focusItem())
    260             {
    261                 /* Of the known type: */
    262                 switch (pFocusItem->type())
    263                 {
    264                     case UIChooserItemType_Group:
    265                     case UIChooserItemType_Global:
    266                     case UIChooserItemType_Machine:
    267                     {
    268                         /* Unindent root if its NOT main: */
    269                         if (model()->root() != model()->mainRoot())
    270                             model()->unindentRoot();
    271                         break;
    272                     }
    273                     default:
    274                         break;
    275                 }
    276             }
    277 #endif
    278             /* Pass that event: */
    279             return false;
    280         }
    281         /* Key RIGHT? */
    282         case Qt::Key_Right:
    283         {
    284 #if 0
    285             /* If there is focus item: */
    286             if (UIChooserItem *pFocusItem = model()->focusItem())
    287             {
    288                 /* Of the group type: */
    289                 if (pFocusItem->type() == UIChooserItemType_Group)
    290                 {
    291                     /* Indent root with this item: */
    292                     model()->indentRoot(pFocusItem);
    293                 }
    294             }
    295 #endif
    296             /* Pass that event: */
    297             return false;
    298         }
    299246        /* Key F2? */
    300247        case Qt::Key_F2:
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserHandlerMouse.cpp

    r77366 r77430  
    199199                if (UIChooserItemGroup *pGroupItem = qgraphicsitem_cast<UIChooserItemGroup*>(pItemUnderMouse))
    200200                {
    201                     /* Prepare variables: */
    202                     int iGroupItemWidth = pGroupItem->geometry().toRect().width();
    203                     int iMouseDoubleClickX = pEvent->scenePos().toPoint().x();
    204                     /* If it was a root: */
    205                     if (pGroupItem->isRoot())
    206                     {
    207 #if 0
    208                         /* Do not allow for unhovered root: */
    209                         if (!pGroupItem->isHovered())
    210                             return false;
    211                         /* Unindent root if possible: */
    212                         if (model()->root() != model()->mainRoot())
    213                         {
    214                             pGroupItem->setHovered(false);
    215                             model()->unindentRoot();
    216                         }
    217 #endif
    218                     }
    219                     /* If it was a simple group item: */
    220                     else
    221                     {
    222                         /* If click was at left part: */
    223                         if (iMouseDoubleClickX < iGroupItemWidth / 2)
    224                         {
    225                             /* Toggle it: */
    226                             if (pGroupItem->isClosed())
    227                                 pGroupItem->open();
    228                             else if (pGroupItem->isOpened())
    229                                 pGroupItem->close();
    230                         }
    231 #if 0
    232                         /* If click was at right part: */
    233                         else
    234                         {
    235                             /* Indent root with group item: */
    236                             pGroupItem->setHovered(false);
    237                             model()->indentRoot(pGroupItem);
    238                         }
    239 #endif
     201                    /* If it was not root: */
     202                    if (!pGroupItem->isRoot())
     203                    {
     204                        /* Toggle it: */
     205                        if (pGroupItem->isClosed())
     206                            pGroupItem->open();
     207                        else if (pGroupItem->isOpened())
     208                            pGroupItem->close();
    240209                    }
    241210                    /* Filter that event out: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r77375 r77430  
    12811281    /* Unhover before indenting: */
    12821282    setHovered(false);
    1283 
    1284 #if 0
    1285     /* Indent to this root: */
    1286     model()->indentRoot(this);
    1287 #endif
    12881283}
    12891284
     
    12921287    /* Unhover before unindenting: */
    12931288    setHovered(false);
    1294 
    1295     /* Unindent to previous root: */
    1296     model()->unindentRoot();
    12971289}
    12981290
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r77374 r77430  
    7272    , m_pContextMenuGroup(0)
    7373    , m_pContextMenuMachine(0)
    74     , m_fSliding(false)
    75     , m_pLeftRoot(0)
    76     , m_pRightRoot(0)
    77     , m_pAfterSlidingFocus(0)
    7874    , m_iScrollingTokenSize(30)
    7975    , m_fIsScrollingInProgress(false)
     
    243239    {
    244240        /* Search for group-item with passed descriptor (name): */
    245         pItem = mainRoot()->searchForItem(strItemDescriptor,
    246                                           UIChooserItemSearchFlag_Group |
    247                                           UIChooserItemSearchFlag_ExactName);
     241        pItem = root()->searchForItem(strItemDescriptor,
     242                                      UIChooserItemSearchFlag_Group |
     243                                      UIChooserItemSearchFlag_ExactName);
    248244    }
    249245    /* Its a machine-item definition? */
     
    255251        {
    256252            /* Search for machine-item with required name: */
    257             pItem = mainRoot()->searchForItem(comMachine.GetName(),
    258                                               UIChooserItemSearchFlag_Machine |
    259                                               UIChooserItemSearchFlag_ExactName);
     253            pItem = root()->searchForItem(comMachine.GetName(),
     254                                          UIChooserItemSearchFlag_Machine |
     255                                          UIChooserItemSearchFlag_ExactName);
    260256        }
    261257    }
     
    354350
    355351    /* Make sure this parent is not main root-item: */
    356     if (pFirstParent == mainRoot())
     352    if (pFirstParent == root())
    357353        return false;
    358354
     
    460456}
    461457
    462 UIChooserItem *UIChooserModel::mainRoot() const
    463 {
    464     return m_rootStack.first();
    465 }
    466 
    467458UIChooserItem *UIChooserModel::root() const
    468459{
    469     return m_rootStack.last();
    470 }
    471 
    472 void UIChooserModel::indentRoot(UIChooserItem *pNewRootItem)
    473 {
    474     /* Do nothing if sliding already: */
    475     if (m_fSliding)
    476         return;
    477 
    478     /* We are sliding: */
    479     m_fSliding = true;
    480     emit sigSlidingStarted();
    481 
    482     /* Hiding old root: */
    483     root()->hide();
    484 
    485     /* Create left root: */
    486     bool fLeftRootIsMain = root() == mainRoot();
    487     m_pLeftRoot = new UIChooserItemGroup(scene(), root()->toGroupItem(), fLeftRootIsMain);
    488     m_pLeftRoot->setPos(0, 0);
    489     m_pLeftRoot->resize(root()->geometry().size());
    490 
    491     /* Create right root: */
    492     m_pRightRoot = new UIChooserItemGroup(scene(), pNewRootItem->toGroupItem(), false);
    493     m_pRightRoot->setPos(root()->geometry().width(), 0);
    494     m_pRightRoot->resize(root()->geometry().size());
    495     m_pRightRoot->setLevel(pNewRootItem->level() + 1);
    496 
    497     /* Indent root: */
    498     root()->setRoot(false);
    499     m_rootStack << pNewRootItem;
    500     root()->setRoot(true);
    501     m_pAfterSlidingFocus = root()->items().first();
    502 
    503     /* Hiding new root: */
    504     root()->hide();
    505 
    506     /* Move it to scene (making it top-level item): */
    507     root()->setParentItem(0);
    508     scene()->addItem(root());
    509 
    510     /* Slide root: */
    511     slideRoot(true);
    512 }
    513 
    514 void UIChooserModel::unindentRoot()
    515 {
    516     /* Do nothing if sliding already: */
    517     if (m_fSliding)
    518         return;
    519 
    520     /* We are sliding: */
    521     m_fSliding = true;
    522     emit sigSlidingStarted();
    523 
    524     /* Hiding old root: */
    525     root()->hide();
    526 
    527     /* Remove it from scene (returning back to it's parent): */
    528     root()->setParentItem(root()->parentItem());
    529 
    530     /* Create left root: */
    531     bool fLeftRootIsMain = m_rootStack.at(m_rootStack.size() - 2) == mainRoot();
    532     m_pLeftRoot = new UIChooserItemGroup(scene(), m_rootStack.at(m_rootStack.size() - 2)->toGroupItem(), fLeftRootIsMain);
    533     m_pLeftRoot->setPos(- root()->geometry().width(), 0);
    534     m_pLeftRoot->resize(root()->geometry().size());
    535 
    536     /* Create right root: */
    537     m_pRightRoot = new UIChooserItemGroup(scene(), root()->toGroupItem(), false);
    538     m_pRightRoot->setPos(0, 0);
    539     m_pRightRoot->resize(root()->geometry().size());
    540     m_pRightRoot->setLevel(root()->level());
    541 
    542     /* Unindent root: */
    543     m_pAfterSlidingFocus = root();
    544     root()->setRoot(false);
    545     m_rootStack.removeLast();
    546     root()->setRoot(true);
    547 
    548     /* Slide root: */
    549     slideRoot(false);
    550 }
    551 
    552 bool UIChooserModel::isSlidingInProgress() const
    553 {
    554     return m_fSliding;
     460    return m_pRoot.data();
    555461}
    556462
     
    562468void UIChooserModel::cleanupGroupTree()
    563469{
    564     cleanupGroupTree(mainRoot());
     470    cleanupGroupTree(root());
    565471}
    566472
     
    679585void UIChooserModel::updateLayout()
    680586{
    681     /* No layout updates while sliding: */
    682     if (m_fSliding)
    683         return;
    684 
    685587    /* Initialize variables: */
    686588    const int iSceneMargin = data(ChooserModelData_Margin).toInt();
     
    776678{
    777679    /* Update machine-items with passed id: */
    778     mainRoot()->updateAllItems(uId);
     680    root()->updateAllItems(uId);
    779681}
    780682
     
    782684{
    783685    /* Update machine-items with passed id: */
    784     mainRoot()->updateAllItems(uId);
     686    root()->updateAllItems(uId);
    785687}
    786688
     
    803705            if (uId == m_uLastCreatedMachineId)
    804706            {
    805                 setCurrentItem(mainRoot()->searchForItem(comMachine.GetName(),
    806                                                          UIChooserItemSearchFlag_Machine |
    807                                                          UIChooserItemSearchFlag_ExactName));
     707                setCurrentItem(root()->searchForItem(comMachine.GetName(),
     708                                                     UIChooserItemSearchFlag_Machine |
     709                                                     UIChooserItemSearchFlag_ExactName));
    808710            }
    809711        }
     
    813715    {
    814716        /* Remove machine-items with passed id: */
    815         mainRoot()->removeAllItems(uId.toString());
     717        root()->removeAllItems(uId.toString());
    816718        /* Update model: */
    817719        cleanupGroupTree();
     
    832734{
    833735    /* Update machine-items with passed id: */
    834     mainRoot()->updateAllItems(uId);
     736    root()->updateAllItems(uId);
    835737}
    836738
     
    838740{
    839741    /* Update machine-items with passed id: */
    840     mainRoot()->updateAllItems(uId);
     742    root()->updateAllItems(uId);
    841743}
    842744
     
    844746{
    845747    AssertMsgFailed(("Focus item destroyed!"));
    846 }
    847 
    848 void UIChooserModel::sltLeftRootSlidingProgress()
    849 {
    850     /* Update left root: */
    851     m_pLeftRoot->updateGeometry();
    852     m_pLeftRoot->updateLayout();
    853 }
    854 
    855 void UIChooserModel::sltRightRootSlidingProgress()
    856 {
    857     /* Update right root: */
    858     m_pRightRoot->updateGeometry();
    859     m_pRightRoot->updateLayout();
    860 }
    861 
    862 void UIChooserModel::sltSlidingComplete()
    863 {
    864     /* Delete temporary roots: */
    865     delete m_pLeftRoot;
    866     m_pLeftRoot = 0;
    867     delete m_pRightRoot;
    868     m_pRightRoot = 0;
    869 
    870     /* We are no more sliding: */
    871     m_fSliding = false;
    872 
    873     /* Update root geometry: */
    874     root()->updateGeometry();
    875 
    876     /* Update model: */
    877     cleanupGroupTree();
    878     updateNavigation();
    879     updateLayout();
    880     if (m_pAfterSlidingFocus)
    881     {
    882         setCurrentItem(m_pAfterSlidingFocus);
    883         m_pAfterSlidingFocus = 0;
    884     }
    885     else
    886     {
    887         if (!navigationList().isEmpty())
    888             setCurrentItem(navigationList().first());
    889         else
    890             unsetCurrentItems();
    891     }
    892748}
    893749
     
    1104960{
    1105961    /* Remove all the items first: */
    1106     mainRoot()->removeAllItems(uId);
     962    root()->removeAllItems(uId);
    1107963    /* Wipe out empty groups: */
    1108964    cleanupGroupTree();
     
    11661022            /* Select first of reloaded items: */
    11671023            if (!pSelectedItem)
    1168                 pSelectedItem = mainRoot()->searchForItem(strMachineName,
    1169                                                           UIChooserItemSearchFlag_Machine |
    1170                                                           UIChooserItemSearchFlag_ExactName);
     1024                pSelectedItem = root()->searchForItem(strMachineName,
     1025                                                      UIChooserItemSearchFlag_Machine |
     1026                                                      UIChooserItemSearchFlag_ExactName);
    11711027        }
    11721028    }
     
    11911047    /* Enumerate all the existing machine-items: */
    11921048    QList<UIChooserItemMachine*> existingMachineItemList;
    1193     UIChooserItemMachine::enumerateMachineItems(mainRoot()->items(), existingMachineItemList);
     1049    UIChooserItemMachine::enumerateMachineItems(root()->items(), existingMachineItemList);
    11941050
    11951051    /* Prepare arrays: */
     
    13461202void UIChooserModel::prepareRoot()
    13471203{
    1348     m_rootStack << new UIChooserItemGroup(scene());
     1204    m_pRoot = new UIChooserItemGroup(scene());
    13491205}
    13501206
     
    14721328    connect(this, SIGNAL(sigSelectionInvalidated()),
    14731329            parent(), SIGNAL(sigSelectionInvalidated()));
    1474     connect(this, SIGNAL(sigSlidingStarted()),
    1475             parent(), SIGNAL(sigSlidingStarted()));
    14761330    connect(this, SIGNAL(sigToggleStarted()),
    14771331            parent(), SIGNAL(sigToggleStarted()));
     
    15671421void UIChooserModel::cleanupRoot()
    15681422{
    1569     delete mainRoot();
    1570     m_rootStack.clear();
     1423    delete root();
     1424    m_pRoot.clear();
    15711425}
    15721426
     
    17511605}
    17521606
    1753 void UIChooserModel::slideRoot(bool fForward)
    1754 {
    1755     /* Animation group: */
    1756     QParallelAnimationGroup *pAnimation = new QParallelAnimationGroup(this);
    1757     connect(pAnimation, SIGNAL(finished()), this, SLOT(sltSlidingComplete()), Qt::QueuedConnection);
    1758 
    1759     /* Left root animation: */
    1760     {
    1761         QPropertyAnimation *pLeftAnimation = new QPropertyAnimation(m_pLeftRoot, "geometry", this);
    1762         connect(pLeftAnimation, SIGNAL(valueChanged(const QVariant&)), this, SLOT(sltLeftRootSlidingProgress()));
    1763         QRectF startGeo = m_pLeftRoot->geometry();
    1764         QRectF endGeo = fForward ? startGeo.translated(- startGeo.width(), 0) :
    1765                                    startGeo.translated(startGeo.width(), 0);
    1766         pLeftAnimation->setEasingCurve(QEasingCurve::InCubic);
    1767         pLeftAnimation->setDuration(500);
    1768         pLeftAnimation->setStartValue(startGeo);
    1769         pLeftAnimation->setEndValue(endGeo);
    1770         pAnimation->addAnimation(pLeftAnimation);
    1771     }
    1772 
    1773     /* Right root animation: */
    1774     {
    1775         QPropertyAnimation *pRightAnimation = new QPropertyAnimation(m_pRightRoot, "geometry", this);
    1776         connect(pRightAnimation, SIGNAL(valueChanged(const QVariant&)), this, SLOT(sltRightRootSlidingProgress()));
    1777         QRectF startGeo = m_pRightRoot->geometry();
    1778         QRectF endGeo = fForward ? startGeo.translated(- startGeo.width(), 0) :
    1779                                    startGeo.translated(startGeo.width(), 0);
    1780         pRightAnimation->setEasingCurve(QEasingCurve::InCubic);
    1781         pRightAnimation->setDuration(500);
    1782         pRightAnimation->setStartValue(startGeo);
    1783         pRightAnimation->setEndValue(endGeo);
    1784         pAnimation->addAnimation(pRightAnimation);
    1785     }
    1786 
    1787     /* Start animation: */
    1788     pAnimation->start();
    1789 }
    1790 
    17911607void UIChooserModel::loadGroupTree()
    17921608{
    17931609    /* Create Global item: */
    1794     createGlobalItem(mainRoot());
     1610    createGlobalItem(root());
    17951611
    17961612    /* Add all the approved machines we have into the group-tree: */
     
    18341650            LogRelFlow(("UIChooserModel:   Creating item for VM {%s} in group {%s}.\n", strName.toUtf8().constData(),
    18351651                                                                                         strGroup.toUtf8().constData()));
    1836             createMachineItem(machine, getGroupItem(strGroup, mainRoot(), fMakeItVisible));
     1652            createMachineItem(machine, getGroupItem(strGroup, root(), fMakeItVisible));
    18371653        }
    18381654        /* Update group definitions: */
     
    18451661        LogRelFlow(("UIChooserModel:  VM {%s} is inaccessible.\n", toOldStyleUuid(machine.GetId()).toUtf8().constData()));
    18461662        /* Create machine-item with main-root group-item as parent: */
    1847         createMachineItem(machine, mainRoot());
     1663        createMachineItem(machine, root());
    18481664    }
    18491665}
     
    18601676        if (!pParent->isRoot())
    18611677            delete pParent;
    1862         /* Unindent if that is root item: */
    1863         else if (root() != mainRoot())
    1864             unindentRoot();
    18651678    }
    18661679}
     
    21962009    /* Prepare full group map: */
    21972010    QMap<QString, QStringList> groups;
    2198     gatherGroupDefinitions(groups, mainRoot());
     2011    gatherGroupDefinitions(groups, root());
    21992012
    22002013    /* Save information in other thread: */
     
    22162029    /* Prepare full group map: */
    22172030    QMap<QString, QStringList> groups;
    2218     gatherGroupOrders(groups, mainRoot());
     2031    gatherGroupOrders(groups, root());
    22192032
    22202033    /* Save information in other thread: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r77366 r77430  
    8282        void sigSelectionInvalidated();
    8383
    84         /** Notifies about root sliding started. */
    85         void sigSlidingStarted();
    86 
    8784        /** Notifies about group toggling started. */
    8885        void sigToggleStarted();
     
    199196    /** @name Children stuff.
    200197      * @{ */
    201         /** Holds the main root instance. */
    202         UIChooserItem *mainRoot() const;
    203         /** Holds the current root reference. */
     198        /** Returns the root instance. */
    204199        UIChooserItem *root() const;
    205 
    206         /** Indents stack of root items with @a pNewRootItem. */
    207         void indentRoot(UIChooserItem *pNewRootItem);
    208         /** Unindents stack of root items flushing top-most. */
    209         void unindentRoot();
    210         /** Returns whether root indenting/unindenting is in progress. */
    211         bool isSlidingInProgress() const;
    212200
    213201        /** Starts editing group name. */
     
    289277    /** @name Children stuff.
    290278      * @{ */
    291         /** Handles left root sliding progress. */
    292         void sltLeftRootSlidingProgress();
    293         /** Handles right root sliding progress. */
    294         void sltRightRootSlidingProgress();
    295         /** Handles sliding progress complete. */
    296         void sltSlidingComplete();
    297 
    298279        /** Handles group rename request. */
    299280        void sltEditGroupName();
     
    404385    /** @name Children stuff.
    405386      * @{ */
    406         /** Performs root sliding, @a fForward if specified. */
    407         void slideRoot(bool fForward);
    408 
    409387        /** Loads group tree. */
    410388        void loadGroupTree();
     
    497475    /** @name Children stuff.
    498476      * @{ */
    499         /** Holds the root stack. */
    500         QList<UIChooserItem*>    m_rootStack;
    501         /** Holds whether root sliding is in progress. */
    502         bool                     m_fSliding;
    503         /** Holds left temporary root instance. */
    504         UIChooserItem           *m_pLeftRoot;
    505         /** Holds right temporary root instance. */
    506         UIChooserItem           *m_pRightRoot;
    507         /** Holds the item whish should be ficused after sliding. */
    508         QPointer<UIChooserItem>  m_pAfterSlidingFocus;
     477        /** Holds the root instance. */
     478        QPointer<UIChooserItem>  m_pRoot;
    509479
    510480        /** Holds the navigation list. */
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