forked from qt-creator/qt-creator
make watchers persistent in the session
This commit is contained in:
@@ -2157,6 +2157,7 @@ static void qDumpStdMap(QDumper &d)
|
|||||||
|
|
||||||
// HACK: we need a properly const qualified version of the
|
// HACK: we need a properly const qualified version of the
|
||||||
// std::pair used. We extract it from the allocator parameter
|
// std::pair used. We extract it from the allocator parameter
|
||||||
|
// (#4, "std::allocator<std::pair<key, value> >")
|
||||||
// as it is there, and, equally importantly, in an order that
|
// as it is there, and, equally importantly, in an order that
|
||||||
// gdb accepts when fed with it.
|
// gdb accepts when fed with it.
|
||||||
char *pairType = (char *)(d.templateParameters[3]) + 16;
|
char *pairType = (char *)(d.templateParameters[3]) + 16;
|
||||||
|
@@ -250,6 +250,10 @@ void DebuggerManager::init()
|
|||||||
this, SLOT(watchExpression(QString)));
|
this, SLOT(watchExpression(QString)));
|
||||||
connect(watchersView, SIGNAL(requestRemoveWatchExpression(QString)),
|
connect(watchersView, SIGNAL(requestRemoveWatchExpression(QString)),
|
||||||
this, SLOT(removeWatchExpression(QString)));
|
this, SLOT(removeWatchExpression(QString)));
|
||||||
|
connect(m_watchHandler, SIGNAL(sessionValueRequested(QString,QVariant*)),
|
||||||
|
this, SIGNAL(sessionValueRequested(QString,QVariant*)));
|
||||||
|
connect(m_watchHandler, SIGNAL(setSessionValueRequested(QString,QVariant)),
|
||||||
|
this, SIGNAL(setSessionValueRequested(QString,QVariant)));
|
||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
QTreeView *tooltipView = qobject_cast<QTreeView *>(m_tooltipWindow);
|
QTreeView *tooltipView = qobject_cast<QTreeView *>(m_tooltipWindow);
|
||||||
@@ -948,6 +952,7 @@ void DebuggerManager::aboutToSaveSession()
|
|||||||
void DebuggerManager::loadSessionData()
|
void DebuggerManager::loadSessionData()
|
||||||
{
|
{
|
||||||
m_breakHandler->loadSessionData();
|
m_breakHandler->loadSessionData();
|
||||||
|
m_watchHandler->loadSessionData();
|
||||||
|
|
||||||
QVariant value;
|
QVariant value;
|
||||||
querySessionValue(QLatin1String("UseFastStart"), &value);
|
querySessionValue(QLatin1String("UseFastStart"), &value);
|
||||||
@@ -964,6 +969,7 @@ void DebuggerManager::loadSessionData()
|
|||||||
void DebuggerManager::saveSessionData()
|
void DebuggerManager::saveSessionData()
|
||||||
{
|
{
|
||||||
m_breakHandler->saveSessionData();
|
m_breakHandler->saveSessionData();
|
||||||
|
m_watchHandler->saveSessionData();
|
||||||
|
|
||||||
setSessionValue(QLatin1String("UseFastStart"),
|
setSessionValue(QLatin1String("UseFastStart"),
|
||||||
m_useFastStartAction->isChecked());
|
m_useFastStartAction->isChecked());
|
||||||
|
@@ -888,6 +888,8 @@ void WatchHandler::watchExpression(const QString &exp)
|
|||||||
data.name = exp;
|
data.name = exp;
|
||||||
data.iname = "watch." + exp;
|
data.iname = "watch." + exp;
|
||||||
insertData(data);
|
insertData(data);
|
||||||
|
m_watchers.append(exp);
|
||||||
|
saveWatchers();
|
||||||
emit watchModelUpdateRequested();
|
emit watchModelUpdateRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -965,7 +967,9 @@ void WatchHandler::showEditValue(const WatchData &data)
|
|||||||
void WatchHandler::removeWatchExpression(const QString &iname)
|
void WatchHandler::removeWatchExpression(const QString &iname)
|
||||||
{
|
{
|
||||||
MODEL_DEBUG("REMOVE WATCH: " << iname);
|
MODEL_DEBUG("REMOVE WATCH: " << iname);
|
||||||
(void) takeData(iname);
|
WatchData data = takeData(iname);
|
||||||
|
m_watchers.removeOne(data.iname);
|
||||||
|
saveWatchers();
|
||||||
emit watchModelUpdateRequested();
|
emit watchModelUpdateRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -973,19 +977,26 @@ void WatchHandler::reinitializeWatchers()
|
|||||||
{
|
{
|
||||||
m_completeSet = initialSet();
|
m_completeSet = initialSet();
|
||||||
m_incompleteSet.clear();
|
m_incompleteSet.clear();
|
||||||
|
reinitializeWatchersHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchHandler::reinitializeWatchersHelper()
|
||||||
|
{
|
||||||
// copy over all watchers and mark all watchers as incomplete
|
// copy over all watchers and mark all watchers as incomplete
|
||||||
for (int i = 0, n = m_oldSet.size(); i < n; ++i) {
|
int i = 0;
|
||||||
WatchData data = m_oldSet.at(i);
|
foreach (const QString &exp, m_watchers) {
|
||||||
if (data.isWatcher()) {
|
WatchData data;
|
||||||
data.level = -1;
|
data.level = -1;
|
||||||
data.row = -1;
|
data.row = -1;
|
||||||
data.parentIndex = -1;
|
data.parentIndex = -1;
|
||||||
data.variable.clear();
|
data.variable.clear();
|
||||||
data.setAllNeeded();
|
data.setAllNeeded();
|
||||||
data.valuedisabled = false;
|
data.valuedisabled = false;
|
||||||
insertData(data); // properly handles "neededChildren"
|
data.iname = "watch." + QString::number(i);
|
||||||
}
|
data.name = exp;
|
||||||
|
data.exp = exp;
|
||||||
|
insertData(data);
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1180,3 +1191,29 @@ bool WatchHandler::checkIndex(int id) const
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchHandler::loadWatchers()
|
||||||
|
{
|
||||||
|
QVariant value;
|
||||||
|
sessionValueRequested("Watchers", &value);
|
||||||
|
m_watchers = value.toStringList();
|
||||||
|
qDebug() << "LOAD WATCHERS: " << m_watchers;
|
||||||
|
reinitializeWatchersHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchHandler::saveWatchers()
|
||||||
|
{
|
||||||
|
qDebug() << "SAVE WATCHERS: " << m_watchers;
|
||||||
|
setSessionValueRequested("Watchers", m_watchers);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchHandler::saveSessionData()
|
||||||
|
{
|
||||||
|
saveWatchers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchHandler::loadSessionData()
|
||||||
|
{
|
||||||
|
loadWatchers();
|
||||||
|
rebuildModel();
|
||||||
|
}
|
||||||
|
@@ -186,13 +186,23 @@ public:
|
|||||||
|
|
||||||
WatchData *findData(const QString &iname);
|
WatchData *findData(const QString &iname);
|
||||||
|
|
||||||
|
void loadSessionData();
|
||||||
|
void saveSessionData();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void watchModelUpdateRequested();
|
void watchModelUpdateRequested();
|
||||||
|
|
||||||
|
void sessionValueRequested(const QString &name, QVariant *value);
|
||||||
|
void setSessionValueRequested(const QString &name, const QVariant &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void reinitializeWatchersHelper();
|
||||||
WatchData takeData(const QString &iname);
|
WatchData takeData(const QString &iname);
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
|
|
||||||
|
void loadWatchers();
|
||||||
|
void saveWatchers();
|
||||||
|
|
||||||
bool m_expandPointers;
|
bool m_expandPointers;
|
||||||
bool m_inChange;
|
bool m_inChange;
|
||||||
|
|
||||||
@@ -203,6 +213,7 @@ private:
|
|||||||
QList<WatchData> m_completeSet;
|
QList<WatchData> m_completeSet;
|
||||||
QList<WatchData> m_oldSet;
|
QList<WatchData> m_oldSet;
|
||||||
QList<WatchData> m_displaySet;
|
QList<WatchData> m_displaySet;
|
||||||
|
QStringList m_watchers;
|
||||||
|
|
||||||
void setDisplayedIName(const QString &iname, bool on);
|
void setDisplayedIName(const QString &iname, bool on);
|
||||||
QSet<QString> m_expandedINames; // those expanded in the treeview
|
QSet<QString> m_expandedINames; // those expanded in the treeview
|
||||||
|
@@ -116,7 +116,7 @@ private:
|
|||||||
|
|
||||||
void testArray()
|
void testArray()
|
||||||
{
|
{
|
||||||
QString x[4];
|
QString x[20];
|
||||||
x[0] = "a";
|
x[0] = "a";
|
||||||
x[1] = "b";
|
x[1] = "b";
|
||||||
x[2] = "c";
|
x[2] = "c";
|
||||||
|
Reference in New Issue
Block a user