1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef EXTERNALTOOLCONFIG_H
34 #define EXTERNALTOOLCONFIG_H
36 #include "coreplugin/externaltool.h"
38 #include <QtGui/QWidget>
39 #include <QtCore/QAbstractItemModel>
45 class ExternalToolConfig;
48 class ExternalToolModel : public QAbstractItemModel
53 explicit ExternalToolModel(QObject *parent);
56 int columnCount(const QModelIndex &parent = QModelIndex()) const;
57 QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const;
58 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
59 QModelIndex parent(const QModelIndex &child) const;
60 int rowCount(const QModelIndex &parent = QModelIndex()) const;
61 Qt::ItemFlags flags(const QModelIndex &modelIndex) const;
62 bool setData(const QModelIndex &modelIndex, const QVariant &value, int role = Qt::EditRole);
64 QMimeData *mimeData(const QModelIndexList &indexes) const;
65 bool dropMimeData(const QMimeData *data,
66 Qt::DropAction action,
69 const QModelIndex &parent);
70 QStringList mimeTypes() const;
72 void setTools(const QMap<QString, QList<ExternalTool *> > &tools);
73 QMap<QString, QList<ExternalTool *> > tools() const;
75 ExternalTool *toolForIndex(const QModelIndex &modelIndex) const;
76 QString categoryForIndex(const QModelIndex &modelIndex) const;
77 void revertTool(const QModelIndex &modelIndex);
78 QModelIndex addCategory();
79 QModelIndex addTool(const QModelIndex &atIndex);
80 void removeTool(const QModelIndex &modelIndex);
81 Qt::DropActions supportedDropActions() const;
83 QVariant data(ExternalTool *tool, int role = Qt::DisplayRole) const;
84 QVariant data(const QString &category, int role = Qt::DisplayRole) const;
86 QMap<QString, QList<ExternalTool *> > m_tools;
90 class ExternalToolConfig : public QWidget
95 explicit ExternalToolConfig(QWidget *parent = 0);
96 ~ExternalToolConfig();
98 void setTools(const QMap<QString, QList<ExternalTool *> > &tools);
99 QMap<QString, QList<ExternalTool *> > tools() const;
102 QString searchKeywords() const;
105 void handleCurrentChanged(const QModelIndex &now, const QModelIndex &previous);
106 void showInfoForItem(const QModelIndex &index);
107 void updateItem(const QModelIndex &index);
108 void revertCurrentItem();
109 void updateButtons(const QModelIndex &index);
110 void updateCurrentItem();
116 Ui::ExternalToolConfig *ui;
117 ExternalToolModel *m_model;
124 #endif // EXTERNALTOOLCONFIG_H