- Timestamp:
- Sep 13, 2018 3:42:21 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp
r74184 r74246 21 21 22 22 /* Qt includes: */ 23 # include <QStatusBar>24 # include <QStyle>25 23 # include <QVBoxLayout> 26 24 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h
r74184 r74246 22 22 #include <QWidget> 23 23 24 /* GUI includes: */25 #include "UIChooserItem.h"26 27 24 /* Forward declarations: */ 28 25 class QVBoxLayout; … … 33 30 class UIVirtualMachineItem; 34 31 35 /** QWidget extension used as VM chooserpane. */32 /** QWidget extension used as VM Chooser-pane. */ 36 33 class UIChooser : public QWidget 37 34 { … … 62 59 public: 63 60 64 /** Constructs chooserpane passing @a pParent to the base-class. */61 /** Constructs Chooser-pane passing @a pParent to the base-class. */ 65 62 UIChooser(UIVirtualBoxManagerWidget *pParent); 66 /** Destructs chooserpane. */63 /** Destructs Chooser-pane. */ 67 64 virtual ~UIChooser() /* override */; 68 65 … … 147 144 /** Holds the main layout instane. */ 148 145 QVBoxLayout *m_pMainLayout; 149 /** Holds the choosermodel instane. */146 /** Holds the Chooser-model instane. */ 150 147 UIChooserModel *m_pChooserModel; 151 /** Holds the chooserview instane. */148 /** Holds the Chooser-view instane. */ 152 149 UIChooserView *m_pChooserView; 153 150 /** @} */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp
r74084 r74246 389 389 { 390 390 /* Root-item should notify chooser-view if minimum-width-hint was changed: */ 391 int iMinimumWidthHint = minimumWidthHint();391 const int iMinimumWidthHint = minimumWidthHint(); 392 392 if (m_iPreviousMinimumWidthHint != iMinimumWidthHint) 393 393 { … … 397 397 } 398 398 /* Root-item should notify chooser-view if minimum-height-hint was changed: */ 399 int iMinimumHeightHint = minimumHeightHint();399 const int iMinimumHeightHint = minimumHeightHint(); 400 400 if (m_iPreviousMinimumHeightHint != iMinimumHeightHint) 401 401 { … … 578 578 return strText; 579 579 580 /* Check if passed text f eats maximum width: */580 /* Check if passed text fits maximum width: */ 581 581 QFontMetrics fm(font, pPaintDevice); 582 582 if (fm.width(strText) <= iWidth) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp
r74138 r74246 60 60 updatePixmap(); 61 61 62 /* Translate finally: */62 /* Apply language settings: */ 63 63 retranslateUi(); 64 64 } … … 89 89 updatePixmap(); 90 90 91 /* Translate finally: */91 /* Apply language settings: */ 92 92 retranslateUi(); 93 93 } … … 215 215 QString UIChooserItemGlobal::definition() const 216 216 { 217 return QString("n=%1").arg( name());217 return QString("n=%1").arg("GLOBAL"); 218 218 } 219 219 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r74085 r74246 67 67 pScene->addItem(this); 68 68 69 /* Translate finally: */69 /* Apply language settings: */ 70 70 retranslateUi(); 71 71 … … 102 102 copyContent(pCopyFrom, this); 103 103 104 /* Translate finally: */104 /* Apply language settings: */ 105 105 retranslateUi(); 106 106 … … 142 142 this, &UIChooserItemGroup::sltHandleWindowRemapped); 143 143 144 /* Translate finally: */144 /* Apply language settings: */ 145 145 retranslateUi(); 146 146 … … 190 190 copyContent(pCopyFrom, this); 191 191 192 /* Translate finally: */192 /* Apply language settings: */ 193 193 retranslateUi(); 194 194 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r74002 r74246 74 74 updateSnapshotName(); 75 75 76 /* Translate finally: */76 /* Apply language settings: */ 77 77 retranslateUi(); 78 78 } … … 110 110 updateSnapshotName(); 111 111 112 /* Translate finally: */112 /* Apply language settings: */ 113 113 retranslateUi(); 114 114 } … … 226 226 227 227 /* What is the new geometry? */ 228 QRectF newGeometry = geometry();228 const QRectF newGeometry = geometry(); 229 229 230 230 /* Should we update visible name? */ … … 252 252 /* Paint decorations: */ 253 253 paintDecorations(pPainter, pOption); 254 255 254 /* Paint machine info: */ 256 255 paintMachineInfo(pPainter, pOption); … … 455 454 } 456 455 457 QSizeF UIChooserItemMachine::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const456 QSizeF UIChooserItemMachine::sizeHint(Qt::SizeHint enmWhich, const QSizeF &constraint /* = QSizeF() */) const 458 457 { 459 458 /* If Qt::MinimumSize requested: */ 460 if ( which == Qt::MinimumSize)459 if (enmWhich == Qt::MinimumSize) 461 460 return QSizeF(minimumWidthHint(), minimumHeightHint()); 462 461 /* Else call to base-class: */ 463 return UIChooserItem::sizeHint( which, constraint);462 return UIChooserItem::sizeHint(enmWhich, constraint); 464 463 } 465 464 … … 586 585 void UIChooserItemMachine::prepare() 587 586 { 588 /* Color s: */587 /* Color tones: */ 589 588 #ifdef VBOX_WS_MAC 590 589 m_iHighlightLightnessMin = 105; … … 667 666 void UIChooserItemMachine::updateStatePixmap() 668 667 { 669 /* Determine the icon metric: */ 670 const QStyle *pStyle = QApplication::style(); 671 const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize); 668 /* Determine icon metric: */ 669 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 672 670 /* Get new state-pixmap and state-pixmap size: */ 673 671 const QIcon stateIcon = machineStateIcon(); … … 891 889 { 892 890 /* Prepare variables: */ 893 QRect fullRect = pOption->rect;891 const QRect fullRect = pOption->rect; 894 892 895 893 /* Paint background: */ 896 894 paintBackground(pPainter, fullRect); 897 898 895 /* Paint frame: */ 899 896 paintFrameRectangle(pPainter, fullRect); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r74184 r74246 142 142 QPaintDevice *UIChooserModel::paintDevice() const 143 143 { 144 if ( !scene() ||scene()->views().isEmpty())145 return 0;146 return scene()->views().first();144 if (scene() && !scene()->views().isEmpty()) 145 return scene()->views().first(); 146 return 0; 147 147 } 148 148 … … 154 154 void UIChooserModel::setCurrentItems(const QList<UIChooserItem*> &items) 155 155 { 156 /* Is there something seems to bechanged? */156 /* Is there something changed? */ 157 157 if (m_currentItems == items) 158 158 return; … … 171 171 m_currentItems << pItem; 172 172 else 173 AssertMsgFailed(("Passed item not in navigation list!"));173 AssertMsgFailed(("Passed item is not in navigation list!")); 174 174 } 175 175 … … 1608 1608 QList<UIChooserItem*> navigationItems; 1609 1609 1610 /* Iterate over all the global-items: */ 1611 foreach (UIChooserItem *pGlobalItem, pItem->items(UIChooserItemType_Global)) 1612 navigationItems << pGlobalItem; 1610 1613 /* Iterate over all the group-items: */ 1611 1614 foreach (UIChooserItem *pGroupItem, pItem->items(UIChooserItemType_Group)) … … 1615 1618 navigationItems << createNavigationList(pGroupItem); 1616 1619 } 1617 /* Iterate over all the global-items: */1618 foreach (UIChooserItem *pGlobalItem, pItem->items(UIChooserItemType_Global))1619 navigationItems << pGlobalItem;1620 1620 /* Iterate over all the machine-items: */ 1621 1621 foreach (UIChooserItem *pMachineItem, pItem->items(UIChooserItemType_Machine)) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r74184 r74246 33 33 34 34 /* Forward declaration: */ 35 class QAction;36 35 class QDrag; 37 36 class QGraphicsItem; … … 57 56 58 57 59 /** QObject extension used as VM chooserpane model: */58 /** QObject extension used as VM Chooser-pane model: */ 60 59 class UIChooserModel : public QObject 61 60 { … … 98 97 public: 99 98 100 /** Constructs choosermodel passing @a pParent to the base-class. */99 /** Constructs Chooser-model passing @a pParent to the base-class. */ 101 100 UIChooserModel(UIChooser *pParent); 102 /** Destructs choosermodel. */101 /** Destructs Chooser-model. */ 103 102 virtual ~UIChooserModel() /* override */; 104 103 … … 110 109 void deinit(); 111 110 112 /** Returns the chooser reference. */111 /** Returns the Chooser reference. */ 113 112 UIChooser *chooser() const; 114 113 /** Returns the action-pool reference. */ … … 239 238 /** @name General stuff. 240 239 * @{ */ 241 /** Handles chooserview resize. */240 /** Handles Chooser-view resize. */ 242 241 void sltHandleViewResized(); 243 242 /** @} */ … … 449 448 /** @name General stuff. 450 449 * @{ */ 451 /** Holds the chooser reference. */450 /** Holds the Chooser reference. */ 452 451 UIChooser *m_pChooser; 453 452 … … 469 468 * @{ */ 470 469 /** Holds the focus item reference. */ 471 QPointer<UIChooserItem> m_pFocusItem;470 QPointer<UIChooserItem> m_pFocusItem; 472 471 /** @} */ 473 472 … … 486 485 487 486 /** Holds the navigation list. */ 488 QList<UIChooserItem*> m_navigationList;489 QList<UIChooserItem*> m_currentItems;487 QList<UIChooserItem*> m_navigationList; 488 QList<UIChooserItem*> m_currentItems; 490 489 491 490 /** Holds the current drag object instance. */ 492 491 QPointer<QDrag> m_pCurrentDragObject; 493 492 /** Holds the drag scrolling token size. */ 494 int m_iScrollingTokenSize;493 int m_iScrollingTokenSize; 495 494 /** Holds whether drag scrolling is in progress. */ 496 bool m_fIsScrollingInProgress;495 bool m_fIsScrollingInProgress; 497 496 498 497 /** Holds the item lookup timer instance. */ 499 QTimer *m_pLookupTimer;498 QTimer *m_pLookupTimer; 500 499 /** Holds the item lookup string. */ 501 QString m_strLookupString;500 QString m_strLookupString; 502 501 503 502 /** Holds the Id of last VM created from the GUI side. */ 504 QString m_strLastCreatedMachineId;503 QString m_strLastCreatedMachineId; 505 504 /** @} */ 506 505 … … 508 507 * @{ */ 509 508 /** Holds the consolidated map of group definitions/orders. */ 510 QMap<QString, QStringList> m_groups;509 QMap<QString, QStringList> m_groups; 511 510 /** @} */ 512 511 };
Note:
See TracChangeset
for help on using the changeset viewer.