Commit fbe6834a authored by Eike Ziller's avatar Eike Ziller Committed by hjk
Browse files

Hide non-existing examples.



Can be force enabled with environment variable.

Change-Id: I262df587cf5a906a9e90850405c9db699c3727ab
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 6bbd8014
......@@ -135,9 +135,11 @@ QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, co
break;
case QXmlStreamReader::EndElement:
if (reader->name() == QLatin1String("example")) {
if (item.projectPath.isEmpty() || !QFileInfo(item.projectPath).exists())
bool projectExists = !item.projectPath.isEmpty() && QFileInfo(item.projectPath).exists();
if (!projectExists)
item.tags.append(QLatin1String("broken"));
examples.append(item);
if (projectExists || !qgetenv("QTC_DEBUG_EXAMPLESMODEL").isEmpty())
examples.append(item);
} else if (reader->name() == QLatin1String("examples")) {
return examples;
}
......@@ -179,10 +181,15 @@ QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader* reader, const
}
break;
case QXmlStreamReader::EndElement:
if (reader->name() == QLatin1String("demo"))
demos.append(item);
else if (reader->name() == QLatin1String("demos"))
if (reader->name() == QLatin1String("demo")) {
bool projectExists = !item.projectPath.isEmpty() && QFileInfo(item.projectPath).exists();
if (!projectExists)
item.tags.append(QLatin1String("broken"));
if (projectExists || !qgetenv("QTC_DEBUG_EXAMPLESMODEL").isEmpty())
demos.append(item);
} else if (reader->name() == QLatin1String("demos")) {
return demos;
}
break;
default: // nothing
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment