Changeset 100169 in vbox
- Timestamp:
- Jun 13, 2023 3:14:29 PM (22 months ago)
- svn:sync-xref-src-repo-rev:
- 157869
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/medium/viso
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r100155 r100169 29 29 /* Qt includes: */ 30 30 #include <QDir> 31 #include <QItemDelegate> 31 32 #include <QFileInfo> 32 33 #include <QGridLayout> … … 41 42 #include "UIVisoContentBrowser.h" 42 43 44 45 /********************************************************************************************************************************* 46 * UIContentBrowserDelegate definition. * 47 *********************************************************************************************************************************/ 48 /** A QItemDelegate child class to disable dashed lines drawn around selected cells in QTableViews */ 49 class UIContentBrowserDelegate : public QItemDelegate 50 { 51 52 Q_OBJECT; 53 54 public: 55 56 UIContentBrowserDelegate(QObject *pParent) 57 : QItemDelegate(pParent){} 58 59 protected: 60 61 virtual void drawFocus ( QPainter * /*painter*/, const QStyleOptionViewItem & /*option*/, const QRect & /*rect*/ ) const {} 62 }; 63 64 43 65 /********************************************************************************************************************************* 44 66 * UIVisoContentTableView definition. * … … 94 116 { 95 117 event->acceptProposedAction(); 96 97 118 } 98 119 … … 420 441 m_pTableView->setAlternatingRowColors(true); 421 442 m_pTableView->setTabKeyNavigation(false); 443 m_pTableView->setItemDelegate(new UIContentBrowserDelegate(this)); 422 444 QHeaderView *pVerticalHeader = m_pTableView->verticalHeader(); 423 445 if (pVerticalHeader) … … 716 738 if (selectedItems.empty()) 717 739 return; 718 /* This is not complete. we have to modify the entries in the m_entryMap as well: */719 740 renameFileObject(selectedItems.at(0)); 720 741 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r100163 r100169 80 80 UIVisoSettingWidget(QWidget *pParent); 81 81 virtual void retranslateUi(); 82 void setSettings(const UIVisoCreatorWidget::Settings &settings); 83 UIVisoCreatorWidget::Settings settings() const; 82 84 83 85 private slots: … … 209 211 { 210 212 emit sigClosed(false); 213 } 214 215 216 void UIVisoSettingWidget::setSettings(const UIVisoCreatorWidget::Settings &settings) 217 { 218 if (m_pVisoNameLineEdit) 219 m_pVisoNameLineEdit->setText(settings.m_strVisoName); 220 if (m_pCustomOptionsLineEdit) 221 m_pCustomOptionsLineEdit->setText(settings.m_customOptions.join(";")); 222 if (m_pShowHiddenObjectsCheckBox) 223 m_pShowHiddenObjectsCheckBox->setChecked(settings.m_fShowHiddenObjects); 224 } 225 226 UIVisoCreatorWidget::Settings UIVisoSettingWidget::settings() const 227 { 228 UIVisoCreatorWidget::Settings settings; 229 if (m_pVisoNameLineEdit) 230 settings.m_strVisoName = m_pVisoNameLineEdit->text(); 231 if (m_pCustomOptionsLineEdit) 232 settings.m_customOptions = m_pCustomOptionsLineEdit->text().split(";"); 233 if (m_pShowHiddenObjectsCheckBox) 234 settings.m_fShowHiddenObjects = m_pShowHiddenObjectsCheckBox->isChecked(); 235 return settings; 211 236 } 212 237 … … 333 358 m_pActionSettings->setChecked(false); 334 359 /* Update settings:*/ 335 if (fAccepted) 336 { 360 if (fAccepted && m_pSettingsWidget) 361 { 362 Settings newSettings = m_pSettingsWidget->settings(); 363 if (m_visoOptions.m_strVisoName != newSettings.m_strVisoName) 364 { 365 m_visoOptions.m_strVisoName = newSettings.m_strVisoName; 366 emit sigVisoNameChanged(m_visoOptions.m_strVisoName); 367 } 368 if (m_visoOptions.m_customOptions != newSettings.m_customOptions) 369 m_visoOptions.m_customOptions = newSettings.m_customOptions; 370 if (m_visoOptions.m_fShowHiddenObjects != newSettings.m_fShowHiddenObjects) 371 m_visoOptions.m_fShowHiddenObjects = newSettings.m_fShowHiddenObjects; 337 372 } 338 373 } … … 447 482 m_pOverlayWidget->setGraphicsEffect(m_pOverlayBlurEffect); 448 483 m_pOverlayBlurEffect->setEnabled(false); 449 m_pOverlayBlurEffect->setBlurRadius( 6);484 m_pOverlayBlurEffect->setBlurRadius(4); 450 485 451 486 m_pSettingsWidget = new UIVisoSettingWidget(this); 452 m_pSettingsWidget->setFixedWidth(300);453 m_pSettingsWidget->setFixedHeight(300);454 487 AssertPtrReturnVoid(m_pSettingsWidget); 455 488 m_pSettingsWidget->setMinimumWidth(300); 489 m_pSettingsWidget->setMinimumHeight(300); 456 490 m_pStackedLayout->addWidget(m_pOverlayWidget); 457 491 m_pStackedLayout->addWidget(m_pBrowserContainerWidget); … … 563 597 /* Add to dummy QWidget to toolbar to center the action icons vertically: */ 564 598 QWidget *topSpacerWidget = new QWidget(this); 599 AssertPtrReturnVoid(topSpacerWidget); 565 600 topSpacerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); 566 601 topSpacerWidget->setVisible(true); 567 602 QWidget *bottomSpacerWidget = new QWidget(this); 603 AssertPtrReturnVoid(bottomSpacerWidget); 568 604 bottomSpacerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); 569 605 bottomSpacerWidget->setVisible(true); … … 612 648 if (m_pMainMenu) 613 649 m_pMainMenu->setEnabled(!m_fShowSettingsDialog); 650 if (m_fShowSettingsDialog) 651 m_pSettingsWidget->setSettings(m_visoOptions); 614 652 } 615 653 } … … 618 656 { 619 657 m_pVerticalToolBar = new QIToolBar; 620 if (!m_pVerticalToolBar) 621 return; 658 AssertPtrReturnVoid(m_pVerticalToolBar); 622 659 623 660 m_pVerticalToolBar->setOrientation(Qt::Vertical); … … 636 673 UIVisoCreatorDialog *pVisoCreator = new UIVisoCreatorDialog(pActionPool, pDialogParent, 637 674 strVisoSaveFolder, strMachineName); 638 639 if (!pVisoCreator) 640 return QUuid(); 675 AssertPtrReturn(pVisoCreator, QUuid()); 676 641 677 windowManager().registerNewParent(pVisoCreator, pDialogParent); 642 678 pVisoCreator->setCurrentPath(gEDataManager->visoCreatorRecentFolder()); … … 737 773 { 738 774 QWidget *pCentralWidget = new QWidget; 775 AssertPtrReturnVoid(pCentralWidget); 739 776 setCentralWidget(pCentralWidget); 740 777 QVBoxLayout *pMainLayout = new QVBoxLayout; 778 AssertPtrReturnVoid(pMainLayout); 741 779 pCentralWidget->setLayout(pMainLayout); 742 780 743 781 744 782 m_pVisoCreatorWidget = new UIVisoCreatorWidget(m_pActionPool, this, true /* show toolbar */, strMachineName); 745 if (m_pVisoCreatorWidget && m_pVisoCreatorWidget->menu()) 783 AssertPtrReturnVoid(m_pVisoCreatorWidget); 784 if (m_pVisoCreatorWidget->menu()) 746 785 { 747 786 menuBar()->addMenu(m_pVisoCreatorWidget->menu()); … … 756 795 757 796 m_pButtonBox = new QIDialogButtonBox; 758 if (m_pButtonBox) 759 { 760 m_pButtonBox->setDoNotPickDefaultButton(true); 761 m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 762 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence(Qt::Key_Escape)); 763 pMainLayout->addWidget(m_pButtonBox); 764 765 // connect(m_pButtonBox->button(QIDialogButtonBox::Help), &QPushButton::pressed, 766 // m_pButtonBox, &QIDialogButtonBox::sltHelpRequest); 767 768 m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents); 769 770 uiCommon().setHelpKeyword(m_pButtonBox->button(QIDialogButtonBox::Help), "create-optical-disk-image"); 771 } 797 AssertPtrReturnVoid(m_pButtonBox); 798 m_pButtonBox->setDoNotPickDefaultButton(true); 799 m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 800 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(QKeySequence(Qt::Key_Escape)); 801 pMainLayout->addWidget(m_pButtonBox); 802 803 connect(m_pButtonBox->button(QIDialogButtonBox::Help), &QPushButton::pressed, 804 m_pButtonBox, &QIDialogButtonBox::sltHandleHelpRequest); 805 806 m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents); 807 808 uiCommon().setHelpKeyword(m_pButtonBox->button(QIDialogButtonBox::Help), "create-optical-disk-image"); 772 809 773 810 m_pStatusLabel = new QILabel; 774 811 m_pStatusBar = new QStatusBar(this); 775 if (m_pButtonBox && m_pStatusLabel) 776 { 777 pMainLayout->addWidget(m_pStatusBar); 778 m_pStatusBar->addPermanentWidget(m_pStatusLabel); 779 } 812 AssertPtrReturnVoid(m_pButtonBox); 813 AssertPtrReturnVoid(m_pStatusLabel); 814 815 pMainLayout->addWidget(m_pStatusBar); 816 m_pStatusBar->addPermanentWidget(m_pStatusLabel); 817 780 818 retranslateUi(); 781 819 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r100162 r100169 74 74 public: 75 75 76 struct Settings 77 { 78 Settings() 79 : m_strVisoName("ad-hoc-viso") 80 , m_fShowHiddenObjects(true){} 81 QString m_strVisoName; 82 /** Additions viso options to be inserted to the viso file as separate lines. */ 83 QStringList m_customOptions; 84 /* If host file browser shows hidden file objects. */ 85 bool m_fShowHiddenObjects; 86 }; 87 76 88 UIVisoCreatorWidget(UIActionPool *pActionPool, QWidget *pParent, 77 89 bool fShowToolBar, const QString& strMachineName = QString()); … … 109 121 private: 110 122 111 struct VisoOptions112 {113 VisoOptions()114 :m_strVisoName("ad-hoc-viso"){}115 QString m_strVisoName;116 /** Additions viso options to be inserted to the viso file as separate lines. */117 QStringList m_customOptions;118 };119 120 struct BrowserOptions121 {122 BrowserOptions()123 :m_fShowHiddenObjects(true){}124 bool m_fShowHiddenObjects;125 };126 127 123 void prepareWidgets(); 128 124 void prepareConnections(); … … 156 152 QIToolBar *m_pToolBar; 157 153 QIToolBar *m_pVerticalToolBar; 158 VisoOptions m_visoOptions; 159 BrowserOptions m_browserOptions; 154 Settings m_visoOptions; 160 155 QMenu *m_pMainMenu; 161 156 QPointer<UIActionPool> m_pActionPool; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.cpp
r100155 r100169 29 29 #include <QGridLayout> 30 30 #include <QHeaderView> 31 #include <QItemDelegate> 31 32 #include <QMimeData> 32 33 #include <QTextEdit> … … 36 37 /* GUI includes: */ 37 38 #include "UIVisoHostBrowser.h" 39 40 41 /********************************************************************************************************************************* 42 * UIHostBrowserDelegate definition. * 43 *********************************************************************************************************************************/ 44 /** A QItemDelegate child class to disable dashed lines drawn around selected cells in QTableViews */ 45 class UIHostBrowserDelegate : public QItemDelegate 46 { 47 48 Q_OBJECT; 49 50 public: 51 52 UIHostBrowserDelegate(QObject *pParent) 53 : QItemDelegate(pParent){} 54 55 protected: 56 57 virtual void drawFocus ( QPainter * /*painter*/, const QStyleOptionViewItem & /*option*/, const QRect & /*rect*/ ) const {} 58 }; 38 59 39 60 /********************************************************************************************************************************* … … 184 205 m_pTableView->setAlternatingRowColors(true); 185 206 m_pTableView->setTabKeyNavigation(false); 207 m_pTableView->setItemDelegate(new UIHostBrowserDelegate(this)); 186 208 QHeaderView *pVerticalHeader = m_pTableView->verticalHeader(); 187 209 if (pVerticalHeader)
Note:
See TracChangeset
for help on using the changeset viewer.