VirtualBox

Ignore:
Timestamp:
Feb 11, 2019 1:49:58 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128771
Message:

FE/Qt: bugref:9340. some refactoring in floppy creation dialog

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r77238 r77263  
    27652765    QWidget *pDialogParent = windowManager().realParentWindow(pParent);
    27662766
    2767     UIFDCreationDialog *pDialog = new UIFDCreationDialog(pParent, strMachineName, strMachineFolder);
     2767    UIFDCreationDialog *pDialog = new UIFDCreationDialog(pParent, strMachineFolder, strMachineName);
    27682768    if (!pDialog)
    27692769        return QUuid();
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp

    r77238 r77263  
    3737
    3838
    39 UIFDCreationDialog::UIFDCreationDialog(QWidget *pParent /* = 0 */,
    40                                        const QString &strMachineName /* = QString() */,
    41                                        const QString &strMachineFolder /* = QString() */)
     39UIFDCreationDialog::UIFDCreationDialog(QWidget *pParent,
     40                                           const QString &strDefaultFolder,
     41                                           const QString &strMachineName /* = QString() */)
    4242   : QIWithRetranslateUI<QDialog>(pParent)
    4343    , m_pFilePathselector(0)
     
    4747    , m_pButtonBox(0)
    4848    , m_pFormatCheckBox(0)
     49    , m_strDefaultFolder(strDefaultFolder)
    4950    , m_strMachineName(strMachineName)
    50     , m_strMachineFolder(strMachineFolder)
    5151{
    5252
     
    6363void UIFDCreationDialog::retranslateUi()
    6464{
    65     setWindowTitle(QString("%1 - %2").arg(m_strMachineName).arg(tr("Floppy Disk Creator")));
     65    if (m_strMachineName.isEmpty())
     66        setWindowTitle(QString("%1").arg(tr("Floppy Disk Creator")));
     67    else
     68        setWindowTitle(QString("%1 - %2").arg(m_strMachineName).arg(tr("Floppy Disk Creator")));
    6669    if (m_pPathLabel)
    6770        m_pPathLabel->setText(tr("File Path:"));
     
    156159    QString strPreferredExtension = UIMediumDefs::getPreferredExtensionForMedium(KDeviceType_Floppy);
    157160
    158     QString strInitialPath = m_strMachineFolder;
     161    QString strInitialPath = m_strDefaultFolder;
    159162    if (strInitialPath.isEmpty())
    160163        strInitialPath = vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder();
     
    163166        return strInitialPath;
    164167
    165     QString strDiskname = VBoxGlobal::findUniqueFileName(m_strMachineFolder, m_strMachineName);
     168    QString strDiskname = !(m_strMachineName.isEmpty()) ? m_strMachineName : "NewFloppyDisk";
     169    strDiskname = VBoxGlobal::findUniqueFileName(m_strDefaultFolder, m_strMachineName);
    166170
    167171    strInitialPath = QDir(strInitialPath).absoluteFilePath(strDiskname + "." + strPreferredExtension);
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.h

    r76581 r77263  
    4545public:
    4646
    47     UIFDCreationDialog(QWidget *pParent = 0,
    48                        const QString &strMachineName = QString(),
    49                        const QString &strMachineFolder = QString());
     47    UIFDCreationDialog(QWidget *pParent,
     48                       const QString &strDefaultFolder,
     49                       const QString &strMachineName = QString());
     50
    5051
    5152    virtual void accept() /* override */;
     
    7879    QDialogButtonBox   *m_pButtonBox;
    7980    QCheckBox          *m_pFormatCheckBox;
     81    QString             m_strDefaultFolder;
    8082    QString             m_strMachineName;
    81     QString             m_strMachineFolder;
    8283    QUuid               m_uMediumID;
    8384};
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette