VirtualBox

Ignore:
Timestamp:
Feb 4, 2021 2:54:27 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142643
Message:

FE/Qt: Some small refactoring in UIFilePathSelector class

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDefaultMachineFolderEditor.cpp

    r86097 r87608  
    9393            if (m_pLabel)
    9494                m_pLabel->setBuddy(m_pSelector);
    95             m_pSelector->setHomeDir(uiCommon().homeFolder());
     95            m_pSelector->setInitialPath(uiCommon().homeFolder());
    9696            connect(m_pSelector, &UIFilePathSelector::pathChanged,
    9797                    this, &UIDefaultMachineFolderEditor::sltHandleSelectorPathChanged);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDEAuthLibraryEditor.cpp

    r86097 r87608  
    9393            if (m_pLabel)
    9494                m_pLabel->setBuddy(m_pSelector);
    95             m_pSelector->setHomeDir(uiCommon().homeFolder());
     95            m_pSelector->setInitialPath(uiCommon().homeFolder());
    9696            m_pSelector->setMode(UIFilePathSelector::Mode_File_Open);
    9797            connect(m_pSelector, &UIFilePathSelector::pathChanged,
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r87251 r87608  
    528528    /* Load old 'Recording' data from the cache: */
    529529    m_pCheckboxRecording->setChecked(oldDisplayData.m_fRecordingEnabled);
    530     m_pEditorRecordingFilePath->setHomeDir(oldDisplayData.m_strRecordingFolder);
     530    m_pEditorRecordingFilePath->setInitialPath(oldDisplayData.m_strRecordingFolder);
    531531    m_pEditorRecordingFilePath->setPath(oldDisplayData.m_strRecordingFilePath);
    532532    m_pSpinboxRecordingFrameWidth->setValue(oldDisplayData.m_iRecordingVideoFrameWidth);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r87251 r87608  
    277277    AssertPtrReturnVoid(m_pComboDragAndDrop);
    278278    m_pEditorSnapshotFolder->setPath(oldGeneralData.m_strSnapshotsFolder);
    279     m_pEditorSnapshotFolder->setHomeDir(oldGeneralData.m_strSnapshotsHomeDir);
     279    m_pEditorSnapshotFolder->setInitialPath(oldGeneralData.m_strSnapshotsHomeDir);
    280280    const int iClipboardModePosition = m_pComboClipboard->findData(oldGeneralData.m_clipboardMode);
    281281    m_pComboClipboard->setCurrentIndex(iClipboardModePosition == -1 ? 0 : iClipboardModePosition);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp

    r86045 r87608  
    225225        {
    226226            m_pSelectorPath->setResetEnabled(false);
    227             m_pSelectorPath->setHomeDir(QDir::homePath());
     227            m_pSelectorPath->setInitialPath(QDir::homePath());
    228228
    229229            pLayoutMain->addWidget(m_pSelectorPath, 0, 1);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp

    r87317 r87608  
    5858    : QIWithRetranslateUI<QIComboBox>(pParent)
    5959    , m_enmMode(Mode_Folder)
    60     , m_strHomeDir(QDir::current().absolutePath())
     60    , m_strInitialPath(QDir::current().absolutePath())
    6161    , m_fEditable(true)
    6262    , m_fModified(false)
     
    379379{
    380380    /* Prepare initial directory: */
    381     QString strInitDir;
     381    QString strInitPath;
    382382    /* If something already chosen: */
    383383    if (!m_strPath.isEmpty())
     
    387387        if (strObjectName == m_strPath)
    388388        {
    389             /* Use the home directory: */
    390             strInitDir = m_strHomeDir;
     389            /* Use the initial path: */
     390            strInitPath = m_strInitialPath;
    391391        }
    392392        /* If that is full file/folder (object) path: */
     
    394394        {
    395395            /* Use the first existing dir of m_strPath: */
    396             strInitDir = QIFileDialog::getFirstExistingDir(m_strPath);
     396            strInitPath = QIFileDialog::getFirstExistingDir(m_strPath);
    397397        }
    398398        /* Finally, append object name itself: */
    399         strInitDir = QDir(strInitDir).absoluteFilePath(strObjectName);
    400     }
    401     /* Use the home directory by default: */
    402     if (strInitDir.isNull())
    403         strInitDir = m_strHomeDir;
     399        strInitPath = QDir(strInitPath).absoluteFilePath(strObjectName);
     400    }
     401    /* Use the initial path by default: */
     402    if (strInitPath.isNull())
     403        strInitPath = m_strInitialPath;
    404404
    405405    /* Open the choose-file/folder dialog: */
     
    408408    {
    409409        case Mode_File_Open:
    410             strSelPath = QIFileDialog::getOpenFileName(strInitDir, m_strFileDialogFilters, parentWidget(), m_strFileDialogTitle); break;
     410            strSelPath = QIFileDialog::getOpenFileName(strInitPath, m_strFileDialogFilters, parentWidget(), m_strFileDialogTitle); break;
    411411        case Mode_File_Save:
    412412        {
    413             strSelPath = QIFileDialog::getSaveFileName(strInitDir, m_strFileDialogFilters, parentWidget(), m_strFileDialogTitle);
     413            strSelPath = QIFileDialog::getSaveFileName(strInitPath, m_strFileDialogFilters, parentWidget(), m_strFileDialogTitle);
    414414            if (!strSelPath.isEmpty() && QFileInfo(strSelPath).suffix().isEmpty())
    415415            {
     
    422422        }
    423423        case Mode_Folder:
    424             strSelPath = QIFileDialog::getExistingDirectory(strInitDir, parentWidget(), m_strFileDialogTitle); break;
     424            strSelPath = QIFileDialog::getExistingDirectory(strInitPath, parentWidget(), m_strFileDialogTitle); break;
    425425    }
    426426
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.h

    r87317 r87608  
    126126    void setPath(const QString &strPath, bool fRefreshText = true);
    127127
    128     /** Defines the @a strHomeDir. */
    129     void setHomeDir(const QString &strHomeDir) { m_strHomeDir = strHomeDir; }
     128    /** Defines the @a strInitialPath. */
     129    void setInitialPath(const QString &strInitialPath) { m_strInitialPath = strInitialPath; }
    130130
    131131protected:
     
    181181    /** Holds the path. */
    182182    QString  m_strPath;
    183     /** Holds the home dir. */
    184     QString  m_strHomeDir;
     183    /** Holds the path which we pass to QFileDialog as initial path. */
     184    QString  m_strInitialPath;
    185185
    186186    /** Holds the file-dialog title. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r87607 r87608  
    449449        m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
    450450        m_pISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    451         m_pISOFilePathSelector->setHomeDir(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));
     451        m_pISOFilePathSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));
    452452        pISOSelectorLayout->addWidget(m_pISOFilePathSelector);
    453453    }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87607 r87608  
    330330            m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);
    331331            m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
    332             m_pISOFilePathSelector->setHomeDir(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));
     332            m_pISOFilePathSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));
    333333            pInstallationISOContainerLayout->addWidget(m_pISOFilePathSelector);
    334334        }
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