dependenciespanel.h 3.13 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
con's avatar
con committed
2
**
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
con's avatar
con committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
con's avatar
con committed
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
****************************************************************************/
hjk's avatar
hjk committed
29

30 31
#ifndef DEPENDENCIESPANEL_H
#define DEPENDENCIESPANEL_H
con's avatar
con committed
32

33
#include "iprojectproperties.h"
con's avatar
con committed
34

35
#include <QAbstractListModel>
36

37
#include <QTreeView>
con's avatar
con committed
38

39
namespace Utils { class DetailsWidget; }
40

con's avatar
con committed
41 42 43 44 45 46
namespace ProjectExplorer {

class Project;

namespace Internal {

47
class DependenciesPanelFactory : public IProjectPanelFactory
con's avatar
con committed
48 49
{
public:
50
    DependenciesPanelFactory() {}
51

Tobias Hunger's avatar
Tobias Hunger committed
52
    QString id() const;
con's avatar
con committed
53
    QString displayName() const;
54
    int priority() const;
55
    bool supports(Project *project);
56
    PropertiesPanel *createPanel(Project *project);
57
};
con's avatar
con committed
58 59


60 61 62 63 64 65 66
//
// DependenciesModel
//

class DependenciesModel : public QAbstractListModel
{
    Q_OBJECT
67

68
public:
69
    explicit DependenciesModel(Project *project, QObject *parent = 0);
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

    int rowCount(const QModelIndex &index) const;
    int columnCount(const QModelIndex &index) const;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
    Qt::ItemFlags flags(const QModelIndex &index) const;

public slots:
    void resetModel();

private:
    Project *m_project;
    QList<Project *> m_projects;
};

dt's avatar
dt committed
85 86 87
class DependenciesView : public QTreeView
{
    Q_OBJECT
88

dt's avatar
dt committed
89 90
public:
    DependenciesView(QWidget *parent);
91 92 93 94

    QSize sizeHint() const;
    void setModel(QAbstractItemModel *model);

dt's avatar
dt committed
95 96
private slots:
    void updateSizeHint();
97

dt's avatar
dt committed
98 99 100 101 102 103 104
private:
    QSize m_sizeHint;
};

class DependenciesWidget : public QWidget
{
    Q_OBJECT
105

dt's avatar
dt committed
106
public:
107 108
    explicit DependenciesWidget(Project *project, QWidget *parent = 0);

dt's avatar
dt committed
109 110 111
private:
    Project *m_project;
    DependenciesModel *m_model;
dt's avatar
dt committed
112
    Utils::DetailsWidget *m_detailsContainer;
dt's avatar
dt committed
113 114
};

con's avatar
con committed
115 116 117
} // namespace Internal
} // namespace ProjectExplorer

118
#endif // DEPENDENCIESPANEL_H