summaryrefslogtreecommitdiff
path: root/src/plugins/boostbuildprojectmanager/b2openprojectwizard.h
blob: d7d6a93f63c8233c74e15caea95487186179bb63 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//
// Copyright (C) 2013 Mateusz Łoskot <mateusz@loskot.net>
// Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
//
// This file is part of Qt Creator Boost.Build plugin project.
//
// This is free software; you can redistribute and/or modify it under
// the terms of the GNU Lesser General Public License, Version 2.1
// as published by the Free Software Foundation.
// See accompanying file LICENSE.txt or copy at
// http://www.gnu.org/licenses/lgpl-2.1-standalone.html.
//
#ifndef BBOPENPROJECTWIZARD_HPP
#define BBOPENPROJECTWIZARD_HPP

// Qt Creator
#include <coreplugin/basefilewizard.h>
#include <coreplugin/basefilewizardfactory.h>
#include <coreplugin/generatedfile.h>
#include <utils/wizard.h>
// Qt
#include <QString>
#include <QStringList>
QT_BEGIN_NAMESPACE
class QVBoxLayout;
class QLabel;
class QTreeView;
class QLineEdit;
QT_END_NAMESPACE

namespace Utils {
class PathChooser;
}

namespace BoostBuildProjectManager {
namespace Internal {

class Project;
class PathsSelectionWizardPage;
class FilesSelectionWizardPage;

//////////////////////////////////////////////////////////////////////////////////////////
// NOTE: The Boost.Build wizard is based on Core::BaseFileWizard which seems to be
// dedicated to build "New Project" wizards. So, the plugin uses the base class in
// unconventional, matching its features to Boost.Build wizard needs, like:
// - no parent QWidget is used
// - platform name is set from default Kit display name, usually it's "Desktop"
// - extra values QVariantMap may carry custom data
// CAUTION: This wizard may stop building or start failing in run-time,
// if Qt Creator changes the base class significantly.
class OpenProjectWizard : public Core::BaseFileWizardFactory
{
    Q_OBJECT

public:
    OpenProjectWizard(Project const* const project);

    bool run(QString const& platform, QVariantMap const& extraValues);

    QVariantMap outputValues() const { return outputValues_; }

protected:

    Core::BaseFileWizard*
    create(QWidget* parent, Core::WizardDialogParameters const& parameters) const;

    Core::GeneratedFiles
    generateFiles(QWizard const* baseWizard, QString* errorMessage) const;

    bool
    postGenerateFiles(QWizard const* wizard
        , Core::GeneratedFiles const& files, QString* errorMessage);

private:
    Project const* const project_;
    QVariantMap outputValues_;
    bool projectOpened_;
};

//////////////////////////////////////////////////////////////////////////////////////////
class OpenProjectWizardDialog : public Core::BaseFileWizard
{
    Q_OBJECT

public:
    OpenProjectWizardDialog(QWidget* parent, QString const& projectFile
        , QVariantMap const& extraValues, QVariantMap& outputValues);

    QString path() const;
    QString projectFile() const;
    QString projectName() const;
    QString defaultProjectName() const;

    QStringList selectedFiles() const;
    QStringList selectedPaths() const;

public slots:
    void setProjectName(QString const& name);

private:
    QVariantMap& outputValues_;
    QVariantMap extraValues_;
    QString projectFile_;
    PathsSelectionWizardPage* pathsPage_;
    FilesSelectionWizardPage* filesPage_;
};

//////////////////////////////////////////////////////////////////////////////////////////
class PathsSelectionWizardPage : public QWizardPage
{
    Q_OBJECT

public:
    explicit PathsSelectionWizardPage(OpenProjectWizardDialog* wizard);

    QString projectName() const;
    void setProjectName(QString const& name);

private:
    OpenProjectWizardDialog* wizard_;
    QLineEdit* nameLineEdit_;
};

} // namespace Internal
} // namespace BoostBuildProjectManager

#endif // BBOPENPROJECTWIZARD_HPP