forked from qt-creator/qt-creator
rename QWB_ASSERT into QTC_ASSERT
This commit is contained in:
@@ -31,16 +31,16 @@
|
|||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef DEBUGGER_QWB_ASSERT_H
|
#ifndef DEBUGGER_QTC_ASSERT_H
|
||||||
#define DEBUGGER_QWB_ASSERT_H
|
#define DEBUGGER_QTC_ASSERT_H
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
#define QWB_ASSERT(cond, action) \
|
#define QTC_ASSERT(cond, action) \
|
||||||
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;action;}
|
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;action;}
|
||||||
#else
|
#else
|
||||||
#define QWB_ASSERT(cond, action) \
|
#define QTC_ASSERT(cond, action) \
|
||||||
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED";action;}
|
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED";action;}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // DEBUGGER_QWB_ASSERT_H
|
#endif // DEBUGGER_QTC_ASSERT_H
|
||||||
|
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|
|||||||
static const QIcon icon2(":/gdbdebugger/images/breakpoint_pending.svg");
|
static const QIcon icon2(":/gdbdebugger/images/breakpoint_pending.svg");
|
||||||
static const QString empty = QString(QLatin1Char('-'));
|
static const QString empty = QString(QLatin1Char('-'));
|
||||||
|
|
||||||
QWB_ASSERT(mi.isValid(), return QVariant());
|
QTC_ASSERT(mi.isValid(), return QVariant());
|
||||||
|
|
||||||
if (mi.row() >= size())
|
if (mi.row() >= size())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@@ -550,7 +550,7 @@ void BreakHandler::breakByFunction(const QString &functionName)
|
|||||||
// One per function is enough for now
|
// One per function is enough for now
|
||||||
for (int index = size(); --index >= 0;) {
|
for (int index = size(); --index >= 0;) {
|
||||||
const BreakpointData *data = at(index);
|
const BreakpointData *data = at(index);
|
||||||
QWB_ASSERT(data, break);
|
QTC_ASSERT(data, break);
|
||||||
if (data->funcName == functionName && data->condition.isEmpty()
|
if (data->funcName == functionName && data->condition.isEmpty()
|
||||||
&& data->ignoreCount.isEmpty())
|
&& data->ignoreCount.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ void DebuggerPlugin::shutdown()
|
|||||||
{
|
{
|
||||||
if (m_debugMode)
|
if (m_debugMode)
|
||||||
m_debugMode->shutdown(); // saves state including manager information
|
m_debugMode->shutdown(); // saves state including manager information
|
||||||
QWB_ASSERT(m_manager, /**/);
|
QTC_ASSERT(m_manager, /**/);
|
||||||
if (m_manager)
|
if (m_manager)
|
||||||
m_manager->shutdown();
|
m_manager->shutdown();
|
||||||
|
|
||||||
@@ -226,13 +226,13 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
m_pm = ExtensionSystem::PluginManager::instance();
|
m_pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
|
||||||
ICore *core = m_pm->getObject<Core::ICore>();
|
ICore *core = m_pm->getObject<Core::ICore>();
|
||||||
QWB_ASSERT(core, return false);
|
QTC_ASSERT(core, return false);
|
||||||
|
|
||||||
Core::ActionManagerInterface *actionManager = core->actionManager();
|
Core::ActionManagerInterface *actionManager = core->actionManager();
|
||||||
QWB_ASSERT(actionManager, return false);
|
QTC_ASSERT(actionManager, return false);
|
||||||
|
|
||||||
Core::UniqueIDManager *uidm = core->uniqueIDManager();
|
Core::UniqueIDManager *uidm = core->uniqueIDManager();
|
||||||
QWB_ASSERT(uidm, return false);
|
QTC_ASSERT(uidm, return false);
|
||||||
|
|
||||||
QList<int> globalcontext;
|
QList<int> globalcontext;
|
||||||
globalcontext << Core::Constants::C_GLOBAL_ID;
|
globalcontext << Core::Constants::C_GLOBAL_ID;
|
||||||
@@ -598,13 +598,13 @@ void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
|
|||||||
|
|
||||||
void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value)
|
void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value)
|
||||||
{
|
{
|
||||||
QWB_ASSERT(m_debugMode, return);
|
QTC_ASSERT(m_debugMode, return);
|
||||||
m_debugMode->settings()->setValue(name, value);
|
m_debugMode->settings()->setValue(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPlugin::queryConfigValue(const QString &name, QVariant *value)
|
void DebuggerPlugin::queryConfigValue(const QString &name, QVariant *value)
|
||||||
{
|
{
|
||||||
QWB_ASSERT(m_debugMode, return);
|
QTC_ASSERT(m_debugMode, return);
|
||||||
*value = m_debugMode->settings()->value(name);
|
*value = m_debugMode->settings()->value(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,9 +118,9 @@ void DebuggerRunControl::start()
|
|||||||
m_running = true;
|
m_running = true;
|
||||||
ApplicationRunConfigurationPtr rc =
|
ApplicationRunConfigurationPtr rc =
|
||||||
qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration());
|
qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration());
|
||||||
QWB_ASSERT(rc, return);
|
QTC_ASSERT(rc, return);
|
||||||
ProjectExplorer::Project *project = rc->project();
|
ProjectExplorer::Project *project = rc->project();
|
||||||
QWB_ASSERT(project, return);
|
QTC_ASSERT(project, return);
|
||||||
|
|
||||||
m_manager->m_executable = rc->executable();
|
m_manager->m_executable = rc->executable();
|
||||||
m_manager->m_environment = rc->environment().toStringList();
|
m_manager->m_environment = rc->environment().toStringList();
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ void GdbEngine::readGdbStandardOutput()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_inbuffer.append(out);
|
m_inbuffer.append(out);
|
||||||
//QWB_ASSERT(!m_inbuffer.isEmpty(), return);
|
//QTC_ASSERT(!m_inbuffer.isEmpty(), return);
|
||||||
|
|
||||||
char c = m_inbuffer[m_inbuffer.size() - 1];
|
char c = m_inbuffer[m_inbuffer.size() - 1];
|
||||||
static const QByteArray termArray("(gdb) ");
|
static const QByteArray termArray("(gdb) ");
|
||||||
@@ -1398,7 +1398,7 @@ void GdbEngine::handleFileExecAndSymbols
|
|||||||
QString msg = response.data.findChild("msg").data();
|
QString msg = response.data.findChild("msg").data();
|
||||||
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
||||||
tr("Starting executable failed:\n") + msg);
|
tr("Starting executable failed:\n") + msg);
|
||||||
QWB_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
||||||
interruptInferior();
|
interruptInferior();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1419,7 +1419,7 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response)
|
|||||||
} else {
|
} else {
|
||||||
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
||||||
tr("Starting executable failed:\n") + msg);
|
tr("Starting executable failed:\n") + msg);
|
||||||
QWB_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
||||||
interruptInferior();
|
interruptInferior();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2414,7 +2414,7 @@ void GdbEngine::selectThread(int index)
|
|||||||
threadsHandler->setCurrentThread(index);
|
threadsHandler->setCurrentThread(index);
|
||||||
|
|
||||||
QList<ThreadData> threads = threadsHandler->threads();
|
QList<ThreadData> threads = threadsHandler->threads();
|
||||||
QWB_ASSERT(index < threads.size(), return);
|
QTC_ASSERT(index < threads.size(), return);
|
||||||
int id = threads.at(index).id;
|
int id = threads.at(index).id;
|
||||||
q->showStatusMessage(tr("Retrieving data for stack view..."), 10000);
|
q->showStatusMessage(tr("Retrieving data for stack view..."), 10000);
|
||||||
sendCommand(QLatin1String("-thread-select ") + QString::number(id),
|
sendCommand(QLatin1String("-thread-select ") + QString::number(id),
|
||||||
@@ -2431,7 +2431,7 @@ void GdbEngine::activateFrame(int frameIndex)
|
|||||||
//qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex
|
//qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex
|
||||||
// << stackHandler->currentIndex();
|
// << stackHandler->currentIndex();
|
||||||
|
|
||||||
QWB_ASSERT(frameIndex < stackHandler->stackSize(), return);
|
QTC_ASSERT(frameIndex < stackHandler->stackSize(), return);
|
||||||
|
|
||||||
if (oldIndex != frameIndex) {
|
if (oldIndex != frameIndex) {
|
||||||
// Assuming this always succeeds saves a roundtrip.
|
// Assuming this always succeeds saves a roundtrip.
|
||||||
@@ -2952,7 +2952,7 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
|
|||||||
void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
QWB_ASSERT(!data.exp.isEmpty(), return);
|
QTC_ASSERT(!data.exp.isEmpty(), return);
|
||||||
QString tmplate;
|
QString tmplate;
|
||||||
QString inner;
|
QString inner;
|
||||||
bool isTemplate = extractTemplate(data.type, &tmplate, &inner);
|
bool isTemplate = extractTemplate(data.type, &tmplate, &inner);
|
||||||
@@ -3093,7 +3093,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
#if DEBUG_SUBITEM
|
#if DEBUG_SUBITEM
|
||||||
qDebug() << "UPDATE SUBITEM: " << data.toString();
|
qDebug() << "UPDATE SUBITEM: " << data.toString();
|
||||||
#endif
|
#endif
|
||||||
QWB_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
|
|
||||||
// in any case we need the type first
|
// in any case we need the type first
|
||||||
if (data.isTypeNeeded()) {
|
if (data.isTypeNeeded()) {
|
||||||
@@ -3121,7 +3121,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we should have a type now. this is relied upon further below
|
// we should have a type now. this is relied upon further below
|
||||||
QWB_ASSERT(!data.type.isEmpty(), return);
|
QTC_ASSERT(!data.type.isEmpty(), return);
|
||||||
|
|
||||||
// a common case that can be easily solved
|
// a common case that can be easily solved
|
||||||
if (data.isChildrenNeeded() && isPointerType(data.type)
|
if (data.isChildrenNeeded() && isPointerType(data.type)
|
||||||
@@ -3179,7 +3179,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.isValueNeeded()) {
|
if (data.isValueNeeded()) {
|
||||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||||
#if DEBUG_SUBITEM
|
#if DEBUG_SUBITEM
|
||||||
qDebug() << "UPDATE SUBITEM: VALUE";
|
qDebug() << "UPDATE SUBITEM: VALUE";
|
||||||
#endif
|
#endif
|
||||||
@@ -3208,7 +3208,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.isChildrenNeeded()) {
|
if (data.isChildrenNeeded()) {
|
||||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||||
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
||||||
sendSynchronizedCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
sendSynchronizedCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
||||||
return;
|
return;
|
||||||
@@ -3233,14 +3233,14 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.isChildCountNeeded()) {
|
if (data.isChildCountNeeded()) {
|
||||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||||
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
||||||
sendCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
sendCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "FIXME: UPDATE SUBITEM: " << data.toString();
|
qDebug() << "FIXME: UPDATE SUBITEM: " << data.toString();
|
||||||
QWB_ASSERT(false, return);
|
QTC_ASSERT(false, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::updateWatchModel()
|
void GdbEngine::updateWatchModel()
|
||||||
@@ -3254,7 +3254,7 @@ void GdbEngine::updateWatchModel2()
|
|||||||
{
|
{
|
||||||
PENDING_DEBUG("UPDATE WATCH MODEL");
|
PENDING_DEBUG("UPDATE WATCH MODEL");
|
||||||
QList<WatchData> incomplete = qq->watchHandler()->takeCurrentIncompletes();
|
QList<WatchData> incomplete = qq->watchHandler()->takeCurrentIncompletes();
|
||||||
//QWB_ASSERT(incomplete.isEmpty(), /**/);
|
//QTC_ASSERT(incomplete.isEmpty(), /**/);
|
||||||
if (!incomplete.isEmpty()) {
|
if (!incomplete.isEmpty()) {
|
||||||
#if DEBUG_PENDING
|
#if DEBUG_PENDING
|
||||||
qDebug() << "##############################################";
|
qDebug() << "##############################################";
|
||||||
@@ -3419,7 +3419,7 @@ void GdbEngine::handleEvaluateExpression(const GdbResultRecord &record,
|
|||||||
const WatchData &data0)
|
const WatchData &data0)
|
||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
QWB_ASSERT(data.isValid(), qDebug() << "HUH?");
|
QTC_ASSERT(data.isValid(), qDebug() << "HUH?");
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
//if (col == 0)
|
//if (col == 0)
|
||||||
// data.name = record.data.findChild("value").data();
|
// data.name = record.data.findChild("value").data();
|
||||||
@@ -3447,7 +3447,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
|
|||||||
const WatchData &data0)
|
const WatchData &data0)
|
||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
QWB_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
// ignore this case, data will follow
|
// ignore this case, data will follow
|
||||||
} else if (record.resultClass == GdbResultError) {
|
} else if (record.resultClass == GdbResultError) {
|
||||||
@@ -3481,7 +3481,7 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
|||||||
const WatchData &data0)
|
const WatchData &data0)
|
||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
QWB_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
|
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
|
||||||
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
|
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void GdbMi::parseValue(const Char *&from, const Char *to)
|
|||||||
void GdbMi::parseTuple(const Char *&from, const Char *to)
|
void GdbMi::parseTuple(const Char *&from, const Char *to)
|
||||||
{
|
{
|
||||||
//qDebug() << "parseTuple: " << QByteArray::fromUtf16(from, to - from);
|
//qDebug() << "parseTuple: " << QByteArray::fromUtf16(from, to - from);
|
||||||
QWB_ASSERT(*from == '{', /**/);
|
QTC_ASSERT(*from == '{', /**/);
|
||||||
++from;
|
++from;
|
||||||
parseTuple_helper(from, to);
|
parseTuple_helper(from, to);
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ void GdbMi::parseTuple_helper(const Char *&from, const Char *to)
|
|||||||
void GdbMi::parseList(const Char *&from, const Char *to)
|
void GdbMi::parseList(const Char *&from, const Char *to)
|
||||||
{
|
{
|
||||||
//qDebug() << "parseList: " << QByteArray::fromUtf16(from, to - from);
|
//qDebug() << "parseList: " << QByteArray::fromUtf16(from, to - from);
|
||||||
QWB_ASSERT(*from == '[', /**/);
|
QTC_ASSERT(*from == '[', /**/);
|
||||||
++from;
|
++from;
|
||||||
m_type = List;
|
m_type = List;
|
||||||
while (from < to) {
|
while (from < to) {
|
||||||
|
|||||||
@@ -213,8 +213,8 @@ void DebugMode::focusCurrentEditor(IMode *mode)
|
|||||||
void DebugMode::writeSettings() const
|
void DebugMode::writeSettings() const
|
||||||
{
|
{
|
||||||
QSettings *s = settings();
|
QSettings *s = settings();
|
||||||
QWB_ASSERT(m_manager, return);
|
QTC_ASSERT(m_manager, return);
|
||||||
QWB_ASSERT(m_manager->mainWindow(), return);
|
QTC_ASSERT(m_manager->mainWindow(), return);
|
||||||
s->beginGroup(QLatin1String("DebugMode"));
|
s->beginGroup(QLatin1String("DebugMode"));
|
||||||
s->setValue(QLatin1String("State"), m_manager->mainWindow()->saveState());
|
s->setValue(QLatin1String("State"), m_manager->mainWindow()->saveState());
|
||||||
s->setValue(QLatin1String("Locked"), m_toggleLockedAction->isChecked());
|
s->setValue(QLatin1String("Locked"), m_toggleLockedAction->isChecked());
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
|
|||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
//qDebug() << "\nUPDATE SUBITEM: " << data.toString();
|
//qDebug() << "\nUPDATE SUBITEM: " << data.toString();
|
||||||
QWB_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
|
|
||||||
if (data.isTypeNeeded() || data.isValueNeeded()) {
|
if (data.isTypeNeeded() || data.isValueNeeded()) {
|
||||||
QScriptValue ob = data.scriptValue;
|
QScriptValue ob = data.scriptValue;
|
||||||
@@ -667,7 +667,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWB_ASSERT(false, return);
|
QTC_ASSERT(false, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDebuggerEngine *createScriptEngine(DebuggerManager *parent)
|
IDebuggerEngine *createScriptEngine(DebuggerManager *parent)
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const
|
|||||||
|
|
||||||
StackFrame StackHandler::currentFrame() const
|
StackFrame StackHandler::currentFrame() const
|
||||||
{
|
{
|
||||||
QWB_ASSERT(m_currentIndex >= 0, return StackFrame());
|
QTC_ASSERT(m_currentIndex >= 0, return StackFrame());
|
||||||
QWB_ASSERT(m_currentIndex < m_stackFrames.size(), return StackFrame());
|
QTC_ASSERT(m_currentIndex < m_stackFrames.size(), return StackFrame());
|
||||||
return m_stackFrames.at(m_currentIndex);
|
return m_stackFrames.at(m_currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const
|
|||||||
int node = idx.internalId();
|
int node = idx.internalId();
|
||||||
if (node < 0)
|
if (node < 0)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
QWB_ASSERT(node < m_displaySet.size(), return QVariant());
|
QTC_ASSERT(node < m_displaySet.size(), return QVariant());
|
||||||
|
|
||||||
const WatchData &data = m_displaySet.at(node);
|
const WatchData &data = m_displaySet.at(node);
|
||||||
|
|
||||||
@@ -702,10 +702,10 @@ void WatchHandler::rebuildModel()
|
|||||||
|
|
||||||
// Possibly append dummy items to prevent empty views
|
// Possibly append dummy items to prevent empty views
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
QWB_ASSERT(m_displaySet.size() >= 2, ok = false);
|
QTC_ASSERT(m_displaySet.size() >= 2, ok = false);
|
||||||
QWB_ASSERT(m_displaySet.at(1).iname == "local", ok = false);
|
QTC_ASSERT(m_displaySet.at(1).iname == "local", ok = false);
|
||||||
QWB_ASSERT(m_displaySet.at(2).iname == "tooltip", ok = false);
|
QTC_ASSERT(m_displaySet.at(2).iname == "tooltip", ok = false);
|
||||||
QWB_ASSERT(m_displaySet.at(3).iname == "watch", ok = false);
|
QTC_ASSERT(m_displaySet.at(3).iname == "watch", ok = false);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
for (int i = 1; i <= 3; ++i) {
|
for (int i = 1; i <= 3; ++i) {
|
||||||
WatchData &data = m_displaySet[i];
|
WatchData &data = m_displaySet[i];
|
||||||
@@ -777,7 +777,7 @@ void WatchHandler::collapseChildren(const QModelIndex &idx)
|
|||||||
qDebug() << "WATCHHANDLER: COLLAPSE IGNORED" << idx;
|
qDebug() << "WATCHHANDLER: COLLAPSE IGNORED" << idx;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QWB_ASSERT(checkIndex(idx.internalId()), return);
|
QTC_ASSERT(checkIndex(idx.internalId()), return);
|
||||||
#if 0
|
#if 0
|
||||||
QString iname0 = m_displaySet.at(idx.internalId()).iname;
|
QString iname0 = m_displaySet.at(idx.internalId()).iname;
|
||||||
MODEL_DEBUG("COLLAPSE NODE" << iname0);
|
MODEL_DEBUG("COLLAPSE NODE" << iname0);
|
||||||
@@ -806,11 +806,11 @@ void WatchHandler::expandChildren(const QModelIndex &idx)
|
|||||||
int index = idx.internalId();
|
int index = idx.internalId();
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
return;
|
return;
|
||||||
QWB_ASSERT(index >= 0, qDebug() << toString() << index; return);
|
QTC_ASSERT(index >= 0, qDebug() << toString() << index; return);
|
||||||
QWB_ASSERT(index < m_completeSet.size(), qDebug() << toString() << index; return);
|
QTC_ASSERT(index < m_completeSet.size(), qDebug() << toString() << index; return);
|
||||||
const WatchData &display = m_displaySet.at(index);
|
const WatchData &display = m_displaySet.at(index);
|
||||||
QWB_ASSERT(index >= 0, qDebug() << toString() << index; return);
|
QTC_ASSERT(index >= 0, qDebug() << toString() << index; return);
|
||||||
QWB_ASSERT(index < m_completeSet.size(), qDebug() << toString() << index; return);
|
QTC_ASSERT(index < m_completeSet.size(), qDebug() << toString() << index; return);
|
||||||
const WatchData &complete = m_completeSet.at(index);
|
const WatchData &complete = m_completeSet.at(index);
|
||||||
MODEL_DEBUG("\n\nEXPAND" << display.iname);
|
MODEL_DEBUG("\n\nEXPAND" << display.iname);
|
||||||
if (display.iname.isEmpty()) {
|
if (display.iname.isEmpty()) {
|
||||||
@@ -848,7 +848,7 @@ void WatchHandler::expandChildren(const QModelIndex &idx)
|
|||||||
void WatchHandler::insertData(const WatchData &data)
|
void WatchHandler::insertData(const WatchData &data)
|
||||||
{
|
{
|
||||||
//MODEL_DEBUG("INSERTDATA: " << data.toString());
|
//MODEL_DEBUG("INSERTDATA: " << data.toString());
|
||||||
QWB_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
if (data.isSomethingNeeded())
|
if (data.isSomethingNeeded())
|
||||||
insertDataHelper(m_incompleteSet, data);
|
insertDataHelper(m_incompleteSet, data);
|
||||||
else
|
else
|
||||||
@@ -977,7 +977,7 @@ bool WatchHandler::canFetchMore(const QModelIndex &parent) const
|
|||||||
// needs to be made synchronous to be useful. Busy loop is no good.
|
// needs to be made synchronous to be useful. Busy loop is no good.
|
||||||
if (!parent.isValid())
|
if (!parent.isValid())
|
||||||
return false;
|
return false;
|
||||||
QWB_ASSERT(checkIndex(parent.internalId()), return false);
|
QTC_ASSERT(checkIndex(parent.internalId()), return false);
|
||||||
const WatchData &data = m_displaySet.at(parent.internalId());
|
const WatchData &data = m_displaySet.at(parent.internalId());
|
||||||
MODEL_DEBUG("CAN FETCH MORE: " << parent << " children: " << data.childCount
|
MODEL_DEBUG("CAN FETCH MORE: " << parent << " children: " << data.childCount
|
||||||
<< data.iname);
|
<< data.iname);
|
||||||
@@ -990,7 +990,7 @@ void WatchHandler::fetchMore(const QModelIndex &parent)
|
|||||||
MODEL_DEBUG("FETCH MORE: " << parent);
|
MODEL_DEBUG("FETCH MORE: " << parent);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QWB_ASSERT(checkIndex(parent.internalId()), return);
|
QTC_ASSERT(checkIndex(parent.internalId()), return);
|
||||||
QString iname = m_displaySet.at(parent.internalId()).iname;
|
QString iname = m_displaySet.at(parent.internalId()).iname;
|
||||||
|
|
||||||
if (m_inFetchMore) {
|
if (m_inFetchMore) {
|
||||||
@@ -1049,15 +1049,15 @@ QModelIndex WatchHandler::index(int row, int col, const QModelIndex &parent) con
|
|||||||
MODEL_DEBUG(" -> " << QModelIndex() << " (2) ");
|
MODEL_DEBUG(" -> " << QModelIndex() << " (2) ");
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
QWB_ASSERT(checkIndex(parentIndex), return QModelIndex());
|
QTC_ASSERT(checkIndex(parentIndex), return QModelIndex());
|
||||||
const WatchData &data = m_displaySet.at(parentIndex);
|
const WatchData &data = m_displaySet.at(parentIndex);
|
||||||
QWB_ASSERT(row >= 0, qDebug() << "ROW: " << row << "PARENT: " << parent
|
QTC_ASSERT(row >= 0, qDebug() << "ROW: " << row << "PARENT: " << parent
|
||||||
<< data.toString() << toString(); return QModelIndex());
|
<< data.toString() << toString(); return QModelIndex());
|
||||||
QWB_ASSERT(row < data.childIndex.size(),
|
QTC_ASSERT(row < data.childIndex.size(),
|
||||||
MODEL_DEBUG("ROW: " << row << data.toString() << toString());
|
MODEL_DEBUG("ROW: " << row << data.toString() << toString());
|
||||||
return QModelIndex());
|
return QModelIndex());
|
||||||
QModelIndex idx = createIndex(row, col, data.childIndex.at(row));
|
QModelIndex idx = createIndex(row, col, data.childIndex.at(row));
|
||||||
QWB_ASSERT(idx.row() == m_displaySet.at(idx.internalId()).row,
|
QTC_ASSERT(idx.row() == m_displaySet.at(idx.internalId()).row,
|
||||||
return QModelIndex());
|
return QModelIndex());
|
||||||
MODEL_DEBUG(" -> " << idx << " (A) ");
|
MODEL_DEBUG(" -> " << idx << " (A) ");
|
||||||
return idx;
|
return idx;
|
||||||
@@ -1071,15 +1071,15 @@ QModelIndex WatchHandler::parent(const QModelIndex &idx) const
|
|||||||
}
|
}
|
||||||
MODEL_DEBUG("PARENT " << idx);
|
MODEL_DEBUG("PARENT " << idx);
|
||||||
int currentIndex = idx.internalId();
|
int currentIndex = idx.internalId();
|
||||||
QWB_ASSERT(checkIndex(currentIndex), return QModelIndex());
|
QTC_ASSERT(checkIndex(currentIndex), return QModelIndex());
|
||||||
QWB_ASSERT(idx.row() == m_displaySet.at(currentIndex).row,
|
QTC_ASSERT(idx.row() == m_displaySet.at(currentIndex).row,
|
||||||
MODEL_DEBUG("IDX: " << idx << toString(); return QModelIndex()));
|
MODEL_DEBUG("IDX: " << idx << toString(); return QModelIndex()));
|
||||||
int parentIndex = m_displaySet.at(currentIndex).parentIndex;
|
int parentIndex = m_displaySet.at(currentIndex).parentIndex;
|
||||||
if (parentIndex < 0) {
|
if (parentIndex < 0) {
|
||||||
MODEL_DEBUG(" -> " << QModelIndex() << " (2) ");
|
MODEL_DEBUG(" -> " << QModelIndex() << " (2) ");
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
QWB_ASSERT(checkIndex(parentIndex), return QModelIndex());
|
QTC_ASSERT(checkIndex(parentIndex), return QModelIndex());
|
||||||
QModelIndex parent =
|
QModelIndex parent =
|
||||||
createIndex(m_displaySet.at(parentIndex).row, 0, parentIndex);
|
createIndex(m_displaySet.at(parentIndex).row, 0, parentIndex);
|
||||||
MODEL_DEBUG(" -> " << parent);
|
MODEL_DEBUG(" -> " << parent);
|
||||||
@@ -1094,7 +1094,7 @@ int WatchHandler::rowCount(const QModelIndex &idx) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int thisIndex = idx.internalId();
|
int thisIndex = idx.internalId();
|
||||||
QWB_ASSERT(checkIndex(thisIndex), return 0);
|
QTC_ASSERT(checkIndex(thisIndex), return 0);
|
||||||
if (idx.row() == -1 && idx.column() == -1) {
|
if (idx.row() == -1 && idx.column() == -1) {
|
||||||
MODEL_DEBUG(" -> " << 3 << " (B) ");
|
MODEL_DEBUG(" -> " << 3 << " (B) ");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1129,7 +1129,7 @@ int WatchHandler::columnCount(const QModelIndex &idx) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MODEL_DEBUG(" -> " << 3 << " (B) ");
|
MODEL_DEBUG(" -> " << 3 << " (B) ");
|
||||||
QWB_ASSERT(checkIndex(idx.internalId()), return 3);
|
QTC_ASSERT(checkIndex(idx.internalId()), return 3);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1139,7 +1139,7 @@ bool WatchHandler::hasChildren(const QModelIndex &idx) const
|
|||||||
bool base = rowCount(idx) > 0 && columnCount(idx) > 0;
|
bool base = rowCount(idx) > 0 && columnCount(idx) > 0;
|
||||||
MODEL_DEBUG("HAS CHILDREN: " << idx << base);
|
MODEL_DEBUG("HAS CHILDREN: " << idx << base);
|
||||||
return base;
|
return base;
|
||||||
QWB_ASSERT(checkIndex(idx.internalId()), return false);
|
QTC_ASSERT(checkIndex(idx.internalId()), return false);
|
||||||
const WatchData &data = m_displaySet.at(idx.internalId());
|
const WatchData &data = m_displaySet.at(idx.internalId());
|
||||||
MODEL_DEBUG("HAS CHILDREN: " << idx << data.toString());
|
MODEL_DEBUG("HAS CHILDREN: " << idx << data.toString());
|
||||||
return data.childCount > 0; // || data.childIndex.size() > 0;
|
return data.childCount > 0; // || data.childIndex.size() > 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user