forked from qt-creator/qt-creator
Allow plugins to register additional example sets
Change-Id: Icfa2a8093a5cffd86dc029fd1b06117f599203ab Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -107,6 +107,7 @@ ExampleSetModel::ExampleSetModel()
|
||||
<< ", examplesPath=" << set.examplesPath;
|
||||
}
|
||||
}
|
||||
m_extraExampleSets += pluginRegisteredExampleSets();
|
||||
|
||||
connect(QtVersionManager::instance(), &QtVersionManager::qtVersionsLoaded,
|
||||
this, &ExampleSetModel::qtVersionManagerLoaded);
|
||||
|
@@ -45,6 +45,14 @@ class ExampleSetModel : public QStandardItemModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct ExtraExampleSet
|
||||
{
|
||||
QString displayName;
|
||||
QString manifestPath;
|
||||
QString examplesPath;
|
||||
};
|
||||
static QVector<ExtraExampleSet> pluginRegisteredExampleSets();
|
||||
|
||||
ExampleSetModel();
|
||||
|
||||
int selectedExampleSet() const { return m_selectedExampleSetIndex; }
|
||||
@@ -56,11 +64,6 @@ signals:
|
||||
void selectedExampleSetChanged(int);
|
||||
|
||||
private:
|
||||
struct ExtraExampleSet {
|
||||
QString displayName;
|
||||
QString manifestPath;
|
||||
QString examplesPath;
|
||||
};
|
||||
|
||||
enum ExampleSetType {
|
||||
InvalidExampleSet,
|
||||
@@ -87,8 +90,7 @@ private:
|
||||
void helpManagerInitialized();
|
||||
void tryToInitialize();
|
||||
|
||||
QList<ExtraExampleSet> m_extraExampleSets;
|
||||
QList<BaseQtVersion*> m_qtVersions;
|
||||
QVector<ExtraExampleSet> m_extraExampleSets;
|
||||
int m_selectedExampleSetIndex = -1;
|
||||
QSet<Core::Id> m_selectedQtTypes;
|
||||
|
||||
|
@@ -25,10 +25,11 @@
|
||||
|
||||
#include "qtversionmanager.h"
|
||||
|
||||
#include "qtkitinformation.h"
|
||||
#include "qtversionfactory.h"
|
||||
#include "baseqtversion.h"
|
||||
#include "exampleslistmodel.h"
|
||||
#include "qtkitinformation.h"
|
||||
#include "qtsupportconstants.h"
|
||||
#include "qtversionfactory.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
@@ -77,6 +78,7 @@ static QtVersionManager *m_instance = nullptr;
|
||||
static FileSystemWatcher *m_configFileWatcher = nullptr;
|
||||
static QTimer *m_fileWatcherTimer = nullptr;
|
||||
static PersistentSettingsWriter *m_writer = nullptr;
|
||||
static QVector<ExampleSetModel::ExtraExampleSet> m_pluginRegisteredExampleSets;
|
||||
|
||||
static Q_LOGGING_CATEGORY(log, "qtc.qt.versions", QtWarningMsg);
|
||||
|
||||
@@ -100,6 +102,11 @@ static bool restoreQtVersions();
|
||||
static void findSystemQt();
|
||||
static void saveQtVersions();
|
||||
|
||||
QVector<ExampleSetModel::ExtraExampleSet> ExampleSetModel::pluginRegisteredExampleSets()
|
||||
{
|
||||
return m_pluginRegisteredExampleSets;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// QtVersionManager
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -471,6 +478,13 @@ void QtVersionManager::removeVersion(BaseQtVersion *version)
|
||||
delete version;
|
||||
}
|
||||
|
||||
void QtVersionManager::registerExampleSet(const QString &displayName,
|
||||
const QString &manifestPath,
|
||||
const QString &examplesPath)
|
||||
{
|
||||
m_pluginRegisteredExampleSets.append({displayName, manifestPath, examplesPath});
|
||||
}
|
||||
|
||||
using Path = QString;
|
||||
using FileName = QString;
|
||||
static QList<std::pair<Path, FileName>> documentationFiles(BaseQtVersion *v)
|
||||
|
@@ -63,6 +63,11 @@ public:
|
||||
static void addVersion(BaseQtVersion *version);
|
||||
static void removeVersion(BaseQtVersion *version);
|
||||
|
||||
// Call latest in extensionsInitialized of plugin depending on QtSupport
|
||||
static void registerExampleSet(const QString &displayName,
|
||||
const QString &manifestPath,
|
||||
const QString &examplesPath);
|
||||
|
||||
signals:
|
||||
// content of BaseQtVersion objects with qmake path might have changed
|
||||
void qtVersionsChanged(const QList<int> &addedIds, const QList<int> &removedIds, const QList<int> &changedIds);
|
||||
|
Reference in New Issue
Block a user