VirtualBox

Ignore:
Timestamp:
Jun 6, 2023 10:14:19 AM (20 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9080. Some renaming.

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

Legend:

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

    r100081 r100082  
    5353    , m_fIsHidden(false)
    5454{
    55     for (int i = static_cast<int>(UICustomFileSystemModelColumn_Name);
    56          i < static_cast<int>(UICustomFileSystemModelColumn_Max); ++i)
    57         m_itemData[static_cast<UICustomFileSystemModelColumn>(i)] = QVariant();
    58     m_itemData[UICustomFileSystemModelColumn_Name] = strName;
     55    for (int i = static_cast<int>(UICustomFileSystemModelData_Name);
     56         i < static_cast<int>(UICustomFileSystemModelData_Max); ++i)
     57        m_itemData[static_cast<UICustomFileSystemModelData>(i)] = QVariant();
     58    m_itemData[UICustomFileSystemModelData_Name] = strName;
    5959    if (parent)
    6060        parent->appendChild(this);
     
    132132QVariant UICustomFileSystemItem::data(int column) const
    133133{
    134     return m_itemData.value(static_cast<UICustomFileSystemModelColumn>(column), QVariant());
     134    return m_itemData.value(static_cast<UICustomFileSystemModelData>(column), QVariant());
    135135}
    136136
    137137QString UICustomFileSystemItem::name() const
    138138{
    139     QVariant data = m_itemData.value(UICustomFileSystemModelColumn_Name, QVariant());
     139    QVariant data = m_itemData.value(UICustomFileSystemModelData_Name, QVariant());
    140140    if (!data.canConvert(QMetaType::QString))
    141141        return QString();
     
    145145void UICustomFileSystemItem::setData(const QVariant &data, int index)
    146146{
    147     m_itemData[static_cast<UICustomFileSystemModelColumn>(index)] = data;
    148 }
    149 
    150 void UICustomFileSystemItem::setData(const QVariant &data, UICustomFileSystemModelColumn enmColumn)
     147    m_itemData[static_cast<UICustomFileSystemModelData>(index)] = data;
     148}
     149
     150void UICustomFileSystemItem::setData(const QVariant &data, UICustomFileSystemModelData enmColumn)
    151151{
    152152    m_itemData[enmColumn] = data;
     
    199199QString UICustomFileSystemItem::path(bool fRemoveTrailingDelimiters /* = false */) const
    200200{
    201     const QString &strPath = m_itemData.value(UICustomFileSystemModelColumn_ISOPath, QString()).toString();
     201    const QString &strPath = m_itemData.value(UICustomFileSystemModelData_ISOPath, QString()).toString();
    202202
    203203    if (fRemoveTrailingDelimiters)
     
    211211    if (path.isNull() || path.isEmpty())
    212212        return;
    213     m_itemData[UICustomFileSystemModelColumn_ISOPath] = path;
     213    m_itemData[UICustomFileSystemModelData_ISOPath] = path;
    214214}
    215215
     
    307307
    308308        /* If the sort column is QDateTime than handle it correctly: */
    309         if (sortColumn() == UICustomFileSystemModelColumn_ChangeTime)
    310         {
    311             QVariant dataLeft = pLeftItem->data(UICustomFileSystemModelColumn_ChangeTime);
    312             QVariant dataRight = pRightItem->data(UICustomFileSystemModelColumn_ChangeTime);
     309        if (sortColumn() == UICustomFileSystemModelData_ChangeTime)
     310        {
     311            QVariant dataLeft = pLeftItem->data(UICustomFileSystemModelData_ChangeTime);
     312            QVariant dataRight = pRightItem->data(UICustomFileSystemModelData_ChangeTime);
    313313            QDateTime leftDateTime = dataLeft.toDateTime();
    314314            QDateTime rightDateTime = dataRight.toDateTime();
     
    316316        }
    317317        /* When we show human readble sizes in size column sorting gets confused, so do it here: */
    318         else if(sortColumn() == UICustomFileSystemModelColumn_Size)
    319         {
    320             qulonglong leftSize = pLeftItem->data(UICustomFileSystemModelColumn_Size).toULongLong();
    321             qulonglong rightSize = pRightItem->data(UICustomFileSystemModelColumn_Size).toULongLong();
     318        else if(sortColumn() == UICustomFileSystemModelData_Size)
     319        {
     320            qulonglong leftSize = pLeftItem->data(UICustomFileSystemModelData_Size).toULongLong();
     321            qulonglong rightSize = pRightItem->data(UICustomFileSystemModelData_Size).toULongLong();
    322322            return (leftSize < rightSize);
    323323
     
    436436    {
    437437        /* dont show anything but the name for up directories: */
    438         if (item->isUpDirectory() && index.column() != UICustomFileSystemModelColumn_Name)
     438        if (item->isUpDirectory() && index.column() != UICustomFileSystemModelData_Name)
    439439            return QVariant();
    440440        /* Format date/time column: */
     
    446446        }
    447447        /* Decide whether to show human-readable file object sizes: */
    448         if (index.column() == UICustomFileSystemModelColumn_Size)
     448        if (index.column() == UICustomFileSystemModelData_Size)
    449449        {
    450450            if (m_fShowHumanReadableSizes)
     
    618618{
    619619    m_pRootItem = new UICustomFileSystemItem(UICustomFileSystemModel::tr("Name"), 0, KFsObjType_Directory);
    620     m_pRootItem->setData(UICustomFileSystemModel::tr("Size"), UICustomFileSystemModelColumn_Size);
    621     m_pRootItem->setData(UICustomFileSystemModel::tr("Change Time"), UICustomFileSystemModelColumn_ChangeTime);
    622     m_pRootItem->setData(UICustomFileSystemModel::tr("Owner"), UICustomFileSystemModelColumn_Owner);
    623     m_pRootItem->setData(UICustomFileSystemModel::tr("Permissions"), UICustomFileSystemModelColumn_Permissions);
    624     m_pRootItem->setData(UICustomFileSystemModel::tr("Local Path"), UICustomFileSystemModelColumn_LocalPath);
    625     m_pRootItem->setData(UICustomFileSystemModel::tr("Path"), UICustomFileSystemModelColumn_ISOPath);
    626 }
     620    m_pRootItem->setData(UICustomFileSystemModel::tr("Size"), UICustomFileSystemModelData_Size);
     621    m_pRootItem->setData(UICustomFileSystemModel::tr("Change Time"), UICustomFileSystemModelData_ChangeTime);
     622    m_pRootItem->setData(UICustomFileSystemModel::tr("Owner"), UICustomFileSystemModelData_Owner);
     623    m_pRootItem->setData(UICustomFileSystemModel::tr("Permissions"), UICustomFileSystemModelData_Permissions);
     624    m_pRootItem->setData(UICustomFileSystemModel::tr("Local Path"), UICustomFileSystemModelData_LocalPath);
     625    m_pRootItem->setData(UICustomFileSystemModel::tr("Path"), UICustomFileSystemModelData_ISOPath);
     626}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h

    r100081 r100082  
    4141#include "COMEnums.h"
    4242
    43 enum UICustomFileSystemModelColumn
    44 {
    45     UICustomFileSystemModelColumn_Name = 0,
    46     UICustomFileSystemModelColumn_Size,
    47     UICustomFileSystemModelColumn_ChangeTime,
    48     UICustomFileSystemModelColumn_Owner,
    49     UICustomFileSystemModelColumn_Permissions,
    50     UICustomFileSystemModelColumn_ISOPath,
    51     UICustomFileSystemModelColumn_LocalPath,
    52     UICustomFileSystemModelColumn_Max
     43enum UICustomFileSystemModelData
     44{
     45    UICustomFileSystemModelData_Name = 0,
     46    UICustomFileSystemModelData_Size,
     47    UICustomFileSystemModelData_ChangeTime,
     48    UICustomFileSystemModelData_Owner,
     49    UICustomFileSystemModelData_Permissions,
     50    UICustomFileSystemModelData_ISOPath,
     51    UICustomFileSystemModelData_LocalPath,
     52    UICustomFileSystemModelData_Max
    5353};
    5454
     
    7575    QVariant data(int column) const;
    7676    void setData(const QVariant &data, int index);
    77     void setData(const QVariant &data, UICustomFileSystemModelColumn enmColumn);
     77    void setData(const QVariant &data, UICustomFileSystemModelData enmColumn);
    7878    int row() const;
    7979    UICustomFileSystemItem *parentItem();
     
    121121    /** Used to find children by name */
    122122    QMap<QString, UICustomFileSystemItem*> m_childMap;
    123     QMap<UICustomFileSystemModelColumn, QVariant>  m_itemData;
     123    QMap<UICustomFileSystemModelData, QVariant>  m_itemData;
    124124    UICustomFileSystemItem *m_parentItem;
    125125    bool             m_bIsOpened;
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp

    r99391 r100082  
    559559                    if (!item)
    560560                        continue;
    561                     item->setData(static_cast<qulonglong>(fsInfo.GetObjectSize()), UICustomFileSystemModelColumn_Size);
    562                     item->setData(changeTime, UICustomFileSystemModelColumn_ChangeTime);
    563                     item->setData(fsInfo.GetUserName(), UICustomFileSystemModelColumn_Owner);
    564                     item->setData(permissionString(fsInfo), UICustomFileSystemModelColumn_Permissions);
     561                    item->setData(static_cast<qulonglong>(fsInfo.GetObjectSize()), UICustomFileSystemModelData_Size);
     562                    item->setData(changeTime, UICustomFileSystemModelData_ChangeTime);
     563                    item->setData(fsInfo.GetUserName(), UICustomFileSystemModelData_Owner);
     564                    item->setData(permissionString(fsInfo), UICustomFileSystemModelData_Permissions);
    565565                    item->setPath(UIPathOperations::removeTrailingDelimiters(UIPathOperations::mergePaths(strPath, fsInfo.GetName())));
    566566                    item->setIsOpened(false);
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp

    r98103 r100082  
    161161            continue;
    162162
    163         item->setData(fileInfo.size(),         UICustomFileSystemModelColumn_Size);
    164         item->setData(fileInfo.lastModified(), UICustomFileSystemModelColumn_ChangeTime);
    165         item->setData(fileInfo.owner(),        UICustomFileSystemModelColumn_Owner);
    166         item->setData(permissionString(fileInfo.permissions()),  UICustomFileSystemModelColumn_Permissions);
     163        item->setData(fileInfo.size(),         UICustomFileSystemModelData_Size);
     164        item->setData(fileInfo.lastModified(), UICustomFileSystemModelData_ChangeTime);
     165        item->setData(fileInfo.owner(),        UICustomFileSystemModelData_Owner);
     166        item->setData(permissionString(fileInfo.permissions()),  UICustomFileSystemModelData_Permissions);
    167167        item->setPath(fileInfo.absoluteFilePath());
    168168        /* if the item is a symlink set the target path and
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp

    r100081 r100082  
    824824        connect(m_pView, &UIGuestControlFileView::customContextMenuRequested,
    825825                this, &UIFileManagerTable::sltCreateFileViewContextMenu);
    826         m_pView->hideColumn(UICustomFileSystemModelColumn_ISOPath);
    827         m_pView->hideColumn(UICustomFileSystemModelColumn_LocalPath);
     826        m_pView->hideColumn(UICustomFileSystemModelData_ISOPath);
     827        m_pView->hideColumn(UICustomFileSystemModelData_LocalPath);
    828828        m_sessionWidgets << m_pView;
    829829    }
     
    12171217    {
    12181218        /* Restore the previous name. relist the view: */
    1219         pItem->setData(strOldName, static_cast<int>(UICustomFileSystemModelColumn_Name));
     1219        pItem->setData(strOldName, static_cast<int>(UICustomFileSystemModelData_Name));
    12201220        relist();
    12211221        emit sigLogOutput(QString(pItem->path()).append(" could not be renamed"), QString(), FileManagerLogType_Error);
     
    13081308    if (pRootItem)
    13091309    {
    1310         pRootItem->setData(UIFileManager::tr("Name"), UICustomFileSystemModelColumn_Name);
    1311         pRootItem->setData(UIFileManager::tr("Size"), UICustomFileSystemModelColumn_Size);
    1312         pRootItem->setData(UIFileManager::tr("Change Time"), UICustomFileSystemModelColumn_ChangeTime);
    1313         pRootItem->setData(UIFileManager::tr("Owner"), UICustomFileSystemModelColumn_Owner);
    1314         pRootItem->setData(UIFileManager::tr("Permissions"), UICustomFileSystemModelColumn_Permissions);
     1310        pRootItem->setData(UIFileManager::tr("Name"), UICustomFileSystemModelData_Name);
     1311        pRootItem->setData(UIFileManager::tr("Size"), UICustomFileSystemModelData_Size);
     1312        pRootItem->setData(UIFileManager::tr("Change Time"), UICustomFileSystemModelData_ChangeTime);
     1313        pRootItem->setData(UIFileManager::tr("Owner"), UICustomFileSystemModelData_Owner);
     1314        pRootItem->setData(UIFileManager::tr("Permissions"), UICustomFileSystemModelData_Permissions);
    13151315    }
    13161316}
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp

    r100081 r100082  
    209209        UICustomFileSystemItem* pAddedItem = new UICustomFileSystemItem(fileInfo.fileName(), pParentItem,
    210210                                                                        fileType(fileInfo));
    211         pAddedItem->setData(strPath, UICustomFileSystemModelColumn_LocalPath);
     211        pAddedItem->setData(strPath, UICustomFileSystemModelData_LocalPath);
    212212        pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), fileInfo.fileName()),
    213                            UICustomFileSystemModelColumn_ISOPath);
     213                           UICustomFileSystemModelData_ISOPath);
    214214        pAddedItem->setIsOpened(false);
    215215        if (fileInfo.isSymLink())
     
    233233    if (!pItem)
    234234        return;
    235     if (pItem->data(UICustomFileSystemModelColumn_ISOPath).toString().isEmpty())
    236         return;
    237 
    238 
    239     if (!bRemove && pItem->data(UICustomFileSystemModelColumn_LocalPath).toString().isEmpty())
     235    if (pItem->data(UICustomFileSystemModelData_ISOPath).toString().isEmpty())
     236        return;
     237
     238
     239    if (!bRemove && pItem->data(UICustomFileSystemModelData_LocalPath).toString().isEmpty())
    240240        return;
    241241    if (!bRemove)
    242         m_entryMap.insert(pItem->data(UICustomFileSystemModelColumn_ISOPath).toString(),
    243                           pItem->data(UICustomFileSystemModelColumn_LocalPath).toString());
     242        m_entryMap.insert(pItem->data(UICustomFileSystemModelData_ISOPath).toString(),
     243                          pItem->data(UICustomFileSystemModelData_LocalPath).toString());
    244244    else
    245         m_entryMap.insert(pItem->data(UICustomFileSystemModelColumn_ISOPath).toString(),
     245        m_entryMap.insert(pItem->data(UICustomFileSystemModelData_ISOPath).toString(),
    246246                          ":remove:");
    247247}
     
    263263    if (pRootItem)
    264264    {
    265         pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Name"), UICustomFileSystemModelColumn_Name);
    266         pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Size"), UICustomFileSystemModelColumn_Size);
    267         pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Change Time"), UICustomFileSystemModelColumn_ChangeTime);
    268         pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Owner"), UICustomFileSystemModelColumn_Owner);
    269         pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Permissions"), UICustomFileSystemModelColumn_Permissions);
    270         pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Local Path"), UICustomFileSystemModelColumn_LocalPath);
    271         pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "ISO Path"), UICustomFileSystemModelColumn_ISOPath);
     265        pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Name"), UICustomFileSystemModelData_Name);
     266        pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Size"), UICustomFileSystemModelData_Size);
     267        pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Change Time"), UICustomFileSystemModelData_ChangeTime);
     268        pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Owner"), UICustomFileSystemModelData_Owner);
     269        pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Permissions"), UICustomFileSystemModelData_Permissions);
     270        pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Local Path"), UICustomFileSystemModelData_LocalPath);
     271        pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "ISO Path"), UICustomFileSystemModelData_ISOPath);
    272272    }
    273273}
     
    321321    UICustomFileSystemItem* pAddedItem = new UICustomFileSystemItem(strNewDirectoryName, pParentItem,
    322322                                                                    KFsObjType_Directory);
    323     pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), strNewDirectoryName), UICustomFileSystemModelColumn_ISOPath);
     323    pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), strNewDirectoryName), UICustomFileSystemModelData_ISOPath);
    324324
    325325    pAddedItem->setIsOpened(false);
     
    341341        if (!pItem)
    342342            continue;
    343         QString strIsoPath = pItem->data(UICustomFileSystemModelColumn_ISOPath).toString();
     343        QString strIsoPath = pItem->data(UICustomFileSystemModelData_ISOPath).toString();
    344344        if (strIsoPath.isEmpty())
    345345            continue;
     
    401401        m_pTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    402402        /* Show only the 0th column that is "name': */
    403         m_pTreeView->hideColumn(UICustomFileSystemModelColumn_Owner);
    404         m_pTreeView->hideColumn(UICustomFileSystemModelColumn_Permissions);
    405         m_pTreeView->hideColumn(UICustomFileSystemModelColumn_Size);
    406         m_pTreeView->hideColumn(UICustomFileSystemModelColumn_ChangeTime);
    407         m_pTreeView->hideColumn(UICustomFileSystemModelColumn_ISOPath);
    408         m_pTreeView->hideColumn(UICustomFileSystemModelColumn_LocalPath);
     403        m_pTreeView->hideColumn(UICustomFileSystemModelData_Owner);
     404        m_pTreeView->hideColumn(UICustomFileSystemModelData_Permissions);
     405        m_pTreeView->hideColumn(UICustomFileSystemModelData_Size);
     406        m_pTreeView->hideColumn(UICustomFileSystemModelData_ChangeTime);
     407        m_pTreeView->hideColumn(UICustomFileSystemModelData_ISOPath);
     408        m_pTreeView->hideColumn(UICustomFileSystemModelData_LocalPath);
    409409    }
    410410
     
    436436        m_pTableView->setModel(m_pTableProxyModel);
    437437        setTableRootIndex();
    438         m_pTableView->hideColumn(UICustomFileSystemModelColumn_Owner);
    439         m_pTableView->hideColumn(UICustomFileSystemModelColumn_Permissions);
    440         m_pTableView->hideColumn(UICustomFileSystemModelColumn_Size);
    441         m_pTableView->hideColumn(UICustomFileSystemModelColumn_ChangeTime);
     438        m_pTableView->hideColumn(UICustomFileSystemModelData_Owner);
     439        m_pTableView->hideColumn(UICustomFileSystemModelData_Permissions);
     440        m_pTableView->hideColumn(UICustomFileSystemModelData_Size);
     441        m_pTableView->hideColumn(UICustomFileSystemModelData_ChangeTime);
    442442
    443443        m_pTableView->setSortingEnabled(true);
     
    527527        if (pItem)
    528528        {
    529             QString strPath = pItem->data(UICustomFileSystemModelColumn_ISOPath).toString();
     529            QString strPath = pItem->data(UICustomFileSystemModelData_ISOPath).toString();
    530530            updateLocationSelectorText(strPath);
    531531        }
     
    648648       should be empty: */
    649649    if (directoryItem->type() != KFsObjType_Directory ||
    650         directoryItem->data(UICustomFileSystemModelColumn_LocalPath).toString().isEmpty())
    651         return;
    652     QDir directory(directoryItem->data(UICustomFileSystemModelColumn_LocalPath).toString());
     650        directoryItem->data(UICustomFileSystemModelData_LocalPath).toString().isEmpty())
     651        return;
     652    QDir directory(directoryItem->data(UICustomFileSystemModelData_LocalPath).toString());
    653653    if (directory.exists() && !directoryItem->isOpened())
    654654    {
     
    662662                                                                         directoryItem,
    663663                                                                       fileType(fileInfo));
    664             newItem->setData(fileInfo.filePath(), UICustomFileSystemModelColumn_LocalPath);
     664            newItem->setData(fileInfo.filePath(), UICustomFileSystemModelData_LocalPath);
    665665
    666666            newItem->setData(UIPathOperations::mergePaths(directoryItem->path(), fileInfo.fileName()),
    667                              UICustomFileSystemModelColumn_ISOPath);
     667                             UICustomFileSystemModelData_ISOPath);
    668668            if (fileInfo.isSymLink())
    669669            {
     
    698698    const QString strName(QDir::toNativeSeparators("/"));
    699699
    700     rootItem()->child(0)->setData(strName, UICustomFileSystemModelColumn_Name);
     700    rootItem()->child(0)->setData(strName, UICustomFileSystemModelData_Name);
    701701    /* If the table root index is the start item then we have to update the location selector text here: */
    702702    if (m_pTableProxyModel->mapToSource(m_pTableView->rootIndex()).internalPointer() == rootItem()->child(0))
     
    735735    {
    736736        /* Restore the previous name in case the @strNewName is a duplicate: */
    737         pItem->setData(strOldName, static_cast<int>(UICustomFileSystemModelColumn_Name));
    738     }
    739 
    740     pItem->setData(UIPathOperations::mergePaths(pItem->parentItem()->path(), pItem->name()), UICustomFileSystemModelColumn_ISOPath);
     737        pItem->setData(strOldName, static_cast<int>(UICustomFileSystemModelData_Name));
     738    }
     739
     740    pItem->setData(UIPathOperations::mergePaths(pItem->parentItem()->path(), pItem->name()), UICustomFileSystemModelData_ISOPath);
    741741    if (m_pTableProxyModel)
    742742        m_pTableProxyModel->invalidate();
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