- Timestamp:
- Sep 4, 2013 1:17:43 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r48261 r48264 1747 1747 it = m_mediums.insert (it, uimedium); 1748 1748 1749 emit sigMediumCreated( *it);1749 emit sigMediumCreated((*it).id()); 1750 1750 } 1751 1751 … … 1762 1762 *it = uimedium; 1763 1763 1764 emit sigMediumUpdated( *it);1764 emit sigMediumUpdated((*it).id()); 1765 1765 } 1766 1766 … … 1796 1796 { 1797 1797 pParent->refresh(); 1798 emit sigMediumUpdated( *pParent);1798 emit sigMediumUpdated(pParent->id()); 1799 1799 } 1800 1800 } … … 4018 4018 4019 4019 /* Notify listeners about newly enumerated medium: */ 4020 emit sigMediumEnumerated( *pMediumEnumeratedEvent->m_iterator);4020 emit sigMediumEnumerated((*pMediumEnumeratedEvent->m_iterator).id()); 4021 4021 4022 4022 /* Accept event: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r48261 r48264 373 373 374 374 /* Notifiers: Medium-processing stuff: */ 375 void sigMediumCreated(const UIMedium &medium);376 void sigMediumUpdated(const UIMedium &medium);375 void sigMediumCreated(const QString &strMediumID); 376 void sigMediumUpdated(const QString &strMediumID); 377 377 void sigMediumDeleted(const QString &strMediumID); 378 378 379 379 /* Notifiers: Medium-enumeration stuff: */ 380 380 void sigMediumEnumerationStarted(); 381 void sigMediumEnumerated(const UIMedium &medium);381 void sigMediumEnumerated(const QString &strMediumID); 382 382 void sigMediumEnumerationFinished(); 383 383 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r48260 r48264 272 272 } 273 273 274 void UIMediumManager::sltHandleMediumCreated(const UIMedium &medium) 275 { 274 void UIMediumManager::sltHandleMediumCreated(const QString &strMediumID) 275 { 276 /* Search for corresponding medium: */ 277 UIMedium medium = vboxGlobal().medium(strMediumID); 278 276 279 /* Ignore non-interesting mediums: */ 277 280 if ((medium.isNull()) || (medium.isHostDrive())) … … 337 340 } 338 341 339 void UIMediumManager::sltHandleMediumUpdated(const UIMedium &medium) 340 { 342 void UIMediumManager::sltHandleMediumUpdated(const QString &strMediumID) 343 { 344 /* Search for corresponding medium: */ 345 UIMedium medium = vboxGlobal().medium(strMediumID); 346 341 347 /* Ignore non-interesting mediums: */ 342 348 if ((medium.isNull()) || (medium.isHostDrive())) … … 420 426 VBoxMediaList::const_iterator it; 421 427 for (it = mediums.begin(); it != mediums.end(); ++it) 422 sltHandleMediumCreated( *it);428 sltHandleMediumCreated((*it).id()); 423 429 424 430 /* Select the first item to be the current one … … 438 444 } 439 445 440 void UIMediumManager::sltHandleMediumEnumerated(const UIMedium &medium)446 void UIMediumManager::sltHandleMediumEnumerated(const QString &strMediumID) 441 447 { 442 448 /* Handle medium-update: */ 443 sltHandleMediumUpdated( medium);449 sltHandleMediumUpdated(strMediumID); 444 450 445 451 /* Advance progress-bar: */ … … 858 864 859 865 /* Configure medium-processing connections: */ 860 connect(&vboxGlobal(), SIGNAL(sigMediumCreated(const UIMedium&)),861 this, SLOT(sltHandleMediumCreated(const UIMedium&)));862 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const UIMedium&)),863 this, SLOT(sltHandleMediumUpdated(const UIMedium&)));866 connect(&vboxGlobal(), SIGNAL(sigMediumCreated(const QString&)), 867 this, SLOT(sltHandleMediumCreated(const QString&))); 868 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const QString&)), 869 this, SLOT(sltHandleMediumUpdated(const QString&))); 864 870 connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)), 865 871 this, SLOT(sltHandleMediumDeleted(const QString&))); … … 868 874 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationStarted()), 869 875 this, SLOT(sltHandleMediumEnumerationStart())); 870 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const UIMedium&)),871 this, SLOT(sltHandleMediumEnumerated(const UIMedium&)));876 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const QString&)), 877 this, SLOT(sltHandleMediumEnumerated(const QString&))); 872 878 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), 873 879 this, SLOT(sltHandleMediumEnumerationFinish())); … … 1159 1165 for (it = mediums.begin(); it != mediums.end(); ++it) 1160 1166 { 1161 sltHandleMediumCreated( *it);1167 sltHandleMediumCreated((*it).id()); 1162 1168 /* But advance progress-bar only for created mediums: */ 1163 1169 if ((*it).state() != KMediumState_NotCreated) -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r48260 r48264 64 64 65 65 /* Handlers: Medium-processing stuff: */ 66 void sltHandleMediumCreated(const UIMedium &medium);67 void sltHandleMediumUpdated(const UIMedium &medium);66 void sltHandleMediumCreated(const QString &strMediumID); 67 void sltHandleMediumUpdated(const QString &strMediumID); 68 68 void sltHandleMediumDeleted(const QString &strMediumID); 69 69 70 70 /* Handlers: Medium-enumeration stuff: */ 71 71 void sltHandleMediumEnumerationStart(); 72 void sltHandleMediumEnumerated(const UIMedium &medium);72 void sltHandleMediumEnumerated(const QString &strMediumID); 73 73 void sltHandleMediumEnumerationFinish(); 74 74 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r48260 r48264 1831 1831 1832 1832 /* Setup connections: */ 1833 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const UIMedium&)),1834 this, SLOT(sltHandleMediumUpdated(const UIMedium&)));1835 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const UIMedium&)),1836 this, SLOT(sltHandleMediumUpdated(const UIMedium&)));1833 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const QString&)), 1834 this, SLOT(sltHandleMediumUpdated(const QString&))); 1835 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const QString&)), 1836 this, SLOT(sltHandleMediumUpdated(const QString&))); 1837 1837 connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)), 1838 1838 this, SLOT(sltHandleMediumDeleted(const QString&))); … … 2271 2271 } 2272 2272 2273 void UIMachineSettingsStorage::sltHandleMediumUpdated(const UIMedium &medium) 2274 { 2273 void UIMachineSettingsStorage::sltHandleMediumUpdated(const QString &strMediumID) 2274 { 2275 /* Search for corresponding medium: */ 2276 UIMedium medium = vboxGlobal().medium(strMediumID); 2277 2275 2278 QModelIndex rootIndex = mStorageModel->root(); 2276 for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++i)2277 { 2278 QModelIndex ctrIndex = rootIndex.child 2279 for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++j)2280 { 2281 QModelIndex attIndex = ctrIndex.child 2282 QString attMediumId = mStorageModel->data 2279 for (int i = 0; i < mStorageModel->rowCount(rootIndex); ++i) 2280 { 2281 QModelIndex ctrIndex = rootIndex.child(i, 0); 2282 for (int j = 0; j < mStorageModel->rowCount(ctrIndex); ++j) 2283 { 2284 QModelIndex attIndex = ctrIndex.child(j, 0); 2285 QString attMediumId = mStorageModel->data(attIndex, StorageModel::R_AttMediumId).toString(); 2283 2286 if (attMediumId == medium.id()) 2284 2287 { 2285 mStorageModel->setData 2288 mStorageModel->setData(attIndex, attMediumId, StorageModel::R_AttMediumId); 2286 2289 2287 2290 /* Revalidate: */ … … 2295 2298 { 2296 2299 QModelIndex rootIndex = mStorageModel->root(); 2297 for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++i)2298 { 2299 QModelIndex ctrIndex = rootIndex.child 2300 for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++j)2301 { 2302 QModelIndex attIndex = ctrIndex.child 2303 QString attMediumId = mStorageModel->data 2300 for (int i = 0; i < mStorageModel->rowCount(rootIndex); ++i) 2301 { 2302 QModelIndex ctrIndex = rootIndex.child(i, 0); 2303 for (int j = 0; j < mStorageModel->rowCount(ctrIndex); ++j) 2304 { 2305 QModelIndex attIndex = ctrIndex.child(j, 0); 2306 QString attMediumId = mStorageModel->data(attIndex, StorageModel::R_AttMediumId).toString(); 2304 2307 if (attMediumId == strMediumID) 2305 2308 { 2306 mStorageModel->setData 2309 mStorageModel->setData(attIndex, UIMedium().id(), StorageModel::R_AttMediumId); 2307 2310 2308 2311 /* Revalidate: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r48260 r48264 683 683 684 684 /* Handlers: Medium-processing stuff: */ 685 void sltHandleMediumUpdated(const UIMedium &medium);685 void sltHandleMediumUpdated(const QString &strMediumID); 686 686 void sltHandleMediumDeleted(const QString &strMediumID); 687 687 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
r48261 r48264 39 39 40 40 /* Setup medium-processing handlers: */ 41 connect(&vboxGlobal(), SIGNAL(sigMediumCreated(const UIMedium&)),42 this, SLOT(sltHandleMediumCreated(const UIMedium&)));43 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const UIMedium&)),44 this, SLOT(sltHandleMediumUpdated(const UIMedium&)));41 connect(&vboxGlobal(), SIGNAL(sigMediumCreated(const QString&)), 42 this, SLOT(sltHandleMediumCreated(const QString&))); 43 connect(&vboxGlobal(), SIGNAL(sigMediumUpdated(const QString&)), 44 this, SLOT(sltHandleMediumUpdated(const QString&))); 45 45 connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)), 46 46 this, SLOT(sltHandleMediumDeleted(const QString&))); … … 49 49 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationStarted()), 50 50 this, SLOT(sltHandleMediumEnumerationStart())); 51 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const UIMedium&)),52 this, SLOT(sltHandleMediumUpdated(const UIMedium&)));51 connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const QString&)), 52 this, SLOT(sltHandleMediumUpdated(const QString&))); 53 53 54 54 /* Setup other connections */ … … 69 69 VBoxMediaList list (vboxGlobal().currentMediaList()); 70 70 foreach (UIMedium medium, list) 71 sltHandleMediumCreated(medium );71 sltHandleMediumCreated(medium.id()); 72 72 73 73 /* If at least one real medium present, process null medium */ … … 168 168 169 169 170 void VBoxMediaComboBox::sltHandleMediumEnumerationStart() 171 { 172 refresh(); 173 } 174 175 void VBoxMediaComboBox::sltHandleMediumCreated(const UIMedium &medium) 176 { 170 void VBoxMediaComboBox::sltHandleMediumCreated(const QString &strMediumID) 171 { 172 /* Search for corresponding medium: */ 173 UIMedium medium = vboxGlobal().medium(strMediumID); 174 177 175 if (medium.isNull() || medium.type() == mType) 178 176 { … … 199 197 } 200 198 201 void VBoxMediaComboBox::sltHandleMediumUpdated(const UIMedium &medium) 202 { 199 void VBoxMediaComboBox::sltHandleMediumUpdated(const QString &strMediumID) 200 { 201 /* Search for corresponding medium: */ 202 UIMedium medium = vboxGlobal().medium(strMediumID); 203 203 204 if (medium.isNull() || medium.type() == mType) 204 205 { … … 224 225 mMedia.erase(mMedia.begin() + index); 225 226 226 /* If no real medium left, add the nullmedium: */227 /* If no real medium left, add the NULL medium: */ 227 228 if (count() == 0) 228 sltHandleMediumCreated(UIMedium()); 229 { 230 UIMedium nullMedium; 231 sltHandleMediumCreated(nullMedium.id()); 232 } 229 233 230 234 /* Emit the signal to ensure the parent dialog handles the change of 231 235 * the selected item: */ 232 236 emit activated(currentIndex()); 237 } 238 239 void VBoxMediaComboBox::sltHandleMediumEnumerationStart() 240 { 241 refresh(); 233 242 } 234 243 … … 262 271 void VBoxMediaComboBox::appendItem (const UIMedium &aMedium) 263 272 { 264 if (!mShowDiffs && aMedium.parent() != NULL)265 {266 /* We are adding the direct machine diff in !mShowDiffs mode. Since its267 * base hard disk has been already appended (enumerated before), we want268 * to replace the base with the diff to avoid showing both (both would269 * be labeled using the base filename and therefore look like270 * duplicates). Note though that these visual duplicates are still271 * possible in !mShowDiffs mode if the same base hard disk is attached*272 * to the VM through different diffs (this is why we don't assert273 * below on findMediaIndex() == true). However, this situation is274 * unavoidable so we accept it assuming that the user will switch to275 mShowDiffs mode if he needs clarity. */276 int index;277 if (findMediaIndex (aMedium.root().id(), index))278 {279 replaceItem (index, aMedium);280 return;281 }282 }283 284 273 mMedia.append (Medium (aMedium.id(), aMedium.location(), 285 274 aMedium.toolTipCheckRO (!mShowDiffs, mShowNullItem && mType != UIMediumType_HardDisk))); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.h
r48261 r48264 53 53 54 54 /* Handlers: Medium-processing stuff: */ 55 void sltHandleMediumCreated(const UIMedium &medium);56 void sltHandleMediumUpdated(const UIMedium &medium);55 void sltHandleMediumCreated(const QString &strMediumID); 56 void sltHandleMediumUpdated(const QString &strMediumID); 57 57 void sltHandleMediumDeleted(const QString &strMediumID); 58 58
Note:
See TracChangeset
for help on using the changeset viewer.