VirtualBox

Changeset 99284 in vbox for trunk/src


Ignore:
Timestamp:
Apr 4, 2023 2:56:01 PM (22 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Make sure all cloud related wizards propose allowed profiles before restricted; Emphasize that difference visually a bit as well.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVMPageSource.cpp

    r98103 r99284  
    3939#include "QIToolButton.h"
    4040#include "UICloudNetworkingStuff.h"
     41#include "UIExtraDataManager.h"
    4142#include "UIIconPool.h"
    4243#include "UIVirtualBoxEventHandler.h"
     
    135136    pCombo->clear();
    136137
     138    /* Acquire restricted accounts: */
     139    const QStringList restrictedProfiles = gEDataManager->cloudProfileManagerRestrictions();
     140
    137141    /* Iterate through existing profiles: */
     142    QStringList allowedProfileNames;
     143    QStringList restrictedProfileNames;
    138144    foreach (const CCloudProfile &comProfile, listCloudProfiles(comProvider, pCenter))
    139145    {
     
    146152            continue;
    147153
    148         /* Compose item, fill the data: */
    149         pCombo->addItem(strCurrentProfileName);
    150         pCombo->setItemData(pCombo->count() - 1, strCurrentProfileName, ProfileData_Name);
     154        /* Compose full profile name: */
     155        const QString strFullProfileName = QString("/%1/%2").arg(strProviderShortName).arg(strCurrentProfileName);
     156        /* Append to appropriate list: */
     157        if (restrictedProfiles.contains(strFullProfileName))
     158            restrictedProfileNames.append(strCurrentProfileName);
     159        else
     160            allowedProfileNames.append(strCurrentProfileName);
     161    }
     162
     163    /* Add allowed items: */
     164    foreach (const QString &strAllowedProfileName, allowedProfileNames)
     165    {
     166        /* Compose item, fill it's data: */
     167        pCombo->addItem(strAllowedProfileName);
     168        pCombo->setItemData(pCombo->count() - 1, strAllowedProfileName, ProfileData_Name);
     169        QFont fnt = pCombo->font();
     170        fnt.setBold(true);
     171        pCombo->setItemData(pCombo->count() - 1, fnt, Qt::FontRole);
     172    }
     173    /* Add restricted items: */
     174    foreach (const QString &strRestrictedProfileName, restrictedProfileNames)
     175    {
     176        /* Compose item, fill it's data: */
     177        pCombo->addItem(strRestrictedProfileName);
     178        pCombo->setItemData(pCombo->count() - 1, strRestrictedProfileName, ProfileData_Name);
     179        QBrush brsh;
     180        brsh.setColor(Qt::gray);
     181        pCombo->setItemData(pCombo->count() - 1, brsh, Qt::ForegroundRole);
    151182    }
    152183
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageFormat.cpp

    r98103 r99284  
    4444#include "UICommon.h"
    4545#include "UIEmptyFilePathSelector.h"
     46#include "UIExtraDataManager.h"
    4647#include "UIIconPool.h"
    4748#include "UINotificationCenter.h"
     
    397398        pCombo->clear();
    398399
     400        /* Acquire restricted accounts: */
     401        const QStringList restrictedProfiles = gEDataManager->cloudProfileManagerRestrictions();
     402
    399403        /* Iterate through existing profile names: */
     404        QStringList allowedProfileNames;
     405        QStringList restrictedProfileNames;
    400406        foreach (const CCloudProfile &comProfile, listCloudProfiles(comProvider, pCenter))
    401407        {
     
    404410                continue;
    405411            /* Acquire profile name: */
    406             QString strProfileName;
    407             if (!cloudProfileName(comProfile, strProfileName, pCenter))
     412            QString strCurrentProfileName;
     413            if (!cloudProfileName(comProfile, strCurrentProfileName, pCenter))
    408414                continue;
    409415
     416            /* Compose full profile name: */
     417            const QString strFullProfileName = QString("/%1/%2").arg(strFormat).arg(strCurrentProfileName);
     418            /* Append to appropriate list: */
     419            if (restrictedProfiles.contains(strFullProfileName))
     420                restrictedProfileNames.append(strCurrentProfileName);
     421            else
     422                allowedProfileNames.append(strCurrentProfileName);
     423        }
     424
     425        /* Add allowed items: */
     426        foreach (const QString &strAllowedProfileName, allowedProfileNames)
     427        {
    410428            /* Compose item, fill it's data: */
    411             pCombo->addItem(strProfileName);
    412             pCombo->setItemData(pCombo->count() - 1, strProfileName, ProfileData_Name);
     429            pCombo->addItem(strAllowedProfileName);
     430            pCombo->setItemData(pCombo->count() - 1, strAllowedProfileName, ProfileData_Name);
     431            QFont fnt = pCombo->font();
     432            fnt.setBold(true);
     433            pCombo->setItemData(pCombo->count() - 1, fnt, Qt::FontRole);
     434        }
     435        /* Add restricted items: */
     436        foreach (const QString &strRestrictedProfileName, restrictedProfileNames)
     437        {
     438            /* Compose item, fill it's data: */
     439            pCombo->addItem(strRestrictedProfileName);
     440            pCombo->setItemData(pCombo->count() - 1, strRestrictedProfileName, ProfileData_Name);
     441            QBrush brsh;
     442            brsh.setColor(Qt::gray);
     443            pCombo->setItemData(pCombo->count() - 1, brsh, Qt::ForegroundRole);
    413444        }
    414445
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageSource.cpp

    r98103 r99284  
    3939#include "UICloudNetworkingStuff.h"
    4040#include "UIEmptyFilePathSelector.h"
     41#include "UIExtraDataManager.h"
    4142#include "UIIconPool.h"
    4243#include "UINotificationCenter.h"
     
    195196        pCombo->clear();
    196197
     198        /* Acquire restricted accounts: */
     199        const QStringList restrictedProfiles = gEDataManager->cloudProfileManagerRestrictions();
     200
    197201        /* Iterate through existing profile names: */
     202        QStringList allowedProfileNames;
     203        QStringList restrictedProfileNames;
    198204        foreach (const CCloudProfile &comProfile, listCloudProfiles(comProvider, pCenter))
    199205        {
     
    206212                continue;
    207213
     214            /* Compose full profile name: */
     215            const QString strFullProfileName = QString("/%1/%2").arg(strSource).arg(strCurrentProfileName);
     216            /* Append to appropriate list: */
     217            if (restrictedProfiles.contains(strFullProfileName))
     218                restrictedProfileNames.append(strCurrentProfileName);
     219            else
     220                allowedProfileNames.append(strCurrentProfileName);
     221        }
     222
     223        /* Add allowed items: */
     224        foreach (const QString &strAllowedProfileName, allowedProfileNames)
     225        {
    208226            /* Compose item, fill it's data: */
    209             pCombo->addItem(strCurrentProfileName);
    210             pCombo->setItemData(pCombo->count() - 1, strCurrentProfileName, ProfileData_Name);
     227            pCombo->addItem(strAllowedProfileName);
     228            pCombo->setItemData(pCombo->count() - 1, strAllowedProfileName, ProfileData_Name);
     229            QFont fnt = pCombo->font();
     230            fnt.setBold(true);
     231            pCombo->setItemData(pCombo->count() - 1, fnt, Qt::FontRole);
     232        }
     233        /* Add restricted items: */
     234        foreach (const QString &strRestrictedProfileName, restrictedProfileNames)
     235        {
     236            /* Compose item, fill it's data: */
     237            pCombo->addItem(strRestrictedProfileName);
     238            pCombo->setItemData(pCombo->count() - 1, strRestrictedProfileName, ProfileData_Name);
     239            QBrush brsh;
     240            brsh.setColor(Qt::gray);
     241            pCombo->setItemData(pCombo->count() - 1, brsh, Qt::ForegroundRole);
    211242        }
    212243
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageSource.cpp

    r98103 r99284  
    3939#include "QIToolButton.h"
    4040#include "UICloudNetworkingStuff.h"
     41#include "UIExtraDataManager.h"
    4142#include "UIIconPool.h"
    4243#include "UINotificationCenter.h"
     
    136137    pCombo->clear();
    137138
     139    /* Acquire restricted accounts: */
     140    const QStringList restrictedProfiles = gEDataManager->cloudProfileManagerRestrictions();
     141
    138142    /* Iterate through existing profiles: */
     143    QStringList allowedProfileNames;
     144    QStringList restrictedProfileNames;
    139145    foreach (const CCloudProfile &comProfile, listCloudProfiles(comProvider, pCenter))
    140146    {
     
    147153            continue;
    148154
    149         /* Compose item, fill the data: */
    150         pCombo->addItem(strCurrentProfileName);
    151         pCombo->setItemData(pCombo->count() - 1, strCurrentProfileName, ProfileData_Name);
     155        /* Compose full profile name: */
     156        const QString strFullProfileName = QString("/%1/%2").arg(strProviderShortName).arg(strCurrentProfileName);
     157        /* Append to appropriate list: */
     158        if (restrictedProfiles.contains(strFullProfileName))
     159            restrictedProfileNames.append(strCurrentProfileName);
     160        else
     161            allowedProfileNames.append(strCurrentProfileName);
     162    }
     163
     164    /* Add allowed items: */
     165    foreach (const QString &strAllowedProfileName, allowedProfileNames)
     166    {
     167        /* Compose item, fill it's data: */
     168        pCombo->addItem(strAllowedProfileName);
     169        pCombo->setItemData(pCombo->count() - 1, strAllowedProfileName, ProfileData_Name);
     170        QFont fnt = pCombo->font();
     171        fnt.setBold(true);
     172        pCombo->setItemData(pCombo->count() - 1, fnt, Qt::FontRole);
     173    }
     174    /* Add restricted items: */
     175    foreach (const QString &strRestrictedProfileName, restrictedProfileNames)
     176    {
     177        /* Compose item, fill it's data: */
     178        pCombo->addItem(strRestrictedProfileName);
     179        pCombo->setItemData(pCombo->count() - 1, strRestrictedProfileName, ProfileData_Name);
     180        QBrush brsh;
     181        brsh.setColor(Qt::gray);
     182        pCombo->setItemData(pCombo->count() - 1, brsh, Qt::ForegroundRole);
    152183    }
    153184
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