儲存庫 vbox 的更動 42560
- 時間撮記:
- 2012-8-2 下午10:16:05 (12 年 以前)
- 位置:
- trunk/src/VBox/Frontends/VirtualBox/src
- 檔案:
-
- 修改 3 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r42533 r42560 131 131 UIActionState::UIActionState(QObject *pParent, const QString &strIcon, const QString &strIconDis) 132 132 : UIAction(pParent, UIActionType_State) 133 , m_iState(0) 133 134 { 134 135 if (!strIcon.isNull()) … … 141 142 const QString &strNormalIconDis, const QString &strSmallIconDis) 142 143 : UIAction(pParent, UIActionType_State) 144 , m_iState(0) 143 145 { 144 146 setIcon(UIIconPool::iconSetFull(normalSize, smallSize, strNormalIcon, strSmallIcon, strNormalIconDis, strSmallIconDis)); … … 147 149 UIActionState::UIActionState(QObject *pParent, const QIcon& icon) 148 150 : UIAction(pParent, UIActionType_State) 151 , m_iState(0) 149 152 { 150 153 if (!icon.isNull()) -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r42553 r42560 135 135 } 136 136 137 void UISelectorWindow::sltStateChanged(QString strId) 138 { 139 /* Get current item: */ 140 UIVMItem *pItem = currentItem(); 141 142 /* Make sure current item present: */ 143 if (!pItem) 144 return; 145 146 /* If signal is for the current item: */ 147 if (pItem->id() == strId) 148 updateActionsAppearance(); 149 } 150 137 151 void UISelectorWindow::sltSnapshotChanged(QString strId) 138 152 { 139 153 /* Get current item: */ 140 UIVMItem *p CurrentItem = currentItem();154 UIVMItem *pItem = currentItem(); 141 155 142 156 /* Make sure current item present: */ 143 if (!p CurrentItem)144 return; 145 146 /* If signal is for current item: */147 if (p CurrentItem->id() == strId)148 m_pVMDesktop->updateSnapshots(p CurrentItem, pCurrentItem->machine());157 if (!pItem) 158 return; 159 160 /* If signal is for the current item: */ 161 if (pItem->id() == strId) 162 m_pVMDesktop->updateSnapshots(pItem, pItem->machine()); 149 163 } 150 164 … … 734 748 } 735 749 736 void UISelectorWindow::sltCurrentVMItemChanged(bool fRefreshDetails, bool fRefreshSnapshots, bool fRefreshDescription)750 void UISelectorWindow::sltCurrentVMItemChanged(bool fRefreshDetails, bool fRefreshSnapshots, bool) 737 751 { 738 752 /* Get current item: */ 739 753 UIVMItem *pItem = currentItem(); 740 QList<UIVMItem*> items = currentItems();741 754 742 755 /* Determine which menu to show: */ … … 758 771 } 759 772 760 /* Enable/disable group actions: */ 761 m_pActionGroupRenameDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_RenameDialog, items)); 762 m_pActionGroupRemoveDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_RemoveDialog, items)); 763 m_pActionGroupStartOrShow->setEnabled(isActionEnabled(UIActionIndexSelector_State_Group_StartOrShow, items)); 764 m_pActionGroupPauseAndResume->setEnabled(isActionEnabled(UIActionIndexSelector_Toggle_Group_PauseAndResume, items)); 765 m_pActionGroupReset->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Reset, items)); 766 m_pActionGroupRefresh->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Refresh, items)); 767 m_pActionGroupLogDialog->setEnabled(isActionEnabled(UIActionIndex_Simple_LogDialog, items)); 768 m_pActionGroupShowInFileManager->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_ShowInFileManager, items)); 769 m_pActionGroupCreateShortcut->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_CreateShortcut, items)); 770 // m_pActionGroupSort->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Sort, items)); 771 772 /* Enable/disable machine actions: */ 773 m_pActionMachineSettingsDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_SettingsDialog, items)); 774 m_pActionMachineCloneWizard->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CloneWizard, items)); 775 m_pActionMachineAddGroupDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_AddGroupDialog, items)); 776 m_pActionMachineRemoveDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_RemoveDialog, items)); 777 m_pActionMachineStartOrShow->setEnabled(isActionEnabled(UIActionIndexSelector_State_Machine_StartOrShow, items)); 778 m_pActionMachineDiscard->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Discard, items)); 779 m_pActionMachinePauseAndResume->setEnabled(isActionEnabled(UIActionIndexSelector_Toggle_Machine_PauseAndResume, items)); 780 m_pActionMachineReset->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Reset, items)); 781 m_pActionMachineRefresh->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Refresh, items)); 782 m_pActionMachineLogDialog->setEnabled(isActionEnabled(UIActionIndex_Simple_LogDialog, items)); 783 m_pActionMachineShowInFileManager->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_ShowInFileManager, items)); 784 m_pActionMachineCreateShortcut->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CreateShortcut, items)); 785 // m_pActionMachineSort->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Sort, items)); 786 787 /* Enable/disable machine-close actions: */ 788 m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items)); 789 m_pPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, items)); 773 /* Update action appearance: */ 774 updateActionsAppearance(); 790 775 791 776 /* If currently selected VM item is accessible: */ … … 798 783 m_pContainer->setCurrentWidget(m_pDetails); 799 784 800 KMachineState state = pItem->machineState(); 801 802 if (fRefreshDetails || fRefreshDescription) 785 if (fRefreshDetails) 803 786 m_pDetails->setItems(currentItems()); 804 787 if (fRefreshSnapshots) 805 788 m_pVMDesktop->updateSnapshots(pItem, pItem->machine()); 806 807 /* Update the Start button action appearance: */ 808 if (state == KMachineState_PoweredOff || 809 state == KMachineState_Saved || 810 state == KMachineState_Teleported || 811 state == KMachineState_Aborted) 812 { 813 m_pActionGroupStartOrShow->setState(1); 814 m_pActionMachineStartOrShow->setState(1); 815 #ifdef QT_MAC_USE_COCOA 816 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when 817 the necessary size of the toolbar is increased. Also for some languages 818 the with doesn't match if the text increase. So manually adjust the size 819 after changing the text. */ 820 mVMToolBar->updateLayout(); 821 #endif /* QT_MAC_USE_COCOA */ 822 } 823 else 824 { 825 m_pActionGroupStartOrShow->setState(2); 826 m_pActionMachineStartOrShow->setState(2); 827 #ifdef QT_MAC_USE_COCOA 828 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when 829 the necessary size of the toolbar is increased. Also for some languages 830 the with doesn't match if the text increase. So manually adjust the size 831 after changing the text. */ 832 mVMToolBar->updateLayout(); 833 #endif /* QT_MAC_USE_COCOA */ 834 } 835 836 /* Update the Pause/Resume action appearance: */ 837 if (state == KMachineState_Paused || 838 state == KMachineState_TeleportingPausedVM) 839 { 840 m_pActionGroupPauseAndResume->blockSignals(true); 841 m_pActionGroupPauseAndResume->setChecked(true); 842 m_pActionGroupPauseAndResume->blockSignals(false); 843 m_pActionMachinePauseAndResume->blockSignals(true); 844 m_pActionMachinePauseAndResume->setChecked(true); 845 m_pActionMachinePauseAndResume->blockSignals(false); 846 } 847 else 848 { 849 m_pActionGroupPauseAndResume->blockSignals(true); 850 m_pActionGroupPauseAndResume->setChecked(false); 851 m_pActionGroupPauseAndResume->blockSignals(false); 852 m_pActionMachinePauseAndResume->blockSignals(true); 853 m_pActionMachinePauseAndResume->setChecked(false); 854 m_pActionMachinePauseAndResume->blockSignals(false); 855 } 856 m_pActionGroupPauseAndResume->updateAppearance(); 857 m_pActionMachinePauseAndResume->updateAppearance(); 858 } 859 789 } 860 790 /* If currently selected VM item is NOT accessible: */ 861 791 else 862 792 { 863 /* Show m_pVMDesktop: */793 /* Make sure valid widget raised: */ 864 794 m_pContainer->setCurrentWidget(m_pVMDesktop); 865 795 … … 893 823 /* Empty and disable other tabs: */ 894 824 m_pVMDesktop->updateSnapshots(0, CMachine()); 895 896 /* Change the Start button text accordingly: */897 m_pActionGroupStartOrShow->setState(1);898 m_pActionMachineStartOrShow->setState(1);899 825 } 900 826 } … … 1463 1389 1464 1390 /* Global event handlers: */ 1391 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltStateChanged(QString))); 1392 connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltStateChanged(QString))); 1465 1393 connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltSnapshotChanged(QString))); 1466 1394 } … … 1578 1506 } 1579 1507 1508 void UISelectorWindow::updateActionsAppearance() 1509 { 1510 /* Get current item(s): */ 1511 UIVMItem *pItem = currentItem(); 1512 QList<UIVMItem*> items = currentItems(); 1513 1514 /* Enable/disable group actions: */ 1515 m_pActionGroupRenameDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_RenameDialog, items)); 1516 m_pActionGroupRemoveDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_RemoveDialog, items)); 1517 m_pActionGroupStartOrShow->setEnabled(isActionEnabled(UIActionIndexSelector_State_Group_StartOrShow, items)); 1518 m_pActionGroupPauseAndResume->setEnabled(isActionEnabled(UIActionIndexSelector_Toggle_Group_PauseAndResume, items)); 1519 m_pActionGroupReset->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Reset, items)); 1520 m_pActionGroupRefresh->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Refresh, items)); 1521 m_pActionGroupLogDialog->setEnabled(isActionEnabled(UIActionIndex_Simple_LogDialog, items)); 1522 m_pActionGroupShowInFileManager->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_ShowInFileManager, items)); 1523 m_pActionGroupCreateShortcut->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_CreateShortcut, items)); 1524 // m_pActionGroupSort->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Sort, items)); 1525 1526 /* Enable/disable machine actions: */ 1527 m_pActionMachineSettingsDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_SettingsDialog, items)); 1528 m_pActionMachineCloneWizard->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CloneWizard, items)); 1529 m_pActionMachineAddGroupDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_AddGroupDialog, items)); 1530 m_pActionMachineRemoveDialog->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_RemoveDialog, items)); 1531 m_pActionMachineStartOrShow->setEnabled(isActionEnabled(UIActionIndexSelector_State_Machine_StartOrShow, items)); 1532 m_pActionMachineDiscard->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Discard, items)); 1533 m_pActionMachinePauseAndResume->setEnabled(isActionEnabled(UIActionIndexSelector_Toggle_Machine_PauseAndResume, items)); 1534 m_pActionMachineReset->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Reset, items)); 1535 m_pActionMachineRefresh->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Refresh, items)); 1536 m_pActionMachineLogDialog->setEnabled(isActionEnabled(UIActionIndex_Simple_LogDialog, items)); 1537 m_pActionMachineShowInFileManager->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_ShowInFileManager, items)); 1538 m_pActionMachineCreateShortcut->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_CreateShortcut, items)); 1539 // m_pActionMachineSort->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Sort, items)); 1540 1541 /* Enable/disable machine-close actions: */ 1542 m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items)); 1543 m_pPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, items)); 1544 1545 /* If item present: */ 1546 if (pItem && pItem->accessible()) 1547 { 1548 /* Get state: */ 1549 KMachineState state = pItem->machineState(); 1550 1551 /* Update the Start button action appearance: */ 1552 if (state == KMachineState_PoweredOff || 1553 state == KMachineState_Saved || 1554 state == KMachineState_Teleported || 1555 state == KMachineState_Aborted) 1556 { 1557 m_pActionGroupStartOrShow->setState(1); 1558 m_pActionMachineStartOrShow->setState(1); 1559 #ifdef QT_MAC_USE_COCOA 1560 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when 1561 the necessary size of the toolbar is increased. Also for some languages 1562 the with doesn't match if the text increase. So manually adjust the size 1563 after changing the text. */ 1564 mVMToolBar->updateLayout(); 1565 #endif /* QT_MAC_USE_COCOA */ 1566 } 1567 else 1568 { 1569 m_pActionGroupStartOrShow->setState(2); 1570 m_pActionMachineStartOrShow->setState(2); 1571 #ifdef QT_MAC_USE_COCOA 1572 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when 1573 the necessary size of the toolbar is increased. Also for some languages 1574 the with doesn't match if the text increase. So manually adjust the size 1575 after changing the text. */ 1576 mVMToolBar->updateLayout(); 1577 #endif /* QT_MAC_USE_COCOA */ 1578 } 1579 1580 /* Update the Pause/Resume action appearance: */ 1581 if (state == KMachineState_Paused || 1582 state == KMachineState_TeleportingPausedVM) 1583 { 1584 m_pActionGroupPauseAndResume->blockSignals(true); 1585 m_pActionGroupPauseAndResume->setChecked(true); 1586 m_pActionGroupPauseAndResume->blockSignals(false); 1587 m_pActionMachinePauseAndResume->blockSignals(true); 1588 m_pActionMachinePauseAndResume->setChecked(true); 1589 m_pActionMachinePauseAndResume->blockSignals(false); 1590 } 1591 else 1592 { 1593 m_pActionGroupPauseAndResume->blockSignals(true); 1594 m_pActionGroupPauseAndResume->setChecked(false); 1595 m_pActionGroupPauseAndResume->blockSignals(false); 1596 m_pActionMachinePauseAndResume->blockSignals(true); 1597 m_pActionMachinePauseAndResume->setChecked(false); 1598 m_pActionMachinePauseAndResume->blockSignals(false); 1599 } 1600 m_pActionGroupPauseAndResume->updateAppearance(); 1601 m_pActionMachinePauseAndResume->updateAppearance(); 1602 } 1603 else 1604 { 1605 /* Update the Start button action appearance: */ 1606 m_pActionGroupStartOrShow->setState(1); 1607 m_pActionMachineStartOrShow->setState(1); 1608 } 1609 } 1610 1580 1611 bool UISelectorWindow::isActionEnabled(int iActionIndex, const QList<UIVMItem*> &items) 1581 1612 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r42553 r42560 63 63 private slots: 64 64 65 /* Handler: Snapshot-view stuff: */ 65 /* Handlers: Global-event stuff: */ 66 void sltStateChanged(QString strId); 66 67 void sltSnapshotChanged(QString strId); 67 68 … … 136 137 QList<UIVMItem*> currentItems() const; 137 138 139 /* Helper: Action update stuff: */ 140 void updateActionsAppearance(); 141 138 142 /* Helpers: Action stuff: */ 139 143 static bool isActionEnabled(int iActionIndex, const QList<UIVMItem*> &items);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器