VirtualBox

Changeset 14692

Show
Ignore:
Timestamp:
11/27/08 10:51:12 (1 month ago)
Author:
vboxsync
Message:

Fe/Qt4: Systray: Moved code around.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r14652 r14692  
    812812    } 
    813813 
     814    /* Returns the number of current running machines. */ 
     815    int machinesAlive() const; 
     816 
    814817    /* various helpers */ 
    815818 
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r14669 r14692  
    31793179 
    31803180    return false; 
     3181} 
     3182 
     3183/** 
     3184 *  Returns the number of current running VMs. 
     3185 * 
     3186 *  @return Number of running VMs. 
     3187 */ 
     3188int VBoxGlobal::machinesAlive () const 
     3189{ 
     3190    int machinesAlive = 0; 
     3191    CVirtualBox vbox = vboxGlobal().virtualBox(); 
     3192    CMachineVector vec = vbox.GetMachines2(); 
     3193    for (CMachineVector::ConstIterator m = vec.begin(); 
     3194        m != vec.end(); ++ m) 
     3195    { 
     3196        switch ((*m).GetState()) 
     3197        { 
     3198            case MachineState_Running: 
     3199            case MachineState_Paused: 
     3200            { 
     3201                machinesAlive++; 
     3202                break; 
     3203            } 
     3204        } 
     3205    } 
     3206 
     3207    return machinesAlive; 
    31813208} 
    31823209 
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r14689 r14692  
    15651565        /* Check if there are some machines alive - else quit, since 
    15661566         * we're not needed as a systray menu anymore. */ 
    1567         int machinesAlive = 0; 
    1568         CVirtualBox vbox = vboxGlobal().virtualBox(); 
    1569         CMachineVector vec = vbox.GetMachines2(); 
    1570         for (CMachineVector::ConstIterator m = vec.begin(); 
    1571             m != vec.end(); ++ m) 
    1572         { 
    1573             switch ((*m).GetState()) 
    1574             { 
    1575                 case MachineState_Running: 
    1576                 case MachineState_Paused: 
    1577                 { 
    1578                     machinesAlive++; 
    1579                     break; 
    1580                 } 
    1581             } 
    1582         } 
    1583  
    1584         if (machinesAlive == 0) 
     1567        if (vboxGlobal().machinesAlive() == 0) 
    15851568        { 
    15861569            fileExit(); 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy