From 0d9e5eb100f181716a83157012acb4a6ba465818 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 10 May 2009 14:39:09 +0200 Subject: [PATCH] Show the active file's name as tab tooltip instead of in the title bar. Since the source file's name is now visible in the tab, we do not need to show it in the window title anymore, but we can show it as a tab tooltip. Previously, the caption was updated every time the source file was switched. This is no longer necessary, and it is sufficient to change the title only when a new program is loaded. --- kdbg/dbgmainwnd.cpp | 29 ++++------------------------- kdbg/dbgmainwnd.h | 1 - kdbg/winstack.cpp | 4 ++-- kdbg/winstack.h | 1 - 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/kdbg/dbgmainwnd.cpp b/kdbg/dbgmainwnd.cpp index 6c60a26..74df6a8 100644 --- a/kdbg/dbgmainwnd.cpp +++ b/kdbg/dbgmainwnd.cpp @@ -119,9 +119,6 @@ DebuggerMainWnd::DebuggerMainWnd(const char* name) : // tab width connect(this, SIGNAL(setTabWidth(int)), m_filesWindow, SIGNAL(setTabWidth(int))); - // file/line updates - connect(m_filesWindow, SIGNAL(fileChanged()), SLOT(slotFileChanged())); - // connect breakpoint table connect(m_bpTable, SIGNAL(activateFileLine(const QString&,int,const DbgAddr&)), m_filesWindow, SLOT(activate(const QString&,int,const DbgAddr&))); @@ -156,7 +153,6 @@ DebuggerMainWnd::DebuggerMainWnd(const char* name) : updateUI(); m_bpTable->updateUI(); - slotFileChanged(); } DebuggerMainWnd::~DebuggerMainWnd() @@ -512,27 +508,6 @@ void DebuggerMainWnd::slotAddWatch(const QString& text) } } -void DebuggerMainWnd::slotFileChanged() -{ - // set caption - QString caption; - - if (m_debugger->haveExecutable()) { - // basename part of executable - QFileInfo executable = m_debugger->executable(); - caption += executable.fileName(); - } - QString file; - int line; - bool anyWindows = m_filesWindow->activeLine(file, line); - if (anyWindows) { - caption += " ("; - caption += file; - caption += ")"; - } - setCaption(caption); -} - void DebuggerMainWnd::slotNewFileLoaded() { // updates program counter in the new file @@ -622,6 +597,10 @@ bool DebuggerMainWnd::debugProgram(const QString& exe, const QString& lang) // keep the directory m_lastDirectory = fi.dirPath(true); m_filesWindow->setExtraDirectory(m_lastDirectory); + + // set caption to basename part of executable + QString caption = fi.fileName(); + setCaption(caption); } else { diff --git a/kdbg/dbgmainwnd.h b/kdbg/dbgmainwnd.h index d008f8e..cac766b 100644 --- a/kdbg/dbgmainwnd.h +++ b/kdbg/dbgmainwnd.h @@ -82,7 +82,6 @@ signals: public slots: virtual void updateUI(); virtual void updateLineItems(); - void slotFileChanged(); void slotAddWatch(); void slotAddWatch(const QString& text); void slotNewFileLoaded(); diff --git a/kdbg/winstack.cpp b/kdbg/winstack.cpp index d5d9151..9a55004 100644 --- a/kdbg/winstack.cpp +++ b/kdbg/winstack.cpp @@ -113,6 +113,8 @@ bool WinStack::activatePath(QString pathName, int lineNo, const DbgAddr& address } addTab(fw, QFileInfo(pathName).fileName()); + setTabToolTip(fw, pathName); + connect(fw, SIGNAL(clickedLeft(const QString&,int,const DbgAddr&,bool)), SIGNAL(toggleBreak(const QString&,int,const DbgAddr&,bool))); connect(fw, SIGNAL(clickedMid(const QString&,int,const DbgAddr&)), @@ -148,8 +150,6 @@ bool WinStack::activateWindow(SourceWindow* fw, int lineNo, const DbgAddr& addre showPage(fw); fw->setFocus(); - emit fileChanged(); - return true; } diff --git a/kdbg/winstack.h b/kdbg/winstack.h index af0d760..b8281c5 100644 --- a/kdbg/winstack.h +++ b/kdbg/winstack.h @@ -84,7 +84,6 @@ public: virtual QSize sizeHint() const; signals: - void fileChanged(); void toggleBreak(const QString&, int, const DbgAddr&, bool); void enadisBreak(const QString&, int, const DbgAddr&); void newFileLoaded(); -- 2.11.4.GIT