Changeset 88552 in vbox for trunk/src/VBox
- Timestamp:
- Apr 15, 2021 5:10:32 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/details
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.cpp
r82968 r88552 112 112 m_pRoot->rebuildGroup(); 113 113 m_pContextMenu->updateCategoryStates(); 114 115 /* Save categories: */ 116 gEDataManager->setSelectorWindowDetailsElements(m_categories); 114 117 } 115 118 … … 119 122 m_pRoot->rebuildGroup(); 120 123 m_pContextMenu->updateOptionStates(DetailsElementType_General); 124 125 /* Save general options: */ 126 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 127 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeGeneral"); 128 if (iEnumIndex != -1) 129 { 130 bool fDefault = true; 131 QStringList options; 132 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 133 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 134 { 135 /* Prepare current option type: */ 136 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral enmOptionType = 137 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 138 /* Skip invalid and default types: */ 139 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Invalid 140 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default) 141 continue; 142 /* If option type enabled: */ 143 if (m_fOptionsGeneral & enmOptionType) 144 { 145 /* Add it to the list: */ 146 options << gpConverter->toInternalString(enmOptionType); 147 /* Make sure item is included by default: */ 148 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default & enmOptionType)) 149 fDefault = false; 150 } 151 /* If option type disabled: */ 152 else 153 { 154 /* Make sure item is excluded by default: */ 155 if (UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default & enmOptionType) 156 fDefault = false; 157 } 158 /* Save options: */ 159 if (!fDefault) 160 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_General, options); 161 else 162 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_General, QStringList()); 163 } 164 } 121 165 } 122 166 … … 126 170 m_pRoot->rebuildGroup(); 127 171 m_pContextMenu->updateOptionStates(DetailsElementType_System); 172 173 /* Save system options: */ 174 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 175 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeSystem"); 176 if (iEnumIndex != -1) 177 { 178 bool fDefault = true; 179 QStringList options; 180 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 181 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 182 { 183 /* Prepare current option type: */ 184 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem enmOptionType = 185 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSystem>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 186 /* Skip invalid and default types: */ 187 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Invalid 188 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default) 189 continue; 190 /* If option type enabled: */ 191 if (m_fOptionsSystem & enmOptionType) 192 { 193 /* Add it to the list: */ 194 options << gpConverter->toInternalString(enmOptionType); 195 /* Make sure item is included by default: */ 196 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default & enmOptionType)) 197 fDefault = false; 198 } 199 /* If option type disabled: */ 200 else 201 { 202 /* Make sure item is excluded by default: */ 203 if (UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default & enmOptionType) 204 fDefault = false; 205 } 206 /* Save options: */ 207 if (!fDefault) 208 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_System, options); 209 else 210 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_System, QStringList()); 211 } 212 } 128 213 } 129 214 … … 133 218 m_pRoot->rebuildGroup(); 134 219 m_pContextMenu->updateOptionStates(DetailsElementType_Display); 220 221 /* Save display options: */ 222 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 223 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeDisplay"); 224 if (iEnumIndex != -1) 225 { 226 bool fDefault = true; 227 QStringList options; 228 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 229 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 230 { 231 /* Prepare current option type: */ 232 const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay enmOptionType = 233 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 234 /* Skip invalid and default types: */ 235 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Invalid 236 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default) 237 continue; 238 /* If option type enabled: */ 239 if (m_fOptionsDisplay & enmOptionType) 240 { 241 /* Add it to the list: */ 242 options << gpConverter->toInternalString(enmOptionType); 243 /* Make sure item is included by default: */ 244 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default & enmOptionType)) 245 fDefault = false; 246 } 247 /* If option type disabled: */ 248 else 249 { 250 /* Make sure item is excluded by default: */ 251 if (UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default & enmOptionType) 252 fDefault = false; 253 } 254 /* Save options: */ 255 if (!fDefault) 256 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Display, options); 257 else 258 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Display, QStringList()); 259 } 260 } 135 261 } 136 262 … … 140 266 m_pRoot->rebuildGroup(); 141 267 m_pContextMenu->updateOptionStates(DetailsElementType_Storage); 268 269 /* Save storage options: */ 270 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 271 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeStorage"); 272 if (iEnumIndex != -1) 273 { 274 bool fDefault = true; 275 QStringList options; 276 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 277 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 278 { 279 /* Prepare current option type: */ 280 const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage enmOptionType = 281 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeStorage>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 282 /* Skip invalid and default types: */ 283 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Invalid 284 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default) 285 continue; 286 /* If option type enabled: */ 287 if (m_fOptionsStorage & enmOptionType) 288 { 289 /* Add it to the list: */ 290 options << gpConverter->toInternalString(enmOptionType); 291 /* Make sure item is included by default: */ 292 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default & enmOptionType)) 293 fDefault = false; 294 } 295 /* If option type disabled: */ 296 else 297 { 298 /* Make sure item is excluded by default: */ 299 if (UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default & enmOptionType) 300 fDefault = false; 301 } 302 /* Save options: */ 303 if (!fDefault) 304 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Storage, options); 305 else 306 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Storage, QStringList()); 307 } 308 } 142 309 } 143 310 … … 147 314 m_pRoot->rebuildGroup(); 148 315 m_pContextMenu->updateOptionStates(DetailsElementType_Audio); 316 317 /* Save audio options: */ 318 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 319 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeAudio"); 320 if (iEnumIndex != -1) 321 { 322 bool fDefault = true; 323 QStringList options; 324 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 325 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 326 { 327 /* Prepare current option type: */ 328 const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio enmOptionType = 329 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeAudio>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 330 /* Skip invalid and default types: */ 331 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Invalid 332 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default) 333 continue; 334 /* If option type enabled: */ 335 if (m_fOptionsAudio & enmOptionType) 336 { 337 /* Add it to the list: */ 338 options << gpConverter->toInternalString(enmOptionType); 339 /* Make sure item is included by default: */ 340 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default & enmOptionType)) 341 fDefault = false; 342 } 343 /* If option type disabled: */ 344 else 345 { 346 /* Make sure item is excluded by default: */ 347 if (UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default & enmOptionType) 348 fDefault = false; 349 } 350 /* Save options: */ 351 if (!fDefault) 352 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Audio, options); 353 else 354 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Audio, QStringList()); 355 } 356 } 149 357 } 150 358 … … 154 362 m_pRoot->rebuildGroup(); 155 363 m_pContextMenu->updateOptionStates(DetailsElementType_Network); 364 365 /* Save network options: */ 366 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 367 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeNetwork"); 368 if (iEnumIndex != -1) 369 { 370 bool fDefault = true; 371 QStringList options; 372 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 373 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 374 { 375 /* Prepare current option type: */ 376 const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork enmOptionType = 377 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 378 /* Skip invalid and default types: */ 379 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid 380 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default) 381 continue; 382 /* If option type enabled: */ 383 if (m_fOptionsNetwork & enmOptionType) 384 { 385 /* Add it to the list: */ 386 options << gpConverter->toInternalString(enmOptionType); 387 /* Make sure item is included by default: */ 388 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default & enmOptionType)) 389 fDefault = false; 390 } 391 /* If option type disabled: */ 392 else 393 { 394 /* Make sure item is excluded by default: */ 395 if (UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default & enmOptionType) 396 fDefault = false; 397 } 398 /* Save options: */ 399 if (!fDefault) 400 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Network, options); 401 else 402 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Network, QStringList()); 403 } 404 } 156 405 } 157 406 … … 161 410 m_pRoot->rebuildGroup(); 162 411 m_pContextMenu->updateOptionStates(DetailsElementType_Serial); 412 413 /* Save serial options: */ 414 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 415 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeSerial"); 416 if (iEnumIndex != -1) 417 { 418 bool fDefault = true; 419 QStringList options; 420 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 421 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 422 { 423 /* Prepare current option type: */ 424 const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial enmOptionType = 425 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSerial>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 426 /* Skip invalid and default types: */ 427 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Invalid 428 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default) 429 continue; 430 /* If option type enabled: */ 431 if (m_fOptionsSerial & enmOptionType) 432 { 433 /* Add it to the list: */ 434 options << gpConverter->toInternalString(enmOptionType); 435 /* Make sure item is included by default: */ 436 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default & enmOptionType)) 437 fDefault = false; 438 } 439 /* If option type disabled: */ 440 else 441 { 442 /* Make sure item is excluded by default: */ 443 if (UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default & enmOptionType) 444 fDefault = false; 445 } 446 /* Save options: */ 447 if (!fDefault) 448 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Serial, options); 449 else 450 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Serial, QStringList()); 451 } 452 } 163 453 } 164 454 … … 168 458 m_pRoot->rebuildGroup(); 169 459 m_pContextMenu->updateOptionStates(DetailsElementType_USB); 460 461 /* Save USB options: */ 462 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 463 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeUsb"); 464 if (iEnumIndex != -1) 465 { 466 bool fDefault = true; 467 QStringList options; 468 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 469 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 470 { 471 /* Prepare current option type: */ 472 const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb enmOptionType = 473 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeUsb>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 474 /* Skip invalid and default types: */ 475 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Invalid 476 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default) 477 continue; 478 /* If option type enabled: */ 479 if (m_fOptionsUsb & enmOptionType) 480 { 481 /* Add it to the list: */ 482 options << gpConverter->toInternalString(enmOptionType); 483 /* Make sure item is included by default: */ 484 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default & enmOptionType)) 485 fDefault = false; 486 } 487 /* If option type disabled: */ 488 else 489 { 490 /* Make sure item is excluded by default: */ 491 if (UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default & enmOptionType) 492 fDefault = false; 493 } 494 /* Save options: */ 495 if (!fDefault) 496 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_USB, options); 497 else 498 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_USB, QStringList()); 499 } 500 } 170 501 } 171 502 … … 175 506 m_pRoot->rebuildGroup(); 176 507 m_pContextMenu->updateOptionStates(DetailsElementType_SF); 508 509 /* Save shared folders options: */ 510 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 511 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeSharedFolders"); 512 if (iEnumIndex != -1) 513 { 514 bool fDefault = true; 515 QStringList options; 516 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 517 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 518 { 519 /* Prepare current option type: */ 520 const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders enmOptionType = 521 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 522 /* Skip invalid and default types: */ 523 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Invalid 524 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default) 525 continue; 526 /* If option type enabled: */ 527 if (m_fOptionsSharedFolders & enmOptionType) 528 { 529 /* Add it to the list: */ 530 options << gpConverter->toInternalString(enmOptionType); 531 /* Make sure item is included by default: */ 532 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default & enmOptionType)) 533 fDefault = false; 534 } 535 /* If option type disabled: */ 536 else 537 { 538 /* Make sure item is excluded by default: */ 539 if (UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default & enmOptionType) 540 fDefault = false; 541 } 542 /* Save options: */ 543 if (!fDefault) 544 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_SF, options); 545 else 546 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_SF, QStringList()); 547 } 548 } 177 549 } 178 550 … … 182 554 m_pRoot->rebuildGroup(); 183 555 m_pContextMenu->updateOptionStates(DetailsElementType_UI); 556 557 /* Save user interface options: */ 558 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 559 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeUserInterface"); 560 if (iEnumIndex != -1) 561 { 562 bool fDefault = true; 563 QStringList options; 564 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 565 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 566 { 567 /* Prepare current option type: */ 568 const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface enmOptionType = 569 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 570 /* Skip invalid and default types: */ 571 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Invalid 572 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Default) 573 continue; 574 /* If option type enabled: */ 575 if (m_fOptionsUserInterface & enmOptionType) 576 { 577 /* Add it to the list: */ 578 options << gpConverter->toInternalString(enmOptionType); 579 /* Make sure item is included by default: */ 580 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Default & enmOptionType)) 581 fDefault = false; 582 } 583 /* If option type disabled: */ 584 else 585 { 586 /* Make sure item is excluded by default: */ 587 if (UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Default & enmOptionType) 588 fDefault = false; 589 } 590 /* Save options: */ 591 if (!fDefault) 592 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_UI, options); 593 else 594 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_UI, QStringList()); 595 } 596 } 184 597 } 185 598 … … 189 602 m_pRoot->rebuildGroup(); 190 603 m_pContextMenu->updateOptionStates(DetailsElementType_Description); 604 605 /* Save description options: */ 606 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject; 607 const int iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeDescription"); 608 if (iEnumIndex != -1) 609 { 610 bool fDefault = true; 611 QStringList options; 612 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex); 613 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex) 614 { 615 /* Prepare current option type: */ 616 const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription enmOptionType = 617 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(metaEnum.keyToValue(metaEnum.key(iKeyIndex))); 618 /* Skip invalid and default types: */ 619 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Invalid 620 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Default) 621 continue; 622 /* If option type enabled: */ 623 if (m_fOptionsDescription & enmOptionType) 624 { 625 /* Add it to the list: */ 626 options << gpConverter->toInternalString(enmOptionType); 627 /* Make sure item is included by default: */ 628 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Default & enmOptionType)) 629 fDefault = false; 630 } 631 /* If option type disabled: */ 632 else 633 { 634 /* Make sure item is excluded by default: */ 635 if (UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Default & enmOptionType) 636 fDefault = false; 637 } 638 /* Save options: */ 639 if (!fDefault) 640 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Description, options); 641 else 642 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Description, QStringList()); 643 } 644 } 191 645 } 192 646 … … 289 743 /* Update element open/close status: */ 290 744 if (m_categories.contains(enmType)) 745 { 291 746 m_categories[enmType] = fToggled; 747 gEDataManager->setSelectorWindowDetailsElements(m_categories); 748 } 292 749 } 293 750 … … 491 948 } 492 949 493 void UIDetailsModel::saveDetailsOptions()494 {495 /* We will use that one for all the options fetching: */496 const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;497 int iEnumIndex = -1;498 499 /* General options: */500 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeGeneral");501 if (iEnumIndex != -1)502 {503 bool fDefault = true;504 QStringList options;505 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);506 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)507 {508 /* Prepare current option type: */509 const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral enmOptionType =510 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));511 /* Skip invalid and default types: */512 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Invalid513 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default)514 continue;515 /* If option type enabled: */516 if (m_fOptionsGeneral & enmOptionType)517 {518 /* Add it to the list: */519 options << gpConverter->toInternalString(enmOptionType);520 /* Make sure item is included by default: */521 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default & enmOptionType))522 fDefault = false;523 }524 /* If option type disabled: */525 else526 {527 /* Make sure item is excluded by default: */528 if (UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default & enmOptionType)529 fDefault = false;530 }531 /* Save options: */532 if (!fDefault)533 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_General, options);534 else535 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_General, QStringList());536 }537 }538 539 /* System options: */540 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeSystem");541 if (iEnumIndex != -1)542 {543 bool fDefault = true;544 QStringList options;545 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);546 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)547 {548 /* Prepare current option type: */549 const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem enmOptionType =550 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSystem>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));551 /* Skip invalid and default types: */552 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Invalid553 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default)554 continue;555 /* If option type enabled: */556 if (m_fOptionsSystem & enmOptionType)557 {558 /* Add it to the list: */559 options << gpConverter->toInternalString(enmOptionType);560 /* Make sure item is included by default: */561 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default & enmOptionType))562 fDefault = false;563 }564 /* If option type disabled: */565 else566 {567 /* Make sure item is excluded by default: */568 if (UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default & enmOptionType)569 fDefault = false;570 }571 /* Save options: */572 if (!fDefault)573 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_System, options);574 else575 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_System, QStringList());576 }577 }578 579 /* Display options: */580 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeDisplay");581 if (iEnumIndex != -1)582 {583 bool fDefault = true;584 QStringList options;585 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);586 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)587 {588 /* Prepare current option type: */589 const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay enmOptionType =590 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));591 /* Skip invalid and default types: */592 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Invalid593 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default)594 continue;595 /* If option type enabled: */596 if (m_fOptionsDisplay & enmOptionType)597 {598 /* Add it to the list: */599 options << gpConverter->toInternalString(enmOptionType);600 /* Make sure item is included by default: */601 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default & enmOptionType))602 fDefault = false;603 }604 /* If option type disabled: */605 else606 {607 /* Make sure item is excluded by default: */608 if (UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default & enmOptionType)609 fDefault = false;610 }611 /* Save options: */612 if (!fDefault)613 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Display, options);614 else615 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Display, QStringList());616 }617 }618 619 /* Storage options: */620 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeStorage");621 if (iEnumIndex != -1)622 {623 bool fDefault = true;624 QStringList options;625 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);626 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)627 {628 /* Prepare current option type: */629 const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage enmOptionType =630 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeStorage>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));631 /* Skip invalid and default types: */632 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Invalid633 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default)634 continue;635 /* If option type enabled: */636 if (m_fOptionsStorage & enmOptionType)637 {638 /* Add it to the list: */639 options << gpConverter->toInternalString(enmOptionType);640 /* Make sure item is included by default: */641 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default & enmOptionType))642 fDefault = false;643 }644 /* If option type disabled: */645 else646 {647 /* Make sure item is excluded by default: */648 if (UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default & enmOptionType)649 fDefault = false;650 }651 /* Save options: */652 if (!fDefault)653 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Storage, options);654 else655 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Storage, QStringList());656 }657 }658 659 /* Audio options: */660 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeAudio");661 if (iEnumIndex != -1)662 {663 bool fDefault = true;664 QStringList options;665 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);666 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)667 {668 /* Prepare current option type: */669 const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio enmOptionType =670 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeAudio>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));671 /* Skip invalid and default types: */672 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Invalid673 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default)674 continue;675 /* If option type enabled: */676 if (m_fOptionsAudio & enmOptionType)677 {678 /* Add it to the list: */679 options << gpConverter->toInternalString(enmOptionType);680 /* Make sure item is included by default: */681 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default & enmOptionType))682 fDefault = false;683 }684 /* If option type disabled: */685 else686 {687 /* Make sure item is excluded by default: */688 if (UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default & enmOptionType)689 fDefault = false;690 }691 /* Save options: */692 if (!fDefault)693 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Audio, options);694 else695 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Audio, QStringList());696 }697 }698 699 /* Network options: */700 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeNetwork");701 if (iEnumIndex != -1)702 {703 bool fDefault = true;704 QStringList options;705 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);706 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)707 {708 /* Prepare current option type: */709 const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork enmOptionType =710 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));711 /* Skip invalid and default types: */712 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid713 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default)714 continue;715 /* If option type enabled: */716 if (m_fOptionsNetwork & enmOptionType)717 {718 /* Add it to the list: */719 options << gpConverter->toInternalString(enmOptionType);720 /* Make sure item is included by default: */721 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default & enmOptionType))722 fDefault = false;723 }724 /* If option type disabled: */725 else726 {727 /* Make sure item is excluded by default: */728 if (UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default & enmOptionType)729 fDefault = false;730 }731 /* Save options: */732 if (!fDefault)733 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Network, options);734 else735 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Network, QStringList());736 }737 }738 739 /* Serial options: */740 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeSerial");741 if (iEnumIndex != -1)742 {743 bool fDefault = true;744 QStringList options;745 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);746 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)747 {748 /* Prepare current option type: */749 const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial enmOptionType =750 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSerial>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));751 /* Skip invalid and default types: */752 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Invalid753 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default)754 continue;755 /* If option type enabled: */756 if (m_fOptionsSerial & enmOptionType)757 {758 /* Add it to the list: */759 options << gpConverter->toInternalString(enmOptionType);760 /* Make sure item is included by default: */761 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default & enmOptionType))762 fDefault = false;763 }764 /* If option type disabled: */765 else766 {767 /* Make sure item is excluded by default: */768 if (UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default & enmOptionType)769 fDefault = false;770 }771 /* Save options: */772 if (!fDefault)773 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Serial, options);774 else775 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Serial, QStringList());776 }777 }778 779 /* Usb options: */780 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeUsb");781 if (iEnumIndex != -1)782 {783 bool fDefault = true;784 QStringList options;785 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);786 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)787 {788 /* Prepare current option type: */789 const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb enmOptionType =790 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeUsb>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));791 /* Skip invalid and default types: */792 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Invalid793 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default)794 continue;795 /* If option type enabled: */796 if (m_fOptionsUsb & enmOptionType)797 {798 /* Add it to the list: */799 options << gpConverter->toInternalString(enmOptionType);800 /* Make sure item is included by default: */801 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default & enmOptionType))802 fDefault = false;803 }804 /* If option type disabled: */805 else806 {807 /* Make sure item is excluded by default: */808 if (UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default & enmOptionType)809 fDefault = false;810 }811 /* Save options: */812 if (!fDefault)813 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_USB, options);814 else815 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_USB, QStringList());816 }817 }818 819 /* SharedFolders options: */820 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeSharedFolders");821 if (iEnumIndex != -1)822 {823 bool fDefault = true;824 QStringList options;825 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);826 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)827 {828 /* Prepare current option type: */829 const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders enmOptionType =830 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));831 /* Skip invalid and default types: */832 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Invalid833 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default)834 continue;835 /* If option type enabled: */836 if (m_fOptionsSharedFolders & enmOptionType)837 {838 /* Add it to the list: */839 options << gpConverter->toInternalString(enmOptionType);840 /* Make sure item is included by default: */841 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default & enmOptionType))842 fDefault = false;843 }844 /* If option type disabled: */845 else846 {847 /* Make sure item is excluded by default: */848 if (UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default & enmOptionType)849 fDefault = false;850 }851 /* Save options: */852 if (!fDefault)853 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_SF, options);854 else855 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_SF, QStringList());856 }857 }858 859 /* UserInterface options: */860 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeUserInterface");861 if (iEnumIndex != -1)862 {863 bool fDefault = true;864 QStringList options;865 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);866 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)867 {868 /* Prepare current option type: */869 const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface enmOptionType =870 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));871 /* Skip invalid and default types: */872 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Invalid873 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Default)874 continue;875 /* If option type enabled: */876 if (m_fOptionsUserInterface & enmOptionType)877 {878 /* Add it to the list: */879 options << gpConverter->toInternalString(enmOptionType);880 /* Make sure item is included by default: */881 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Default & enmOptionType))882 fDefault = false;883 }884 /* If option type disabled: */885 else886 {887 /* Make sure item is excluded by default: */888 if (UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Default & enmOptionType)889 fDefault = false;890 }891 /* Save options: */892 if (!fDefault)893 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_UI, options);894 else895 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_UI, QStringList());896 }897 }898 899 /* Description options: */900 iEnumIndex = smo.indexOfEnumerator("DetailsElementOptionTypeDescription");901 if (iEnumIndex != -1)902 {903 bool fDefault = true;904 QStringList options;905 const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);906 for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)907 {908 /* Prepare current option type: */909 const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription enmOptionType =910 static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));911 /* Skip invalid and default types: */912 if ( enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Invalid913 || enmOptionType == UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Default)914 continue;915 /* If option type enabled: */916 if (m_fOptionsDescription & enmOptionType)917 {918 /* Add it to the list: */919 options << gpConverter->toInternalString(enmOptionType);920 /* Make sure item is included by default: */921 if (!(UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Default & enmOptionType))922 fDefault = false;923 }924 /* If option type disabled: */925 else926 {927 /* Make sure item is excluded by default: */928 if (UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Default & enmOptionType)929 fDefault = false;930 }931 /* Save options: */932 if (!fDefault)933 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Description, options);934 else935 gEDataManager->setVBoxManagerDetailsPaneElementOptions(DetailsElementType_Description, QStringList());936 }937 }938 }939 940 void UIDetailsModel::saveDetailsCategories()941 {942 gEDataManager->setSelectorWindowDetailsElements(m_categories);943 }944 945 void UIDetailsModel::saveSettings()946 {947 saveDetailsOptions();948 saveDetailsCategories();949 }950 951 950 void UIDetailsModel::cleanupContextMenu() 952 951 { … … 970 969 { 971 970 /* Cleanup things: */ 972 saveSettings();973 971 cleanupContextMenu(); 974 972 cleanupRoot(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.h
r82968 r88552 206 206 void loadDetailsOptions(DetailsElementType enmType = DetailsElementType_Invalid); 207 207 208 /** Saves details options. */209 void saveDetailsOptions();210 /** Saves details categories. */211 void saveDetailsCategories();212 /** Saves settings. */213 void saveSettings();214 208 /** Cleanups context-menu. */ 215 209 void cleanupContextMenu();
Note:
See TracChangeset
for help on using the changeset viewer.