Changeset 71490 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 23, 2018 3:49:49 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121462
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp
r70474 r71490 5 5 6 6 /* 7 * Copyright (C) 2013-201 7Oracle Corporation7 * Copyright (C) 2013-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 # include <precomp.h> 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Qt includes: */ 22 23 # include <QPainter> … … 327 328 } 328 329 329 bool UIPopupPane::eventFilter(QObject *p Watched, QEvent *pEvent)330 bool UIPopupPane::eventFilter(QObject *pObject, QEvent *pEvent) 330 331 { 331 332 /* Depending on event-type: */ … … 348 349 { 349 350 /* Unhover pane if hovered but not focused: */ 350 if (p Watched== this && m_fHovered && !m_fFocused)351 if (pObject == this && m_fHovered && !m_fFocused) 351 352 { 352 353 m_fHovered = false; … … 414 415 } 415 416 416 void UIPopupPane::polishEvent(QShowEvent *)417 void UIPopupPane::polishEvent(QShowEvent *) 417 418 { 418 419 /* Focus if marked as 'focused': */ … … 424 425 } 425 426 426 void UIPopupPane::paintEvent(QPaintEvent *)427 void UIPopupPane::paintEvent(QPaintEvent *) 427 428 { 428 429 /* Compose painting rectangle, … … 537 538 } 538 539 } 540 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h
r69500 r71490 5 5 6 6 /* 7 * Copyright (C) 2013-201 7Oracle Corporation7 * Copyright (C) 2013-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ UIPopupPane_h__19 #define __ UIPopupPane_h__18 #ifndef ___UIPopupPane_h___ 19 #define ___UIPopupPane_h___ 20 20 21 21 /* Qt includes: */ 22 #include <QMap> 22 23 #include <QWidget> 23 #include <QMap>24 24 25 25 /* GUI includes: */ … … 27 27 28 28 /* Forward declaration: */ 29 class QEvent; 30 class QObject; 31 class QPainter; 32 class QPaintEvent; 33 class QRect; 34 class QShowEvent; 35 class QSize; 36 class QString; 37 class QWidget; 38 class UIAnimation; 39 class UIPopupPaneDetails; 29 40 class UIPopupPaneMessage; 30 class UIPopupPaneDetails;31 41 class UIPopupPaneButtonPane; 32 class UIAnimation; 33 34 /* Popup-pane prototype: */ 42 43 /** QWidget extension used as popup-center pane prototype. */ 35 44 class UIPopupPane : public QIWithRetranslateUI<QWidget> 36 45 { … … 45 54 signals: 46 55 47 /* Notifiers: Show/hide stuff:*/56 /** Asks to show itself asynchronously. */ 48 57 void sigToShow(); 58 /** Asks to hide itself asynchronously. */ 49 59 void sigToHide(); 60 /** Asks to show itself instantly. */ 50 61 void sigShow(); 62 /** Asks to hide itself instantly. */ 51 63 void sigHide(); 52 64 53 /* Notifiers: Hover stuff:*/65 /** Notifies about hover enter. */ 54 66 void sigHoverEnter(); 67 /** Notifies about hover leave. */ 55 68 void sigHoverLeave(); 56 69 57 /* Notifiers: Focus stuff:*/70 /** Notifies about focus enter. */ 58 71 void sigFocusEnter(); 72 /** Notifies about focus leave. */ 59 73 void sigFocusLeave(); 60 74 61 /* Notifiers: Layout stuff:*/75 /** Proposes pane @a iWidth. */ 62 76 void sigProposePaneWidth(int iWidth); 77 /** Proposes details pane @a iHeight. */ 63 78 void sigProposeDetailsPaneHeight(int iHeight); 79 /** Notifies about size-hint changed. */ 64 80 void sigSizeHintChanged(); 65 81 66 /* Notifier: Complete stuff:*/82 /** Asks to close with @a iResultCode. */ 67 83 void sigDone(int iResultCode) const; 68 84 69 85 public: 70 86 71 /* Constructor: */ 87 /** Constructs popup-pane. 88 * @param pParent Brings the parent. 89 * @param strMessage Brings the pane message. 90 * @param strDetails Brings the pane details. 91 * @param buttonDescriptions Brings the button descriptions. */ 72 92 UIPopupPane(QWidget *pParent, 73 93 const QString &strMessage, const QString &strDetails, 74 94 const QMap<int, QString> &buttonDescriptions); 75 95 76 /* API: Recall stuff:*/96 /** Recalls itself. */ 77 97 void recall(); 78 98 79 /* API: Text stuff:*/99 /** Defines the @a strMessage. */ 80 100 void setMessage(const QString &strMessage); 101 /** Defines the @a strDetails. */ 81 102 void setDetails(const QString &strDetails); 82 103 83 /* API: Layout stuff:*/104 /** Returns minimum size-hint. */ 84 105 QSize minimumSizeHint() const { return m_minimumSizeHint; } 106 /** Defines @a minimumSizeHint. */ 85 107 void setMinimumSizeHint(const QSize &minimumSizeHint); 108 /** Lays the content out. */ 86 109 void layoutContent(); 87 110 88 111 public slots: 89 112 90 /* Handler: Layout stuff:*/113 /** Handles proposal for a @a newSize. */ 91 114 void sltHandleProposalForSize(QSize newSize); 92 115 93 116 private slots: 94 117 95 /* Handler: Show/hide stuff:*/118 /** Marks pane as fully shown. */ 96 119 void sltMarkAsShown(); 97 120 98 /* Handler: Layout stuff:*/121 /** Updates size-hint. */ 99 122 void sltUpdateSizeHint(); 100 123 101 /* Handler: Button stuff:*/124 /** Handles a click of button with @a iButtonID. */ 102 125 void sltButtonClicked(int iButtonID); 103 126 104 127 private: 105 128 106 /* Type definitions:*/129 /** A pair of strings. */ 107 130 typedef QPair<QString, QString> QStringPair; 131 /** A list of string pairs. */ 108 132 typedef QList<QStringPair> QStringPairList; 109 133 110 /* Helpers: Prepare stuff:*/134 /** Prepares all. */ 111 135 void prepare(); 136 /** Prepares background. */ 112 137 void prepareBackground(); 138 /** Prepares content. */ 113 139 void prepareContent(); 140 /** Prepares animation. */ 114 141 void prepareAnimation(); 115 142 116 /* Helpers: Translate stuff: */ 117 void retranslateUi(); 143 /** Handles translation event. */ 144 virtual void retranslateUi() /* override */; 145 /** Translats tool-tips. */ 118 146 void retranslateToolTips(); 119 147 120 /* Handler: Event-filter stuff: */ 121 bool eventFilter(QObject *pWatched, QEvent *pEvent); 122 123 /* Handlers: Event stuff: */ 124 void showEvent(QShowEvent *pEvent); 148 /** Pre-handles standard Qt @a pEvent for passed @a pObject. */ 149 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */; 150 151 /** Handles show @a pEvent. */ 152 virtual void showEvent(QShowEvent *pEvent); /* override */; 153 /** Handles first show @a pEvent. */ 125 154 void polishEvent(QShowEvent *pEvent); 126 void paintEvent(QPaintEvent *pEvent); 127 128 /* Helpers: Paint stuff: */ 155 156 /** Handles paint @a pEvent. */ 157 virtual void paintEvent(QPaintEvent *pEvent) /* override */; 158 159 /** Assigns clipping of @a rect geometry for passed @a painter. */ 129 160 void configureClipping(const QRect &rect, QPainter &painter); 161 /** Paints background of @a rect geometry using @a painter. */ 130 162 void paintBackground(const QRect &rect, QPainter &painter); 163 /** Paints frame of @a rect geometry using @a painter. */ 131 164 void paintFrame(QPainter &painter); 132 165 133 /* Helper: Complete stuff:*/166 /** Closes pane with @a iResultCode. */ 134 167 void done(int iResultCode); 135 168 136 /* Property: Show/hide stuff:*/169 /** Returns size-hint in hidden state. */ 137 170 QSize hiddenSizeHint() const { return m_hiddenSizeHint; } 171 /** Returns size-hint in shown state. */ 138 172 QSize shownSizeHint() const { return m_shownSizeHint; } 139 173 140 /* Property: Hover stuff:*/174 /** Returns default opacity. */ 141 175 int defaultOpacity() const { return m_iDefaultOpacity; } 176 /** Returns hovered opacity. */ 142 177 int hoveredOpacity() const { return m_iHoveredOpacity; } 178 /** Returns current opacity. */ 143 179 int opacity() const { return m_iOpacity; } 180 /** Defines current @a iOpacity. */ 144 181 void setOpacity(int iOpacity) { m_iOpacity = iOpacity; update(); } 145 182 146 /* Helpers: Details stuff:*/183 /** Returns details text. */ 147 184 QString prepareDetailsText() const; 185 /** Prepares passed @a aDetailsList. */ 148 186 void prepareDetailsList(QStringPairList &aDetailsList) const; 149 187 150 /* Variables: General stuff:*/188 /** Holds whether the pane was polished. */ 151 189 bool m_fPolished; 190 191 /** Holds the pane ID. */ 152 192 const QString m_strId; 193 194 /** Holds the layout margin. */ 153 195 const int m_iLayoutMargin; 196 /** Holds the layout spacing. */ 154 197 const int m_iLayoutSpacing; 198 199 /** Holds the minimum size-hint. */ 155 200 QSize m_minimumSizeHint; 156 201 157 /* Variables: Text stuff: */ 158 QString m_strMessage, m_strDetails; 159 160 /* Variables: Button stuff: */ 202 /** Holds the pane message. */ 203 QString m_strMessage; 204 /** Holds the pane details. */ 205 QString m_strDetails; 206 207 /** Holds the button descriptions. */ 161 208 QMap<int, QString> m_buttonDescriptions; 162 209 163 /* Variables: Show/hide stuff: */ 164 bool m_fShown; 210 /** Holds whether the pane is shown fully. */ 211 bool m_fShown; 212 /** Holds the show/hide animation instance. */ 165 213 UIAnimation *m_pShowAnimation; 166 QSize m_hiddenSizeHint; 167 QSize m_shownSizeHint; 168 169 /* Variables: Focus stuff: */ 214 /** Holds the size-hint of pane in hidden state. */ 215 QSize m_hiddenSizeHint; 216 /** Holds the size-hint of pane in shown state. */ 217 QSize m_shownSizeHint; 218 219 /** Holds whether the pane can loose focus. */ 170 220 bool m_fCanLooseFocus; 221 /** Holds whether the pane is focused. */ 171 222 bool m_fFocused; 172 223 173 /* Variables: Hover stuff: */ 174 bool m_fHovered; 224 /** Holds whether the pane is hovered. */ 225 bool m_fHovered; 226 /** Holds the default opacity. */ 175 227 const int m_iDefaultOpacity; 228 /** Holds the hovered opacity. */ 176 229 const int m_iHoveredOpacity; 177 int m_iOpacity; 178 179 /* Widgets: */ 230 /** Holds the current opacity. */ 231 int m_iOpacity; 232 233 /** Holds the message pane instance. */ 180 234 UIPopupPaneMessage *m_pMessagePane; 235 /** Holds the details pane instance. */ 181 236 UIPopupPaneDetails *m_pDetailsPane; 237 /** Holds the buttons pane instance. */ 182 238 UIPopupPaneButtonPane *m_pButtonPane; 183 239 }; 184 240 185 #endif /* __UIPopupPane_h__ */ 241 #endif /* !___UIPopupPane_h___ */ 242
Note:
See TracChangeset
for help on using the changeset viewer.