Changeset 81095 in vbox
- Timestamp:
- Oct 1, 2019 3:38:34 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133705
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r81055 r81095 53 53 54 54 55 /** Known item states. */55 /** Item states. */ 56 56 enum ItemState 57 57 { … … 63 63 64 64 65 /** Known pixmap types. */65 /** Pixmap types. */ 66 66 enum PixmapType 67 67 { … … 159 159 {} 160 160 161 /** Returns whether the @aother passed data is equal to this one. */161 /** Returns whether @a another passed data is equal to this one. */ 162 162 bool equal(const UIDataSettingsMachineStorageAttachment &other) const 163 163 { … … 174 174 } 175 175 176 /** Returns whether the @aother passed data is equal to this one. */176 /** Returns whether @a another passed data is equal to this one. */ 177 177 bool operator==(const UIDataSettingsMachineStorageAttachment &other) const { return equal(other); } 178 /** Returns whether the @aother passed data is different from this one. */178 /** Returns whether @a another passed data is different from this one. */ 179 179 bool operator!=(const UIDataSettingsMachineStorageAttachment &other) const { return !equal(other); } 180 180 … … 210 210 {} 211 211 212 /** Returns whether the @aother passed data is equal to this one. */212 /** Returns whether @a another passed data is equal to this one. */ 213 213 bool equal(const UIDataSettingsMachineStorageController &other) const 214 214 { … … 222 222 } 223 223 224 /** Returns whether the @aother passed data is equal to this one. */224 /** Returns whether @a another passed data is equal to this one. */ 225 225 bool operator==(const UIDataSettingsMachineStorageController &other) const { return equal(other); } 226 /** Returns whether the @aother passed data is different from this one. */226 /** Returns whether @a another passed data is different from this one. */ 227 227 bool operator!=(const UIDataSettingsMachineStorageController &other) const { return !equal(other); } 228 228 … … 246 246 UIDataSettingsMachineStorage() {} 247 247 248 /** Returns whether the @aother passed data is equal to this one. */248 /** Returns whether @a another passed data is equal to this one. */ 249 249 bool operator==(const UIDataSettingsMachineStorage & /* other */) const { return true; } 250 /** Returns whether the @aother passed data is different from this one. */250 /** Returns whether @a another passed data is different from this one. */ 251 251 bool operator!=(const UIDataSettingsMachineStorage & /* other */) const { return false; } 252 252 }; … … 265 265 static void destroy(); 266 266 267 /** Returns pixmap corresponding to passed @a pixmapType. */267 /** Returns pixmap corresponding to passed @a enmPixmapType. */ 268 268 QPixmap pixmap(PixmapType pixmapType) const; 269 /** Returns icon (probably merged) corresponding to passed @a pixmapType and @a pixmapDisabledType. */269 /** Returns icon (probably merged) corresponding to passed @a enmPixmapType and @a pixmapDisabledType. */ 270 270 QIcon icon(PixmapType pixmapType, PixmapType pixmapDisabledType = InvalidPixmap) const; 271 271 … … 287 287 288 288 289 /* Abstract Item*/289 /** QITreeViewItem subclass used as abstract storage tree-view item. */ 290 290 class AbstractItem : public QITreeViewItem 291 291 { … … 294 294 public: 295 295 296 /** Item types. */ 296 297 enum ItemType 297 298 { … … 302 303 }; 303 304 305 /** Constructs top-level item passing @a pParent to the base-class. */ 304 306 AbstractItem(QITreeView *pParent); 307 /** Constructs sub-level item passing @a pParentItem to the base-class. */ 305 308 AbstractItem(AbstractItem *pParentItem); 309 /** Destructs item. */ 306 310 virtual ~AbstractItem(); 307 311 312 /** Returns parent-item. */ 308 313 AbstractItem* parent() const; 314 /** Returns ID. */ 309 315 QUuid id() const; 316 317 /** Returns machine ID. */ 310 318 QUuid machineId() const; 311 319 /** Defines @a uMchineId. */ 312 320 void setMachineId (const QUuid &uMchineId); 313 321 322 /** Returns runtime type information. */ 314 323 virtual ItemType rtti() const = 0; 324 /** Returns child item with specified @a iIndex. */ 315 325 virtual AbstractItem* childItem (int aIndex) const = 0; 326 /** Returns child item with specified @a uId. */ 316 327 virtual AbstractItem* childItemById (const QUuid &uId) const = 0; 328 /** Returns position of specified child @a pItem. */ 317 329 virtual int posOfChild (AbstractItem *aItem) const = 0; 330 /** Returns tool-tip information. */ 318 331 virtual QString tip() const = 0; 332 /** Returns pixmap information for specified @a enmState. */ 319 333 virtual QPixmap pixmap (ItemState aState = State_DefaultItem) = 0; 320 334 321 335 protected: 322 336 337 /** Adds a child @a pItem. */ 323 338 virtual void addChild (AbstractItem *aItem) = 0; 339 /** Removes the child @a pItem. */ 324 340 virtual void delChild (AbstractItem *aItem) = 0; 325 341 342 /** Holds the parent item reference. */ 326 343 AbstractItem *m_pParentItem; 344 /** Holds the item ID. */ 327 345 QUuid mId; 346 /** Holds the item machine ID. */ 328 347 QUuid mMachineId; 329 348 }; … … 331 350 332 351 333 /* Root Item*/352 /** AbstractItem subclass used as root storage tree-view item. */ 334 353 class RootItem : public AbstractItem 335 354 { … … 338 357 public: 339 358 359 /** Constructs top-level item passing @a pParent to the base-class. */ 340 360 RootItem(QITreeView *pParent); 361 /** Destructs item. */ 341 362 ~RootItem(); 342 363 364 /** Returns a number of shildren of certain @a enmBus type. */ 343 365 ULONG childCount (KStorageBus aBus) const; 344 366 345 367 private: 346 368 369 /** Returns runtime type information. */ 347 370 ItemType rtti() const; 371 /** Returns child item with specified @a iIndex. */ 348 372 AbstractItem* childItem (int aIndex) const; 373 /** Returns child item with specified @a uId. */ 349 374 AbstractItem* childItemById (const QUuid &uId) const; 375 /** Returns position of specified child @a pItem. */ 350 376 int posOfChild (AbstractItem *aItem) const; 377 /** Returns the number of children. */ 351 378 int childCount() const; 379 /** Returns the item text. */ 352 380 QString text() const; 381 /** Returns tool-tip information. */ 353 382 QString tip() const; 383 /** Returns pixmap information for specified @a enmState. */ 354 384 QPixmap pixmap (ItemState aState); 385 /** Adds a child @a pItem. */ 355 386 void addChild (AbstractItem *aItem); 387 /** Removes the child @a pItem. */ 356 388 void delChild (AbstractItem *aItem); 357 389 390 /** Holds the list of controller items. */ 358 391 QList <AbstractItem*> mControllers; 359 392 }; 360 393 361 394 362 /* Controller Item*/395 /** AbstractItem subclass used as controller storage tree-view item. */ 363 396 class ControllerItem : public AbstractItem 364 397 { … … 367 400 public: 368 401 402 /** Constructs sub-level item passing @a pParent to the base-class. 403 * @param strName Brings the controller name. 404 * @param enmBus Brings the controller bus. 405 * @param enmType Brings the controller type. */ 369 406 ControllerItem (AbstractItem *aParent, const QString &aName, KStorageBus aBusType, 370 407 KStorageControllerType aControllerType); 408 /** Destructs item. */ 371 409 ~ControllerItem(); 372 410 411 /** Returns bus. */ 373 412 KStorageBus ctrBusType() const; 413 /** Returns possible buses to switch from current one. */ 374 414 ControllerBusList ctrBusTypes() const; 415 /** Returns old controller name. */ 375 416 QString oldCtrName() const; 417 /** Returns current controller name. */ 376 418 QString ctrName() const; 419 /** Returns type. */ 377 420 KStorageControllerType ctrType() const; 421 /** Returns possible types to switch from current one. */ 378 422 ControllerTypeList ctrTypes() const; 423 /** Returns current port count. */ 379 424 uint portCount(); 425 /** Returns maximum port count. */ 380 426 uint maxPortCount(); 427 /** Returns whether controller uses IO cache. */ 381 428 bool ctrUseIoCache() const; 382 429 430 /** Defines @a enmBus. */ 383 431 void setCtrBusType(KStorageBus enmCtrBusType); 432 /** Defines @a strName. */ 384 433 void setCtrName (const QString &aCtrName); 434 /** Defines @a enmType. */ 385 435 void setCtrType (KStorageControllerType aCtrType); 436 /** Defines @a uPortCount. */ 386 437 void setPortCount (uint aPortCount); 438 /** Defines whether controller @a fUseIoCache. */ 387 439 void setCtrUseIoCache (bool aUseIoCache); 388 440 441 /** Returns possible controller slots. */ 389 442 SlotsList ctrAllSlots() const; 443 /** Returns used controller slots. */ 390 444 SlotsList ctrUsedSlots() const; 445 /** Returns supported device type list. */ 391 446 DeviceTypeList ctrDeviceTypeList() const; 392 447 448 /** Returns an ID list of attached media of specified @a enmType. */ 393 449 QList<QUuid> attachmentIDs(KDeviceType enmType = KDeviceType_Null) const; 394 450 451 /** Returns a list of attachments. */ 395 452 QList<AbstractItem*> attachments() const { return mAttachments; } 453 /** Defines a list of @a attachments. */ 396 454 void setAttachments(const QList<AbstractItem*> &attachments) { mAttachments = attachments; } 397 455 398 456 private: 399 457 458 /** Returns runtime type information. */ 400 459 ItemType rtti() const; 460 /** Returns child item with specified @a iIndex. */ 401 461 AbstractItem* childItem (int aIndex) const; 462 /** Returns child item with specified @a uId. */ 402 463 AbstractItem* childItemById (const QUuid &uId) const; 464 /** Returns position of specified child @a pItem. */ 403 465 int posOfChild (AbstractItem *aItem) const; 466 /** Returns the number of children. */ 404 467 int childCount() const; 468 /** Returns the item text. */ 405 469 QString text() const; 470 /** Returns tool-tip information. */ 406 471 QString tip() const; 472 /** Returns pixmap information for specified @a enmState. */ 407 473 QPixmap pixmap (ItemState aState); 474 /** Adds a child @a pItem. */ 408 475 void addChild (AbstractItem *aItem); 476 /** Removes the child @a pItem. */ 409 477 void delChild (AbstractItem *aItem); 410 478 479 /** Updates possible buses. */ 411 480 void updateBusInfo(); 481 /** Updates possible types. */ 412 482 void updateTypeInfo(); 483 /** Updates pixmaps of possible buses. */ 413 484 void updatePixmaps(); 414 485 486 /** Holds the bus. */ 415 487 KStorageBus mBusType; 488 /** Holds the type. */ 416 489 KStorageControllerType mCtrType; 417 490 491 /** Holds the possible buses. */ 418 492 ControllerBusList m_buses; 493 /** Holds the possible types. */ 419 494 ControllerTypeList m_types; 495 /** Holds the pixmaps of possible buses. */ 420 496 QList<PixmapType> m_pixmaps; 421 497 498 /** Holds the old name. */ 422 499 QString mOldCtrName; 500 /** Holds the current name. */ 423 501 QString mCtrName; 502 /** Holds the current port count. */ 424 503 uint mPortCount; 504 /** Holds whether controller uses IO cache. */ 425 505 bool mUseIoCache; 506 /** Holds the list of attachments. */ 426 507 QList <AbstractItem*> mAttachments; 427 508 }; 428 509 429 510 430 /* Attachment Item*/511 /** AbstractItem subclass used as attachment storage tree-view item. */ 431 512 class AttachmentItem : public AbstractItem 432 513 { … … 435 516 public: 436 517 518 /** Constructs sub-level item passing @a pParent to the base-class. 519 * @param enmDeviceType Brings the attachment device type. */ 437 520 AttachmentItem (AbstractItem *aParent, KDeviceType aDeviceType); 438 521 522 /** Returns storage slot. */ 439 523 StorageSlot attSlot() const; 524 /** Returns possible storage slots. */ 440 525 SlotsList attSlots() const; 526 /** Returns device type. */ 441 527 KDeviceType attDeviceType() const; 528 /** Returns possible device types. */ 442 529 DeviceTypeList attDeviceTypes() const; 530 /** Returns the medium id. */ 443 531 QUuid attMediumId() const; 532 /** Returns whether attachment is a host drive. */ 444 533 bool attIsHostDrive() const; 534 /** Returns whether attachment is passthrough. */ 445 535 bool attIsPassthrough() const; 536 /** Returns whether attachment is temporary ejectable. */ 446 537 bool attIsTempEject() const; 538 /** Returns whether attachment is non-rotational. */ 447 539 bool attIsNonRotational() const; 540 /** Returns whether attachment is hot-pluggable. */ 448 541 bool attIsHotPluggable() const; 449 542 543 /** Defines storage @a slot. */ 450 544 void setAttSlot (const StorageSlot &aAttSlot); 545 /** Defines @a enmDeviceType. */ 451 546 void setAttDevice (KDeviceType aAttDeviceType); 547 /** Defines @a uMediumId. */ 452 548 void setAttMediumId (const QUuid &uAttMediumId); 549 /** Defines whether attachment is @a fPassthrough. */ 453 550 void setAttIsPassthrough (bool aPassthrough); 551 /** Defines whether attachment is @a fTemporaryEjectable. */ 454 552 void setAttIsTempEject (bool aTempEject); 553 /** Defines whether attachment is @a fNonRotational. */ 455 554 void setAttIsNonRotational (bool aNonRotational); 555 /** Returns whether attachment is @a fIsHotPluggable. */ 456 556 void setAttIsHotPluggable(bool fIsHotPluggable); 457 557 558 /** Returns medium size. */ 458 559 QString attSize() const; 560 /** Returns logical medium size. */ 459 561 QString attLogicalSize() const; 562 /** Returns medium location. */ 460 563 QString attLocation() const; 564 /** Returns medium format. */ 461 565 QString attFormat() const; 566 /** Returns medium details. */ 462 567 QString attDetails() const; 568 /** Returns medium usage. */ 463 569 QString attUsage() const; 570 /** Returns medium encryption password ID. */ 464 571 QString attEncryptionPasswordID() const; 465 572 466 573 private: 467 574 575 /** Caches medium information. */ 468 576 void cache(); 469 577 578 /** Returns runtime type information. */ 470 579 ItemType rtti() const; 580 /** Returns child item with specified @a iIndex. */ 471 581 AbstractItem* childItem (int aIndex) const; 582 /** Returns child item with specified @a uId. */ 472 583 AbstractItem* childItemById (const QUuid &uId) const; 584 /** Returns position of specified child @a pItem. */ 473 585 int posOfChild (AbstractItem *aItem) const; 586 /** Returns the number of children. */ 474 587 int childCount() const; 588 /** Returns the item text. */ 475 589 QString text() const; 590 /** Returns tool-tip information. */ 476 591 QString tip() const; 592 /** Returns pixmap information for specified @a enmState. */ 477 593 QPixmap pixmap (ItemState aState); 594 /** Adds a child @a pItem. */ 478 595 void addChild (AbstractItem *aItem); 596 /** Removes the child @a pItem. */ 479 597 void delChild (AbstractItem *aItem); 480 598 599 /** Holds the device type. */ 481 600 KDeviceType mAttDeviceType; 482 601 602 /** Holds the storage slot. */ 483 603 StorageSlot mAttSlot; 604 /** Holds the medium ID. */ 484 605 QUuid mAttMediumId; 606 /** Holds whether attachment is a host drive. */ 485 607 bool mAttIsHostDrive; 608 /** Holds whether attachment is passthrough. */ 486 609 bool mAttIsPassthrough; 610 /** Holds whether attachment is temporary ejectable. */ 487 611 bool mAttIsTempEject; 612 /** Holds whether attachment is non-rotational. */ 488 613 bool mAttIsNonRotational; 614 /** Holds whether attachment is hot-pluggable. */ 489 615 bool m_fIsHotPluggable; 490 616 617 /** Holds the name. */ 491 618 QString mAttName; 619 /** Holds the tool-tip. */ 492 620 QString mAttTip; 621 /** Holds the pixmap. */ 493 622 QPixmap mAttPixmap; 494 623 624 /** Holds the medium size. */ 495 625 QString mAttSize; 626 /** Holds the logical medium size. */ 496 627 QString mAttLogicalSize; 628 /** Holds the medium location. */ 497 629 QString mAttLocation; 630 /** Holds the medium format. */ 498 631 QString mAttFormat; 632 /** Holds the medium details. */ 499 633 QString mAttDetails; 634 /** Holds the medium usage. */ 500 635 QString mAttUsage; 636 /** Holds the medium encryption password ID. */ 501 637 QString m_strAttEncryptionPasswordID; 502 638 }; 503 639 504 640 505 /* Storage Model*/641 /** QAbstractItemModel subclass used as complex storage model. */ 506 642 class StorageModel : public QAbstractItemModel 507 643 { … … 510 646 public: 511 647 648 /** Data roles. */ 512 649 enum DataRole 513 650 { … … 580 717 }; 581 718 719 /** Tool-tip types. */ 582 720 enum ToolTipType 583 721 { … … 589 727 }; 590 728 729 /** Constructs storage model passing @a pParent to the base-class. */ 591 730 StorageModel(QITreeView *pParent); 731 /** Destructs storage model. */ 592 732 ~StorageModel(); 593 733 734 /** Returns row count for the passed @a parentIndex. */ 594 735 int rowCount (const QModelIndex &aParent = QModelIndex()) const; 736 /** Returns column count for the passed @a parentIndex. */ 595 737 int columnCount (const QModelIndex &aParent = QModelIndex()) const; 596 738 739 /** Returns root item. */ 597 740 QModelIndex root() const; 741 /** Returns item specified by @a iRow, @a iColum and @a parentIndex. */ 598 742 QModelIndex index (int aRow, int aColumn, const QModelIndex &aParent = QModelIndex()) const; 743 /** Returns parent item of specified @a index item. */ 599 744 QModelIndex parent (const QModelIndex &aIndex) const; 600 745 746 /** Returns model data for specified @a index and @a iRole. */ 601 747 QVariant data (const QModelIndex &aIndex, int aRole) const; 748 /** Defines model data for specified @a index and @a iRole as @a value. */ 602 749 bool setData (const QModelIndex &aIndex, const QVariant &aValue, int aRole); 603 750 751 /** Adds controller with certain @a strCtrName, @a enmBus and @a enmType. */ 604 752 QModelIndex addController (const QString &aCtrName, KStorageBus aBusType, KStorageControllerType aCtrType); 753 /** Deletes controller with certain @a uCtrId. */ 605 754 void delController (const QUuid &uCtrId); 606 755 756 /** Adds attachment with certain @a enmDeviceType and @a uMediumId to controller with certain @a uCtrId. */ 607 757 QModelIndex addAttachment (const QUuid &uCtrId, KDeviceType aDeviceType, const QUuid &uMediumId); 758 /** Deletes attachment with certain @a uAttId from controller with certain @a uCtrId. */ 608 759 void delAttachment (const QUuid &uCtrId, const QUuid &uAttId); 609 /** Moves attachment determined by @a uAttId 610 * from controller determined by @a uCtrOldId to one determined by @a uCtrNewId. */ 760 /** Moves attachment with certain @a uAttId from controller with certain @a uCtrOldId to one with another @a uCtrNewId. */ 611 761 void moveAttachment(const QUuid &uAttId, const QUuid &uCtrOldId, const QUuid &uCtrNewId); 612 762 763 /** Defines @a uMachineId for reference. */ 613 764 void setMachineId (const QUuid &uMachineId); 614 765 766 /** Sorts the contents of model by @a iColumn and @a enmOrder. */ 615 767 void sort(int iColumn = 0, Qt::SortOrder order = Qt::AscendingOrder); 768 /** Returns attachment index by specified @a controllerIndex and @a attachmentStorageSlot. */ 616 769 QModelIndex attachmentBySlot(QModelIndex controllerIndex, StorageSlot attachmentStorageSlot); 617 770 771 /** Returns chipset type. */ 618 772 KChipsetType chipsetType() const; 773 /** Defines chipset @a enmType. */ 619 774 void setChipsetType(KChipsetType type); 620 775 621 /** Defines configuration access level. */776 /** Defines @a newConfigurationAccessLevel. */ 622 777 void setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel); 623 778 779 /** Clears model of all contents. */ 624 780 void clear(); 625 781 782 /** Returns current controller types. */ 626 783 QMap<KStorageBus, int> currentControllerTypes() const; 784 /** Returns maximum controller types. */ 627 785 QMap<KStorageBus, int> maximumControllerTypes() const; 628 786 629 787 private: 630 788 789 /** Returns model flags for specified @a index. */ 631 790 Qt::ItemFlags flags (const QModelIndex &aIndex) const; 632 791 792 /** Holds the root item instance. */ 633 793 AbstractItem *mRootItem; 634 794 795 /** Holds the enabled plus pixmap instance. */ 635 796 QPixmap mPlusPixmapEn; 797 /** Holds the disabled plus pixmap instance. */ 636 798 QPixmap mPlusPixmapDis; 637 799 800 /** Holds the enabled minus pixmap instance. */ 638 801 QPixmap mMinusPixmapEn; 802 /** Holds the disabled minus pixmap instance. */ 639 803 QPixmap mMinusPixmapDis; 640 804 805 /** Holds the tool-tip type. */ 641 806 ToolTipType mToolTipType; 642 807 808 /** Holds the chipset type. */ 643 809 KChipsetType m_chipsetType; 644 810 … … 649 815 650 816 651 /* Storage Delegate*/817 /** QItemDelegate subclass used as storage table item delegate. */ 652 818 class StorageDelegate : public QItemDelegate 653 819 { … … 656 822 public: 657 823 824 /** Constructs storage delegate passing @a pParent to the base-class. */ 658 825 StorageDelegate (QObject *aParent); 659 826 660 827 private: 661 828 829 /** Paints @a index item with specified @a option using specified @a pPainter. */ 662 830 void paint (QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const; 663 831 }; 664 832 665 833 666 /** 667 * UI Medium ID Holder. 668 * Used for compliance with other storage page widgets 669 * which caching and holding corresponding information. 670 */ 834 /** QObject subclass used as UI medium ID holder. 835 * Used for compliance with other storage page widgets 836 * which caching and holding corresponding information. */ 671 837 class UIMediumIDHolder : public QObject 672 838 { … … 675 841 public: 676 842 843 /** Constructs medium ID holder passing @a pParent to the base-class. */ 677 844 UIMediumIDHolder(QWidget *pParent) : QObject(pParent) {} 678 845 846 /** Returns medium ID. */ 679 847 QUuid id() const { return m_uId; } 848 /** Defines medium @a uId. */ 680 849 void setId(const QUuid &uId) { m_uId = uId; emit sigChanged(); } 681 850 851 /** Returns medium device type. */ 682 852 UIMediumDeviceType type() const { return m_type; } 853 /** Defines medium device @a enmType. */ 683 854 void setType(UIMediumDeviceType type) { m_type = type; } 684 855 856 /** Returns whether medium ID is null. */ 685 857 bool isNull() const { return m_uId == UIMedium().id(); } 686 858 687 859 signals: 688 860 861 /** Notify about medium ID changed. */ 689 862 void sigChanged(); 690 863 691 864 private: 692 865 866 /** Holds the medium ID. */ 693 867 QUuid m_uId; 868 /** Holds the medium device type. */ 694 869 UIMediumDeviceType m_type; 695 870 }; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r81055 r81095 61 61 ~UIMachineSettingsStorage(); 62 62 63 /** Defines chipset @a type. */63 /** Defines chipset @a enmType. */ 64 64 void setChipsetType(KChipsetType enmType); 65 65
Note:
See TracChangeset
for help on using the changeset viewer.