VirtualBox

Changeset 91436 in vbox


Ignore:
Timestamp:
Sep 28, 2021 1:31:44 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: Adding functionality of listing recently used media in UIFilePathSelector.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.cpp

    r91192 r91436  
    302302    if (pLineEdit)
    303303        pLineEdit->mark(fError, strErrorMessage);
     304}
     305
     306void QIComboBox::insertSeparator(int iIndex)
     307{
     308    AssertPtrReturnVoid(m_pComboBox);
     309    m_pComboBox->insertSeparator(iIndex);
    304310}
    305311
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.h

    r87737 r91436  
    122122    void mark(bool fError, const QString &strErrorMessage = QString());
    123123
     124    void insertSeparator(int iIndex);
     125
    124126public slots:
    125127
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r91220 r91436  
    2525#include "QILineEdit.h"
    2626#include "UICommon.h"
     27#include "UIExtraDataManager.h"
    2728#include "UIIconPool.h"
    2829#include "UIFilePathSelector.h"
     
    513514                m_pImageSelector->setFileDialogFilters("ISO Images(*.iso *.ISO)");
    514515                m_pImageSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD));
     516                m_pImageSelector->setRecentPathList(gEDataManager->recentListOfOpticalDisks());
    515517
    516518                m_pMainLayout->addWidget(m_pImageSelector, iRow, 1, 1, 2);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp

    r91125 r91436  
    194194}
    195195
     196void UIFilePathSelector::setRecentPathList(const QStringList &recentPathList)
     197{
     198    while (count() >= static_cast<int>(RecentListSeparator))
     199    {
     200        removeItem(count() - 1);
     201    }
     202    insertSeparator(RecentListSeparator);
     203
     204    foreach (const QString strPath, recentPathList)
     205        addItem(strPath);
     206}
     207
    196208void UIFilePathSelector::setPath(const QString &strPath, bool fRefreshText /* = true */)
    197209{
     
    346358        }
    347359        default:
    348             break;
     360        {
     361            if (iIndex >= RecentListSeparator)
     362            {
     363                changePath(itemText(iIndex));
     364                update();
     365            }
     366            break;
     367        }
    349368    }
    350369    setCurrentIndex(PathId);
     
    528547         * and text have be corresponding real stored path
    529548         * which can be absolute or relative. */
    530         if (lineEdit()->text() != m_strPath)
     549        //if (lineEdit()->text() != m_strPath)
    531550            setItemText(PathId, m_strPath);
    532551        setItemIcon(PathId, QIcon());
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.h

    r87608 r91436  
    6565        PathId = 0,
    6666        SelectId,
    67         ResetId
     67        ResetId,
     68        RecentListSeparator
    6869    };
    6970
     
    121122    const QString& defaultPath() const;
    122123
     124    void setRecentPathList(const QStringList &recentPathList);
     125
    123126public slots:
    124127
Note: See TracChangeset for help on using the changeset viewer.

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