[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kate] addons/kate/gdbplugin: GDB plugin: Do not query locals if the locals panel is hidden.
From:       Kåre Särs <kare.sars () iki ! fi>
Date:       2013-04-30 19:23:14
Message-ID: 20130430192314.79512A603F () git ! kde ! org
[Download RAW message or body]

Git commit 6b6a19fdf61bc6ed2c85083e944f342234d094b3 by Kåre Särs.
Committed on 30/04/2013 at 21:19.
Pushed by sars into branch 'master'.

GDB plugin: Do not query locals if the locals panel is hidden.

M  +19   -2    addons/kate/gdbplugin/debugview.cpp
M  +3    -0    addons/kate/gdbplugin/debugview.h
M  +10   -0    addons/kate/gdbplugin/localsview.cpp
M  +8    -1    addons/kate/gdbplugin/localsview.h
M  +3    -0    addons/kate/gdbplugin/plugin_kategdb.cpp

http://commits.kde.org/kate/6b6a19fdf61bc6ed2c85083e944f342234d094b3

diff --git a/addons/kate/gdbplugin/debugview.cpp b/addons/kate/gdbplugin/debugview.cpp
index 10895c9..ed7ee01 100644
--- a/addons/kate/gdbplugin/debugview.cpp
+++ b/addons/kate/gdbplugin/debugview.cpp
@@ -44,7 +44,8 @@ DebugView::DebugView( QObject* parent )
     m_debugProcess(0),
     m_state( none ),
     m_subState( normal ),
-    m_debugLocationChanged( true )
+    m_debugLocationChanged( true ),
+    m_queryLocals( false )
 {
 }
 
@@ -617,7 +618,7 @@ void DebugView::issueNextCommand()
             // FIXME "thread" needs a better generic solution 
             if (m_debugLocationChanged || m_lastCommand.startsWith("thread")) {
                 m_debugLocationChanged = false;
-                if (!m_lastCommand.startsWith("(Q)")) {
+                if (m_queryLocals && !m_lastCommand.startsWith("(Q)")) {
                     m_nextCommands << "(Q)info stack";
                     m_nextCommands << "(Q)frame";
                     m_nextCommands << "(Q)info args";
@@ -666,3 +667,19 @@ void DebugView::outputTextMaybe( const QString &text )
         emit outputText( text + '\n' );
     }
 }
+
+
+void DebugView::slotQueryLocals(bool query)
+{
+    m_queryLocals = query;
+    if ( query && ( m_state == ready ) && ( m_nextCommands.size() == 0 ) )
+    {
+        m_nextCommands << "(Q)info stack";
+        m_nextCommands << "(Q)frame";
+        m_nextCommands << "(Q)info args";
+        m_nextCommands << "(Q)print *this";
+        m_nextCommands << "(Q)info locals";
+        m_nextCommands << "(Q)info thread";
+        issueNextCommand();
+    }
+}
diff --git a/addons/kate/gdbplugin/debugview.h b/addons/kate/gdbplugin/debugview.h
index cc351f2..3b64dee 100644
--- a/addons/kate/gdbplugin/debugview.h
+++ b/addons/kate/gdbplugin/debugview.h
@@ -59,6 +59,8 @@ public Q_SLOTS:
     void slotKill();
     void slotReRun();
 
+    void slotQueryLocals(bool display);
+
 private Q_SLOTS:
     void slotError();
     void slotReadDebugStdOut();
@@ -135,6 +137,7 @@ private:
     QString             m_outBuffer;
     QString             m_errBuffer;
     QStringList         m_errorList;
+    bool                m_queryLocals;
 };
 
 #endif
diff --git a/addons/kate/gdbplugin/localsview.cpp b/addons/kate/gdbplugin/localsview.cpp
index 7696a23..3f1bcc0 100644
--- a/addons/kate/gdbplugin/localsview.cpp
+++ b/addons/kate/gdbplugin/localsview.cpp
@@ -37,6 +37,16 @@ LocalsView::~LocalsView()
 {
 }
 
+void LocalsView::showEvent(QShowEvent *)
+{
+    emit localsVisible(true);
+}
+
+void LocalsView::hideEvent(QHideEvent *)
+{
+    emit localsVisible(false);
+}
+
 void LocalsView::createWrappedItem(QTreeWidgetItem *parent, const QString &name, const QString &value)
 {
     QTreeWidgetItem *item = new QTreeWidgetItem(parent, QStringList(name));
diff --git a/addons/kate/gdbplugin/localsview.h b/addons/kate/gdbplugin/localsview.h
index 7d41d4b..febfaf3 100644
--- a/addons/kate/gdbplugin/localsview.h
+++ b/addons/kate/gdbplugin/localsview.h
@@ -36,7 +36,14 @@ public Q_SLOTS:
     void addLocal(const QString &vString);
     void addStruct(QTreeWidgetItem *parent, const QString &vString);
     void addArray(QTreeWidgetItem *parent, const QString &vString);
-    
+
+Q_SIGNALS:
+    void localsVisible(bool visible);
+
+protected:
+    void showEvent(QShowEvent *event);
+    void hideEvent(QHideEvent *event);
+
 private:
     void createWrappedItem(QTreeWidgetItem *parent, const QString &name, const QString &value);
     void createWrappedItem(QTreeWidget *parent, const QString &name, const QString &value);
diff --git a/addons/kate/gdbplugin/plugin_kategdb.cpp b/addons/kate/gdbplugin/plugin_kategdb.cpp
index 760f8f8..2ee1f48 100644
--- a/addons/kate/gdbplugin/plugin_kategdb.cpp
+++ b/addons/kate/gdbplugin/plugin_kategdb.cpp
@@ -211,6 +211,9 @@ KatePluginGDBView::KatePluginGDBView( Kate::MainWindow* mainWin, Kate::Applicati
     connect( m_debugView, SIGNAL(threadInfo(int,bool)),
              this,        SLOT(insertThread(int,bool)) );
 
+    connect( m_localsView, SIGNAL(localsVisible(bool)),
+             m_debugView,  SLOT(slotQueryLocals(bool)) );
+
     // Actions
     m_configView->registerActions( actionCollection() );
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic