summaryrefslogtreecommitdiff
path: root/src/plugins/python/pythonwizardpage.h
blob: 1d605b241767ece5781e485c464b76719a2798dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include <projectexplorer/jsonwizard/jsonwizard.h>
#include <projectexplorer/jsonwizard/jsonwizardpagefactory.h>
#include <projectexplorer/runconfigurationaspects.h>

#include <utils/aspects.h>
#include <utils/wizardpage.h>

namespace Python::Internal {

class PythonWizardPageFactory : public ProjectExplorer::JsonWizardPageFactory
{
public:
    PythonWizardPageFactory();

    Utils::WizardPage *create(ProjectExplorer::JsonWizard *wizard,
                              Utils::Id typeId,
                              const QVariant &data) override;
    bool validateData(Utils::Id typeId, const QVariant &data, QString *errorMessage) override;
};

class PythonWizardPage : public Utils::WizardPage
{
public:
    PythonWizardPage(const QList<QPair<QString, QVariant>> &pySideAndData, const int defaultPyside);
    void initializePage() override;
    bool validatePage() override;

private:
    void setupProject(const ProjectExplorer::JsonWizard::GeneratorFiles &files);
    void updateInterpreters();
    void updateStateLabel();

    ProjectExplorer::InterpreterAspect m_interpreter;
    Utils::SelectionAspect m_pySideVersion;
    Utils::BoolAspect m_createVenv;
    Utils::StringAspect m_venvPath;
    Utils::InfoLabel *m_stateLabel = nullptr;
};

} // namespace Python::Internal