Changeset 107293 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Dec 11, 2024 5:06:46 PM (5 weeks ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp
r106061 r107293 32 32 # include <QStyle> 33 33 #endif 34 #include <QUuid>35 34 36 35 /* GUI includes */ 37 #include "UIActionPoolManager.h"38 36 #include "UICommon.h" 39 37 #include "UIDetails.h" … … 41 39 #include "UIFileManager.h" 42 40 #include "UIGlobalSession.h" 43 #include "UIIconPool.h"44 41 #include "UISnapshotPane.h" 45 42 #include "UIToolPaneMachine.h" … … 47 44 #include "UIVMActivityToolWidget.h" 48 45 #include "UIVMLogViewerWidget.h" 49 50 46 51 47 /* Other VBox includes: */ … … 65 61 , m_fActive(false) 66 62 { 67 /* Prepare: */68 63 prepare(); 69 64 } … … 71 66 UIToolPaneMachine::~UIToolPaneMachine() 72 67 { 73 /* Cleanup: */74 68 cleanup(); 75 69 } … … 96 90 bool UIToolPaneMachine::isToolOpened(UIToolType enmType) const 97 91 { 98 /* Search through the stacked widgets: */99 92 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 100 93 if (m_pLayout->widget(iIndex)->property("ToolType").value<UIToolType>() == enmType) … … 127 120 /* Create Error pane: */ 128 121 m_pPaneError = new UIErrorPane; 129 if (m_pPaneError) 130 { 122 AssertPtrReturnVoid(m_pPaneError); 123 { 124 /* Configure pane: */ 125 m_pPaneError->setProperty("ToolType", QVariant::fromValue(UIToolType_Error)); 131 126 #ifndef VBOX_WS_MAC 132 127 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4; 133 128 m_pPaneError->setContentsMargins(iMargin, 0, iMargin, 0); 134 129 #endif 135 136 /* Configure pane: */137 m_pPaneError->setProperty("ToolType", QVariant::fromValue(UIToolType_Error));138 130 139 131 /* Add into layout: */ … … 168 160 AssertPtrReturnVoid(m_pPaneSnapshots); 169 161 { 170 #ifndef VBOX_WS_MAC171 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4;172 m_pPaneSnapshots->setContentsMargins(iMargin, 0, iMargin, 0);173 #endif174 175 162 /* Configure pane: */ 176 163 m_pPaneSnapshots->setProperty("ToolType", QVariant::fromValue(UIToolType_Snapshots)); … … 178 165 this, &UIToolPaneMachine::sigCurrentSnapshotItemChange); 179 166 m_pPaneSnapshots->setMachineItems(m_items); 167 #ifndef VBOX_WS_MAC 168 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4; 169 m_pPaneSnapshots->setContentsMargins(iMargin, 0, iMargin, 0); 170 #endif 180 171 181 172 /* Add into layout: */ … … 187 178 case UIToolType_Logs: 188 179 { 189 /* Create theLogviewer pane: */180 /* Create Logviewer pane: */ 190 181 m_pPaneLogViewer = new UIVMLogViewerWidget(EmbedTo_Stack, m_pActionPool, false /* show toolbar */); 191 182 AssertPtrReturnVoid(m_pPaneLogViewer); 192 183 { 193 #ifndef VBOX_WS_MAC194 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4;195 m_pPaneLogViewer->setContentsMargins(iMargin, 0, iMargin, 0);196 #endif197 198 184 /* Configure pane: */ 199 185 m_pPaneLogViewer->setProperty("ToolType", QVariant::fromValue(UIToolType_Logs)); … … 201 187 this, &UIToolPaneMachine::sltDetachToolPane); 202 188 m_pPaneLogViewer->setSelectedVMListItems(m_items); 189 #ifndef VBOX_WS_MAC 190 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4; 191 m_pPaneLogViewer->setContentsMargins(iMargin, 0, iMargin, 0); 192 #endif 203 193 204 194 /* Add into layout: */ … … 210 200 case UIToolType_VMActivity: 211 201 { 202 /* Create Activity pane: */ 212 203 m_pPaneVMActivityMonitor = new UIVMActivityToolWidget(EmbedTo_Stack, m_pActionPool, 213 204 false /* Show toolbar */, 0 /* Parent */); 214 205 AssertPtrReturnVoid(m_pPaneVMActivityMonitor); 215 #ifndef VBOX_WS_MAC 216 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4; 217 m_pPaneVMActivityMonitor->setContentsMargins(iMargin, 0, iMargin, 0); 218 #endif 219 220 /* Configure pane: */ 221 m_pPaneVMActivityMonitor->setProperty("ToolType", QVariant::fromValue(UIToolType_VMActivity)); 222 m_pPaneVMActivityMonitor->setSelectedVMListItems(m_items); 223 /* Add into layout: */ 224 m_pLayout->addWidget(m_pPaneVMActivityMonitor); 225 m_pLayout->setCurrentWidget(m_pPaneVMActivityMonitor); 226 227 connect(m_pPaneVMActivityMonitor, &UIVMActivityToolWidget::sigSwitchToActivityOverviewPane, 228 this, &UIToolPaneMachine::sigSwitchToActivityOverviewPane); 206 { 207 /* Configure pane: */ 208 m_pPaneVMActivityMonitor->setProperty("ToolType", QVariant::fromValue(UIToolType_VMActivity)); 209 m_pPaneVMActivityMonitor->setSelectedVMListItems(m_items); 210 connect(m_pPaneVMActivityMonitor, &UIVMActivityToolWidget::sigSwitchToActivityOverviewPane, 211 this, &UIToolPaneMachine::sigSwitchToActivityOverviewPane); 212 #ifndef VBOX_WS_MAC 213 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4; 214 m_pPaneVMActivityMonitor->setContentsMargins(iMargin, 0, iMargin, 0); 215 #endif 216 217 /* Add into layout: */ 218 m_pLayout->addWidget(m_pPaneVMActivityMonitor); 219 m_pLayout->setCurrentWidget(m_pPaneVMActivityMonitor); 220 } 229 221 break; 230 222 } 231 223 case UIToolType_FileManager: 232 224 { 225 /* Create File Manager pane: */ 233 226 if (!m_items.isEmpty()) 234 227 m_pPaneFileManager = new UIFileManager(EmbedTo_Stack, m_pActionPool, … … 239 232 0, false /* fShowToolbar */); 240 233 AssertPtrReturnVoid(m_pPaneFileManager); 241 #ifndef VBOX_WS_MAC 242 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4; 243 m_pPaneFileManager->setContentsMargins(iMargin, 0, iMargin, 0); 244 #endif 245 /* Configure pane: */ 246 m_pPaneFileManager->setProperty("ToolType", QVariant::fromValue(UIToolType_FileManager)); 247 m_pPaneFileManager->setSelectedVMListItems(m_items); 248 /* Add into layout: */ 249 m_pLayout->addWidget(m_pPaneFileManager); 250 m_pLayout->setCurrentWidget(m_pPaneFileManager); 234 { 235 /* Configure pane: */ 236 m_pPaneFileManager->setProperty("ToolType", QVariant::fromValue(UIToolType_FileManager)); 237 m_pPaneFileManager->setSelectedVMListItems(m_items); 238 #ifndef VBOX_WS_MAC 239 const int iMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 4; 240 m_pPaneFileManager->setContentsMargins(iMargin, 0, iMargin, 0); 241 #endif 242 243 /* Add into layout: */ 244 m_pLayout->addWidget(m_pPaneFileManager); 245 m_pLayout->setCurrentWidget(m_pPaneFileManager); 246 } 251 247 break; 252 248 } … … 279 275 case UIToolType_Logs: m_pPaneLogViewer = 0; break; 280 276 case UIToolType_VMActivity: m_pPaneVMActivityMonitor = 0; break; 277 case UIToolType_FileManager: m_pPaneFileManager = 0; break; 281 278 default: break; 282 279 } … … 291 288 } 292 289 290 QString UIToolPaneMachine::currentHelpKeyword() const 291 { 292 QWidget *pCurrentToolWidget = 0; 293 switch (currentTool()) 294 { 295 case UIToolType_Error: 296 pCurrentToolWidget = m_pPaneError; 297 break; 298 case UIToolType_Details: 299 pCurrentToolWidget = m_pPaneDetails; 300 break; 301 case UIToolType_Snapshots: 302 pCurrentToolWidget = m_pPaneSnapshots; 303 break; 304 case UIToolType_Logs: 305 pCurrentToolWidget = m_pPaneLogViewer; 306 break; 307 case UIToolType_VMActivity: 308 pCurrentToolWidget = m_pPaneVMActivityMonitor; 309 break; 310 case UIToolType_FileManager: 311 pCurrentToolWidget = m_pPaneFileManager; 312 break; 313 default: 314 break; 315 } 316 return uiCommon().helpKeyword(pCurrentToolWidget); 317 } 318 293 319 void UIToolPaneMachine::setErrorDetails(const QString &strDetails) 294 320 { … … 344 370 { 345 371 return m_pPaneSnapshots ? m_pPaneSnapshots->currentSnapshotId() : QUuid(); 346 }347 348 QString UIToolPaneMachine::currentHelpKeyword() const349 {350 QWidget *pCurrentToolWidget = 0;351 switch (currentTool())352 {353 case UIToolType_Error:354 pCurrentToolWidget = m_pPaneError;355 break;356 case UIToolType_Details:357 pCurrentToolWidget = m_pPaneDetails;358 break;359 case UIToolType_Snapshots:360 pCurrentToolWidget = m_pPaneSnapshots;361 break;362 case UIToolType_Logs:363 pCurrentToolWidget = m_pPaneLogViewer;364 break;365 case UIToolType_VMActivity:366 pCurrentToolWidget = m_pPaneVMActivityMonitor;367 break;368 case UIToolType_FileManager:369 pCurrentToolWidget = m_pPaneFileManager;370 break;371 default:372 break;373 }374 return uiCommon().helpKeyword(pCurrentToolWidget);375 }376 377 void UIToolPaneMachine::prepare()378 {379 /* Create stacked-layout: */380 m_pLayout = new QStackedLayout(this);381 382 /* Create Details pane: */383 openTool(UIToolType_Details);384 }385 386 void UIToolPaneMachine::cleanup()387 {388 /* Remove all widgets prematurelly: */389 while (m_pLayout->count())390 {391 QWidget *pWidget = m_pLayout->widget(0);392 m_pLayout->removeWidget(pWidget);393 delete pWidget;394 }395 }396 397 void UIToolPaneMachine::handleTokenChange()398 {399 // printf("UIToolPaneMachine::handleTokenChange: Active = %d, current tool = %d\n", m_fActive, currentTool());400 372 } 401 373 … … 406 378 if (sender() == m_pPaneLogViewer) 407 379 enmToolType = UIToolType_Logs; 408 409 380 if (enmToolType != UIToolType_Invalid) 410 381 emit sigDetachToolPane(enmToolType); 411 382 } 383 384 void UIToolPaneMachine::prepare() 385 { 386 /* Create stacked-layout: */ 387 m_pLayout = new QStackedLayout(this); 388 389 /* Create Details pane: */ 390 openTool(UIToolType_Details); 391 } 392 393 void UIToolPaneMachine::cleanup() 394 { 395 /* Remove all widgets prematurelly: */ 396 while (m_pLayout->count()) 397 { 398 QWidget *pWidget = m_pLayout->widget(0); 399 m_pLayout->removeWidget(pWidget); 400 delete pWidget; 401 } 402 } 403 404 void UIToolPaneMachine::handleTokenChange() 405 { 406 // printf("UIToolPaneMachine::handleTokenChange: Active = %d, current tool = %d\n", m_fActive, currentTool()); 407 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.h
r106061 r107293 39 39 #include "UIExtraDataDefs.h" 40 40 41 /* COM includes: */42 #include "CMachine.h"43 44 41 /* Forward declarations: */ 45 class QHBoxLayout;46 42 class QStackedLayout; 47 class QVBoxLayout;48 43 class UIActionPool; 49 44 class UIDetails; … … 55 50 class UIFileManager; 56 51 57 /** QWidget subclass representing container for tool panes. */52 /** QWidget subclass representing container for Machine tool panes. */ 58 53 class UIToolPaneMachine : public QWidget 59 54 { … … 99 94 void closeTool(UIToolType enmType); 100 95 96 /** Returns the help keyword of the current tool's widget. */ 97 QString currentHelpKeyword() const; 98 101 99 /** Defines error @a strDetails and switches to Error pane. */ 102 100 void setErrorDetails(const QString &strDetails); … … 110 108 /** Returns currently selected snapshot ID if any. */ 111 109 QUuid currentSnapshotId(); 112 113 /** Returns the help keyword of the current tool's widget. */114 QString currentHelpKeyword() const;115 110 116 111 private slots: … … 135 130 136 131 /** Holds the stacked-layout instance. */ 137 QStackedLayout *m_pLayout;132 QStackedLayout *m_pLayout; 138 133 /** Holds the Error pane instance. */ 139 UIErrorPane *m_pPaneError;134 UIErrorPane *m_pPaneError; 140 135 /** Holds the Details pane instance. */ 141 UIDetails *m_pPaneDetails;136 UIDetails *m_pPaneDetails; 142 137 /** Holds the Snapshots pane instance. */ 143 UISnapshotPane *m_pPaneSnapshots;138 UISnapshotPane *m_pPaneSnapshots; 144 139 /** Holds the Logviewer pane instance. */ 145 UIVMLogViewerWidget *m_pPaneLogViewer;140 UIVMLogViewerWidget *m_pPaneLogViewer; 146 141 /** Holds the Performance Monitor pane instance. */ 147 142 UIVMActivityToolWidget *m_pPaneVMActivityMonitor; 148 143 /** Holds the File Manager pane instance. */ 149 UIFileManager *m_pPaneFileManager;144 UIFileManager *m_pPaneFileManager; 150 145 151 146 /** Holds whether this pane is active. */
Note:
See TracChangeset
for help on using the changeset viewer.