VirtualBox

Changeset 44013 in vbox for trunk


Ignore:
Timestamp:
Dec 3, 2012 2:31:54 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
82425
Message:

FE/Qt: VM group UI: Details-view: Set-item cleanup (part 1).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp

    r43991 r44013  
    3737    , m_iLastStep(-1)
    3838{
    39     /* Setup size-policy: */
    40     setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    41 
    42     /* Add item to the parent: */
     39    /* Add set to the parent group: */
    4340    parentItem()->addItem(this);
    4441
     42    /* Prepare set: */
     43    prepareSet();
     44
    4545    /* Prepare connections: */
    46     connect(this, SIGNAL(sigStartFirstStep(QString)), this, SLOT(sltFirstStep(QString)), Qt::QueuedConnection);
    47     connect(this, SIGNAL(sigSetPrepared()), this, SLOT(sltSetPrepared()), Qt::QueuedConnection);
    48     connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));
    49     connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString)));
    50     connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString)));
    51     connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
    52     connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltUpdateAppearance()));
    53     connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltUpdateAppearance()));
     46    prepareConnections();
    5447}
    5548
    5649UIGDetailsSet::~UIGDetailsSet()
    5750{
    58     /* Delete all the items: */
     51    /* Cleanup items: */
    5952    clearItems();
    6053
    61     /* Remove item from the parent: */
     54    /* Remove set from the parent group: */
    6255    parentItem()->removeItem(this);
    6356}
     
    6659{
    6760    /* Assign settings: */
     61    m_machine = pItem->machine();
    6862    m_fFullSet = fFullSet;
    69     m_machine = pItem->machine();
    7063    m_settings = settings;
    7164
     
    7467}
    7568
    76 const CMachine& UIGDetailsSet::machine() const
    77 {
    78     return m_machine;
    79 }
    80 
    8169void UIGDetailsSet::sltFirstStep(QString strSetId)
    8270{
    83     /* Clear step: */
     71    /* Cleanup step: */
    8472    delete m_pStep;
    8573    m_pStep = 0;
    8674
    87     /* Was that a requested set? */
     75    /* Is step id valid? */
    8876    if (strSetId != m_strSetId)
    8977        return;
     
    120108{
    121109    /* Is this our VM changed? */
    122     if (machine().GetId() != strId)
     110    if (m_machine.GetId() != strId)
    123111        return;
    124112
     
    134122{
    135123    /* Is this our VM changed? */
    136     if (machine().GetId() != strId)
     124    if (m_machine.GetId() != strId)
    137125        return;
    138126
     
    205193    switch (type)
    206194    {
     195        case UIGDetailsItemType_Element: return m_elements.values();
    207196        case UIGDetailsItemType_Any: return items(UIGDetailsItemType_Element);
    208         case UIGDetailsItemType_Element: return m_elements.values();
    209197        default: AssertMsgFailed(("Invalid item type!")); break;
    210198    }
     
    216204    switch (type)
    217205    {
     206        case UIGDetailsItemType_Element: return !m_elements.isEmpty();
    218207        case UIGDetailsItemType_Any: return hasItems(UIGDetailsItemType_Element);
    219         case UIGDetailsItemType_Element: return !m_elements.isEmpty();
    220208        default: AssertMsgFailed(("Invalid item type!")); break;
    221209    }
     
    227215    switch (type)
    228216    {
    229         case UIGDetailsItemType_Any:
    230         {
    231             clearItems(UIGDetailsItemType_Element);
    232             break;
    233         }
    234217        case UIGDetailsItemType_Element:
    235218        {
     
    237220                delete m_elements[iKey];
    238221            AssertMsg(m_elements.isEmpty(), ("Set items cleanup failed!"));
     222            break;
     223        }
     224        case UIGDetailsItemType_Any:
     225        {
     226            clearItems(UIGDetailsItemType_Element);
    239227            break;
    240228        }
     
    253241        return pItem->toElement();
    254242    return 0;
     243}
     244
     245void UIGDetailsSet::prepareSet()
     246{
     247    /* Setup size-policy: */
     248    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
     249}
     250
     251void UIGDetailsSet::prepareConnections()
     252{
     253    /* Build connections: */
     254    connect(this, SIGNAL(sigStartFirstStep(QString)), this, SLOT(sltFirstStep(QString)), Qt::QueuedConnection);
     255    connect(this, SIGNAL(sigSetPrepared()), this, SLOT(sltSetPrepared()), Qt::QueuedConnection);
     256
     257    /* Global-events connections: */
     258    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));
     259    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString)));
     260    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString)));
     261    connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
     262
     263    /* Meidum-enumeration connections: */
     264    connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltUpdateAppearance()));
     265    connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltUpdateAppearance()));
    255266}
    256267
     
    380391    foreach (UIGDetailsItem *pItem, items())
    381392    {
    382         /* Get particular element: */
     393        /* Skip hidden: */
     394        if (!pItem->isVisible())
     395            continue;
     396
     397        /* For each particular element: */
    383398        UIGDetailsElement *pElement = pItem->toElement();
    384         if (!pElement->isVisible())
    385             continue;
    386 
    387         /* For each particular element: */
    388399        switch (pElement->elementType())
    389400        {
     
    467478    }
    468479
    469     /* Clear step: */
     480    /* Cleanup step: */
    470481    delete m_pStep;
    471482    m_pStep = 0;
    472483
    473     /* Prepare first element: */
     484    /* Generate new set-id: */
    474485    m_strSetId = QUuid::createUuid().toString();
     486
     487    /* Request to prepare first step: */
    475488    emit sigStartFirstStep(m_strSetId);
    476489}
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h

    r43989 r44013  
    5858
    5959    /* API: Machine stuff: */
    60     const CMachine& machine() const;
     60    const CMachine& machine() const { return m_machine; }
    6161
    6262private slots:
     
    8787    QVariant data(int iKey) const;
    8888
    89     /* Children stuff: */
     89    /* Hidden API: Children stuff: */
    9090    void addItem(UIGDetailsItem *pItem);
    9191    void removeItem(UIGDetailsItem *pItem);
     
    9494    void clearItems(UIGDetailsItemType type = UIGDetailsItemType_Element);
    9595    UIGDetailsElement* element(DetailsElementType elementType) const;
     96
     97    /* Helpers: Prepare stuff: */
     98    void prepareSet();
     99    void prepareConnections();
    96100
    97101    /* Helpers: Layout stuff: */
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