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},
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
|
||||
PythonSettings settings;
|
||||
};
|
||||
|
||||
PythonPlugin::PythonPlugin()
|
||||
@@ -66,8 +68,6 @@ bool PythonPlugin::initialize(const QStringList &arguments, QString *errorMessag
|
||||
|
||||
ProjectManager::registerProjectType<PythonProject>(PythonMimeType);
|
||||
|
||||
PythonSettings::init();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -688,8 +688,10 @@ static QString idForPythonFromPath(const QList<Interpreter> &pythons)
|
||||
static PythonSettings *settingsInstance = nullptr;
|
||||
|
||||
PythonSettings::PythonSettings()
|
||||
: QObject(PythonPlugin::instance())
|
||||
{
|
||||
QTC_ASSERT(!settingsInstance, return);
|
||||
settingsInstance = this;
|
||||
|
||||
setObjectName("PythonSettings");
|
||||
ExtensionSystem::PluginManager::addObject(this);
|
||||
|
||||
@@ -714,12 +716,6 @@ PythonSettings::~PythonSettings()
|
||||
settingsInstance = nullptr;
|
||||
}
|
||||
|
||||
void PythonSettings::init()
|
||||
{
|
||||
QTC_ASSERT(!settingsInstance, return );
|
||||
settingsInstance = new PythonSettings();
|
||||
}
|
||||
|
||||
void PythonSettings::setInterpreter(const QList<Interpreter> &interpreters, const QString &defaultId)
|
||||
{
|
||||
if (defaultId == settingsInstance->m_defaultInterpreterId
|
||||
|
@@ -14,10 +14,9 @@ class PythonSettings : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PythonSettings();
|
||||
~PythonSettings();
|
||||
|
||||
static void init();
|
||||
|
||||
using Interpreter = ProjectExplorer::Interpreter;
|
||||
|
||||
static QList<Interpreter> interpreters();
|
||||
@@ -47,8 +46,6 @@ public slots:
|
||||
void listDetectedPython(const QString &detectionSource, QString *logMessage);
|
||||
|
||||
private:
|
||||
PythonSettings();
|
||||
|
||||
void initFromSettings(QSettings *settings);
|
||||
void writeToSettings(QSettings *settings);
|
||||
|
||||
|
Reference in New Issue
Block a user