Changeset 100146 in vbox
- Timestamp:
- Jun 9, 2023 4:15:06 PM (22 months ago)
- svn:sync-xref-src-repo-rev:
- 157841
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium/viso
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r100136 r100146 28 28 /* Qt includes: */ 29 29 #include <QGridLayout> 30 #include <QGraphicsBlurEffect> 31 #include <QGroupBox> 30 32 #include <QLabel> 31 33 #include <QMenuBar> 34 #include <QPainter> 32 35 #include <QPushButton> 33 36 #include <QStyle> 34 37 #include <QStatusBar> 38 #include <QStackedLayout> 35 39 #include <QTextStream> 36 40 … … 58 62 #include <iprt/path.h> 59 63 60 61 class UIVisoSettingWidget : public QIWithRetranslateUI<QFrame> 64 // class UIDimmableWidget : public QWidget 65 // { 66 // public: 67 // UIDimmableWidget(QWidget *pParent = 0); 68 69 // protected: 70 // virtual void paintEvent(QPaintEvent *pEvent) final override; 71 // private: 72 // // QGraphicsBlurEffect *m_pOverlayBlurEffect; 73 // // m_pOverlayBlurEffect = new QGraphicsBlurEffect(this); 74 // // AssertPtrReturnVoid(m_pOverlayBlurEffect); 75 // // m_pBrowserContainerWidget->setGraphicsEffect(m_pOverlayBlurEffect); 76 // // m_pOverlayBlurEffect->setEnabled(false); 77 // // m_pOverlayBlurEffect->setBlurRadius(8); 78 // // if (m_pOverlayBlurEffect) 79 // // m_pOverlayBlurEffect->setEnabled(m_pSettingsWidget->isVisible()); 80 81 // QWidget *m_pOverlayWidget; 82 // }; 83 84 class UIVisoSettingWidget : public QIWithRetranslateUI<QGroupBox> 62 85 { 63 86 public: … … 67 90 68 91 UIVisoSettingWidget::UIVisoSettingWidget(QWidget *pParent) 69 :QIWithRetranslateUI<QFrame>(pParent) 70 { 71 72 } 92 :QIWithRetranslateUI<QGroupBox>(pParent) 93 { 94 95 } 96 73 97 74 98 … … 97 121 , m_pActionPool(pActionPool) 98 122 , m_fShowToolBar(fShowToolBar) 123 , m_fShowSettingsDialog(false) 99 124 , m_pSettingsWidget(0) 100 125 , m_pBrowserContainerWidget(0) … … 150 175 if (m_pVISOContentBrowser) 151 176 m_pVISOContentBrowser->setTitle(tr("VISO Content")); 177 if (m_pSettingsWidget) 178 m_pSettingsWidget->setTitle(tr("Setting")); 179 } 180 181 void UIVisoCreatorWidget::paintEvent(QPaintEvent *pEvent) 182 { 183 Q_UNUSED(pEvent); 184 if (m_pSettingsWidget && m_pOverlayWidget && m_pOverlayBlurEffect) 185 { 186 m_pSettingsWidget->setVisible(m_fShowSettingsDialog); 187 m_pOverlayWidget->setVisible(m_fShowSettingsDialog); 188 m_pOverlayBlurEffect->setEnabled(m_fShowSettingsDialog); 189 if (m_fShowSettingsDialog) 190 { 191 int x = 0.5 * (m_pOverlayWidget->width() - m_pSettingsWidget->width()); 192 int y = 0.5 * (m_pOverlayWidget->height() - m_pSettingsWidget->height()); 193 m_pSettingsWidget->move(m_pOverlayWidget->x() + x, m_pOverlayWidget->y() + y); 194 } 195 } 152 196 } 153 197 … … 160 204 void UIVisoCreatorWidget::sltPanelActionToggled(bool fChecked) 161 205 { 162 Q_UNUSED(fChecked); 163 if (m_pSettingsWidget) 164 m_pSettingsWidget->setVisible(!m_pSettingsWidget->isVisible()); 165 #if 0 166 QAction *pSenderAction = qobject_cast<QAction*>(sender()); 167 if (!pSenderAction) 168 return; 169 UIDialogPanel* pPanel = 0; 170 /* Look for the sender() within the m_panelActionMap's values: */ 171 for (QMap<UIDialogPanel*, QAction*>::const_iterator iterator = m_panelActionMap.begin(); 172 iterator != m_panelActionMap.end(); ++iterator) 173 { 174 if (iterator.value() == pSenderAction) 175 pPanel = iterator.key(); 176 } 177 if (!pPanel) 178 return; 179 if (fChecked) 180 showPanel(pPanel); 181 else 182 hidePanel(pPanel); 183 #endif 206 m_fShowSettingsDialog = fChecked; 207 update(); 184 208 } 185 209 … … 282 306 if (m_pActionPool && m_pActionPool->action(UIActionIndex_M_VISOCreator)) 283 307 m_pMainMenu = m_pActionPool->action(UIActionIndex_M_VISOCreator)->menu(); 284 // int iLayoutRow = 0; 308 285 309 if (m_fShowToolBar) 286 310 { … … 294 318 } 295 319 320 QStackedLayout *pStackedLayout = new QStackedLayout; 321 AssertPtrReturnVoid(pStackedLayout); 322 m_pMainLayout->addLayout(pStackedLayout); 323 296 324 m_pBrowserContainerWidget = new QWidget; 297 325 AssertPtrReturnVoid(m_pBrowserContainerWidget); 298 326 299 m_pMainLayout->addWidget(m_pBrowserContainerWidget);300 327 QGridLayout *pContainerLayout = new QGridLayout(m_pBrowserContainerWidget); 301 328 AssertPtrReturnVoid(pContainerLayout); 302 329 pContainerLayout->setContentsMargins(0, 0, 0, 0); 330 303 331 m_pHostBrowser = new UIVisoHostBrowser; 304 332 AssertPtrReturnVoid(m_pHostBrowser); 305 306 333 pContainerLayout->addWidget(m_pHostBrowser, 0, 0, 1, 4); 307 334 … … 315 342 m_pVISOContentBrowser->setVisoName(m_visoOptions.m_strVisoName); 316 343 317 // ++iLayoutRow; 318 // m_pConfigurationPanel = new UIVisoConfigurationPanel(this); 319 // if (m_pConfigurationPanel) 320 // { 321 // m_pMainLayout->addWidget(m_pConfigurationPanel, iLayoutRow++, 0, 1, 9); 322 // m_pConfigurationPanel->hide(); 323 // m_pConfigurationPanel->setVisoName(m_visoOptions.m_strVisoName); 324 // m_pConfigurationPanel->setVisoCustomOptions(m_visoOptions.m_customOptions); 325 // } 326 327 328 // m_pSettingsWidget = new UIVisoSettingWidget(this); 329 // if (m_pSettingsWidget) 330 // { 331 // QVBoxLayout *pMainLayout = new QVBoxLayout(m_pSettingsWidget); 332 // QPushButton *pB = new QPushButton; 333 // pB->setText("ssssasas"); 334 // pMainLayout->addWidget(pB); 335 // m_pSettingsWidget->setVisible(false); 336 // } 344 m_pOverlayWidget = new QWidget(this); 345 m_pOverlayWidget->setAutoFillBackground(true); 346 QPalette pal = QPalette(); 347 QColor color = pal.color(QPalette::Window); 348 color.setAlpha(60); 349 pal.setColor(QPalette::Window, color); 350 m_pOverlayWidget->setPalette(pal); 351 352 m_pOverlayBlurEffect = new QGraphicsBlurEffect(this); 353 AssertPtrReturnVoid(m_pOverlayBlurEffect); 354 m_pBrowserContainerWidget->setGraphicsEffect(m_pOverlayBlurEffect); 355 m_pOverlayBlurEffect->setEnabled(false); 356 m_pOverlayBlurEffect->setBlurRadius(6); 357 358 m_pSettingsWidget = new UIVisoSettingWidget(this); 359 m_pSettingsWidget->setFixedWidth(300); 360 m_pSettingsWidget->setFixedHeight(300); 361 AssertPtrReturnVoid(m_pSettingsWidget); 362 363 364 /* When added to stacked layout m_pSettingsWidget cannot be centered: */ 365 //pStackedLayout->addWidget(m_pSettingsWidget); 366 //pStackedLayout->setAlignment(m_pSettingsWidget, Qt::AlignRight); 367 pStackedLayout->addWidget(m_pOverlayWidget); 368 pStackedLayout->addWidget(m_pBrowserContainerWidget); 369 pStackedLayout->setStackingMode(QStackedLayout::StackAll); 370 371 m_pSettingsWidget->hide(); 372 m_pOverlayWidget->hide(); 337 373 } 338 374 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r100135 r100146 44 44 /* Forward declarations: */ 45 45 class QGridLayout; 46 class QGraphicsBlurEffect; 46 47 class QVBoxLayout; 47 48 class QLabel; … … 92 93 93 94 virtual void retranslateUi() final override; 95 virtual void paintEvent(QPaintEvent *pEvent) final override; 94 96 95 97 private slots: … … 176 178 QPointer<UIActionPool> m_pActionPool; 177 179 bool m_fShowToolBar; 180 bool m_fShowSettingsDialog; 178 181 UIVisoSettingWidget *m_pSettingsWidget; 179 182 QWidget *m_pBrowserContainerWidget; 183 QWidget *m_pOverlayWidget; 184 QGraphicsBlurEffect *m_pOverlayBlurEffect; 180 185 }; 181 186
Note:
See TracChangeset
for help on using the changeset viewer.