Changeset 75216 in vbox
- Timestamp:
- Nov 1, 2018 1:24:16 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r74942 r75216 1620 1620 } 1621 1621 1622 void UIMessageCenter::cannotAcquireCloudProviderManagerParameter(const CCloudProviderManager &comManager, QWidget *pParent /* = 0 */) const 1623 { 1624 error(pParent, MessageType_Error, 1625 tr("Failed to acquire cloud provider manager parameter."), 1626 UIErrorString::formatErrorInfo(comManager)); 1627 } 1628 1622 1629 void UIMessageCenter::cannotFindCloudProvider(const CCloudProviderManager &comManager, const QUuid &uId, QWidget *pParent /* = 0 */) const 1623 1630 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r74942 r75216 362 362 /* API: Cloud Profile Manager warnings: */ 363 363 void cannotAcquireCloudProviderManager(const CVirtualBox &comVBox, QWidget *pParent = 0) const; 364 void cannotAcquireCloudProviderManagerParameter(const CCloudProviderManager &comManager, QWidget *pParent = 0) const; 364 365 void cannotFindCloudProvider(const CCloudProviderManager &comManager, const QUuid &uId, QWidget *pParent = 0) const; 365 366 void cannotAcquireCloudProviderParameter(const CCloudProvider &comProvider, QWidget *pParent = 0) const; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp
r75070 r75216 39 39 # include "UIEmptyFilePathSelector.h" 40 40 # include "UIIconPool.h" 41 # include "UIMessageCenter.h" 41 42 # include "UIVirtualBoxManager.h" 42 43 # include "UIWizardExportApp.h" … … 73 74 , m_pAccountPropertyTable(0) 74 75 { 75 /* Init Cloud Provider Manager: */76 CVirtualBox comVBox = vboxGlobal().virtualBox();77 m_comCloudProviderManager = comVBox.GetCloudProviderManager();78 AssertMsg(comVBox.isOk() && m_comCloudProviderManager.isNotNull(),79 ("Unable to acquire Cloud Provider Manager"));80 76 } 81 77 … … 97 93 } 98 94 99 /* Iterate through existing providers: */ 100 foreach (const CCloudProvider &comProvider, m_comCloudProviderManager.GetProviders()) 101 { 102 /* Skip if we have nothing to populate (file missing?): */ 103 if (comProvider.isNull()) 104 continue; 105 106 /* Compose empty item, fill it's data: */ 107 m_pFormatComboBox->addItem(QString()); 108 m_pFormatComboBox->setItemData(m_pFormatComboBox->count() - 1, comProvider.GetId(), FormatData_ID); 109 m_pFormatComboBox->setItemData(m_pFormatComboBox->count() - 1, comProvider.GetName(), FormatData_Name); 110 m_pFormatComboBox->setItemData(m_pFormatComboBox->count() - 1, comProvider.GetShortName(), FormatData_ShortName); 111 m_pFormatComboBox->setItemData(m_pFormatComboBox->count() - 1, true, FormatData_IsItCloudFormat); 95 /* Initialize Cloud Provider Manager: */ 96 CVirtualBox comVBox = vboxGlobal().virtualBox(); 97 m_comCloudProviderManager = comVBox.GetCloudProviderManager(); 98 /* Show error message if necessary: */ 99 if (!comVBox.isOk()) 100 msgCenter().cannotAcquireCloudProviderManager(comVBox); 101 else 102 { 103 /* Acquire existing providers: */ 104 const QVector<CCloudProvider> providers = m_comCloudProviderManager.GetProviders(); 105 /* Show error message if necessary: */ 106 if (!m_comCloudProviderManager.isOk()) 107 msgCenter().cannotAcquireCloudProviderManagerParameter(m_comCloudProviderManager); 108 else 109 { 110 /* Iterate through existing providers: */ 111 foreach (const CCloudProvider &comProvider, providers) 112 { 113 /* Skip if we have nothing to populate (file missing?): */ 114 if (comProvider.isNull()) 115 continue; 116 117 /* Compose empty item, fill it's data: */ 118 m_pFormatComboBox->addItem(QString()); 119 m_pFormatComboBox->setItemData(m_pFormatComboBox->count() - 1, comProvider.GetId(), FormatData_ID); 120 m_pFormatComboBox->setItemData(m_pFormatComboBox->count() - 1, comProvider.GetName(), FormatData_Name); 121 m_pFormatComboBox->setItemData(m_pFormatComboBox->count() - 1, comProvider.GetShortName(), FormatData_ShortName); 122 m_pFormatComboBox->setItemData(m_pFormatComboBox->count() - 1, true, FormatData_IsItCloudFormat); 123 } 124 } 112 125 } 113 126 … … 135 148 /* Clear combo initially: */ 136 149 m_pAccountComboBox->clear(); 150 137 151 /* Return if no provider chosen: */ 138 152 if (providerId().isNull()) 139 153 return; 140 154 141 /* Acquire Cloud Provider: */ 142 CCloudProvider comCloudProvider = m_comCloudProviderManager.GetProviderById(providerId()); 143 /* Return if the provider has disappeared: */ 144 if (comCloudProvider.isNull()) 145 return; 146 147 /* Iterate through profile names: */ 148 foreach (const QString &strProfileName, comCloudProvider.GetProfileNames()) 149 { 150 m_pAccountComboBox->addItem(strProfileName); 151 m_pAccountComboBox->setItemData(m_pAccountComboBox->count() - 1, strProfileName, AccountData_ProfileName); 155 /* (Re)initialize Cloud Provider: */ 156 m_comCloudProvider = m_comCloudProviderManager.GetProviderById(providerId()); 157 /* Show error message if necessary: */ 158 if (!m_comCloudProviderManager.isOk()) 159 msgCenter().cannotFindCloudProvider(m_comCloudProviderManager, providerId()); 160 else 161 { 162 /* Acquire existing profile names: */ 163 const QVector<QString> profileNames = m_comCloudProvider.GetProfileNames(); 164 /* Show error message if necessary: */ 165 if (!m_comCloudProvider.isOk()) 166 msgCenter().cannotAcquireCloudProviderParameter(m_comCloudProvider); 167 else 168 { 169 /* Iterate through existing profile names: */ 170 foreach (const QString &strProfileName, profileNames) 171 { 172 /* Skip if we have nothing to show (wtf happened?): */ 173 if (strProfileName.isEmpty()) 174 continue; 175 176 /* Compose item, fill it's data: */ 177 m_pAccountComboBox->addItem(strProfileName); 178 m_pAccountComboBox->setItemData(m_pAccountComboBox->count() - 1, strProfileName, AccountData_ProfileName); 179 } 180 } 152 181 } 153 182 … … 163 192 m_pAccountPropertyTable->setRowCount(0); 164 193 m_pAccountPropertyTable->setColumnCount(0); 165 /* Return if no provider chosen: */ 166 if (providerId().isNull()) 194 195 /* Return if no provider initialized: */ 196 if (m_comCloudProvider.isNull()) 167 197 return; 168 169 /* Acquire Cloud Provider: */ 170 CCloudProvider comCloudProvider = m_comCloudProviderManager.GetProviderById(providerId()); 171 /* Return if the provider has disappeared: */ 172 if (comCloudProvider.isNull()) 198 /* Return if no profile chosen: */ 199 if (profileName().isNull()) 173 200 return; 174 201 175 202 /* Acquire Cloud Profile: */ 176 m_comCloudProfile = comCloudProvider.GetProfileByName(profileName()); 177 /* Return if the profile has disappeared: */ 178 if (m_comCloudProfile.isNull()) 179 return; 180 181 /* Acquire properties: */ 182 QVector<QString> keys; 183 QVector<QString> values; 184 values = m_comCloudProfile.GetProperties(QString(), keys); 185 186 /* Configure table: */ 187 m_pAccountPropertyTable->setRowCount(keys.size()); 188 m_pAccountPropertyTable->setColumnCount(2); 189 190 /* Push acquired keys/values to data fields: */ 191 for (int i = 0; i < m_pAccountPropertyTable->rowCount(); ++i) 192 { 193 /* Create key item: */ 194 QTableWidgetItem *pItemK = new QTableWidgetItem(keys.at(i)); 195 if (pItemK) 203 m_comCloudProfile = m_comCloudProvider.GetProfileByName(profileName()); 204 /* Show error message if necessary: */ 205 if (!m_comCloudProvider.isOk()) 206 msgCenter().cannotFindCloudProfile(m_comCloudProvider, profileName()); 207 else 208 { 209 /* Acquire properties: */ 210 QVector<QString> keys; 211 QVector<QString> values; 212 values = m_comCloudProfile.GetProperties(QString(), keys); 213 /* Show error message if necessary: */ 214 if (!m_comCloudProfile.isOk()) 215 msgCenter().cannotAcquireCloudProfileParameter(m_comCloudProfile); 216 else 196 217 { 197 /* Non-editable for sure, but non-selectable? */ 198 pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsEditable); 199 pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsSelectable); 200 201 /* Use non-translated description as tool-tip: */ 202 const QString strToolTip = m_comCloudProfile.GetPropertyDescription(keys.at(i)); 203 pItemK->setData(Qt::UserRole, strToolTip); 204 205 /* Insert into table: */ 206 m_pAccountPropertyTable->setItem(i, 0, pItemK); 218 /* Configure table: */ 219 m_pAccountPropertyTable->setRowCount(keys.size()); 220 m_pAccountPropertyTable->setColumnCount(2); 221 222 /* Push acquired keys/values to data fields: */ 223 for (int i = 0; i < m_pAccountPropertyTable->rowCount(); ++i) 224 { 225 /* Create key item: */ 226 QTableWidgetItem *pItemK = new QTableWidgetItem(keys.at(i)); 227 if (pItemK) 228 { 229 /* Non-editable for sure, but non-selectable? */ 230 pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsEditable); 231 pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsSelectable); 232 233 /* Use non-translated description as tool-tip: */ 234 const QString strToolTip = m_comCloudProfile.GetPropertyDescription(keys.at(i)); 235 /* Show error message if necessary: */ 236 if (!m_comCloudProfile.isOk()) 237 msgCenter().cannotAcquireCloudProfileParameter(m_comCloudProfile); 238 else 239 pItemK->setData(Qt::UserRole, strToolTip); 240 241 /* Insert into table: */ 242 m_pAccountPropertyTable->setItem(i, 0, pItemK); 243 } 244 245 /* Create value item: */ 246 QTableWidgetItem *pItemV = new QTableWidgetItem(values.at(i)); 247 if (pItemV) 248 { 249 /* Non-editable for sure, but non-selectable? */ 250 pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsEditable); 251 pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsSelectable); 252 253 /* Use the value as tool-tip, there can be quite long values: */ 254 const QString strToolTip = values.at(i); 255 pItemV->setToolTip(strToolTip); 256 257 /* Insert into table: */ 258 m_pAccountPropertyTable->setItem(i, 1, pItemV); 259 } 260 } 261 262 /* Update table tool-tips: */ 263 updateAccountPropertyTableToolTips(); 264 265 /* Adjust the table: */ 266 adjustAccountPropertyTable(); 207 267 } 208 209 /* Create value item: */ 210 QTableWidgetItem *pItemV = new QTableWidgetItem(values.at(i)); 211 if (pItemV) 212 { 213 /* Non-editable for sure, but non-selectable? */ 214 pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsEditable); 215 pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsSelectable); 216 217 /* Use the value as tool-tip, there can be quite long values: */ 218 const QString strToolTip = values.at(i); 219 pItemV->setToolTip(strToolTip); 220 221 /* Insert into table: */ 222 m_pAccountPropertyTable->setItem(i, 1, pItemV); 223 } 224 } 225 226 /* Update table tool-tips: */ 227 updateAccountPropertyTableToolTips(); 228 229 /* Adjust the table: */ 230 adjustAccountPropertyTable(); 268 } 231 269 } 232 270 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h
r75055 r75216 150 150 /** Holds the Cloud Provider Manager reference. */ 151 151 CCloudProviderManager m_comCloudProviderManager; 152 /** Holds the Cloud Provider object reference. */ 153 CCloudProvider m_comCloudProvider; 152 154 /** Holds the Cloud Profile object reference. */ 153 155 CCloudProfile m_comCloudProfile;
Note:
See TracChangeset
for help on using the changeset viewer.