targetsetuppage.h 4.55 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
2
**
hjk's avatar
hjk committed
3 4
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
7
**
hjk's avatar
hjk committed
8 9 10 11 12 13 14
** 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 Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
15 16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17 18 19 20 21 22 23 24 25
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26 27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
29 30 31 32

#ifndef TARGETSETUPPAGE_H
#define TARGETSETUPPAGE_H

33
#include "../qt4projectmanager_global.h"
Tobias Hunger's avatar
Tobias Hunger committed
34 35
#include "../qt4targetsetupwidget.h"

36
#include <coreplugin/featureprovider.h>
Tobias Hunger's avatar
Tobias Hunger committed
37
#include <projectexplorer/kitmanager.h>
Tobias Hunger's avatar
Tobias Hunger committed
38
#include <qtsupport/qtversionmanager.h>
39

40
#include <QString>
Tobias Hunger's avatar
Tobias Hunger committed
41
#include <QWizardPage>
42 43 44 45 46

namespace Qt4ProjectManager {
class Qt4Project;

namespace Internal {
Tobias Hunger's avatar
Tobias Hunger committed
47
class ImportWidget;
48
class TargetSetupPageUi;
Tobias Hunger's avatar
Tobias Hunger committed
49
} // namespace Internal
Tobias Hunger's avatar
Tobias Hunger committed
50

51 52
/// \internal
class QT4PROJECTMANAGER_EXPORT TargetSetupPage : public QWizardPage
53 54 55 56 57 58 59
{
    Q_OBJECT

public:
    explicit TargetSetupPage(QWidget* parent = 0);
    ~TargetSetupPage();

dt's avatar
dt committed
60 61
    /// Initializes the TargetSetupPage
    /// \note The import information is gathered in initializePage(), make sure that the right proFilePath is set before
62
    void initializePage();
Tobias Hunger's avatar
Tobias Hunger committed
63 64

    // Call these before initializePage!
Tobias Hunger's avatar
Tobias Hunger committed
65 66
    void setRequiredKitMatcher(ProjectExplorer::KitMatcher *matcher);
    void setPreferredKitMatcher(ProjectExplorer::KitMatcher *matcher);
dt's avatar
dt committed
67
    void setImportSearch(bool b);
68 69 70 71 72 73

    /// Sets whether the targetsetupage uses a scrollarea
    /// to host the widgets from the factories
    /// call this before \sa initializePage()
    void setUseScrollArea(bool b);

74
    bool isComplete() const;
dt's avatar
dt committed
75
    bool setupProject(Qt4ProjectManager::Qt4Project *project);
Tobias Hunger's avatar
Tobias Hunger committed
76 77 78
    bool isKitSelected(Core::Id id) const;
    void setKitSelected(Core::Id id, bool selected);
    QList<Core::Id> selectedKits() const;
79 80
    void setProFilePath(const QString &dir);

81 82
    /// Overrides the summary text of the targetsetuppage
    void setNoteText(const QString &text);
Tobias Hunger's avatar
Tobias Hunger committed
83
    void showOptionsHint(bool show);
84

85
private slots:
Tobias Hunger's avatar
Tobias Hunger committed
86 87
    void import(const Utils::FileName &path);
    void handleQtUpdate(const QList<int> &add, const QList<int> &rm, const QList<int> &mod);
Tobias Hunger's avatar
Tobias Hunger committed
88 89 90
    void handleKitAddition(ProjectExplorer::Kit *k);
    void handleKitRemoval(ProjectExplorer::Kit *k);
    void handleKitUpdate(ProjectExplorer::Kit *k);
Tobias Hunger's avatar
Tobias Hunger committed
91
    void updateVisibility();
Tobias Hunger's avatar
Tobias Hunger committed
92
    void openOptions();
93 94

private:
95
    void selectAtLeastOneKit();
Tobias Hunger's avatar
Tobias Hunger committed
96
    void import(const Utils::FileName &path, const bool silent);
Tobias Hunger's avatar
Tobias Hunger committed
97 98
    void removeWidget(ProjectExplorer::Kit *k);
    Qt4TargetSetupWidget *addWidget(ProjectExplorer::Kit *k);
Tobias Hunger's avatar
Tobias Hunger committed
99 100 101

    void setupImports();

dt's avatar
dt committed
102
    void setupWidgets();
Tobias Hunger's avatar
Tobias Hunger committed
103
    void reset();
104 105
    ProjectExplorer::Kit *createTemporaryKit(QtSupport::BaseQtVersion *version, bool temporaryVersion, const Utils::FileName &parsedSpec);
    void cleanKit(ProjectExplorer::Kit *k);
Tobias Hunger's avatar
Tobias Hunger committed
106 107 108 109 110 111
    void makeQtPersistent(ProjectExplorer::Kit *k);
    void addProject(ProjectExplorer::Kit *k, const QString &path);
    void removeProject(ProjectExplorer::Kit *k, const QString &path);

    ProjectExplorer::KitMatcher *m_requiredMatcher;
    ProjectExplorer::KitMatcher *m_preferredMatcher;
Tobias Hunger's avatar
Tobias Hunger committed
112
    QLayout *m_baseLayout;
dt's avatar
dt committed
113
    bool m_importSearch;
114
    bool m_ignoreUpdates;
115
    QString m_proFilePath;
116
    QString m_defaultShadowBuildLocation;
117
    QMap<Core::Id, Qt4TargetSetupWidget *> m_widgets;
Tobias Hunger's avatar
Tobias Hunger committed
118
    Qt4TargetSetupWidget *m_firstWidget;
Tobias Hunger's avatar
Tobias Hunger committed
119

120
    Internal::TargetSetupPageUi *m_ui;
Tobias Hunger's avatar
Tobias Hunger committed
121 122 123

    Internal::ImportWidget *m_importWidget;
    QSpacerItem *m_spacer;
Tobias Hunger's avatar
Tobias Hunger committed
124 125

    bool m_forceOptionHint;
126 127 128 129 130
};

} // namespace Qt4ProjectManager

#endif // TARGETSETUPPAGE_H