forked from qt-creator/qt-creator
Python: Initialize settings in the pimpl
Change-Id: I172136851c3002bf785d9b8f378c0cccc408e0e2 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -39,6 +39,8 @@ public:
|
|||||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
|
||||||
{runConfigFactory.runConfigurationId()}
|
{runConfigFactory.runConfigurationId()}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PythonSettings settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
PythonPlugin::PythonPlugin()
|
PythonPlugin::PythonPlugin()
|
||||||
@@ -66,8 +68,6 @@ bool PythonPlugin::initialize(const QStringList &arguments, QString *errorMessag
|
|||||||
|
|
||||||
ProjectManager::registerProjectType<PythonProject>(PythonMimeType);
|
ProjectManager::registerProjectType<PythonProject>(PythonMimeType);
|
||||||
|
|
||||||
PythonSettings::init();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -688,8 +688,10 @@ static QString idForPythonFromPath(const QList<Interpreter> &pythons)
|
|||||||
static PythonSettings *settingsInstance = nullptr;
|
static PythonSettings *settingsInstance = nullptr;
|
||||||
|
|
||||||
PythonSettings::PythonSettings()
|
PythonSettings::PythonSettings()
|
||||||
: QObject(PythonPlugin::instance())
|
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(!settingsInstance, return);
|
||||||
|
settingsInstance = this;
|
||||||
|
|
||||||
setObjectName("PythonSettings");
|
setObjectName("PythonSettings");
|
||||||
ExtensionSystem::PluginManager::addObject(this);
|
ExtensionSystem::PluginManager::addObject(this);
|
||||||
|
|
||||||
@@ -714,12 +716,6 @@ PythonSettings::~PythonSettings()
|
|||||||
settingsInstance = nullptr;
|
settingsInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonSettings::init()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(!settingsInstance, return );
|
|
||||||
settingsInstance = new PythonSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PythonSettings::setInterpreter(const QList<Interpreter> &interpreters, const QString &defaultId)
|
void PythonSettings::setInterpreter(const QList<Interpreter> &interpreters, const QString &defaultId)
|
||||||
{
|
{
|
||||||
if (defaultId == settingsInstance->m_defaultInterpreterId
|
if (defaultId == settingsInstance->m_defaultInterpreterId
|
||||||
|
@@ -14,10 +14,9 @@ class PythonSettings : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
PythonSettings();
|
||||||
~PythonSettings();
|
~PythonSettings();
|
||||||
|
|
||||||
static void init();
|
|
||||||
|
|
||||||
using Interpreter = ProjectExplorer::Interpreter;
|
using Interpreter = ProjectExplorer::Interpreter;
|
||||||
|
|
||||||
static QList<Interpreter> interpreters();
|
static QList<Interpreter> interpreters();
|
||||||
@@ -47,8 +46,6 @@ public slots:
|
|||||||
void listDetectedPython(const QString &detectionSource, QString *logMessage);
|
void listDetectedPython(const QString &detectionSource, QString *logMessage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PythonSettings();
|
|
||||||
|
|
||||||
void initFromSettings(QSettings *settings);
|
void initFromSettings(QSettings *settings);
|
||||||
void writeToSettings(QSettings *settings);
|
void writeToSettings(QSettings *settings);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user