- Timestamp:
- Oct 29, 2019 10:23:58 AM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r81422 r81563 58 58 template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>() { return true; } 59 59 template<> bool canConvert<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>() { return true; } 60 template<> bool canConvert<UIExtraDataMetaDefs::RestrictedDialogs>() { return true; } 60 61 template<> bool canConvert<UIToolType>() { return true; } 61 62 template<> bool canConvert<UIVisualStateType>() { return true; } … … 1454 1455 } 1455 1456 1457 /* QString <= UIExtraDataMetaDefs::RestrictedDialogs: */ 1458 template<> QString toInternalString(const UIExtraDataMetaDefs::RestrictedDialogs &enmRestrictedDialogs) 1459 { 1460 QString strResult; 1461 switch (enmRestrictedDialogs) 1462 { 1463 case UIExtraDataMetaDefs::RestrictedDialogs_VISOCreator: strResult = "VISOCreator"; break; 1464 case UIExtraDataMetaDefs::RestrictedDialogs_All: strResult = "All"; break; 1465 default: 1466 { 1467 AssertMsgFailed(("No text for details element option type=%d", enmRestrictedDialogs)); 1468 break; 1469 } 1470 } 1471 return strResult; 1472 } 1473 1474 /* UIExtraDataMetaDefs::RestrictedDialogs <= QString: */ 1475 template<> UIExtraDataMetaDefs::RestrictedDialogs fromInternalString<UIExtraDataMetaDefs::RestrictedDialogs>(const QString &strRestrictedDialogs) 1476 { 1477 /* Here we have some fancy stuff allowing us 1478 * to search through the keys using 'case-insensitive' rule: */ 1479 QStringList keys; QList<UIExtraDataMetaDefs::RestrictedDialogs> values; 1480 keys << "VISOCreator"; values << UIExtraDataMetaDefs::RestrictedDialogs_VISOCreator; 1481 keys << "All"; values << UIExtraDataMetaDefs::RestrictedDialogs_All; 1482 /* Invalid type for unknown words: */ 1483 if (!keys.contains(strRestrictedDialogs, Qt::CaseInsensitive)) 1484 return UIExtraDataMetaDefs::RestrictedDialogs_Invalid; 1485 /* Corresponding type for known words: */ 1486 return values.at(keys.indexOf(QRegExp(strRestrictedDialogs, Qt::CaseInsensitive))); 1487 } 1488 1456 1489 /* UIExtraDataMetaDefs::DetailsElementOptionTypeDescription <= QString: */ 1457 1490 template<> UIExtraDataMetaDefs::DetailsElementOptionTypeDescription fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(const QString &strDetailsElementOptionTypeDescription) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r81309 r81563 239 239 const char *UIExtraDataDefs::GUI_GuestControl_LogViewerVisiblePanels = "GUI/LogViewerVisiblePanels"; 240 240 241 /* Restricted dialogs: */ 242 const char *UIExtraDataDefs::GUI_RestrictedDialogs = "GUI/RestrictedDialogs"; 241 243 242 244 /* Obsolete keys: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r81422 r81563 436 436 /** @} */ 437 437 438 /** @name Restricted dialogs 439 * @{ */ 440 SHARED_LIBRARY_STUFF extern const char *GUI_RestrictedDialogs; 441 /** @} */ 438 442 439 443 /** @name Old key support stuff. … … 774 778 }; 775 779 Q_ENUM(DetailsElementOptionTypeDescription); 780 781 enum RestrictedDialogs 782 { 783 RestrictedDialogs_Invalid = 0, 784 RestrictedDialogs_VISOCreator = RT_BIT(0), 785 RestrictedDialogs_All = 0xFFFF 786 }; 787 Q_ENUM(RestrictedDialogs); 776 788 }; 777 789 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r81358 r81563 1990 1990 #endif /* VBOX_WITH_DEBUGGER_GUI */ 1991 1991 << GUI_ExtraDataManager_Geometry << GUI_ExtraDataManager_SplitterHints 1992 << GUI_LogWindowGeometry; 1992 << GUI_LogWindowGeometry 1993 << GUI_RestrictedDialogs; 1993 1994 } 1994 1995 … … 4519 4520 } 4520 4521 4522 UIExtraDataMetaDefs::RestrictedDialogs UIExtraDataManager::restrictedDialogs(const QUuid &uID) 4523 { 4524 UIExtraDataMetaDefs::RestrictedDialogs result = UIExtraDataMetaDefs::RestrictedDialogs_Invalid; 4525 foreach (const QString &strValue, extraDataStringList(GUI_RestrictedDialogs, uID)) 4526 { 4527 UIExtraDataMetaDefs::RestrictedDialogs value = 4528 gpConverter->fromInternalString<UIExtraDataMetaDefs::RestrictedDialogs>(strValue); 4529 if (value != UIExtraDataMetaDefs::RestrictedDialogs_Invalid) 4530 result = static_cast<UIExtraDataMetaDefs::RestrictedDialogs>(result | value); 4531 } 4532 return result; 4533 } 4534 4535 void UIExtraDataManager::setRestrictedDialogs(UIExtraDataMetaDefs::RestrictedDialogs dialogs, const QUuid &uID) 4536 { 4537 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 4538 const int iEnumIndex = smo.indexOfEnumerator("RestrictedDialogs"); 4539 QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 4540 4541 QStringList result; 4542 if (dialogs == UIExtraDataMetaDefs::RestrictedDialogs_All) 4543 result << gpConverter->toInternalString(dialogs); 4544 else 4545 { 4546 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 4547 { 4548 const UIExtraDataMetaDefs::RestrictedDialogs enumValue = 4549 static_cast<UIExtraDataMetaDefs::RestrictedDialogs>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 4550 if (enumValue == UIExtraDataMetaDefs::RestrictedDialogs_Invalid || 4551 enumValue == UIExtraDataMetaDefs::RestrictedDialogs_All) 4552 continue; 4553 if (dialogs & enumValue) 4554 result << gpConverter->toInternalString(enumValue); 4555 } 4556 } 4557 setExtraDataStringList(GUI_RestrictedDialogs, result, uID); 4558 } 4559 4521 4560 void UIExtraDataManager::sltExtraDataChange(const QUuid &uMachineID, const QString &strKey, const QString &strValue) 4522 4561 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r81358 r81563 750 750 void setLogViewerVisiblePanels(const QStringList &panelNameList); 751 751 QStringList logViewerVisiblePanels(); 752 /** @} */ 753 754 /** @name Restricted Dialogs 755 * @{ */ 756 /** Returns a list of restricted dialogs. */ 757 UIExtraDataMetaDefs::RestrictedDialogs restrictedDialogs(const QUuid &uID); 758 /** Defines restricted Runtime UI menu types. */ 759 void setRestrictedDialogs(UIExtraDataMetaDefs::RestrictedDialogs types, const QUuid &uID); 752 760 /** @} */ 753 761 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r81274 r81563 2916 2916 2917 2917 int UICommon::openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType, QUuid &outUuid, 2918 const QString &strMachineFolder, const QString &strMachineName, 2919 const QString &strMachineGuestOSTypeId, bool fEnableCreate) 2920 { 2918 const QString &strMachineFolder, const QString &strMachineName, 2919 const QString &strMachineGuestOSTypeId, bool fEnableCreate, const QUuid &uMachineID /* = QUuid() */) 2920 { 2921 QUuid uMachineOrGlobalId = uMachineID == QUuid() ? gEDataManager->GlobalID : uMachineID; 2922 2921 2923 QWidget *pDialogParent = windowManager().realParentWindow(pParent); 2922 2924 QPointer<UIMediumSelector> pSelector = new UIMediumSelector(enmMediumType, strMachineName, 2923 strMachineFolder, strMachineGuestOSTypeId, pDialogParent); 2925 strMachineFolder, strMachineGuestOSTypeId, 2926 uMachineOrGlobalId, pDialogParent); 2924 2927 2925 2928 if (!pSelector) … … 3183 3186 int iDialogReturn = openMediumSelectorDialog(windowManager().mainWindowShown(), target.mediumType, uMediumID, 3184 3187 strMachineFolder, comConstMachine.GetName(), 3185 comConstMachine.GetOSTypeId(), true /*fEnableCreate */ );3188 comConstMachine.GetOSTypeId(), true /*fEnableCreate */, comConstMachine.GetId()); 3186 3189 if (iDialogReturn == UIMediumSelector::ReturnCode_LeftEmpty && 3187 3190 (target.mediumType == UIMediumDeviceType_DVD || target.mediumType == UIMediumDeviceType_Floppy)) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r80926 r81563 520 520 * @param strMachineGuestOSTypeId Passes the type ID of machine's guest os, 521 521 * @param fEnableCreate Passes whether to show/enable create action in the medium selector dialog, 522 * @param uMachineID Passes the machine UUID, 522 523 * returns the return code of the UIMediumSelector::ReturnCode as int. In case of a medium selection 523 524 * UUID of the selected medium is stored in @param outUuid.*/ 524 525 int openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType, QUuid &outUuid, 525 526 const QString &strMachineFolder, const QString &strMachineName, 526 const QString &strMachineGuestOSTypeId, bool fEnableCreate );527 const QString &strMachineGuestOSTypeId, bool fEnableCreate, const QUuid &uMachineID = QUuid()); 527 528 528 529 /** Creates and shows a dialog (wizard) to create a medium of type @a enmMediumType. -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
r81562 r81563 54 54 55 55 56 UIMediumSelector::UIMediumSelector(UIMediumDeviceType enmMediumType, const QString &machineName /* = QString() */,57 const QString &machineSettingsFilePath /* = QString() */,58 const Q String &strMachineGuestOSTypeId /*= QString() */, QWidget *pParent /* = 0 */)56 UIMediumSelector::UIMediumSelector(UIMediumDeviceType enmMediumType, const QString &machineName, 57 const QString &machineSettingsFilePath, const QString &strMachineGuestOSTypeId, 58 const QUuid &uMachineID, QWidget *pParent) 59 59 :QIWithRetranslateUI<QIMainDialog>(pParent) 60 60 , m_pCentralWidget(0) … … 79 79 , m_strMachineName(machineName) 80 80 , m_strMachineGuestOSTypeId(strMachineGuestOSTypeId) 81 , m_uMachineID(uMachineID) 81 82 { 82 83 /* Start full medium-enumeration (if necessary): */ … … 224 225 225 226 m_pToolBar->addAction(m_pActionAdd); 226 m_pToolBar->addAction(m_pActionCreate); 227 if (!(gEDataManager->restrictedDialogs(m_uMachineID) & UIExtraDataMetaDefs::RestrictedDialogs_VISOCreator)) 228 m_pToolBar->addAction(m_pActionCreate); 227 229 m_pToolBar->addSeparator(); 228 230 m_pToolBar->addAction(m_pActionRefresh); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.h
r77291 r81563 51 51 public: 52 52 53 UIMediumSelector(UIMediumDeviceType enmMediumType, const QString &machineName = QString(),54 const QString &machineSettingsFilePath = QString(), const QString &strMachineGuestOSTypeId = QString(),55 QWidget *pParent = 0);53 UIMediumSelector(UIMediumDeviceType enmMediumType, const QString &machineName, 54 const QString &machineSettingsFilePath, const QString &strMachineGuestOSTypeId, 55 const QUuid &uMachineID, QWidget *pParent); 56 56 /** Disables/enables the create action and controls its visibility. */ 57 57 void setEnableCreateAction(bool fEnable); … … 152 152 QString m_strMachineName; 153 153 QString m_strMachineGuestOSTypeId; 154 QUuid m_uMachineID; 154 155 }; 155 156 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r81551 r81563 3939 3939 strMachineFolder, m_strMachineName, 3940 3940 m_strMachineGuestOSTypeId, 3941 true /* enable create action: */ );3941 true /* enable create action: */, m_uMachineId); 3942 3942 3943 3943 if (iResult == UIMediumSelector::ReturnCode_Rejected || … … 4835 4835 strMachineFolder, m_strMachineName, 4836 4836 m_strMachineGuestOSTypeId, 4837 true /* enable cr1eate action: */ );4837 true /* enable cr1eate action: */, m_uMachineId); 4838 4838 4839 4839 /* Continue only if iResult is either UIMediumSelector::ReturnCode_Accepted or UIMediumSelector::ReturnCode_LeftEmpty: */
Note:
See TracChangeset
for help on using the changeset viewer.