From 499c1ee413a23343837c6141bf53e9be048901ce Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 28 Apr 2009 21:20:47 +0200 Subject: [PATCH] Introduce the helper activeWindow(). Currently this function simply returns the member variable, but we will have a less trivial implementation later. --- kdbg/winstack.cpp | 37 +++++++++++++++++++++---------------- kdbg/winstack.h | 1 + 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/kdbg/winstack.cpp b/kdbg/winstack.cpp index fb7edbf..29c799d 100644 --- a/kdbg/winstack.cpp +++ b/kdbg/winstack.cpp @@ -206,12 +206,12 @@ bool WinStack::activeLine(QString& fileName, int& lineNo) bool WinStack::activeLine(QString& fileName, int& lineNo, DbgAddr& address) { - if (m_activeWindow == 0) { + if (activeWindow() == 0) { return false; } - fileName = m_activeWindow->fileName(); - m_activeWindow->activeLine(lineNo, address); + fileName = activeFileName(); + activeWindow()->activeLine(lineNo, address); return true; } @@ -282,42 +282,47 @@ void WinStack::setPC(bool set, const QString& fileName, int lineNo, void WinStack::resizeEvent(QResizeEvent*) { - if (m_activeWindow != 0) { - m_activeWindow->resize(width(), height()); + if (activeWindow() != 0) { + activeWindow()->resize(width(), height()); } } +SourceWindow* WinStack::activeWindow() const +{ + return m_activeWindow; +} + QString WinStack::activeFileName() const { QString f; - if (m_activeWindow != 0) - f = m_activeWindow->fileName(); + if (activeWindow() != 0) + f = activeWindow()->fileName(); return f; } void WinStack::slotFindForward() { - if (m_activeWindow != 0) - m_activeWindow->find(m_findDlg.searchText(), m_findDlg.caseSensitive(), + if (activeWindow() != 0) + activeWindow()->find(m_findDlg.searchText(), m_findDlg.caseSensitive(), SourceWindow::findForward); } void WinStack::slotFindBackward() { - if (m_activeWindow != 0) - m_activeWindow->find(m_findDlg.searchText(), m_findDlg.caseSensitive(), + if (activeWindow() != 0) + activeWindow()->find(m_findDlg.searchText(), m_findDlg.caseSensitive(), SourceWindow::findBackward); } void WinStack::maybeTip(const QPoint& p) { - if (m_activeWindow == 0) + if (activeWindow() == 0) return; // get the word at the point QString word; QRect r; - if (!m_activeWindow->wordAtPoint(p, word, r)) + if (!activeWindow()->wordAtPoint(p, word, r)) return; // must be valid @@ -375,9 +380,9 @@ void WinStack::slotSetTabWidth(int numChars) void WinStack::slotFileReload() { - if (m_activeWindow != 0) { + if (activeWindow() != 0) { TRACE("reloading one file"); - m_activeWindow->reloadFile(); + activeWindow()->reloadFile(); } } @@ -516,7 +521,7 @@ void WinStack::selectWindow(int id) for (int i = 0; i < m_fileList.size(); i++) { dlg.insertString(m_fileList[i]->fileName()); - if (m_activeWindow == m_fileList[i]) { + if (activeWindow() == m_fileList[i]) { index = i; } } diff --git a/kdbg/winstack.h b/kdbg/winstack.h index 0a44fa3..eb8082b 100644 --- a/kdbg/winstack.h +++ b/kdbg/winstack.h @@ -88,6 +88,7 @@ public: void maybeTip(const QPoint& p); bool hasWindows() const { return m_fileList.size() > 0; } QString activeFileName() const; + SourceWindow* activeWindow() const; virtual QSize sizeHint() const; virtual void resizeEvent(QResizeEvent*); -- 2.11.4.GIT