VirtualBox

Changeset 14355 in vbox for trunk


Ignore:
Timestamp:
Nov 19, 2008 4:03:59 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: Removed some dead code and corrected indent.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h

    r14296 r14355  
    149149#ifdef VBOX_GUI_WITH_SYSTRAY
    150150    QAction *mTrayShowWindowAction;
    151     QAction *mTrayExitAction;
    152151#endif
    153152
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMListView.h

    r14296 r14355  
    3333class VBoxSelectorWnd;
    3434
    35 class VBoxVMItem : public QObject
    36 {
    37     Q_OBJECT;
    38 
    39 public:
    40 
    41     enum Action
    42     {
    43         Config = 0,
    44         Delete,
    45         Start,
    46         Discard,
    47         Pause,
    48         Refresh,
    49         ShowLogs
    50     };
    51 
    52 public:
    53 
    54     VBoxVMItem (const CMachine &aMachine, VBoxSelectorWnd *pParent);
     35class VBoxVMItem
     36{
     37public:
     38
     39    VBoxVMItem (const CMachine &aMachine);
    5540    virtual ~VBoxVMItem();
    5641
     
    7055
    7156    bool accessible() const { return mAccessible; }
    72     bool running() const {  return (sessionState() != KSessionState_Closed); }
    7357    const CVirtualBoxErrorInfo &accessError() const { return mAccessError; }
    7458    KMachineState state() const { return mState; }
     
    8367
    8468    /* Private member vars */
    85     VBoxSelectorWnd *mParent;
    8669    CMachine mMachine;
    8770
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r14296 r14355  
    570570    mTrayShowWindowAction->setText (tr ("Sun xVM VirtualBox"));
    571571
    572     mTrayExitAction = new QAction (this);
    573     Assert (mTrayExitAction);
    574     mTrayExitAction->setMenuRole (QAction::QuitRole);
    575     mTrayExitAction->setIcon (VBoxGlobal::iconSet (":/exit_16px.png"));
    576 
    577572    if (QSystemTrayIcon::isSystemTrayAvailable())
    578573    {
     
    903898    AssertMsgReturnVoid (item, ("Item must be always selected here"));
    904899
    905     /* We always get here when mVMListView emits the activated() signal,
    906      * so we must explicitly check if the action is enabled or not. */
    907    if (aUuid.isNull())  /* If Uuid is NULL, this function is called from the mVMListView activated() signal. */
    908    {
    909        if (!vmStartAction->isEnabled())
    910            return;
    911    }
     900    /* Are we called from the mVMListView's activated() signal? */
     901    if (aUuid.isNull())
     902    {
     903        /* We always get here when mVMListView emits the activated() signal,
     904         * so we must explicitly check if the action is enabled or not. */
     905        if (!vmStartAction->isEnabled())
     906            return;
     907    }
    912908
    913909#if defined (VBOX_GUI_SEPARATE_VM_PROCESS)
     
    10741070    for (CMachineVector::ConstIterator m = vec.begin();
    10751071         m != vec.end(); ++ m)
    1076         mVMModel->addItem (new VBoxVMItem (*m, this));
     1072        mVMModel->addItem (new VBoxVMItem (*m));
    10771073    mVMModel->sort();
    10781074
    10791075    vmListViewCurrentChanged();
     1076
    10801077#ifdef VBOX_GUI_WITH_SYSTRAY
    10811078    mTrayIcon->refresh();
     
    13321329
    13331330        KMachineState state = item->state();
    1334         bool bRunning = item->running();
    1335         bool bModifyEnabled = !bRunning && state != KMachineState_Saved;
     1331        bool running = item->sessionState() != KSessionState_Closed;
     1332        bool modifyEnabled = !running && state != KMachineState_Saved;
    13361333
    13371334        if (aRefreshDetails)
     
    13391336            vmDetailsView->setDetailsText (
    13401337                vboxGlobal().detailsReport (m, false /* isNewVM */,
    1341                                             bModifyEnabled /* withLinks */));
     1338                                            modifyEnabled /* withLinks */));
    13421339        }
    13431340        if (aRefreshSnapshots)
     
    13671364
    13681365        /* enable/disable modify actions */
    1369         vmConfigAction->setEnabled (bModifyEnabled);
    1370         vmDeleteAction->setEnabled (bModifyEnabled);
    1371         vmDiscardAction->setEnabled (state == KMachineState_Saved && !bRunning);
     1366        vmConfigAction->setEnabled (modifyEnabled);
     1367        vmDeleteAction->setEnabled (modifyEnabled);
     1368        vmDiscardAction->setEnabled (state == KMachineState_Saved && !running);
    13721369        vmPauseAction->setEnabled (state == KMachineState_Running ||
    13731370                                   state == KMachineState_Paused);
     
    13881385                tr ("Start the selected virtual machine"));
    13891386
    1390             vmStartAction->setEnabled (!bRunning);
     1387            vmStartAction->setEnabled (!running);
    13911388        }
    13921389
     
    15541551        if (!m.isNull())
    15551552        {
    1556             mVMModel->addItem (new VBoxVMItem (m, this));
     1553            mVMModel->addItem (new VBoxVMItem (m));
    15571554            mVMModel->sort();
    15581555            /* Make sure the description, ... pages are properly updated.
     
    16861683    if (pItem && pItem->accessible())
    16871684    {
     1685        /* look at vmListViewCurrentChanged() */
    16881686        CMachine m = pItem->machine();
    16891687        KMachineState s = pItem->state();
    1690         bool bRunning = pItem->running();
     1688        bool bRunning = pItem->sessionState() != KSessionState_Closed;
    16911689        bool bModifyEnabled = !bRunning && s != KMachineState_Saved;
    16921690
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMListView.cpp

    r14296 r14355  
    135135#endif
    136136
    137 VBoxVMItem::VBoxVMItem (const CMachine &aMachine, VBoxSelectorWnd *pParent)
    138     : mParent (pParent), mMachine (aMachine)
     137VBoxVMItem::VBoxVMItem (const CMachine &aMachine)
     138    : mMachine (aMachine)
    139139{
    140140    recache();
     
    201201    {
    202202        QString name = mMachine.GetName();
    203         setObjectName (name);
     203
    204204        CSnapshot snp = mMachine.GetCurrentSnapshot();
    205205        mSnapshotName = snp.isNull() ? QString::null : snp.GetName();
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