KDE/kdevelop
Vladimir Prus
ghost at cs.msu.su
Tue Jul 19 13:48:02 UTC 2005
SVN commit 436239 by vprus:
Automatically show variables window when application stops,
and hide when application terminates.
* languages/cpp/debugger/debuggerpart.cpp
(DebuggerPart::slotDbgStatus): Add show/hide logic.
* src/newmainwindow.cpp
(NewMainWindow::lowerView): Implement. The previous implementation
did nothing.
CCMAIL: kdevelop-devel at kdevelop.org
M +32 -1 languages/cpp/debugger/debuggerpart.cpp
M +5 -0 languages/cpp/debugger/debuggerpart.h
M +7 -2 src/newmainwindow.cpp
--- trunk/KDE/kdevelop/languages/cpp/debugger/debuggerpart.cpp #436238:436239
@@ -71,7 +71,7 @@
DebuggerPart::DebuggerPart( QObject *parent, const char *name, const QStringList & ) :
KDevPlugin( &data, parent, name ? name : "DebuggerPart" ),
- controller(0)
+ controller(0), justRestarted_(false)
{
setObjId("DebuggerInterface");
setInstance(DebuggerFactory::instance());
@@ -919,13 +919,42 @@
ac->action("debug_run")->setWhatsThis( i18n("Restart in debugger\n\n"
"Restarts the program in the debugger") );
slotStop();
+ mainWindow()->lowerView(variableWidget);
}
else
{
stateIndicator = "P";
stateChanged( QString("paused") );
+ // On the first stop, show the variables view.
+ // We do it on first stop, and not at debugger start, because
+ // a program might just successfully run till completion. If we show
+ // the var views on start and hide on stop, this will look like flicker.
+ // On the other hand, if application is paused, it's very
+ // likely that the user wants to see variables.
+ if (justRestarted_)
+ {
+ justRestarted_ = false;
+ mainWindow()->raiseView(variableWidget);
+ }
}
+ // As soon as debugger clears 's_appNotStarted' flag, we
+ // set 'justRestarted' variable.
+ // The other approach would be to set justRestarted in slotRun, slotCore
+ // and slotAttach.
+ // Note that setting this var in startDebugger is not OK, because the
+ // initial state of debugger is exactly the same as state after pause,
+ // so we'll always show varaibles view.
+ if ((previousDebuggerState_ & s_appNotStarted) &&
+ !(state & s_appNotStarted))
+ {
+ justRestarted_ = true;
+ }
+ if (state & s_appNotStarted)
+ {
+ justRestarted_ = false;
+ }
+
// And now? :-)
kdDebug(9012) << "Debugger state: " << stateIndicator << ": " << endl;
kdDebug(9012) << " " << msg << endl;
@@ -933,6 +962,8 @@
statusBarIndicator->setText(stateIndicator);
if (!msg.isEmpty())
mainWindow()->statusBar()->message(msg, 3000);
+
+ previousDebuggerState_ = state;
}
--- trunk/KDE/kdevelop/languages/cpp/debugger/debuggerpart.h #436238:436239
@@ -115,6 +115,11 @@
QCString m_drkonqi;
KDevDebugger *m_debugger;
+ int previousDebuggerState_;
+ // Set to true after each debugger restart
+ // Currently used to auto-show variables view
+ // on the first pause.
+ bool justRestarted_;
};
}
--- trunk/KDE/kdevelop/src/newmainwindow.cpp #436238:436239
@@ -674,9 +674,14 @@
}
-void NewMainWindow::lowerView(QWidget *)
+void NewMainWindow::lowerView(QWidget* view)
{
- // seems there's nothing to do here
+ if( !view || !view->parentWidget() )
+ return;
+
+ if( QGuardedPtr<KDockWidget> dockWidget = static_cast<KDockWidget*>(view->parentWidget()->qt_cast("KDockWidget")) ) {
+ makeDockInvisible( dockWidget );
+ }
}
More information about the KDevelop-devel
mailing list