diff options
author | Eike Ziller <eike.ziller@digia.com> | 2012-11-27 17:43:52 +0100 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-11-27 17:54:36 +0100 |
commit | fbe6834a167d73c2031598fb4099c9fba18639d1 (patch) | |
tree | fe53f3498aec42c906c1fc614f39b8d56cc01f2a /src/plugins/qtsupport/exampleslistmodel.cpp | |
parent | 6bbd80143b69f64036c794041275267431333efc (diff) | |
download | qt-creator-fbe6834a167d73c2031598fb4099c9fba18639d1.tar.gz |
Hide non-existing examples.
Can be force enabled with environment variable.
Change-Id: I262df587cf5a906a9e90850405c9db699c3727ab
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/qtsupport/exampleslistmodel.cpp')
-rw-r--r-- | src/plugins/qtsupport/exampleslistmodel.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index b59733efee..1b80b460a3 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -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; |