Changeset 51196 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 6, 2014 3:28:35 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93578
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/extradata
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r51195 r51196 607 607 } 608 608 609 QStringList UIExtraDataManager::extraDataStringList(const QString &strKey, const QString &strID /* = QString() */) const 609 void UIExtraDataManager::setExtraDataString(const QString &strKey, const QString &strValue, const QString &strID /* = QString() */) 610 610 { 611 611 /* Hot-load machine extra-data map if necessary: */ … … 616 616 ExtraDataMap &data = m_data[strID]; 617 617 618 /* [Re]cache passed value: */ 619 data[strKey] = strValue; 620 621 /* Global extra-data: */ 622 if (strID.isNull()) 623 { 624 /* Get global object: */ 625 CVirtualBox vbox = vboxGlobal().virtualBox(); 626 /* Update global extra-data: */ 627 vbox.SetExtraData(strKey, strValue); 628 } 629 /* Machine extra-data: */ 630 else 631 { 632 /* Search for corresponding machine: */ 633 CVirtualBox vbox = vboxGlobal().virtualBox(); 634 CMachine machine = vbox.FindMachine(strID); 635 AssertReturnVoid(vbox.isOk() && !machine.isNull()); 636 /* Update machine extra-data: */ 637 machine.SetExtraData(strKey, strValue); 638 } 639 } 640 641 QStringList UIExtraDataManager::extraDataStringList(const QString &strKey, const QString &strID /* = QString() */) const 642 { 643 /* Hot-load machine extra-data map if necessary: */ 644 if (!strID.isNull() && !m_data.contains(strID)) 645 hotloadMachineExtraDataMap(strID); 646 647 /* Access corresponding map: */ 648 ExtraDataMap &data = m_data[strID]; 649 618 650 /* QStringList() if machine value was not set: */ 619 651 if (!data.contains(strKey)) … … 624 656 } 625 657 658 void UIExtraDataManager::setExtraDataStringList(const QString &strKey, const QStringList &strValue, const QString &strID /* = QString() */) 659 { 660 /* Hot-load machine extra-data map if necessary: */ 661 if (!strID.isNull() && !m_data.contains(strID)) 662 hotloadMachineExtraDataMap(strID); 663 664 /* Access corresponding map: */ 665 ExtraDataMap &data = m_data[strID]; 666 667 /* [Re]cache passed value: */ 668 data[strKey] = strValue.join(","); 669 670 /* Global extra-data: */ 671 if (strID.isNull()) 672 { 673 /* Get global object: */ 674 CVirtualBox vbox = vboxGlobal().virtualBox(); 675 /* Update global extra-data: */ 676 vbox.SetExtraDataStringList(strKey, strValue); 677 } 678 /* Machine extra-data: */ 679 else 680 { 681 /* Search for corresponding machine: */ 682 CVirtualBox vbox = vboxGlobal().virtualBox(); 683 CMachine machine = vbox.FindMachine(strID); 684 AssertReturnVoid(vbox.isOk() && !machine.isNull()); 685 /* Update machine extra-data: */ 686 machine.SetExtraDataStringList(strKey, strValue); 687 } 688 } 689 626 690 #include "UIExtraDataManager.moc" 627 691 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r51195 r51196 180 180 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */ 181 181 QString extraDataString(const QString &strKey, const QString &strID = QString()) const; 182 /** Defines extra-data value corresponding to passed @a strKey as strValue. 183 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */ 184 void setExtraDataString(const QString &strKey, const QString &strValue, const QString &strID = QString()); 182 185 183 186 /** Returns extra-data value corresponding to passed @a strKey as QStringList. 184 187 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */ 185 188 QStringList extraDataStringList(const QString &strKey, const QString &strID = QString()) const; 189 /** Defines extra-data value corresponding to passed @a strKey as strValue. 190 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */ 191 void setExtraDataStringList(const QString &strKey, const QStringList &strValue, const QString &strID = QString()); 186 192 187 193 /** Singleton Extra-data Manager instance. */
Note:
See TracChangeset
for help on using the changeset viewer.