Changeset 100500 in vbox for trunk/src/VBox
- Timestamp:
- Jul 11, 2023 9:36:58 AM (17 months ago)
- 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
r100497 r100500 255 255 256 256 UIVisoCreatorWidget::UIVisoCreatorWidget(UIActionPool *pActionPool, QWidget *pParent, 257 bool fShowToolBar, const QString& strViso SavePath, const QString& strMachineName)257 bool fShowToolBar, const QString& strVisoFilePath, const QString& strMachineName) 258 258 : QIWithRetranslateUI<QWidget>(pParent) 259 259 , m_pActionSettings(0) … … 275 275 , m_pBrowserContainerWidget(0) 276 276 , m_pStackedLayout(0) 277 , m_strViso SavePath(strVisoSavePath)277 , m_strVisoFilePath(strVisoFilePath) 278 278 { 279 279 m_visoOptions.m_strVisoName = !strMachineName.isEmpty() ? strMachineName : "ad-hoc"; … … 301 301 { 302 302 return m_visoOptions.m_strVisoName; 303 } 304 305 void UIVisoCreatorWidget::setVisoName(const QString& strName) 306 { 307 if (m_visoOptions.m_strVisoName == strName) 308 return; 309 m_visoOptions.m_strVisoName = strName; 310 emit sigVisoNameChanged(m_visoOptions.m_strVisoName); 311 } 312 313 void UIVisoCreatorWidget::setVisoFilePath(const QString& strPath) 314 { 315 if (m_strVisoFilePath == strPath) 316 return; 317 m_strVisoFilePath = strPath; 318 emit sigVisoFilePathChanged(m_strVisoFilePath); 303 319 } 304 320 … … 377 393 { 378 394 Settings newSettings = m_pSettingsWidget->settings(); 379 if (m_visoOptions.m_strVisoName != newSettings.m_strVisoName) 380 { 381 m_visoOptions.m_strVisoName = newSettings.m_strVisoName; 382 emit sigVisoNameChanged(m_visoOptions.m_strVisoName); 383 } 395 setVisoName(newSettings.m_strVisoName); 384 396 if (m_visoOptions.m_customOptions != newSettings.m_customOptions) 385 397 m_visoOptions.m_customOptions = newSettings.m_customOptions; … … 420 432 void UIVisoCreatorWidget::sltSaveAsAction() 421 433 { 422 // QString strSaveFileName = getSaveFileName(visoFileFullPath(), "VISO files (*.viso)", this, 423 // UIVisoCreatorWidget::tr("Select a file to save Viso content to")); 434 QString strSaveFileName = QIFileDialog::getSaveFileName(visoFileFullPath(), "VISO files (*.viso)", this, 435 UIVisoCreatorWidget::tr("Select a file to save Viso content to")); 436 if (visoFileFullPath() != strSaveFileName) 437 { 438 QFileInfo fileInfo(strSaveFileName); 439 setVisoFilePath(fileInfo.absolutePath()); 440 setVisoName(fileInfo.fileName()); 441 } 424 442 } 425 443 … … 695 713 QString UIVisoCreatorWidget::visoFileFullPath() const 696 714 { 697 return QString("%1/%2%3").arg(m_strViso SavePath).arg(visoName()).arg(".viso");715 return QString("%1/%2%3").arg(m_strVisoFilePath).arg(visoName()).arg(".viso"); 698 716 } 699 717 … … 703 721 *********************************************************************************************************************************/ 704 722 UIVisoCreatorDialog::UIVisoCreatorDialog(UIActionPool *pActionPool, QWidget *pParent, 705 const QString& strViso SavePath, const QString& strMachineName /* = QString() */)723 const QString& strVisoFilePath, const QString& strMachineName /* = QString() */) 706 724 : QIWithRetranslateUI<QIWithRestorableGeometry<QIMainDialog> >(pParent) 707 725 , m_pVisoCreatorWidget(0) … … 713 731 we manage escape key here with special casing: */ 714 732 setRejectByEscape(false); 715 prepareWidgets(strVisoSavePath, strMachineName); 716 prepareConnections(); 733 prepareWidgets(strVisoFilePath, strMachineName); 717 734 loadSettings(); 718 735 } … … 759 776 } 760 777 761 void UIVisoCreatorDialog::prepareWidgets(const QString& strViso SavePath, const QString &strMachineName)778 void UIVisoCreatorDialog::prepareWidgets(const QString& strVisoFilePath, const QString &strMachineName) 762 779 { 763 780 QWidget *pCentralWidget = new QWidget; … … 769 786 770 787 771 m_pVisoCreatorWidget = new UIVisoCreatorWidget(m_pActionPool, this, true /* show toolbar */, strViso SavePath, strMachineName);788 m_pVisoCreatorWidget = new UIVisoCreatorWidget(m_pActionPool, this, true /* show toolbar */, strVisoFilePath, strMachineName); 772 789 AssertPtrReturnVoid(m_pVisoCreatorWidget); 773 790 if (m_pVisoCreatorWidget->menu()) … … 779 796 connect(m_pVisoCreatorWidget, &UIVisoCreatorWidget::sigVisoNameChanged, 780 797 this, &UIVisoCreatorDialog::sltVisoNameChanged); 798 connect(m_pVisoCreatorWidget, &UIVisoCreatorWidget::sigVisoFilePathChanged, 799 this, &UIVisoCreatorDialog::sltVisoFilePathChanged); 781 800 connect(m_pVisoCreatorWidget, &UIVisoCreatorWidget::sigSettingDialogToggle, 782 801 this, &UIVisoCreatorDialog::sltSettingDialogToggle); … … 795 814 m_pButtonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents); 796 815 816 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIVisoCreatorDialog::close); 817 connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UIVisoCreatorDialog::accept); 818 819 797 820 uiCommon().setHelpKeyword(m_pButtonBox->button(QIDialogButtonBox::Help), "create-optical-disk-image"); 798 821 799 822 retranslateUi(); 800 }801 802 void UIVisoCreatorDialog::prepareConnections()803 {804 if (m_pButtonBox)805 {806 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIVisoCreatorDialog::close);807 connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UIVisoCreatorDialog::accept);808 }809 823 } 810 824 … … 852 866 { 853 867 Q_UNUSED(strName); 868 updateWindowTitle(); 869 } 870 871 void UIVisoCreatorDialog::sltVisoFilePathChanged(const QString &strPath) 872 { 873 Q_UNUSED(strPath); 854 874 updateWindowTitle(); 855 875 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r100497 r100500 136 136 void toggleSettingsWidget(bool fShown); 137 137 QStringList findISOFiles(const QStringList &pathList) const; 138 void setVisoName(const QString& strName); 139 void setVisoFilePath(const QString& strPath); 140 138 141 /** @name Main toolbar (and main menu) actions 139 142 * @{ */ … … 166 169 QGraphicsBlurEffect *m_pOverlayBlurEffect; 167 170 QStackedLayout *m_pStackedLayout; 168 QString m_strViso SavePath;171 QString m_strVisoFilePath; 169 172 }; 170 173 … … 203 206 void sltSetCancelButtonShortCut(QKeySequence keySequence); 204 207 void sltVisoNameChanged(const QString &strName); 208 void sltVisoFilePathChanged(const QString &strPath); 205 209 void sltSettingDialogToggle(bool fIsShown); 206 210 207 211 private: 208 212 void prepareWidgets(const QString& strVisoSavePath, const QString &strMachineName); 209 void prepareConnections();210 213 virtual void retranslateUi() final override; 211 214 void loadSettings();
Note:
See TracChangeset
for help on using the changeset viewer.