Changeset 67109 in vbox for trunk/src/VBox
- Timestamp:
- May 26, 2017 9:53:10 AM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPane.cpp
r67108 r67109 73 73 74 74 /* Translate actions: */ 75 m_actions[Tool sType_SnapshotManager]->setText(tr("Snapshot Manager"));76 m_actions[Tool sType_VirtualMediaManager]->setText(tr("Virtual Media Manager"));77 m_actions[Tool sType_HostNetworkManager]->setText(tr("Host Network Manager"));75 m_actions[ToolType_SnapshotManager]->setText(tr("Snapshot Manager")); 76 m_actions[ToolType_VirtualMediaManager]->setText(tr("Virtual Media Manager")); 77 m_actions[ToolType_HostNetworkManager]->setText(tr("Host Network Manager")); 78 78 79 79 /* Translate tab-bar: */ 80 80 for (int iTabIndex = 0; iTabIndex < m_pTabBar->count(); ++iTabIndex) 81 81 { 82 const Tool sType enmType = m_pTabBar->tabData(iTabIndex).value<ToolsType>();82 const ToolType enmType = m_pTabBar->tabData(iTabIndex).value<ToolType>(); 83 83 m_pTabBar->setTabText(iTabIndex, m_actions.value(enmType)->text()); 84 84 } … … 92 92 93 93 /* Acquire sender's type: */ 94 const Tool sType enmType = pAction->property("ToolsType").value<ToolsType>();95 AssertReturnVoid(enmType != Tool sType_Invalid);94 const ToolType enmType = pAction->property("ToolType").value<ToolType>(); 95 AssertReturnVoid(enmType != ToolType_Invalid); 96 96 97 97 /* Activate corresponding tab: */ … … 120 120 121 121 /* Acquire sender's type: */ 122 const Tool sType enmType = pButton->property("ToolsType").value<ToolsType>();123 AssertReturnVoid(enmType != Tool sType_Invalid);122 const ToolType enmType = pButton->property("ToolType").value<ToolType>(); 123 AssertReturnVoid(enmType != ToolType_Invalid); 124 124 125 125 /* Search for the tab with such type: */ 126 126 int iActualTabIndex = -1; 127 127 for (int iTabIndex = 0; iTabIndex < m_pTabBar->count(); ++iTabIndex) 128 if (m_pTabBar->tabData(iTabIndex).value<Tool sType>() == enmType)128 if (m_pTabBar->tabData(iTabIndex).value<ToolType>() == enmType) 129 129 iActualTabIndex = iTabIndex; 130 130 AssertReturnVoid(iActualTabIndex != -1); … … 173 173 174 174 /* Add and activate snapshots pane: */ 175 activateTabBarTab(Tool sType_SnapshotManager, false);175 activateTabBarTab(ToolType_SnapshotManager, false); 176 176 177 177 /* Add into layout: */ … … 252 252 253 253 /* Create SnapShot manager action: */ 254 m_actions[Tool sType_SnapshotManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/snapshot_manager_22px.png",254 m_actions[ToolType_SnapshotManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/snapshot_manager_22px.png", 255 255 ":/snapshot_manager_16px.png"), 256 256 QString(), this, &UIToolsPane::sltHandleMenuToolbarTrigger); 257 257 { 258 m_actions[Tool sType_SnapshotManager]->setCheckable(true);259 m_actions[Tool sType_SnapshotManager]->260 setProperty("Tool sType", QVariant::fromValue(ToolsType_SnapshotManager));258 m_actions[ToolType_SnapshotManager]->setCheckable(true); 259 m_actions[ToolType_SnapshotManager]-> 260 setProperty("ToolType", QVariant::fromValue(ToolType_SnapshotManager)); 261 261 } 262 262 263 263 /* Create Virtual Media manager action: */ 264 m_actions[Tool sType_VirtualMediaManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/diskimage_22px.png",264 m_actions[ToolType_VirtualMediaManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/diskimage_22px.png", 265 265 ":/diskimage_16px.png"), 266 266 QString(), this, &UIToolsPane::sltHandleMenuToolbarTrigger); 267 267 { 268 m_actions[Tool sType_VirtualMediaManager]->setCheckable(true);269 m_actions[Tool sType_VirtualMediaManager]->270 setProperty("Tool sType", QVariant::fromValue(ToolsType_VirtualMediaManager));268 m_actions[ToolType_VirtualMediaManager]->setCheckable(true); 269 m_actions[ToolType_VirtualMediaManager]-> 270 setProperty("ToolType", QVariant::fromValue(ToolType_VirtualMediaManager)); 271 271 } 272 272 273 273 /* Create Host Network manager action: */ 274 m_actions[Tool sType_HostNetworkManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/host_iface_manager_22px.png",274 m_actions[ToolType_HostNetworkManager] = m_pMenu->addAction(UIIconPool::iconSetFull(":/host_iface_manager_22px.png", 275 275 ":/host_iface_manager_16px.png"), 276 276 QString(), this, &UIToolsPane::sltHandleMenuToolbarTrigger); 277 277 { 278 m_actions[Tool sType_HostNetworkManager]->setCheckable(true);279 m_actions[Tool sType_HostNetworkManager]->280 setProperty("Tool sType", QVariant::fromValue(ToolsType_HostNetworkManager));278 m_actions[ToolType_HostNetworkManager]->setCheckable(true); 279 m_actions[ToolType_HostNetworkManager]-> 280 setProperty("ToolType", QVariant::fromValue(ToolType_HostNetworkManager)); 281 281 } 282 282 … … 298 298 } 299 299 300 void UIToolsPane::activateTabBarTab(Tool sType enmType, bool fCloseable)300 void UIToolsPane::activateTabBarTab(ToolType enmType, bool fCloseable) 301 301 { 302 302 /* Search for a tab with such type: */ 303 303 int iActualTabIndex = -1; 304 304 for (int iTabIndex = 0; iTabIndex < m_pTabBar->count(); ++iTabIndex) 305 if (m_pTabBar->tabData(iTabIndex).value<Tool sType>() == enmType)305 if (m_pTabBar->tabData(iTabIndex).value<ToolType>() == enmType) 306 306 iActualTabIndex = iTabIndex; 307 307 … … 313 313 switch (enmType) 314 314 { 315 case Tool sType_SnapshotManager:315 case ToolType_SnapshotManager: 316 316 m_pPaneSnapshots = new UISnapshotPane; 317 317 m_pStackedLayout->addWidget(m_pPaneSnapshots); 318 318 break; 319 case Tool sType_VirtualMediaManager:319 case ToolType_VirtualMediaManager: 320 320 m_pStackedLayout->addWidget(new UIMediumManagerWidget(EmbedTo_Stack)); 321 321 break; 322 case Tool sType_HostNetworkManager:322 case ToolType_HostNetworkManager: 323 323 m_pStackedLayout->addWidget(new UIHostNetworkManagerWidget(EmbedTo_Stack)); 324 324 break; … … 342 342 #endif 343 343 pButtonClose->setIcon(UIIconPool::iconSet(":/close_16px.png")); 344 pButtonClose->setProperty("Tool sType", QVariant::fromValue(enmType));344 pButtonClose->setProperty("ToolType", QVariant::fromValue(enmType)); 345 345 connect(pButtonClose, &QIToolButton::clicked, this, &UIToolsPane::sltHandleTabBarButtonClick); 346 346 /* Add into tab-bar: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPane.h
r67091 r67109 37 37 38 38 39 /** Tool types. */ 40 enum ToolType 41 { 42 ToolType_Invalid, 43 ToolType_SnapshotManager, 44 ToolType_VirtualMediaManager, 45 ToolType_HostNetworkManager, 46 }; 47 48 /* Make sure QVariant can eat ToolType: */ 49 Q_DECLARE_METATYPE(ToolType); 50 51 39 52 /** QWidget subclass representing container for tool panes. */ 40 53 class UIToolsPane : public QIWithRetranslateUI<QWidget> … … 43 56 44 57 public: 45 46 /** Tools types. */47 enum ToolsType48 {49 ToolsType_Invalid,50 ToolsType_SnapshotManager,51 ToolsType_VirtualMediaManager,52 ToolsType_HostNetworkManager,53 };54 58 55 59 /** Constructs tools pane passing @a pParent to the base-class. */ … … 94 98 95 99 /** Activates corresponding tab-bar tab, adds new if necessary. */ 96 void activateTabBarTab(Tool sType enmType, bool fCloseable);100 void activateTabBarTab(ToolType enmType, bool fCloseable); 97 101 98 102 /** Holds the main layout isntance. */ … … 111 115 QMenu *m_pMenu; 112 116 /** Holds the menu action instances. */ 113 QMap<Tool sType, QAction*> m_actions;117 QMap<ToolType, QAction*> m_actions; 114 118 }; 115 116 /* Make sure QVariant can eat UIToolsPane::ToolsType: */117 Q_DECLARE_METATYPE(UIToolsPane::ToolsType);118 119 119 120 #endif /* !___UIToolsPane_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.