Changeset 67114 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 26, 2017 11:49:48 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 115781
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r67046 r67114 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 56 56 # include "UISelectorWindow.h" 57 57 # include "UISettingsDialogSpecific.h" 58 # include "UISnapshotPane.h"59 58 # include "UISpacerWidgets.h" 60 59 # include "UISpecialControls.h" … … 130 129 , m_pPaneDetails(0) 131 130 , m_pPaneDesktop(0) 132 , m_pPane Snapshots(0)131 , m_pPaneTools(0) 133 132 , m_pGroupMenuAction(0) 134 133 , m_pMachineMenuAction(0) … … 306 305 307 306 /* Make sure MM window is not opened: */ 308 if (m_pManagerVirtualMedia) 307 if ( m_pManagerVirtualMedia 308 || m_pPaneTools->isToolOpened(ToolType_VirtualMediaManager)) 309 309 return; 310 310 … … 425 425 void UISelectorWindow::sltOpenVirtualMediumManagerWindow() 426 426 { 427 /* First check if instance of widget opened embedded: */ 428 if (m_pPaneTools->isToolOpened(ToolType_VirtualMediaManager)) 429 { 430 sltPerformSegmentedButtonSwitch(SegmentType_Tools); 431 m_pPaneTools->setCurrentTool(ToolType_VirtualMediaManager); 432 return; 433 } 434 427 435 /* Create instance if not yet created: */ 428 436 if (!m_pManagerVirtualMedia) … … 451 459 void UISelectorWindow::sltOpenHostNetworkManagerWindow() 452 460 { 461 /* First check if instance of widget opened embedded: */ 462 if (m_pPaneTools->isToolOpened(ToolType_HostNetworkManager)) 463 { 464 sltPerformSegmentedButtonSwitch(SegmentType_Tools); 465 m_pPaneTools->setCurrentTool(ToolType_HostNetworkManager); 466 return; 467 } 468 453 469 /* Create instance if not yet created: */ 454 470 if (!m_pManagerHostNetwork) … … 1062 1078 { 1063 1079 case SegmentType_Details: m_pContainerDetails->setCurrentWidget(m_pPaneDetails); break; 1064 case SegmentType_ Snapshots: m_pContainerDetails->setCurrentWidget(m_pPaneSnapshots); break;1065 default: break;1080 case SegmentType_Tools: m_pContainerDetails->setCurrentWidget(m_pPaneTools); break; 1081 default: break; 1066 1082 } 1067 1083 } … … 1092 1108 } 1093 1109 1110 void UISelectorWindow::sltHandleToolsPaneToolOpened(ToolType enmType) 1111 { 1112 switch (enmType) 1113 { 1114 case ToolType_VirtualMediaManager: sltCloseVirtualMediumManagerWindow(); break; 1115 case ToolType_HostNetworkManager: sltCloseHostNetworkManagerWindow(); break; 1116 default: break; 1117 } 1118 } 1119 1094 1120 UIVMItem* UISelectorWindow::currentItem() const 1095 1121 { … … 1102 1128 } 1103 1129 1104 void UISelectorWindow::updateSnapshots(UIVMItem *pItem, const CMachine &comMachine) 1105 { 1106 /* Update segmented-button text: */ 1107 // TODO: Bring that NLS to "&Snapshots" / "&Snapshots (%1)" form 1108 // as translator should be able to translate whole sentence. 1109 // And move it from UIDesktopPane to UISelectorWindow context. 1110 QString strName = QApplication::translate("UIDesktopPane", "&Snapshots"); 1111 if (pItem) 1112 { 1113 /* Append the snapshot count (if any): */ 1114 const ULONG count = pItem->snapshotCount(); 1115 if (count) 1116 strName += QString(" (%1)").arg(count); 1117 } 1118 m_pSegmentedButton->setTitle(SegmentType_Snapshots, strName); 1119 1130 void UISelectorWindow::updateSnapshots(UIVMItem * /* pItem */, const CMachine &comMachine) 1131 { 1120 1132 /* Update snapshot pane availability: */ 1121 1133 if (comMachine.isNotNull()) 1122 m_pSegmentedButton->setEnabled(SegmentType_ Snapshots, true);1134 m_pSegmentedButton->setEnabled(SegmentType_Tools, true); 1123 1135 else 1124 1136 lockSnapshots(); 1125 1137 1126 /* Update snapshotpane finally: */1127 m_pPane Snapshots->setMachine(comMachine);1138 /* Update tools pane finally: */ 1139 m_pPaneTools->setMachine(comMachine); 1128 1140 } 1129 1141 … … 1133 1145 sltPerformSegmentedButtonSwitchToDetails(); 1134 1146 /* Then lock the snapshot pane: */ 1135 m_pSegmentedButton->setEnabled(SegmentType_ Snapshots, false);1147 m_pSegmentedButton->setEnabled(SegmentType_Tools, false); 1136 1148 } 1137 1149 … … 1153 1165 // TODO: Move that NLS from UIDesktopPane to UISelectorWindow context. 1154 1166 m_pSegmentedButton->setTitle(SegmentType_Details, QApplication::translate("UIDesktopPane", "&Details")); 1167 m_pSegmentedButton->setTitle(SegmentType_Tools, QApplication::translate("UIDesktopPane", "&Tools")); 1155 1168 1156 1169 /* Make sure details and snapshot panes are updated: */ … … 1783 1796 /* Create/add segmented-button: */ 1784 1797 m_pSegmentedButton = new UITexturedSegmentedButton(this, 2); 1785 m_pSegmentedButton->setIcon(SegmentType_Details, UIIconPool::iconSet(":/ vm_settings_16px.png",1786 ":/ vm_settings_disabled_16px.png"));1787 m_pSegmentedButton->setIcon(SegmentType_ Snapshots, UIIconPool::iconSet(":/snapshot_take_16px.png",1788 ":/snapshot_take_disabled_16px.png"));1798 m_pSegmentedButton->setIcon(SegmentType_Details, UIIconPool::iconSet(":/edataman_16px.png", 1799 ":/edataman_16px.png")); 1800 m_pSegmentedButton->setIcon(SegmentType_Tools, UIIconPool::iconSet(":/guesttools_16px.png", 1801 ":/guesttools_disabled_16px.png")); 1789 1802 m_pToolBar->addWidget(m_pSegmentedButton); 1790 1803 … … 1815 1828 m_pPaneDesktop = new UIDesktopPane(actionPool()->action(UIActionIndexST_M_Group_S_Refresh), this); 1816 1829 1817 /* Prepare snapshotpane: */1818 m_pPane Snapshots = new UISnapshotPane(this);1819 1820 /* Cr ate container: */1830 /* Prepare tools pane: */ 1831 m_pPaneTools = new UIToolsPane(this); 1832 1833 /* Create container: */ 1821 1834 m_pContainerDetails = new QStackedWidget(this); 1822 1835 m_pContainerDetails->addWidget(m_pPaneDetails); 1823 1836 m_pContainerDetails->addWidget(m_pPaneDesktop); 1824 m_pContainerDetails->addWidget(m_pPane Snapshots);1837 m_pContainerDetails->addWidget(m_pPaneTools); 1825 1838 1826 1839 /* Layout all the widgets: */ … … 1947 1960 connect(m_pPaneDetails, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)), 1948 1961 this, SLOT(sltOpenMachineSettingsDialog(const QString&, const QString&, const QString&))); 1962 connect(m_pPaneTools, &UIToolsPane::sigToolOpened, this, &UISelectorWindow::sltHandleToolsPaneToolOpened); 1949 1963 1950 1964 /* Global event handlers: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r67046 r67114 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 #include "QIMainWindow.h" 26 26 #include "QIWithRetranslateUI.h" 27 #include "UIToolsPane.h" 27 28 #include "VBoxGlobal.h" 28 29 … … 40 41 class UIGDetails; 41 42 class UIMainBar; 42 class UISnapshotPane;43 43 class UITexturedSegmentedButton; 44 44 class UIToolBar; … … 54 54 enum SegmentType 55 55 { 56 SegmentType_Details = 0,57 SegmentType_ Snapshots56 SegmentType_Details, 57 SegmentType_Tools, 58 58 }; 59 59 … … 204 204 /** @} */ 205 205 206 /** @name Tools-pane stuff. 207 * @{ */ 208 void sltHandleToolsPaneToolOpened(ToolType enmType); 209 /** @} */ 210 206 211 private: 207 212 … … 348 353 /** Holds the Desktop-pane instance. */ 349 354 UIDesktopPane *m_pPaneDesktop; 350 /** Holds the Snapshot-pane instance. */351 UI SnapshotPane *m_pPaneSnapshots;355 /** Holds the Tools-pane instance. */ 356 UIToolsPane *m_pPaneTools; 352 357 353 358 /** Holds the list of Group menu actions. */
Note:
See TracChangeset
for help on using the changeset viewer.