1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef TOOLCHAINOPTIONSPAGE_H
35 #define TOOLCHAINOPTIONSPAGE_H
37 #include "ui_toolchainoptionspage.h"
39 #include <coreplugin/dialogs/ioptionspage.h>
41 #include <QtCore/QAbstractItemModel>
44 class QTreeWidgetItem;
48 namespace ProjectExplorer {
51 class ToolChainConfigWidget;
52 class ToolChainFactory;
53 class ToolChainManager;
58 // --------------------------------------------------------------------------
60 // --------------------------------------------------------------------------
62 class ToolChainModel : public QAbstractItemModel
67 explicit ToolChainModel(QWidget *configWidgetParent, QObject *parent = 0);
70 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
71 QModelIndex parent(const QModelIndex &index) const;
72 int rowCount(const QModelIndex &parent = QModelIndex()) const;
73 int columnCount(const QModelIndex &parent = QModelIndex()) const;
75 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
76 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
77 Qt::ItemFlags flags(const QModelIndex &index) const;
78 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
80 ToolChain *toolChain(const QModelIndex &);
81 int manualToolChains() const;
83 ToolChainConfigWidget *widget(const QModelIndex &);
86 bool isDirty(ToolChain *) const;
90 void markForRemoval(ToolChain *);
91 void markForAddition(ToolChain *);
94 void toolChainStateChanged();
97 void addToolChain(ProjectExplorer::ToolChain *);
98 void removeToolChain(ProjectExplorer::ToolChain *);
99 void setDirty(ProjectExplorer::ToolChain *);
102 QModelIndex index(ToolChainNode *, int column = 0) const;
103 ToolChainNode *createNode(ToolChainNode *parent, ToolChain *tc, bool changed);
105 ToolChainNode * m_root;
106 ToolChainNode * m_autoRoot;
107 ToolChainNode * m_manualRoot;
109 QList<ToolChainNode *> m_toAddList;
110 QList<ToolChainNode *> m_toRemoveList;
112 QWidget *m_configWidgetParent;
115 // --------------------------------------------------------------------------
116 // ToolChainOptionsPage
117 // --------------------------------------------------------------------------
119 class ToolChainOptionsPage : public Core::IOptionsPage
124 ToolChainOptionsPage();
126 virtual QString id() const;
127 virtual QString displayName() const;
128 virtual QString category() const;
129 virtual QString displayCategory() const;
130 virtual QIcon categoryIcon() const;
132 virtual QWidget *createPage(QWidget *parent);
133 virtual void apply();
134 virtual void finish();
135 virtual bool matches(const QString &) const;
138 void toolChainSelectionChanged(const QModelIndex &, const QModelIndex &);
139 void createToolChain(QObject *);
140 void removeToolChain();
144 Ui::ToolChainOptionsPage *m_ui;
145 QWidget *m_configWidget;
146 QString m_searchKeywords;
148 ToolChainModel *m_model;
149 QList<ToolChainFactory *> m_factories;
150 QItemSelectionModel * m_selectionModel;
151 ToolChainConfigWidget *m_currentTcWidget;
154 } // namespace Internal
155 } // namespace ProjectExplorer
157 #endif // TOOLCHAINOPTIONSPAGE_H