Changeset 43460 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 28, 2012 9:58:36 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r43444 r43460 1633 1633 /* Start/Show action is deremined by 1st item: */ 1634 1634 if (pItem && pItem->accessible()) 1635 m_pAction_Common_StartOrShow->setState( isItemPoweredOff(pItem) ? 1 : 2);1635 m_pAction_Common_StartOrShow->setState(UIVMItem::isItemPoweredOff(pItem) ? 1 : 2); 1636 1636 else 1637 1637 m_pAction_Common_StartOrShow->setState(1); … … 1640 1640 UIVMItem *pFirstStartedAction = 0; 1641 1641 foreach (UIVMItem *pSelectedItem, items) 1642 if ( isItemStarted(pSelectedItem))1642 if (UIVMItem::isItemStarted(pSelectedItem)) 1643 1643 pFirstStartedAction = pSelectedItem; 1644 1644 /* Update the Pause/Resume action appearance: */ 1645 1645 m_pAction_Common_PauseAndResume->blockSignals(true); 1646 m_pAction_Common_PauseAndResume->setChecked(pFirstStartedAction && isItemPaused(pFirstStartedAction));1646 m_pAction_Common_PauseAndResume->setChecked(pFirstStartedAction && UIVMItem::isItemPaused(pFirstStartedAction)); 1647 1647 m_pAction_Common_PauseAndResume->updateAppearance(); 1648 1648 m_pAction_Common_PauseAndResume->blockSignals(false); … … 1685 1685 items.size() == 1 && 1686 1686 pItem->accessible() && 1687 ! isItemStuck(pItem);1687 !UIVMItem::isItemStuck(pItem); 1688 1688 } 1689 1689 case UIActionIndexSelector_Simple_Machine_Clone: … … 1691 1691 return !m_pChooser->isGroupSavingInProgress() && 1692 1692 items.size() == 1 && 1693 isItemEditable(pItem);1693 UIVMItem::isItemEditable(pItem); 1694 1694 } 1695 1695 case UIActionIndexSelector_Simple_Machine_Remove: … … 1775 1775 { 1776 1776 foreach (UIVMItem *pItem, items) 1777 if (! isItemPoweredOff(pItem))1777 if (!UIVMItem::isItemPoweredOff(pItem)) 1778 1778 return false; 1779 1779 return true; … … 1785 1785 foreach (UIVMItem *pItem, items) 1786 1786 { 1787 if (! isItemRunning(pItem))1787 if (!UIVMItem::isItemRunning(pItem)) 1788 1788 continue; 1789 1789 … … 1844 1844 { 1845 1845 foreach (UIVMItem *pItem, items) 1846 if (!pItem->accessible() || isItemEditable(pItem))1846 if (!pItem->accessible() || UIVMItem::isItemEditable(pItem)) 1847 1847 return true; 1848 1848 return false; … … 1854 1854 foreach (UIVMItem *pItem, items) 1855 1855 { 1856 if (( isItemPoweredOff(pItem) &&isItemEditable(pItem)) ||1857 ( isItemStarted(pItem) && pItem->canSwitchTo()))1856 if ((UIVMItem::isItemPoweredOff(pItem) && UIVMItem::isItemEditable(pItem)) || 1857 (UIVMItem::isItemStarted(pItem) && pItem->canSwitchTo())) 1858 1858 return true; 1859 1859 } … … 1865 1865 { 1866 1866 foreach (UIVMItem *pItem, items) 1867 if ( isItemSaved(pItem) &&isItemEditable(pItem))1867 if (UIVMItem::isItemSaved(pItem) && UIVMItem::isItemEditable(pItem)) 1868 1868 return true; 1869 1869 return false; … … 1874 1874 { 1875 1875 foreach (UIVMItem *pItem, items) 1876 if ( isItemStarted(pItem))1876 if (UIVMItem::isItemStarted(pItem)) 1877 1877 return true; 1878 1878 return false; … … 1883 1883 { 1884 1884 foreach (UIVMItem *pItem, items) 1885 if ( isItemRunning(pItem))1885 if (UIVMItem::isItemRunning(pItem)) 1886 1886 return true; 1887 1887 return false; 1888 1888 } 1889 1889 1890 /* static */1891 bool UISelectorWindow::isItemEditable(UIVMItem *pItem)1892 {1893 return pItem->accessible() &&1894 pItem->sessionState() == KSessionState_Unlocked;1895 }1896 1897 /* static */1898 bool UISelectorWindow::isItemSaved(UIVMItem *pItem)1899 {1900 if (pItem->accessible() &&1901 pItem->machineState() == KMachineState_Saved)1902 return true;1903 return false;1904 }1905 1906 /* static */1907 bool UISelectorWindow::isItemPoweredOff(UIVMItem *pItem)1908 {1909 if (pItem->accessible() &&1910 (pItem->machineState() == KMachineState_PoweredOff ||1911 pItem->machineState() == KMachineState_Saved ||1912 pItem->machineState() == KMachineState_Teleported ||1913 pItem->machineState() == KMachineState_Aborted))1914 return true;1915 return false;1916 }1917 1918 /* static */1919 bool UISelectorWindow::isItemStarted(UIVMItem *pItem)1920 {1921 return isItemRunning(pItem) || isItemPaused(pItem);1922 }1923 1924 /* static */1925 bool UISelectorWindow::isItemRunning(UIVMItem *pItem)1926 {1927 if (pItem->accessible() &&1928 (pItem->machineState() == KMachineState_Running ||1929 pItem->machineState() == KMachineState_Teleporting ||1930 pItem->machineState() == KMachineState_LiveSnapshotting))1931 return true;1932 return false;1933 }1934 1935 /* static */1936 bool UISelectorWindow::isItemPaused(UIVMItem *pItem)1937 {1938 if (pItem->accessible() &&1939 (pItem->machineState() == KMachineState_Paused ||1940 pItem->machineState() == KMachineState_TeleportingPausedVM))1941 return true;1942 return false;1943 1944 }1945 1946 /* static */1947 bool UISelectorWindow::isItemStuck(UIVMItem *pItem)1948 {1949 if (pItem->accessible() &&1950 pItem->machineState() == KMachineState_Stuck)1951 return true;1952 return false;1953 }1954 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r43155 r43460 158 158 static bool isAtLeastOneItemStarted(const QList<UIVMItem*> &items); 159 159 static bool isAtLeastOneItemRunning(const QList<UIVMItem*> &items); 160 static bool isItemEditable(UIVMItem *pItem);161 static bool isItemSaved(UIVMItem *pItem);162 static bool isItemPoweredOff(UIVMItem *pItem);163 static bool isItemStarted(UIVMItem *pItem);164 static bool isItemRunning(UIVMItem *pItem);165 static bool isItemPaused(UIVMItem *pItem);166 static bool isItemStuck(UIVMItem *pItem);167 160 168 161 /* Central splitter window: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp
r43447 r43460 415 415 } 416 416 417 /* static */ 418 bool UIVMItem::isItemEditable(UIVMItem *pItem) 419 { 420 return pItem->accessible() && 421 pItem->sessionState() == KSessionState_Unlocked; 422 } 423 424 /* static */ 425 bool UIVMItem::isItemSaved(UIVMItem *pItem) 426 { 427 if (pItem->accessible() && 428 pItem->machineState() == KMachineState_Saved) 429 return true; 430 return false; 431 } 432 433 /* static */ 434 bool UIVMItem::isItemPoweredOff(UIVMItem *pItem) 435 { 436 if (pItem->accessible() && 437 (pItem->machineState() == KMachineState_PoweredOff || 438 pItem->machineState() == KMachineState_Saved || 439 pItem->machineState() == KMachineState_Teleported || 440 pItem->machineState() == KMachineState_Aborted)) 441 return true; 442 return false; 443 } 444 445 /* static */ 446 bool UIVMItem::isItemStarted(UIVMItem *pItem) 447 { 448 return isItemRunning(pItem) || isItemPaused(pItem); 449 } 450 451 /* static */ 452 bool UIVMItem::isItemRunning(UIVMItem *pItem) 453 { 454 if (pItem->accessible() && 455 (pItem->machineState() == KMachineState_Running || 456 pItem->machineState() == KMachineState_Teleporting || 457 pItem->machineState() == KMachineState_LiveSnapshotting)) 458 return true; 459 return false; 460 } 461 462 /* static */ 463 bool UIVMItem::isItemPaused(UIVMItem *pItem) 464 { 465 if (pItem->accessible() && 466 (pItem->machineState() == KMachineState_Paused || 467 pItem->machineState() == KMachineState_TeleportingPausedVM)) 468 return true; 469 return false; 470 471 } 472 473 /* static */ 474 bool UIVMItem::isItemStuck(UIVMItem *pItem) 475 { 476 if (pItem->accessible() && 477 pItem->machineState() == KMachineState_Stuck) 478 return true; 479 return false; 480 } 481 417 482 QString UIVMItemMimeData::m_type = "application/org.virtualbox.gui.vmselector.uivmitem"; 418 483 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h
r41608 r43460 65 65 bool switchTo(); 66 66 67 static bool isItemEditable(UIVMItem *pItem); 68 static bool isItemSaved(UIVMItem *pItem); 69 static bool isItemPoweredOff(UIVMItem *pItem); 70 static bool isItemStarted(UIVMItem *pItem); 71 static bool isItemRunning(UIVMItem *pItem); 72 static bool isItemPaused(UIVMItem *pItem); 73 static bool isItemStuck(UIVMItem *pItem); 74 67 75 private: 68 76
Note:
See TracChangeset
for help on using the changeset viewer.