2019-07-05 09:40:31 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2019 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#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
|