Changeset 51953 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 9, 2014 12:27:52 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/extradata
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r51952 r51953 356 356 /** Handles machine (un)registration. */ 357 357 void sltMachineRegistered(QString strID, bool fAdded); 358 /** Handles extra-data map acknowledging. */ 359 void sltExtraDataMapAcknowledging(QString strID); 358 360 /** Handles extra-data change. */ 359 361 void sltExtraDataChange(QString strID, QString strKey, QString strValue); … … 639 641 } 640 642 643 void UIExtraDataManagerWindow::sltExtraDataMapAcknowledging(QString strID) 644 { 645 /* Update item with 'changed ID' if it is among 'known IDs': */ 646 for (int iRow = 0; iRow < m_pModelSourceOfChooser->rowCount(); ++iRow) 647 if (chooserID(iRow) == strID) 648 m_pModelSourceOfChooser->itemFromIndex(chooserIndex(iRow))->setData(true, Field_Known); 649 } 650 641 651 void UIExtraDataManagerWindow::sltExtraDataChange(QString strID, QString strKey, QString strValue) 642 652 { … … 705 715 /* Add all the new items finally: */ 706 716 const QString strID = index.data(Field_ID).toString(); 707 AssertReturnVoid(gEDataManager->contains(strID)); 717 if (!gEDataManager->contains(strID)) 718 gEDataManager->hotloadMachineExtraDataMap(strID); 708 719 const ExtraDataMap data = gEDataManager->map(strID); 709 720 foreach (const QString &strKey, data.keys()) … … 1828 1839 #endif /* DEBUG */ 1829 1840 1841 void UIExtraDataManager::hotloadMachineExtraDataMap(const QString &strID) 1842 { 1843 /* Make sure it is valid ID: */ 1844 AssertMsgReturnVoid(!strID.isNull() && strID != GlobalID, 1845 ("Invalid VM ID = {%s}\n", strID.toAscii().constData())); 1846 /* Which is not loaded yet: */ 1847 AssertReturnVoid(!m_data.contains(strID)); 1848 1849 /* Search for corresponding machine: */ 1850 CVirtualBox vbox = vboxGlobal().virtualBox(); 1851 CMachine machine = vbox.FindMachine(strID); 1852 AssertReturnVoid(vbox.isOk() && !machine.isNull()); 1853 1854 /* Make sure at least empty map is created: */ 1855 m_data[strID] = ExtraDataMap(); 1856 1857 /* Do not handle inaccessible machine: */ 1858 if (!machine.GetAccessible()) 1859 return; 1860 1861 /* Load machine extra-data map: */ 1862 foreach (const QString &strKey, machine.GetExtraDataKeys()) 1863 m_data[strID][strKey] = machine.GetExtraData(strKey); 1864 1865 /* Notifies about extra-data map acknowledged: */ 1866 emit sigExtraDataMapAcknowledging(strID); 1867 } 1868 1830 1869 QString UIExtraDataManager::extraDataString(const QString &strKey, const QString &strID /* = GlobalID */) 1831 1870 { … … 3199 3238 m_pWindow = new UIExtraDataManagerWindow; 3200 3239 /* Configure window connections: */ 3240 connect(this, SIGNAL(sigExtraDataMapAcknowledging(QString)), 3241 m_pWindow, SLOT(sltExtraDataMapAcknowledging(QString))); 3201 3242 connect(this, SIGNAL(sigExtraDataChange(QString, QString, QString)), 3202 3243 m_pWindow, SLOT(sltExtraDataChange(QString, QString, QString))); … … 3206 3247 } 3207 3248 #endif /* DEBUG */ 3208 3209 void UIExtraDataManager::hotloadMachineExtraDataMap(const QString &strID)3210 {3211 /* Make sure it is valid ID: */3212 AssertMsgReturnVoid(!strID.isNull() && strID != GlobalID,3213 ("Invalid VM ID = {%s}\n", strID.toAscii().constData()));3214 /* Which is not loaded yet: */3215 AssertReturnVoid(!m_data.contains(strID));3216 3217 /* Search for corresponding machine: */3218 CVirtualBox vbox = vboxGlobal().virtualBox();3219 CMachine machine = vbox.FindMachine(strID);3220 AssertReturnVoid(vbox.isOk() && !machine.isNull());3221 3222 /* Make sure at least empty map is created: */3223 m_data[strID] = ExtraDataMap();3224 3225 /* Do not handle inaccessible machine: */3226 if (!machine.GetAccessible())3227 return;3228 3229 /* Load machine extra-data map: */3230 foreach (const QString &strKey, machine.GetExtraDataKeys())3231 m_data[strID][strKey] = machine.GetExtraData(strKey);3232 }3233 3249 3234 3250 bool UIExtraDataManager::isFeatureAllowed(const QString &strKey, const QString &strID /* = GlobalID */) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r51931 r51953 54 54 signals: 55 55 56 /** Notifies about extra-data map acknowledging. */ 57 void sigExtraDataMapAcknowledging(QString strID); 58 56 59 /** Notifies about extra-data change. */ 57 60 void sigExtraDataChange(QString strID, QString strKey, QString strValue); … … 96 99 /** Returns read-only extra-data map for passed @a strID. */ 97 100 const ExtraDataMap map(const QString &strID) const { return m_data.value(strID); } 101 102 /** Hot-load machine extra-data map. */ 103 void hotloadMachineExtraDataMap(const QString &strID); 98 104 99 105 /** Returns extra-data value corresponding to passed @a strKey as QString. … … 470 476 #endif /* DEBUG */ 471 477 472 /** Hot-load machine extra-data map. */473 void hotloadMachineExtraDataMap(const QString &strID);474 475 478 /** Determines whether feature corresponding to passed @a strKey is allowed. 476 479 * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
Note:
See TracChangeset
for help on using the changeset viewer.