Changeset 77412 in vbox
- Timestamp:
- Feb 21, 2019 6:25:37 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128973
- Location:
- trunk/src/VBox/Debugger
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/VBoxDbgBase.cpp
r76553 r77412 163 163 164 164 165 VBoxDbgBaseWindow::VBoxDbgBaseWindow(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent) 166 : QWidget(a_pParent, Qt::Window), VBoxDbgBase(a_pDbgGui), m_fPolished(false), 167 m_x(INT_MAX), m_y(INT_MAX), m_cx(0), m_cy(0) 168 { 165 VBoxDbgBaseWindow::VBoxDbgBaseWindow(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent, const char *a_pszTitle) 166 : QWidget(a_pParent, Qt::Window), VBoxDbgBase(a_pDbgGui), m_pszTitle(a_pszTitle), m_fPolished(false) 167 , m_x(INT_MAX), m_y(INT_MAX), m_cx(0), m_cy(0) 168 { 169 /* Set the title, using the parent one as prefix when possible: */ 170 if (!parent()) 171 { 172 QString strMachineName = a_pDbgGui->getMachineName(); 173 if (strMachineName.isEmpty()) 174 setWindowTitle(QString("VBoxDbg - %1").arg(m_pszTitle)); 175 else 176 setWindowTitle(QString("%1 - VBoxDbg - %2").arg(strMachineName).arg(m_pszTitle)); 177 } 178 else 179 { 180 setWindowTitle(QString("%1 - %2").arg(parentWidget()->windowTitle()).arg(m_pszTitle)); 181 182 /* Install an event filter so we can make adjustments when the parent title changes: */ 183 parent()->installEventFilter(this); 184 } 169 185 } 170 186 … … 215 231 vPolishSizeAndPos(); 216 232 return fRc; 233 } 234 235 236 bool VBoxDbgBaseWindow::eventFilter(QObject *pWatched, QEvent *pEvent) 237 { 238 /* We're only interested in title changes to the parent so we can amend our own title: */ 239 if ( pWatched == parent() 240 && pEvent->type() == QEvent::WindowTitleChange) 241 setWindowTitle(QString("%1 - %2").arg(parentWidget()->windowTitle()).arg(m_pszTitle)); 242 243 /* Forward to base-class: */ 244 return QWidget::eventFilter(pWatched, pEvent); 217 245 } 218 246 -
trunk/src/VBox/Debugger/VBoxDbgBase.h
r76564 r77412 134 134 * @param a_pDbgGui Pointer to the debugger gui object. 135 135 * @param a_pParent Pointer to the parent object. 136 */ 137 VBoxDbgBaseWindow(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent); 136 * @param a_pszTitle The window title string (persistent, not copied). 137 */ 138 VBoxDbgBaseWindow(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent, const char *a_pszTitle); 138 139 139 140 /** … … 168 169 169 170 /** 171 * Event filter for various purposes (mainly title bar). 172 * 173 * @param pWatched The object event came to. 174 * @param pEvent The event being handled. 175 */ 176 virtual bool eventFilter(QObject *pWatched, QEvent *pEvent); 177 178 /** 170 179 * Internal worker for polishing the size and position (X11 hacks). 171 180 */ … … 177 186 QSize vGuessBorderSizes(); 178 187 179 180 188 private: 189 /** The Window title string (inflexible, read only). */ 190 const char *m_pszTitle; 181 191 /** Whether we've done the size polishing in showEvent or not. */ 182 192 bool m_fPolished; -
trunk/src/VBox/Debugger/VBoxDbgConsole.cpp
r77409 r77412 484 484 485 485 VBoxDbgConsole::VBoxDbgConsole(VBoxDbgGui *a_pDbgGui, QWidget *a_pParent/* = NULL*/, IVirtualBox *a_pVirtualBox/* = NULL */) 486 : VBoxDbgBaseWindow(a_pDbgGui, a_pParent ), m_pOutput(NULL), m_pInput(NULL), m_fInputRestoreFocus(false),486 : VBoxDbgBaseWindow(a_pDbgGui, a_pParent, "Console"), m_pOutput(NULL), m_pInput(NULL), m_fInputRestoreFocus(false), 487 487 m_pszInputBuf(NULL), m_cbInputBuf(0), m_cbInputBufAlloc(0), 488 488 m_pszOutputBuf(NULL), m_cbOutputBuf(0), m_cbOutputBufAlloc(0), … … 490 490 m_fTerminate(false), m_fThreadTerminated(false) 491 491 { 492 QString strMachineName;493 if (a_pDbgGui)494 strMachineName = a_pDbgGui->getMachineName();495 496 if (strMachineName.isEmpty())497 setWindowTitle("VBoxDbg - Console");498 else499 setWindowTitle(QString("%1 - VBoxDbg - Console").arg(strMachineName));500 492 /* 501 493 * Create the output text box. -
trunk/src/VBox/Debugger/VBoxDbgGui.cpp
r77409 r77412 257 257 } 258 258 259 259 260 QString 260 261 VBoxDbgGui::getMachineName() const … … 267 268 { 268 269 strName = QString::fromUtf16(bstr); 269 }270 SysFreeString(bstr);270 SysFreeString(bstr); 271 } 271 272 return strName; 272 273 } 274 273 275 274 276 void -
trunk/src/VBox/Debugger/VBoxDbgStatsQt.cpp
r76553 r77412 3040 3040 3041 3041 VBoxDbgStats::VBoxDbgStats(VBoxDbgGui *a_pDbgGui, const char *pszPat/* = NULL*/, unsigned uRefreshRate/* = 0*/, QWidget *pParent/* = NULL*/) 3042 : VBoxDbgBaseWindow(a_pDbgGui, pParent), m_PatStr(pszPat), m_pPatCB(NULL), m_uRefreshRate(0), m_pTimer(NULL), m_pView(NULL) 3043 { 3044 /* Assign window-title: */ 3045 if (parent()) 3046 { 3047 setWindowTitle(QString("%1 - Statistics").arg(parentWidget()->windowTitle())); 3048 parent()->installEventFilter(this); 3049 } 3050 else 3051 setWindowTitle("VBoxDbg - Statistics"); 3052 3042 : VBoxDbgBaseWindow(a_pDbgGui, pParent, "Statistics") 3043 , m_PatStr(pszPat), m_pPatCB(NULL), m_uRefreshRate(0), m_pTimer(NULL), m_pView(NULL) 3044 { 3053 3045 /* 3054 3046 * On top, a horizontal box with the pattern field, buttons and refresh interval. … … 3161 3153 3162 3154 3163 bool VBoxDbgStats::eventFilter(QObject *pWatched, QEvent *pEvent)3164 {3165 /* Skip events which are not related to our parent: */3166 if (pWatched != parent())3167 return VBoxDbgBaseWindow::eventFilter(pWatched, pEvent);3168 3169 /* Depending on event-type: */3170 switch (pEvent->type())3171 {3172 case QEvent::WindowTitleChange: setWindowTitle(QString("%1 - Statistics").arg(parentWidget()->windowTitle())); break;3173 default: break;3174 }3175 3176 /* Call to base-class: */3177 return VBoxDbgBaseWindow::eventFilter(pWatched, pEvent);3178 }3179 3180 3181 3155 void 3182 3156 VBoxDbgStats::apply(const QString &Str) -
trunk/src/VBox/Debugger/VBoxDbgStatsQt.h
r76564 r77412 204 204 virtual void closeEvent(QCloseEvent *a_pCloseEvt); 205 205 206 /**207 * Event filter for various purposes.208 *209 * @param pWatched The object event came to.210 * @param pEvent The event being handled.211 */212 virtual bool eventFilter(QObject *pWatched, QEvent *pEvent);213 214 206 protected slots: 215 207 /** Apply the activated combobox pattern. */
Note:
See TracChangeset
for help on using the changeset viewer.