forked from qt-creator/qt-creator
Fix duplicate entries in examples dropdown
Both the "normal" Qt node adds an example set, and the Android/ Automotive node adds another one with the same paths, leading to e.g. two items "Qt6 6.2.4" in the dropdown for the examples. De-duplicate example sets with the same paths, which we already do if an example set and a Qt version itself refer to the same path. Fixes: QTCREATORBUG-27294 Change-Id: Ia469045b2f2812612fcd8328bdfd223479b8d449 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
@@ -50,6 +51,8 @@
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace QtSupport {
|
||||
namespace Internal {
|
||||
|
||||
@@ -101,12 +104,21 @@ ExampleSetModel::ExampleSetModel()
|
||||
qWarning() << "Manifest path " << set.manifestPath << "is not a readable directory, ignoring";
|
||||
continue;
|
||||
}
|
||||
m_extraExampleSets.append(set);
|
||||
if (debugExamples()) {
|
||||
qWarning() << "Adding examples set displayName=" << set.displayName
|
||||
<< ", manifestPath=" << set.manifestPath
|
||||
<< ", examplesPath=" << set.examplesPath;
|
||||
}
|
||||
if (!Utils::anyOf(m_extraExampleSets, [&set](const ExtraExampleSet &s) {
|
||||
return FilePath::fromString(s.examplesPath).cleanPath()
|
||||
== FilePath::fromString(set.examplesPath).cleanPath()
|
||||
&& FilePath::fromString(s.manifestPath).cleanPath()
|
||||
== FilePath::fromString(set.manifestPath).cleanPath();
|
||||
})) {
|
||||
m_extraExampleSets.append(set);
|
||||
} else if (debugExamples()) {
|
||||
qWarning() << "Not adding, because example set with same directories exists";
|
||||
}
|
||||
}
|
||||
m_extraExampleSets += pluginRegisteredExampleSets();
|
||||
|
||||
|
Reference in New Issue
Block a user