VirtualBox

Ignore:
Timestamp:
Mar 5, 2007 6:02:01 PM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Details/Snapshots tabs are not disabled as a whole any more; inappropriate actions are disabled instead.

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

Legend:

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

    r1073 r1236  
    721721    static const char *sSectionHrefTpl =
    722722        "<tr><td rowspan=%1 align=left><img src='%2'></td>"
    723             "<td width=100% colspan=2><a href='%3'><nobr>%4</nobr></a></td></tr>"
     723            "<td width=100% colspan=2><b><a href='%3'><nobr>%4</nobr></a></b></td></tr>"
    724724            "%5"
    725725        "<tr><td width=100% colspan=2><font size=1>&nbsp;</font></td></tr>";
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r1215 r1236  
    218218
    219219    void goToSettings();
     220    void sessionStateChanged (const VBoxSessionStateChangeEvent &aE);
    220221
    221222private:
     223
     224    QUuid mMachineId;
    222225
    223226    VBoxSelectorWnd *mParent;
     
    264267                                          QSizePolicy::Minimum));
    265268
     269    /* connect VirtualBox callback events */
     270    connect (&vboxGlobal(), SIGNAL (sessionStateChanged (const VBoxSessionStateChangeEvent &)),
     271             this, SLOT (sessionStateChanged (const VBoxSessionStateChangeEvent &)));
     272
    266273    /* apply language settings */
    267274    languageChange();
     
    270277void VBoxVMDescriptionPage::setMachine (const CMachine &aMachine)
    271278{
     279    Assert (!aMachine.isNull());
     280
     281    QUuid id = aMachine.GetId();
     282    if (id == mMachineId)
     283        return;
     284
     285    mMachineId = id;
     286
    272287    QString text = aMachine.GetDescription();
     288
    273289    if (text.isEmpty())
    274290        text = QString::null;
     
    298314{
    299315    mParent->vmSettings ("#general", 2);
     316}
     317
     318void VBoxVMDescriptionPage::sessionStateChanged (const VBoxSessionStateChangeEvent &aE)
     319{
     320    if (aE.id != mMachineId)
     321        return; /* not interested in other machines */
     322
     323    /* whether another direct session is open or not */
     324    bool busy = aE.state != CEnums::SessionClosed;
     325
     326    mBtnEdit->setEnabled (!busy);
    300327}
    301328
     
    10281055        CMachine m = item->machine();
    10291056
     1057        CEnums::MachineState state = item->state();
     1058        bool running = item->sessionState() != CEnums::SessionClosed;
     1059        bool modifyEnabled = !running && state != CEnums::Saved;
     1060
    10301061        if (aRefreshDetails)
    10311062        {
    10321063            vmDetailsView->setDetailsText (
    10331064                vboxGlobal().detailsReport (m, false /* isNewVM */,
    1034                                                true /* withLinks */));
     1065                                               !running /* withLinks */));
    10351066        }
    10361067        if (aRefreshSnapshots)
     
    10501081        }
    10511082
    1052         CEnums::MachineState state = item->state();
    1053         bool running = item->sessionState() != CEnums::SessionClosed;
    1054         bool modifyEnabled = !running && state != CEnums::Saved;
    1055 
    1056         /* enable/disable info panes */
    1057         vmDetailsView->setEnabled (modifyEnabled);
    1058         vmSnapshotsWgt->setEnabled (!running);
    1059         vmDescriptionPage->setEnabled (!running);
    1060 
    10611083        /* enable/disable modify actions */
    10621084        vmConfigAction->setEnabled (modifyEnabled);
     
    11941216void VBoxSelectorWnd::sessionStateChanged (const VBoxSessionStateChangeEvent &e)
    11951217{
    1196     refreshVMItem (e.id, false, false, false);
     1218    refreshVMItem (e.id, true, false, false);
    11971219}
    11981220
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSnapshotsWgt.ui

    r382 r1236  
    239239    <connection>
    240240        <sender>&amp;vboxGlobal()</sender>
     241        <signal>sessionStateChanged (const VBoxSessionStateChangeEvent &amp;)</signal>
     242        <receiver>VBoxSnapshotsWgt</receiver>
     243        <slot>sessionStateChanged (const VBoxSessionStateChangeEvent &amp;)</slot>
     244    </connection>
     245    <connection>
     246        <sender>&amp;vboxGlobal()</sender>
    241247        <signal>snapshotChanged (const VBoxSnapshotEvent &amp;)</signal>
    242248        <receiver>VBoxSnapshotsWgt</receiver>
     
    264270    <variable access="private">CMachine mMachine;</variable>
    265271    <variable access="private">QUuid mMachineId;</variable>
     272    <variable access="private">CEnums::SessionState mSessionState;</variable>
    266273    <variable access="private">class ListViewItem; ListViewItem *mCurSnapshotItem;</variable>
    267274    <variable access="private">class ToolTip; ToolTip *mToolTip;</variable>
     
    279286    <slot>machineDataChanged (const VBoxMachineDataChangeEvent &amp; aE)</slot>
    280287    <slot>machineStateChanged (const VBoxMachineStateChangeEvent &amp; aE)</slot>
     288    <slot>sessionStateChanged (const VBoxSessionStateChangeEvent &amp; aE)</slot>
    281289    <slot>snapshotChanged (const VBoxSnapshotEvent &amp; aE)</slot>
    282290</slots>
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSnapshotsWgt.ui.h

    r382 r1236  
    116116    CSnapshot snapshot() const { return mSnapshot; }
    117117    QUuid snapshotId() const { return mId; }
     118
     119    CEnums::MachineState machineState() const { return mMachineState; }
    118120
    119121    void recache()
     
    336338{
    337339    mMachine = aMachine;
    338     mMachineId = aMachine.isNull() ? QUuid() : aMachine.GetId();
     340
     341    if (aMachine.isNull())
     342    {
     343        mMachineId = QUuid();
     344        mSessionState = CEnums::InvalidSessionState;
     345    }
     346    else
     347    {
     348        mMachineId = aMachine.GetId();
     349        mSessionState = aMachine.GetSessionState();
     350    }
     351
    339352    refreshAll();
    340353}
     
    458471        listView->ensureItemVisible (item);
    459472
     473    /* whether another direct session is open or not */
     474    bool busy = mSessionState != CEnums::SessionClosed;
     475
    460476    /* enable/disable snapshot actions */
    461     snapshotActionGroup->setEnabled (
     477    snapshotActionGroup->setEnabled (!busy &&
    462478        item && mCurSnapshotItem && item != mCurSnapshotItem->firstChild());
    463479
    464     showSnapshotDetailsAction->setEnabled (snapshotActionGroup->isEnabled());
     480    /* enable/disable the details action regardles of the session state */
     481    showSnapshotDetailsAction->setEnabled (
     482        item && mCurSnapshotItem && item != mCurSnapshotItem->firstChild());
    465483
    466484    /* enable/disable current state actions */
    467     curStateActionGroup->setEnabled (
     485    curStateActionGroup->setEnabled (!busy &&
    468486        item && mCurSnapshotItem && item == mCurSnapshotItem->firstChild());
    469487
    470488    /* the Take Snapshot action is always enabled for the current state */
    471     takeSnapshotAction->setEnabled (curStateActionGroup->isEnabled() ||
     489    takeSnapshotAction->setEnabled (!busy && curStateActionGroup->isEnabled() ||
    472490                                    (item && !mCurSnapshotItem));
    473491
     
    489507        {
    490508            /* we have only one item -- current state */
    491             takeSnapshotAction->addTo (mContextMenu);
     509            curStateActionGroup->addTo (mContextMenu);
    492510        }
    493511        else
     
    672690}
    673691
     692void VBoxSnapshotsWgt::sessionStateChanged (const VBoxSessionStateChangeEvent &aE)
     693{
     694    if (aE.id != mMachineId)
     695        return; /* not interested in other machines */
     696
     697    mSessionState = aE.state;
     698    listView_currentChanged (listView->currentItem());
     699}
     700
    674701void VBoxSnapshotsWgt::snapshotChanged (const VBoxSnapshotEvent &aE)
    675702{
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