- Timestamp:
- Nov 9, 2021 12:48:18 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 148135
- 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
r92270 r92289 39 39 #endif 40 40 41 UIVisoCreatorDialog::UIVisoCreatorDialog(QWidget *pParent /* =0 */, const QString& strMachineName /* = QString() */) 42 : QIWithRetranslateUI<QIMainDialog>(pParent) 41 /********************************************************************************************************************************* 42 * UIVisoCreatorWidget implementation. * 43 *********************************************************************************************************************************/ 44 45 UIVisoCreatorWidget::UIVisoCreatorWidget(QWidget *pParent /* =0 */, const QString& strMachineName /* = QString() */) 46 : QIWithRetranslateUI<QWidget>(pParent) 43 47 , m_pActionConfiguration(0) 44 48 , m_pActionOptions(0) … … 51 55 , m_pHostBrowser(0) 52 56 , m_pVisoBrowser(0) 53 , m_pButtonBox(0)54 57 , m_pToolBar(0) 55 58 , m_pVerticalToolBar(0) 56 , m_pCentralWidget(0)57 59 , m_pMainMenu(0) 58 60 , m_strMachineName(strMachineName) … … 69 71 } 70 72 71 QStringList UIVisoCreator Dialog::entryList() const73 QStringList UIVisoCreatorWidget::entryList() const 72 74 { 73 75 if (!m_pVisoBrowser) … … 76 78 } 77 79 78 const QString &UIVisoCreator Dialog::visoName() const80 const QString &UIVisoCreatorWidget::visoName() const 79 81 { 80 82 return m_visoOptions.m_strVisoName; 81 83 } 82 84 83 const QStringList &UIVisoCreator Dialog::customOptions() const85 const QStringList &UIVisoCreatorWidget::customOptions() const 84 86 { 85 87 return m_visoOptions.m_customOptions; 86 88 } 87 89 88 QString UIVisoCreator Dialog::currentPath() const90 QString UIVisoCreatorWidget::currentPath() const 89 91 { 90 92 if (!m_pHostBrowser) … … 93 95 } 94 96 95 void UIVisoCreator Dialog::setCurrentPath(const QString &strPath)97 void UIVisoCreatorWidget::setCurrentPath(const QString &strPath) 96 98 { 97 99 if (!m_pHostBrowser) … … 100 102 } 101 103 102 void UIVisoCreatorDialog::retranslateUi() 103 { 104 if (!m_strMachineName.isEmpty()) 105 setWindowTitle(QString("%1 - %2").arg(m_strMachineName).arg(tr("VISO Creator"))); 106 else 107 setWindowTitle(QString("%1").arg(tr("VISO Creator"))); 104 void UIVisoCreatorWidget::retranslateUi() 105 { 108 106 if (m_pActionConfiguration) 109 107 { … … 144 142 if (m_pRenameAction) 145 143 m_pRenameAction->setToolTip(QApplication::translate("UIVisoCreator", "Rename the selected object")); 146 if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Ok)) 147 { 148 m_pButtonBox->button(QDialogButtonBox::Ok)->setText(QApplication::translate("UIVisoCreator", "C&reate")); 149 m_pButtonBox->button(QDialogButtonBox::Ok)->setToolTip(QApplication::translate("UIVisoCreator", "Creates VISO file with the selected content")); 150 } 151 if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Help)) 152 m_pButtonBox->button(QDialogButtonBox::Help)->setToolTip(QApplication::translate("UIVisoCreator", "Opens the help browser and navigates to the related section")); 153 } 154 155 void UIVisoCreatorDialog::sltHandleAddObjectsToViso(QStringList pathList) 144 } 145 146 void UIVisoCreatorWidget::sltHandleAddObjectsToViso(QStringList pathList) 156 147 { 157 148 if (m_pVisoBrowser) … … 159 150 } 160 151 161 void UIVisoCreator Dialog::sltPanelActionToggled(bool fChecked)152 void UIVisoCreatorWidget::sltPanelActionToggled(bool fChecked) 162 153 { 163 154 QAction *pSenderAction = qobject_cast<QAction*>(sender()); … … 180 171 } 181 172 182 void UIVisoCreator Dialog::sltHandleVisoNameChanged(const QString &strVisoName)173 void UIVisoCreatorWidget::sltHandleVisoNameChanged(const QString &strVisoName) 183 174 { 184 175 if (m_visoOptions.m_strVisoName == strVisoName) … … 189 180 } 190 181 191 void UIVisoCreator Dialog::sltHandleCustomVisoOptionsChanged(const QStringList &customVisoOptions)182 void UIVisoCreatorWidget::sltHandleCustomVisoOptionsChanged(const QStringList &customVisoOptions) 192 183 { 193 184 if (m_visoOptions.m_customOptions == customVisoOptions) … … 196 187 } 197 188 198 void UIVisoCreator Dialog::sltHandleShowHiddenObjectsChange(bool fShow)189 void UIVisoCreatorWidget::sltHandleShowHiddenObjectsChange(bool fShow) 199 190 { 200 191 if (m_browserOptions.m_fShowHiddenObjects == fShow) … … 204 195 } 205 196 206 void UIVisoCreator Dialog::sltHandleHidePanel(UIDialogPanel *pPanel)197 void UIVisoCreatorWidget::sltHandleHidePanel(UIDialogPanel *pPanel) 207 198 { 208 199 hidePanel(pPanel); 209 200 } 210 201 211 void UIVisoCreator Dialog::sltHandleBrowserTreeViewVisibilityChanged(bool fVisible)202 void UIVisoCreatorWidget::sltHandleBrowserTreeViewVisibilityChanged(bool fVisible) 212 203 { 213 204 Q_UNUSED(fVisible); … … 215 206 } 216 207 217 void UIVisoCreator Dialog::sltHandleHostBrowserTableSelectionChanged(bool fIsSelectionEmpty)208 void UIVisoCreatorWidget::sltHandleHostBrowserTableSelectionChanged(bool fIsSelectionEmpty) 218 209 { 219 210 if (m_pAddAction) … … 221 212 } 222 213 223 void UIVisoCreator Dialog::sltHandleContentBrowserTableSelectionChanged(bool fIsSelectionEmpty)214 void UIVisoCreatorWidget::sltHandleContentBrowserTableSelectionChanged(bool fIsSelectionEmpty) 224 215 { 225 216 if (m_pRemoveAction) … … 227 218 } 228 219 229 void UIVisoCreator Dialog::sltHandleShowContextMenu(const QWidget *pContextMenuRequester, const QPoint &point)220 void UIVisoCreatorWidget::sltHandleShowContextMenu(const QWidget *pContextMenuRequester, const QPoint &point) 230 221 { 231 222 if (!pContextMenuRequester) … … 248 239 } 249 240 250 void UIVisoCreatorDialog::prepareWidgets() 251 { 252 m_pCentralWidget = new QWidget; 253 if (!m_pCentralWidget) 254 return; 255 setCentralWidget(m_pCentralWidget); 256 257 m_pMainLayout = new QGridLayout; 258 m_pCentralWidget->setLayout(m_pMainLayout); 259 if (!m_pMainLayout || !menuBar()) 241 void UIVisoCreatorWidget::prepareWidgets() 242 { 243 m_pMainLayout = new QGridLayout(this); 244 if (!m_pMainLayout) 260 245 return; 261 246 … … 272 257 #endif 273 258 274 m_pMainMenu = menuBar()->addMenu(tr("VISO")); 275 if (m_pActionConfiguration) 276 m_pMainMenu->addAction(m_pActionConfiguration); 277 if (m_pActionOptions) 278 m_pMainMenu->addAction(m_pActionOptions); 279 280 m_pToolBar = new QIToolBar; 281 if (m_pToolBar) 282 { 283 /* Configure toolbar: */ 284 const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize)); 285 m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric)); 286 m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 287 m_pMainLayout->addWidget(m_pToolBar, 0, 0, 1, 5); 288 } 259 // m_pMainMenu = menuBar()->addMenu(tr("VISO")); 260 261 // if (m_pActionConfiguration) 262 // m_pMainMenu->addAction(m_pActionConfiguration); 263 // if (m_pActionOptions) 264 // m_pMainMenu->addAction(m_pActionOptions); 265 266 // m_pToolBar = new QIToolBar; 267 // if (m_pToolBar) 268 // { 269 // /* Configure toolbar: */ 270 // const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize)); 271 // m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric)); 272 // m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 273 // m_pMainLayout->addWidget(m_pToolBar, 0, 0, 1, 5); 274 // } 289 275 290 276 m_pHostBrowser = new UIVisoHostBrowser; 291 277 if (m_pHostBrowser) 292 278 { 293 m_pMainLayout->addWidget(m_pHostBrowser, 1, 0, 1, 2);279 m_pMainLayout->addWidget(m_pHostBrowser, 0, 0, 1, 2); 294 280 m_pMainLayout->setColumnStretch(m_pMainLayout->indexOf(m_pHostBrowser), 2); 295 281 } … … 298 284 if (m_pVerticalToolBar) 299 285 { 300 m_pMainLayout->addWidget(m_pVerticalToolBar, 1, 2, 1, 1);286 m_pMainLayout->addWidget(m_pVerticalToolBar, 0, 2, 1, 1); 301 287 m_pMainLayout->setColumnStretch(m_pMainLayout->indexOf(m_pVerticalToolBar), 1); 302 288 } … … 305 291 if (m_pVisoBrowser) 306 292 { 307 m_pMainLayout->addWidget(m_pVisoBrowser, 1, 3, 1, 2);293 m_pMainLayout->addWidget(m_pVisoBrowser, 0, 3, 1, 2); 308 294 m_pVisoBrowser->setVisoName(m_visoOptions.m_strVisoName); 309 295 m_pMainLayout->setColumnStretch(m_pMainLayout->indexOf(m_pVisoBrowser), 2); … … 313 299 if (m_pConfigurationPanel) 314 300 { 315 m_pMainLayout->addWidget(m_pConfigurationPanel, 2, 0, 1, 5);301 m_pMainLayout->addWidget(m_pConfigurationPanel, 1, 0, 1, 5); 316 302 m_pConfigurationPanel->hide(); 317 303 m_pConfigurationPanel->setVisoName(m_visoOptions.m_strVisoName); … … 323 309 { 324 310 m_pCreatorOptionsPanel->setShowHiddenbjects(m_browserOptions.m_fShowHiddenObjects); 325 m_pMainLayout->addWidget(m_pCreatorOptionsPanel, 3, 0, 1, 5);311 m_pMainLayout->addWidget(m_pCreatorOptionsPanel, 2, 0, 1, 5); 326 312 m_pCreatorOptionsPanel->hide(); 327 313 } 328 329 m_pButtonBox = new QIDialogButtonBox; 330 if (m_pButtonBox) 331 { 332 m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 333 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape); 334 m_pMainLayout->addWidget(m_pButtonBox, 4, 0, 1, 5); 335 336 connect(m_pButtonBox->button(QIDialogButtonBox::Help), &QPushButton::pressed, 337 &(msgCenter()), &UIMessageCenter::sltHandleHelpRequest); 338 m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents); 339 340 uiCommon().setHelpKeyword(m_pButtonBox->button(QIDialogButtonBox::Help), "viso"); 341 } 342 } 343 344 void UIVisoCreatorDialog::prepareConnections() 314 } 315 316 void UIVisoCreatorWidget::prepareConnections() 345 317 { 346 318 if (m_pHostBrowser) 347 319 { 348 320 connect(m_pHostBrowser, &UIVisoHostBrowser::sigAddObjectsToViso, 349 this, &UIVisoCreator Dialog::sltHandleAddObjectsToViso);321 this, &UIVisoCreatorWidget::sltHandleAddObjectsToViso); 350 322 connect(m_pHostBrowser, &UIVisoHostBrowser::sigTreeViewVisibilityChanged, 351 this, &UIVisoCreator Dialog::sltHandleBrowserTreeViewVisibilityChanged);323 this, &UIVisoCreatorWidget::sltHandleBrowserTreeViewVisibilityChanged); 352 324 connect(m_pHostBrowser, &UIVisoHostBrowser::sigTableSelectionChanged, 353 this, &UIVisoCreator Dialog::sltHandleHostBrowserTableSelectionChanged);325 this, &UIVisoCreatorWidget::sltHandleHostBrowserTableSelectionChanged); 354 326 connect(m_pHostBrowser, &UIVisoHostBrowser::sigCreateFileTableViewContextMenu, 355 this, &UIVisoCreator Dialog::sltHandleShowContextMenu);327 this, &UIVisoCreatorWidget::sltHandleShowContextMenu); 356 328 } 357 329 … … 359 331 { 360 332 connect(m_pVisoBrowser, &UIVisoContentBrowser::sigTableSelectionChanged, 361 this, &UIVisoCreator Dialog::sltHandleContentBrowserTableSelectionChanged);333 this, &UIVisoCreatorWidget::sltHandleContentBrowserTableSelectionChanged); 362 334 connect(m_pVisoBrowser, &UIVisoContentBrowser::sigCreateFileTableViewContextMenu, 363 this, &UIVisoCreatorDialog::sltHandleShowContextMenu); 364 } 365 366 if (m_pButtonBox) 367 { 368 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIVisoCreatorDialog::close); 369 connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UIVisoCreatorDialog::accept); 335 this, &UIVisoCreatorWidget::sltHandleShowContextMenu); 370 336 } 371 337 372 338 if (m_pActionConfiguration) 373 connect(m_pActionConfiguration, &QAction::triggered, this, &UIVisoCreator Dialog::sltPanelActionToggled);339 connect(m_pActionConfiguration, &QAction::triggered, this, &UIVisoCreatorWidget::sltPanelActionToggled); 374 340 if (m_pActionOptions) 375 connect(m_pActionOptions, &QAction::triggered, this, &UIVisoCreator Dialog::sltPanelActionToggled);341 connect(m_pActionOptions, &QAction::triggered, this, &UIVisoCreatorWidget::sltPanelActionToggled); 376 342 377 343 if (m_pConfigurationPanel) 378 344 { 379 345 connect(m_pConfigurationPanel, &UIVisoConfigurationPanel::sigVisoNameChanged, 380 this, &UIVisoCreator Dialog::sltHandleVisoNameChanged);346 this, &UIVisoCreatorWidget::sltHandleVisoNameChanged); 381 347 connect(m_pConfigurationPanel, &UIVisoConfigurationPanel::sigCustomVisoOptionsChanged, 382 this, &UIVisoCreator Dialog::sltHandleCustomVisoOptionsChanged);348 this, &UIVisoCreatorWidget::sltHandleCustomVisoOptionsChanged); 383 349 connect(m_pConfigurationPanel, &UIVisoConfigurationPanel::sigHidePanel, 384 this, &UIVisoCreator Dialog::sltHandleHidePanel);350 this, &UIVisoCreatorWidget::sltHandleHidePanel); 385 351 m_panelActionMap.insert(m_pConfigurationPanel, m_pActionConfiguration); 386 352 } … … 389 355 { 390 356 connect(m_pCreatorOptionsPanel, &UIVisoCreatorOptionsPanel::sigShowHiddenObjects, 391 this, &UIVisoCreator Dialog::sltHandleShowHiddenObjectsChange);357 this, &UIVisoCreatorWidget::sltHandleShowHiddenObjectsChange); 392 358 connect(m_pCreatorOptionsPanel, &UIVisoCreatorOptionsPanel::sigHidePanel, 393 this, &UIVisoCreator Dialog::sltHandleHidePanel);359 this, &UIVisoCreatorWidget::sltHandleHidePanel); 394 360 m_panelActionMap.insert(m_pCreatorOptionsPanel, m_pActionOptions); 395 361 } … … 413 379 } 414 380 415 void UIVisoCreator Dialog::prepareActions()381 void UIVisoCreatorWidget::prepareActions() 416 382 { 417 383 m_pActionConfiguration = new QAction(this); … … 479 445 } 480 446 481 void UIVisoCreator Dialog::populateMenuMainToolbar()447 void UIVisoCreatorWidget::populateMenuMainToolbar() 482 448 { 483 449 if (!m_pMainMenu || !m_pToolBar) … … 496 462 } 497 463 498 void UIVisoCreator Dialog::hidePanel(UIDialogPanel* panel)464 void UIVisoCreatorWidget::hidePanel(UIDialogPanel* panel) 499 465 { 500 466 if (panel && panel->isVisible()) … … 510 476 } 511 477 512 void UIVisoCreator Dialog::showPanel(UIDialogPanel* panel)478 void UIVisoCreatorWidget::showPanel(UIDialogPanel* panel) 513 479 { 514 480 if (panel && panel->isHidden()) … … 525 491 } 526 492 527 void UIVisoCreator Dialog::manageEscapeShortCut()528 { 529 / * Take the escape key from m_pButtonBox and from the panels in case treeview(s) in530 host and/or content browser is open. We use the escape key to close those first: */531 if ((m_pHostBrowser && m_pHostBrowser->isTreeViewVisible()) ||532 (m_pVisoBrowser && m_pVisoBrowser->isTreeViewVisible()))533 {534 if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel))535 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence());536 for (int i = 0; i < m_visiblePanelsList.size(); ++i)537 m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence());538 return;539 }540 541 / * if there are no visible panels then assign esc. key to cancel button of the button box: */542 if (m_visiblePanelsList.isEmpty())543 {544 if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel))545 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence(Qt::Key_Escape));546 return;547 }548 if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel))549 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence());493 void UIVisoCreatorWidget::manageEscapeShortCut() 494 { 495 // /* Take the escape key from m_pButtonBox and from the panels in case treeview(s) in 496 // host and/or content browser is open. We use the escape key to close those first: */ 497 // if ((m_pHostBrowser && m_pHostBrowser->isTreeViewVisible()) || 498 // (m_pVisoBrowser && m_pVisoBrowser->isTreeViewVisible())) 499 // { 500 // if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel)) 501 // m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence()); 502 // for (int i = 0; i < m_visiblePanelsList.size(); ++i) 503 // m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence()); 504 // return; 505 // } 506 507 // /* if there are no visible panels then assign esc. key to cancel button of the button box: */ 508 // if (m_visiblePanelsList.isEmpty()) 509 // { 510 // if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel)) 511 // m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence(Qt::Key_Escape)); 512 // return; 513 // } 514 // if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Cancel)) 515 // m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence()); 550 516 551 517 /* Just loop thru the visible panel list and set the esc key to the 552 518 panel which made visible latest */ 553 for (int i = 0; i < m_visiblePanelsList.size() - 1; ++i)554 m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence());555 m_visiblePanelsList.back()->setCloseButtonShortCut(QKeySequence(Qt::Key_Escape));556 } 557 558 void UIVisoCreator Dialog::prepareVerticalToolBar()519 // for (int i = 0; i < m_visiblePanelsList.size() - 1; ++i) 520 // m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence()); 521 // m_visiblePanelsList.back()->setCloseButtonShortCut(QKeySequence(Qt::Key_Escape)); 522 } 523 524 void UIVisoCreatorWidget::prepareVerticalToolBar() 559 525 { 560 526 m_pVerticalToolBar = new QIToolBar; … … 580 546 m_pVerticalToolBar->addWidget(bottomSpacerWidget); 581 547 } 548 549 /********************************************************************************************************************************* 550 * UIVisoCreatorDialog implementation. * 551 *********************************************************************************************************************************/ 552 UIVisoCreatorDialog::UIVisoCreatorDialog(QWidget *pParent /* = 0 */, const QString& strMachineName /* = QString() */) 553 : QIWithRetranslateUI<QIMainDialog>(pParent) 554 , m_strMachineName(strMachineName) 555 , m_pVisoCreatorWidget(0) 556 , m_pButtonBox(0) 557 { 558 prepareWidgets(); 559 prepareConnections(); 560 } 561 562 QStringList UIVisoCreatorDialog::entryList() const 563 { 564 if (m_pVisoCreatorWidget) 565 return m_pVisoCreatorWidget->entryList(); 566 return QStringList(); 567 } 568 569 QString UIVisoCreatorDialog::visoName() const 570 { 571 if (m_pVisoCreatorWidget) 572 return m_pVisoCreatorWidget->visoName(); 573 return QString(); 574 } 575 576 QStringList UIVisoCreatorDialog::customOptions() const 577 { 578 if (m_pVisoCreatorWidget) 579 return m_pVisoCreatorWidget->customOptions(); 580 return QStringList(); 581 } 582 583 QString UIVisoCreatorDialog::currentPath() const 584 { 585 if (m_pVisoCreatorWidget) 586 return m_pVisoCreatorWidget->currentPath(); 587 return QString(); 588 } 589 590 void UIVisoCreatorDialog::setCurrentPath(const QString &strPath) 591 { 592 if (m_pVisoCreatorWidget) 593 m_pVisoCreatorWidget->setCurrentPath(strPath); 594 } 595 596 void UIVisoCreatorDialog::prepareWidgets() 597 { 598 QWidget *pCentralWidget = new QWidget; 599 setCentralWidget(pCentralWidget); 600 QVBoxLayout *pMainLayout = new QVBoxLayout; 601 pCentralWidget->setLayout(pMainLayout); 602 603 604 m_pVisoCreatorWidget = new UIVisoCreatorWidget(this, m_strMachineName); 605 if (m_pVisoCreatorWidget) 606 { 607 pMainLayout->addWidget(m_pVisoCreatorWidget); 608 } 609 610 m_pButtonBox = new QIDialogButtonBox; 611 if (m_pButtonBox) 612 { 613 m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 614 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape); 615 pMainLayout->addWidget(m_pButtonBox); 616 617 connect(m_pButtonBox->button(QIDialogButtonBox::Help), &QPushButton::pressed, 618 &(msgCenter()), &UIMessageCenter::sltHandleHelpRequest); 619 m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents); 620 621 uiCommon().setHelpKeyword(m_pButtonBox->button(QIDialogButtonBox::Help), "viso"); 622 } 623 retranslateUi(); 624 } 625 626 void UIVisoCreatorDialog::prepareConnections() 627 { 628 if (m_pButtonBox) 629 { 630 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIVisoCreatorDialog::close); 631 connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UIVisoCreatorDialog::accept); 632 } 633 } 634 635 void UIVisoCreatorDialog::retranslateUi() 636 { 637 if (!m_strMachineName.isEmpty()) 638 setWindowTitle(QString("%1 - %2").arg(m_strMachineName).arg(tr("VISO Creator"))); 639 else 640 setWindowTitle(QString("%1").arg(tr("VISO Creator"))); 641 if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Ok)) 642 { 643 m_pButtonBox->button(QDialogButtonBox::Ok)->setText(QApplication::translate("UIVisoCreator", "C&reate")); 644 m_pButtonBox->button(QDialogButtonBox::Ok)->setToolTip(QApplication::translate("UIVisoCreator", "Creates VISO file with the selected content")); 645 } 646 if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Help)) 647 m_pButtonBox->button(QDialogButtonBox::Help)->setToolTip(QApplication::translate("UIVisoCreator", "Opens the help browser and navigates to the related section")); 648 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r92270 r92289 43 43 * for VISO file system. It has the main menu, main toolbar, and a vertical toolbar and corresponding 44 44 * actions. */ 45 class UIVisoCreator Dialog : public QIWithRetranslateUI<QIMainDialog>45 class UIVisoCreatorWidget : public QIWithRetranslateUI<QWidget> 46 46 { 47 47 Q_OBJECT; … … 49 49 public: 50 50 51 UIVisoCreator Dialog(QWidget *pParent = 0, const QString& strMachineName = QString());51 UIVisoCreatorWidget(QWidget *pParent = 0, const QString& strMachineName = QString()); 52 52 /** Returns the content of the .viso file. Each element of the list corresponds to a line in the .viso file. */ 53 53 QStringList entryList() const; … … 138 138 UIVisoHostBrowser *m_pHostBrowser; 139 139 UIVisoContentBrowser *m_pVisoBrowser; 140 QIDialogButtonBox *m_pButtonBox; 140 141 141 QIToolBar *m_pToolBar; 142 142 QIToolBar *m_pVerticalToolBar; 143 143 VisoOptions m_visoOptions; 144 144 BrowserOptions m_browserOptions; 145 QWidget *m_pCentralWidget;146 145 QMenu *m_pMainMenu; 147 146 QString m_strMachineName; … … 152 151 }; 153 152 153 154 class UIVisoCreatorDialog : public QIWithRetranslateUI<QIMainDialog> 155 { 156 Q_OBJECT; 157 158 public: 159 160 UIVisoCreatorDialog(QWidget *pParent = 0, const QString& strMachineName = QString()); 161 162 QStringList entryList() const; 163 QString visoName() const; 164 QStringList customOptions() const; 165 QString currentPath() const; 166 void setCurrentPath(const QString &strPath); 167 168 private: 169 void prepareWidgets(); 170 void prepareConnections(); 171 virtual void retranslateUi() final override; 172 173 QString m_strMachineName; 174 UIVisoCreatorWidget *m_pVisoCreatorWidget; 175 QIDialogButtonBox *m_pButtonBox; 176 }; 154 177 #endif /* !FEQT_INCLUDED_SRC_medium_viso_UIVisoCreator_h */
Note:
See TracChangeset
for help on using the changeset viewer.