Changeset 86225 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 22, 2020 4:25:07 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp
r84910 r86225 166 166 /* Acquire label: */ 167 167 const QString strLabel = comIteratedValue.GetLabel(); 168 169 /* Handle possible value types: */ 170 QString strValue; 171 switch (comIteratedValue.GetType()) 172 { 173 case KFormValueType_Boolean: 174 { 175 CBooleanFormValue comValue(comIteratedValue); 176 const bool fBool = comValue.GetSelected(); 177 strValue = fBool ? QApplication::translate("UIDetails", "Enabled", "details (cloud value)") 178 : QApplication::translate("UIDetails", "Disabled", "details (cloud value)"); 179 break; 180 } 181 case KFormValueType_String: 182 { 183 CStringFormValue comValue(comIteratedValue); 184 strValue = comValue.GetString(); 185 break; 186 } 187 case KFormValueType_Choice: 188 { 189 AssertMsgFailed(("Aren't we decided to convert all choices to strings?\n")); 190 CChoiceFormValue comValue(comIteratedValue); 191 const QVector<QString> possibleValues = comValue.GetValues(); 192 const int iCurrentIndex = comValue.GetSelectedIndex(); 193 strValue = possibleValues.value(iCurrentIndex); 194 break; 195 } 196 case KFormValueType_RangedInteger: 197 { 198 CRangedIntegerFormValue comValue(comIteratedValue); 199 strValue = QString("%1 %2") 200 .arg(comValue.GetInteger()) 201 .arg(QApplication::translate("UICommon", comValue.GetSuffix().toUtf8().constData())); 202 break; 203 } 204 default: 205 break; 206 } 168 /* Generate value: */ 169 const QString strValue = generateFormValueInformation(comIteratedValue); 207 170 208 171 /* Generate table string: */ 209 if (comIteratedValue.GetEnabled()) 210 table << UITextTableLine(strLabel, QString("<a href=#%1,%2>%3</a>").arg(strAnchorType, strLabel, strValue)); 211 else 212 table << UITextTableLine(strLabel, strValue); 172 table << UITextTableLine(strLabel, QString("<a href=#%1,%2>%3</a>").arg(strAnchorType, strLabel, strValue)); 213 173 } 214 174 } 215 175 216 176 return table; 177 } 178 179 QString UIDetailsGenerator::generateFormValueInformation(const CFormValue &comFormValue) 180 { 181 /* Handle possible form value types: */ 182 QString strResult; 183 switch (comFormValue.GetType()) 184 { 185 case KFormValueType_Boolean: 186 { 187 CBooleanFormValue comValue(comFormValue); 188 const bool fBool = comValue.GetSelected(); 189 strResult = fBool ? QApplication::translate("UIDetails", "Enabled", "details (cloud value)") 190 : QApplication::translate("UIDetails", "Disabled", "details (cloud value)"); 191 break; 192 } 193 case KFormValueType_String: 194 { 195 CStringFormValue comValue(comFormValue); 196 strResult = comValue.GetString(); 197 break; 198 } 199 case KFormValueType_Choice: 200 { 201 AssertMsgFailed(("Aren't we decided to convert all choices to strings?\n")); 202 CChoiceFormValue comValue(comFormValue); 203 const QVector<QString> possibleValues = comValue.GetValues(); 204 const int iCurrentIndex = comValue.GetSelectedIndex(); 205 strResult = possibleValues.value(iCurrentIndex); 206 break; 207 } 208 case KFormValueType_RangedInteger: 209 { 210 CRangedIntegerFormValue comValue(comFormValue); 211 strResult = QString("%1 %2") 212 .arg(comValue.GetInteger()) 213 .arg(QApplication::translate("UICommon", comValue.GetSuffix().toUtf8().constData())); 214 break; 215 } 216 default: 217 break; 218 } 219 /* Return result: */ 220 return strResult; 217 221 } 218 222 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.h
r83719 r86225 28 28 /* Forward declarations: */ 29 29 class CCloudMachine; 30 class CFormValue; 30 31 class CMachine; 31 32 … … 38 39 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationGeneral(CCloudMachine &comCloudMachine, 39 40 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral &fOptions); 41 SHARED_LIBRARY_STUFF QString generateFormValueInformation(const CFormValue &comFormValue); 40 42 41 43 SHARED_LIBRARY_STUFF UITextTable generateMachineInformationSystem(CMachine &comMachine,
Note:
See TracChangeset
for help on using the changeset viewer.