Changeset 77042 in vbox
- Timestamp:
- Jan 30, 2019 12:51:31 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128485
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp
r77026 r77042 37 37 int iPosition /* = -1 */) 38 38 : UIChooserItem(pParent, pParent->isTemporary(), 0, 100) 39 , m_iPosition(iPosition) 39 40 , m_iDefaultLightnessMin(0) 40 41 , m_iDefaultLightnessMax(0) … … 47 48 , m_iHeightHint(0) 48 49 { 49 /* Prepare: */50 50 prepare(); 51 52 /* Add item to the parent: */53 AssertMsg(parentItem(), ("No parent set for global-item!"));54 parentItem()->addItem(this, iPosition);55 setZValue(parentItem()->zValue() + 1);56 57 /* Configure connections: */58 connect(gpManager, &UIVirtualBoxManager::sigWindowRemapped,59 this, &UIChooserItemGlobal::sltHandleWindowRemapped);60 61 /* Init: */62 updatePixmaps();63 64 /* Apply language settings: */65 retranslateUi();66 51 } 67 52 … … 70 55 int iPosition /* = -1 */) 71 56 : UIChooserItem(pParent, pParent->isTemporary(), 0, 100) 57 , m_iPosition(iPosition) 72 58 , m_iDefaultLightnessMin(0) 73 59 , m_iDefaultLightnessMax(0) … … 80 66 , m_iHeightHint(pCopyFrom->heightHint()) 81 67 { 82 /* Prepare: */83 68 prepare(); 84 85 /* Add item to the parent: */86 AssertMsg(parentItem(), ("No parent set for global-item!"));87 parentItem()->addItem(this, iPosition);88 setZValue(parentItem()->zValue() + 1);89 90 /* Configure connections: */91 connect(gpManager, &UIVirtualBoxManager::sigWindowRemapped,92 this, &UIChooserItemGlobal::sltHandleWindowRemapped);93 94 /* Init: */95 updatePixmaps();96 97 /* Apply language settings: */98 retranslateUi();99 69 } 100 70 101 71 UIChooserItemGlobal::~UIChooserItemGlobal() 102 72 { 103 /* If that item is focused: */ 104 if (model()->focusItem() == this) 105 { 106 /* Unset the focus: */ 107 model()->setFocusItem(0); 108 } 109 /* If that item is in selection list: */ 110 if (model()->currentItems().contains(this)) 111 { 112 /* Remove item from the selection list: */ 113 model()->removeFromCurrentItems(this); 114 } 115 /* If that item is in navigation list: */ 116 if (model()->navigationList().contains(this)) 117 { 118 /* Remove item from the navigation list: */ 119 model()->removeFromNavigationList(this); 120 } 121 122 /* Remove item from the parent: */ 123 AssertMsg(parentItem(), ("No parent set for global-item!")); 124 parentItem()->removeItem(this); 73 cleanup(); 125 74 } 126 75 … … 438 387 m_iMinimumNameWidth = 0; 439 388 m_iMaximumNameWidth = 0; 389 390 /* Add item to the parent: */ 391 AssertPtrReturnVoid(parentItem()); 392 parentItem()->addItem(this, m_iPosition); 393 setZValue(parentItem()->zValue() + 1); 394 395 /* Configure connections: */ 396 connect(gpManager, &UIVirtualBoxManager::sigWindowRemapped, 397 this, &UIChooserItemGlobal::sltHandleWindowRemapped); 398 399 /* Init: */ 400 updatePixmaps(); 401 402 /* Apply language settings: */ 403 retranslateUi(); 404 } 405 406 void UIChooserItemGlobal::cleanup() 407 { 408 /* If that item is focused: */ 409 if (model()->focusItem() == this) 410 { 411 /* Unset the focus: */ 412 model()->setFocusItem(0); 413 } 414 /* If that item is in selection list: */ 415 if (model()->currentItems().contains(this)) 416 { 417 /* Remove item from the selection list: */ 418 model()->removeFromCurrentItems(this); 419 } 420 /* If that item is in navigation list: */ 421 if (model()->navigationList().contains(this)) 422 { 423 /* Remove item from the navigation list: */ 424 model()->removeFromNavigationList(this); 425 } 426 427 /* Remove item from the parent: */ 428 AssertPtrReturnVoid(parentItem()); 429 parentItem()->removeItem(this); 440 430 } 441 431 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h
r77026 r77042 195 195 /** Prepares all. */ 196 196 void prepare(); 197 /** Cleanups all. */ 198 void cleanup(); 197 199 /** @} */ 198 200 … … 231 233 /** @name Item stuff. 232 234 * @{ */ 235 /** Holds initial item position. */ 236 const int m_iPosition; 237 233 238 /** Holds item minimum default lightness. */ 234 239 int m_iDefaultLightnessMin;
Note:
See TracChangeset
for help on using the changeset viewer.