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

31
32
33
#ifndef QTOPTIONSPAGE_H
#define QTOPTIONSPAGE_H

34
#include "debugginghelperbuildtask.h"
35
36
#include <coreplugin/dialogs/ioptionspage.h>

37
#include <QIcon>
38
39
#include <QPointer>
#include <QWidget>
40
41

QT_BEGIN_NAMESPACE
42
class QSortFilterProxyModel;
43
44
class QTextBrowser;
class QUrl;
45
46
QT_END_NAMESPACE

47
namespace ProjectExplorer { class ToolChain; }
48
49
50
51
namespace Utils {
class TreeModel;
class TreeItem;
}
52

53
namespace QtSupport {
54

dt's avatar
dt committed
55
56
class BaseQtVersion;
class QtConfigWidget;
57
58

namespace Internal {
59
60
class QtVersionItem;

61
62
namespace Ui {
class QtVersionManager;
63
64
class QtVersionInfo;
class DebuggingHelper;
65
66
}

67
class QtOptionsPageWidget : public QWidget
68
69
{
    Q_OBJECT
hjk's avatar
hjk committed
70

71
public:
72
    QtOptionsPageWidget(QWidget *parent = 0);
73
    ~QtOptionsPageWidget();
dt's avatar
dt committed
74
    QList<BaseQtVersion *> versions() const;
75
    void apply();
76
77

private:
dt's avatar
dt committed
78
79
80
81
82
    void updateDescriptionLabel();
    void userChangedCurrentVersion();
    void updateWidgets();
    void updateDebuggingHelperUi();
    BaseQtVersion *currentVersion() const;
83
84
    QtVersionItem *currentItem() const;
    void showDebuggingBuildLog(const QtVersionItem *item);
85

86
    const QString m_specifyNameString;
87

88
    Internal::Ui::QtVersionManager *m_ui;
89
90
    Internal::Ui::QtVersionInfo *m_versionUi;
    Internal::Ui::DebuggingHelper *m_debuggingHelperUi;
91
    QTextBrowser *m_infoBrowser;
92
    int m_defaultVersion;
93
    QIcon m_invalidVersionIcon;
94
    QIcon m_warningVersionIcon;
95
    QIcon m_validVersionIcon;
dt's avatar
dt committed
96
    QtConfigWidget *m_configurationWidget;
97

98
private slots:
99
    void updateQtVersions(const QList<int> &, const QList<int> &, const QList<int> &);
dt's avatar
dt committed
100
    void qtVersionChanged();
101
    void versionChanged(const QModelIndex &current, const QModelIndex &previous);
102
103
    void addQtDir();
    void removeQtDir();
dt_'s avatar
dt_ committed
104
    void editPath();
dt's avatar
dt committed
105
    void updateCleanUpButton();
106
    void updateCurrentQtName();
107
108
109
    void buildDebuggingHelper(DebuggingHelperBuildTask::Tools tools
                              = DebuggingHelperBuildTask::AllTools);
    void buildQmlDump();
110
    void slotShowDebuggingBuildLog();
111
112
    void debuggingHelperBuildFinished(int qtVersionId, const QString &output,
                                      DebuggingHelperBuildTask::Tools tools);
113
    void cleanUpQtVersions();
114
    void toolChainsUpdated();
115
    void selectedToolChainChanged(int index);
116

117
    void qtVersionsDumpUpdated(const Utils::FileName &qmakeCommand);
118
    void setInfoWidgetVisibility();
119
    void infoAnchorClicked(const QUrl &);
120
121
122

private:
    struct ValidityInfo {
123
        QString description;
124
125
126
127
128
        QString message;
        QString toolTip;
        QIcon icon;
    };
    ValidityInfo validInformation(const BaseQtVersion *version);
129
    QList<ProjectExplorer::ToolChain*> toolChains(const BaseQtVersion *version);
130
    QByteArray defaultToolChainId(const BaseQtVersion *version);
131

132
    bool isNameUnique(const BaseQtVersion *version);
133
    void updateVersionItem(QtVersionItem *item);
134

135
136
137
138
    Utils::TreeModel *m_model;
    QSortFilterProxyModel *m_filterModel;
    Utils::TreeItem *m_autoItem;
    Utils::TreeItem *m_manualItem;
139
140
141
142
143
};

class QtOptionsPage : public Core::IOptionsPage
{
    Q_OBJECT
144

145
146
public:
    QtOptionsPage();
147

148
    QWidget *widget();
149
    void apply();
150
    void finish();
151

152
private:
153
    QPointer<QtOptionsPageWidget> m_widget;
154
155
156
};

} //namespace Internal
Orgad Shaneh's avatar
Orgad Shaneh committed
157
} //namespace QtSupport
158
159
160


#endif // QTOPTIONSPAGE_H