Changeset 82290 in vbox
- Timestamp:
- Nov 29, 2019 6:31:38 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r80700 r82290 241 241 const UIDataSettingsMachineGeneral &oldGeneralData = m_pCache->base(); 242 242 243 /* We are doing that *now* because these combos have 244 * dynamical content which depends on cashed value: */ 245 repopulateComboClipboardMode(); 246 243 247 /* Load old 'Basic' data from the cache: */ 244 248 AssertPtrReturnVoid(m_pNameAndSystemEditor); … … 252 256 mPsSnapshot->setPath(oldGeneralData.m_strSnapshotsFolder); 253 257 mPsSnapshot->setHomeDir(oldGeneralData.m_strSnapshotsHomeDir); 254 mCbClipboard->setCurrentIndex(oldGeneralData.m_clipboardMode); 258 const int iClipboardModePosition = mCbClipboard->findData(oldGeneralData.m_clipboardMode); 259 mCbClipboard->setCurrentIndex(iClipboardModePosition == -1 ? 0 : iClipboardModePosition); 255 260 mCbDragAndDrop->setCurrentIndex(oldGeneralData.m_dndMode); 256 261 … … 289 294 AssertPtrReturnVoid(mCbDragAndDrop); 290 295 newGeneralData.m_strSnapshotsFolder = mPsSnapshot->path(); 291 newGeneralData.m_clipboardMode = (KClipboardMode)mCbClipboard->currentIndex();296 newGeneralData.m_clipboardMode = mCbClipboard->currentData().value<KClipboardMode>(); 292 297 newGeneralData.m_dndMode = (KDnDMode)mCbDragAndDrop->currentIndex(); 293 298 … … 466 471 "virtual machine will be stored. Be aware that " 467 472 "snapshots can take quite a lot of storage space.")); 473 468 474 /* Translate Shared Clipboard mode combo: */ 469 475 AssertPtrReturnVoid(mCbClipboard); 470 mCbClipboard->setItemText(0, gpConverter->toString(KClipboardMode_Disabled)); 471 mCbClipboard->setItemText(1, gpConverter->toString(KClipboardMode_HostToGuest)); 472 mCbClipboard->setItemText(2, gpConverter->toString(KClipboardMode_GuestToHost)); 473 mCbClipboard->setItemText(3, gpConverter->toString(KClipboardMode_Bidirectional)); 476 for (int iIndex = 0; iIndex < mCbClipboard->count(); ++iIndex) 477 { 478 const KClipboardMode enmType = mCbClipboard->currentData().value<KClipboardMode>(); 479 mCbClipboard->setItemText(iIndex, gpConverter->toString(enmType)); 480 } 481 474 482 /* Translate Drag'n'drop mode combo: */ 475 483 AssertPtrReturnVoid(mCbDragAndDrop); … … 559 567 /* Tab and it's layout created in the .ui file. */ 560 568 { 561 /* Shared Clipboard Mode combo-box created in the .ui file. */562 AssertPtrReturnVoid(mCbClipboard);563 {564 /* Configure combo-box: */565 mCbClipboard->addItem(""); /* KClipboardMode_Disabled */566 mCbClipboard->addItem(""); /* KClipboardMode_HostToGuest */567 mCbClipboard->addItem(""); /* KClipboardMode_GuestToHost */568 mCbClipboard->addItem(""); /* KClipboardMode_Bidirectional */569 }570 571 569 /* Drag&drop Mode combo-box created in the .ui file. */ 572 570 AssertPtrReturnVoid(mCbDragAndDrop); … … 656 654 delete m_pCache; 657 655 m_pCache = 0; 656 } 657 658 void UIMachineSettingsGeneral::repopulateComboClipboardMode() 659 { 660 /* Shared Clipboard mode combo-box created in the .ui file. */ 661 AssertPtrReturnVoid(mCbClipboard); 662 { 663 /* Clear combo first of all: */ 664 mCbClipboard->clear(); 665 666 /* Load currently supported Shared Clipboard modes: */ 667 CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 668 QVector<KClipboardMode> clipboardModes = comProperties.GetSupportedClipboardModes(); 669 /* Take into account currently cached value: */ 670 const KClipboardMode enmCachedValue = m_pCache->base().m_clipboardMode; 671 if (!clipboardModes.contains(enmCachedValue)) 672 clipboardModes.prepend(enmCachedValue); 673 674 /* Populate combo finally: */ 675 foreach (const KClipboardMode &enmMode, clipboardModes) 676 mCbClipboard->addItem(gpConverter->toString(enmMode), QVariant::fromValue(enmMode)); 677 } 658 678 } 659 679 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r76581 r82290 111 111 void cleanup(); 112 112 113 /** Repopulates Clipboard mode combo-box. */ 114 void repopulateComboClipboardMode(); 115 113 116 /** Saves existing general data from the cache. */ 114 117 bool saveGeneralData();
Note:
See TracChangeset
for help on using the changeset viewer.