forked from qt-creator/qt-creator
QmlDebugger: user input on watches
Reviewed-by: hjk
This commit is contained in:
@@ -1311,6 +1311,16 @@ unsigned DebuggerEngine::debuggerCapabilities() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool DebuggerEngine::canWatchWidgets() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DebuggerEngine::acceptsWatchesWhileRunning() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DebuggerEngine::isSynchronous() const
|
||||
{
|
||||
return false;
|
||||
|
@@ -180,6 +180,8 @@ public:
|
||||
virtual void setRegisterValue(int regnr, const QString &value);
|
||||
virtual void addOptionPages(QList<Core::IOptionsPage*> *) const;
|
||||
virtual unsigned debuggerCapabilities() const;
|
||||
virtual bool canWatchWidgets() const;
|
||||
virtual bool acceptsWatchesWhileRunning() const;
|
||||
|
||||
virtual bool isSynchronous() const;
|
||||
virtual QByteArray qtNamespace() const;
|
||||
|
@@ -482,7 +482,7 @@ public:
|
||||
void runEngine() {}
|
||||
void shutdownEngine() {}
|
||||
void shutdownInferior() {}
|
||||
unsigned debuggerCapabilities() const { return 0; }
|
||||
unsigned debuggerCapabilities() const { return AddWatcherCapability; }
|
||||
bool acceptsBreakpoint(BreakpointId) const { return false; }
|
||||
bool acceptsDebuggerCommands() const { return false; }
|
||||
};
|
||||
|
@@ -1895,6 +1895,11 @@ unsigned GdbEngine::debuggerCapabilities() const
|
||||
return caps | SnapshotCapability;
|
||||
}
|
||||
|
||||
bool GdbEngine::canWatchWidgets() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void GdbEngine::continueInferiorInternal()
|
||||
{
|
||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||
|
@@ -110,6 +110,7 @@ private: ////////// General Interface //////////
|
||||
virtual void runEngine();
|
||||
|
||||
virtual unsigned debuggerCapabilities() const;
|
||||
virtual bool canWatchWidgets() const;
|
||||
virtual void detachDebugger();
|
||||
virtual void shutdownEngine();
|
||||
virtual void shutdownInferior();
|
||||
|
@@ -248,6 +248,16 @@ unsigned QmlCppEngine::debuggerCapabilities() const
|
||||
return d->m_cppEngine->debuggerCapabilities();
|
||||
}
|
||||
|
||||
bool QmlCppEngine::canWatchWidgets() const
|
||||
{
|
||||
return d->m_activeEngine->canWatchWidgets();
|
||||
}
|
||||
|
||||
bool QmlCppEngine::acceptsWatchesWhileRunning() const
|
||||
{
|
||||
return d->m_activeEngine->acceptsWatchesWhileRunning();
|
||||
}
|
||||
|
||||
bool QmlCppEngine::isSynchronous() const
|
||||
{
|
||||
return d->m_activeEngine->isSynchronous();
|
||||
|
@@ -75,6 +75,8 @@ public:
|
||||
|
||||
void setRegisterValue(int regnr, const QString &value);
|
||||
unsigned debuggerCapabilities() const;
|
||||
virtual bool canWatchWidgets() const;
|
||||
virtual bool acceptsWatchesWhileRunning() const;
|
||||
|
||||
bool isSynchronous() const;
|
||||
QByteArray qtNamespace() const;
|
||||
|
@@ -353,6 +353,11 @@ void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
|
||||
DebuggerEngine::showMessage(msg, channel, timeout);
|
||||
}
|
||||
|
||||
bool QmlEngine::acceptsWatchesWhileRunning() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmlEngine::closeConnection()
|
||||
{
|
||||
disconnect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
|
||||
|
@@ -63,6 +63,7 @@ public:
|
||||
void showMessage(const QString &msg, int channel = LogDebug,
|
||||
int timeout = -1) const;
|
||||
void filterApplicationMessage(const QString &msg, int channel);
|
||||
virtual bool acceptsWatchesWhileRunning() const;
|
||||
|
||||
public slots:
|
||||
void messageReceived(const QByteArray &message);
|
||||
|
@@ -811,7 +811,7 @@ Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
|
||||
|
||||
// Disable editing if debuggee is positively running.
|
||||
const bool isRunning = engine() && engine()->state() == InferiorRunOk;
|
||||
if (isRunning)
|
||||
if (isRunning && engine() && !engine()->acceptsWatchesWhileRunning())
|
||||
return notEditable;
|
||||
|
||||
const WatchData &data = *watchItem(idx);
|
||||
@@ -1186,6 +1186,10 @@ void WatchHandler::insertData(const WatchData &data)
|
||||
if (data.isSomethingNeeded() && data.iname.contains('.')) {
|
||||
MODEL_DEBUG("SOMETHING NEEDED: " << data.toString());
|
||||
if (!m_engine->isSynchronous()) {
|
||||
WatchModel *model = modelForIName(data.iname);
|
||||
QTC_ASSERT(model, return);
|
||||
model->insertData(data);
|
||||
|
||||
m_engine->updateWatchData(data);
|
||||
} else {
|
||||
m_engine->showMessage(QLatin1String("ENDLESS LOOP: SOMETHING NEEDED: ")
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QResizeEvent>
|
||||
#include <QtGui/QInputDialog>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -361,15 +362,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
|
||||
const bool actionsEnabled = engine->debuggerActionsEnabled();
|
||||
const unsigned engineCapabilities = engine->debuggerCapabilities();
|
||||
const bool canHandleWatches =
|
||||
actionsEnabled && (engineCapabilities & AddWatcherCapability);
|
||||
const bool canHandleWatches = engineCapabilities & AddWatcherCapability;
|
||||
const DebuggerState state = engine->state();
|
||||
const bool canInsertWatches = (state==InferiorStopOk) || ((state==InferiorRunOk) && engine->acceptsWatchesWhileRunning());
|
||||
|
||||
QMenu menu;
|
||||
QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item"));
|
||||
actInsertNewWatchItem->setEnabled(canHandleWatches);
|
||||
actInsertNewWatchItem->setEnabled(canHandleWatches && canInsertWatches);
|
||||
QAction *actSelectWidgetToWatch = menu.addAction(tr("Select Widget to Watch"));
|
||||
actSelectWidgetToWatch->setEnabled(canHandleWatches);
|
||||
actSelectWidgetToWatch->setEnabled(canHandleWatches && (engine->canWatchWidgets()));
|
||||
|
||||
// Offer to open address pointed to or variable address.
|
||||
const bool createPointerActions = pointerValue && pointerValue != address;
|
||||
@@ -497,7 +498,13 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||
if (act == actAdjustColumnWidths) {
|
||||
resizeColumnsToContents();
|
||||
} else if (act == actInsertNewWatchItem) {
|
||||
watchExpression(QString());
|
||||
bool ok;
|
||||
QString newExp = QInputDialog::getText(this, tr("Enter watch expression"),
|
||||
tr("Expression:"), QLineEdit::Normal,
|
||||
QString(), &ok);
|
||||
if (ok && !newExp.isEmpty()) {
|
||||
watchExpression(newExp);
|
||||
}
|
||||
} else if (act == actOpenMemoryEditAtVariableAddress) {
|
||||
currentEngine()->openMemoryView(address);
|
||||
} else if (act == actOpenMemoryEditAtPointerValue) {
|
||||
|
Reference in New Issue
Block a user