2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2019 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2019-07-05 09:40:31 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-04-13 12:26:54 +02:00
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
|
|
|
|
|
2022-07-15 11:49:34 +02:00
|
|
|
#include <utils/filepath.h>
|
2019-07-05 09:40:31 +02:00
|
|
|
|
2022-07-15 11:49:34 +02:00
|
|
|
namespace Python::Internal {
|
2019-07-05 09:40:31 +02:00
|
|
|
|
|
|
|
|
class PythonSettings : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2022-07-15 11:49:34 +02:00
|
|
|
|
2019-07-05 09:40:31 +02:00
|
|
|
public:
|
|
|
|
|
static void init();
|
|
|
|
|
|
2022-04-13 12:26:54 +02:00
|
|
|
using Interpreter = ProjectExplorer::Interpreter;
|
|
|
|
|
|
2019-07-05 09:40:31 +02:00
|
|
|
static QList<Interpreter> interpreters();
|
|
|
|
|
static Interpreter defaultInterpreter();
|
2022-03-16 09:35:02 +01:00
|
|
|
static Interpreter interpreter(const QString &interpreterId);
|
2019-07-05 09:40:31 +02:00
|
|
|
static void setInterpreter(const QList<Interpreter> &interpreters, const QString &defaultId);
|
2019-10-25 09:15:59 +02:00
|
|
|
static void addInterpreter(const Interpreter &interpreter, bool isDefault = false);
|
2022-06-07 17:36:24 +02:00
|
|
|
static void setPyLSConfiguration(const QString &configuration);
|
2022-06-09 13:41:41 +02:00
|
|
|
static bool pylsEnabled();
|
|
|
|
|
static void setPylsEnabled(const bool &enabled);
|
2022-06-07 17:36:24 +02:00
|
|
|
static QString pyLSConfiguration();
|
2019-07-05 09:40:31 +02:00
|
|
|
static PythonSettings *instance();
|
|
|
|
|
|
2019-10-25 09:15:59 +02:00
|
|
|
static QList<Interpreter> detectPythonVenvs(const Utils::FilePath &path);
|
|
|
|
|
|
2019-07-05 09:40:31 +02:00
|
|
|
signals:
|
|
|
|
|
void interpretersChanged(const QList<Interpreter> &interpreters, const QString &defaultId);
|
2022-06-07 17:36:24 +02:00
|
|
|
void pylsConfigurationChanged(const QString &configuration);
|
2022-06-09 13:41:41 +02:00
|
|
|
void pylsEnabledChanged(const bool enabled);
|
2019-07-05 09:40:31 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
PythonSettings();
|
2019-10-25 09:15:59 +02:00
|
|
|
|
|
|
|
|
static void saveSettings();
|
2019-07-05 09:40:31 +02:00
|
|
|
};
|
|
|
|
|
|
2022-07-15 11:49:34 +02:00
|
|
|
} // PythonEditor::Internal
|