Changeset 47644 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 9, 2013 1:40:03 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
r47626 r47644 125 125 AssertPtrReturnVoid(pParent); 126 126 127 /* Composing corresponding popup-stack : */127 /* Composing corresponding popup-stack ID: */ 128 128 const QString strPopupStackID(popupStackID(pParent)); 129 129 … … 141 141 newStackType == UIPopupStackType_Separate ? "separate window" : "embedded widget")); 142 142 stackType = newStackType; 143 } 144 145 void UIPopupCenter::setPopupStackOrientation(QWidget *pParent, UIPopupStackOrientation newStackOrientation) 146 { 147 /* Make sure parent is set! */ 148 AssertPtrReturnVoid(pParent); 149 150 /* Composing corresponding popup-stack ID: */ 151 const QString strPopupStackID(popupStackID(pParent)); 152 153 /* Looking for current popup-stack orientation, create if it doesn't exists: */ 154 UIPopupStackOrientation &stackOrientation = m_stackOrientations[strPopupStackID]; 155 156 /* Make sure stack-orientation has changed: */ 157 if (stackOrientation == newStackOrientation) 158 return; 159 160 /* Remember new stack orientation: */ 161 LogRelFlow(("UIPopupCenter::setPopupStackType: Changing orientation of popup-stack with ID = '%s' from '%s' to '%s'.\n", 162 strPopupStackID.toAscii().constData(), 163 stackOrientation == UIPopupStackOrientation_Top ? "top oriented" : "bottom oriented", 164 newStackOrientation == UIPopupStackOrientation_Top ? "top oriented" : "bottom oriented")); 165 stackOrientation = newStackOrientation; 166 167 /* Update orientation for popup-stack if it currently exists: */ 168 if (m_stacks.contains(strPopupStackID)) 169 m_stacks[strPopupStackID]->setOrientation(stackOrientation); 143 170 } 144 171 … … 245 272 { 246 273 /* Create new one: */ 247 pPopupStack = m_stacks[strPopupStackID] = new UIPopupStack(strPopupStackID );274 pPopupStack = m_stacks[strPopupStackID] = new UIPopupStack(strPopupStackID, m_stackOrientations[strPopupStackID]); 248 275 /* Attach popup-stack connections: */ 249 276 connect(pPopupStack, SIGNAL(sigPopupPaneDone(QString, int)), this, SLOT(sltPopupPaneDone(QString, int))); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
r47615 r47644 36 36 }; 37 37 38 /* Popup-stack orientations: */ 39 enum UIPopupStackOrientation 40 { 41 UIPopupStackOrientation_Top, 42 UIPopupStackOrientation_Bottom 43 }; 44 38 45 /* Popup-center singleton: */ 39 46 class UIPopupCenter: public QObject … … 56 63 void hidePopupStack(QWidget *pParent); 57 64 void setPopupStackType(QWidget *pParent, UIPopupStackType newStackType); 65 void setPopupStackOrientation(QWidget *pParent, UIPopupStackOrientation newStackOrientation); 58 66 59 67 /* API: Main message function. … … 130 138 /* Variables: Popup-stack stuff: */ 131 139 QMap<QString, UIPopupStackType> m_stackTypes; 140 QMap<QString, UIPopupStackOrientation> m_stackOrientations; 132 141 QMap<QString, QPointer<UIPopupStack> > m_stacks; 133 142 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
r47523 r47644 30 30 #include "UIPopupStackViewport.h" 31 31 32 UIPopupStack::UIPopupStack(const QString &strID )32 UIPopupStack::UIPopupStack(const QString &strID, UIPopupStackOrientation orientation) 33 33 : m_strID(strID) 34 , m_orientation(orientation) 34 35 , m_pScrollArea(0) 35 36 , m_pScrollViewport(0) … … 74 75 /* Redirect request to viewport: */ 75 76 m_pScrollViewport->recallPopupPane(strPopupPaneID); 77 } 78 79 void UIPopupStack::setOrientation(UIPopupStackOrientation orientation) 80 { 81 /* Make sure orientation has changed: */ 82 if (m_orientation == orientation) 83 return; 84 85 /* Update orientation: */ 86 m_orientation = orientation; 87 sltAdjustGeometry(); 76 88 } 77 89 … … 104 116 /* Read parent geometry: */ 105 117 QRect geo(parentWidget()->geometry()); 106 107 /* Determine origin: */108 bool fIsWindow = isWindow();109 int iX = fIsWindow ? geo.x() : 0;110 int iY = fIsWindow ? geo.y() : 0;111 /* Add menu-bar height: */112 iY += m_iParentMenuBarHeight;113 118 114 119 /* Determine size: */ … … 128 133 /* Compare minimum and current height: */ 129 134 iHeight = qMin(iHeight, iMinimumHeight); 135 } 136 137 /* Determine origin: */ 138 int iX = 0; 139 int iY = 0; 140 /* Shift for top-level window: */ 141 if (isWindow()) 142 { 143 iX += geo.x(); 144 iY += geo.y(); 145 } 146 switch (m_orientation) 147 { 148 case UIPopupStackOrientation_Top: 149 { 150 /* Just add menu-bar height: */ 151 iY += m_iParentMenuBarHeight; 152 break; 153 } 154 case UIPopupStackOrientation_Bottom: 155 { 156 /* Shift to bottom: */ 157 iY += (geo.height() - iHeight); 158 /* And subtract status-bar height: */ 159 iY -= m_iParentStatusBarHeight; 160 break; 161 } 130 162 } 131 163 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h
r47523 r47644 24 24 #include <QMap> 25 25 26 /* GUI includes: */ 27 #include "UIPopupCenter.h" 28 26 29 /* Forward declaration: */ 27 30 class QVBoxLayout; … … 48 51 49 52 /* Constructor: */ 50 UIPopupStack(const QString &strID );53 UIPopupStack(const QString &strID, UIPopupStackOrientation orientation); 51 54 52 55 /* API: Popup-pane stuff: */ … … 59 62 const QString &strMessage, const QString &strDetails); 60 63 void recallPopupPane(const QString &strPopupPaneID); 64 void setOrientation(UIPopupStackOrientation orientation); 61 65 62 66 /* API: Parent stuff: */ … … 94 98 /* Variable: General stuff: */ 95 99 QString m_strID; 100 UIPopupStackOrientation m_orientation; 96 101 97 102 /* Variables: Widget stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.