OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / miniprojecttargetselector.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
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.
18 **
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.
22 **
23 ** Other Usage
24 **
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.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef MINIPROJECTTARGETSELECTOR_H
34 #define MINIPROJECTTARGETSELECTOR_H
35
36 #include <QtGui/QListWidget>
37
38
39 QT_BEGIN_NAMESPACE
40 class QComboBox;
41 class QLabel;
42 class QStackedWidget;
43 QT_END_NAMESPACE
44
45 namespace ProjectExplorer {
46 class Project;
47 class Target;
48 class RunConfiguration;
49 class Target;
50 class BuildConfiguration;
51
52 namespace Internal {
53
54 // helper classes
55
56 class ProjectListWidget : public QListWidget
57 {
58     Q_OBJECT
59 private:
60     ProjectExplorer::Project* m_project;
61
62 public:
63     explicit ProjectListWidget(ProjectExplorer::Project *project, QWidget *parent = 0);
64
65     QSize sizeHint() const;
66
67     void setBuildComboPopup();
68     void setRunComboPopup();
69
70     ProjectExplorer::Project *project() const;
71
72 private slots:
73     void setTarget(int index);
74 };
75
76 class MiniTargetWidget : public QWidget
77 {
78     Q_OBJECT
79 public:
80     explicit MiniTargetWidget(ProjectExplorer::Target *target, QWidget *parent = 0);
81     ProjectExplorer::Target *target() const;
82
83     bool hasBuildConfiguration() const;
84
85 private slots:
86     void addRunConfiguration(ProjectExplorer::RunConfiguration *runConfig);
87     void removeRunConfiguration(ProjectExplorer::RunConfiguration *runConfig);
88     void addBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfig);
89     void removeBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfig);
90
91     void setActiveBuildConfiguration(int index);
92     void setActiveRunConfiguration(int index);
93     void setActiveBuildConfiguration();
94     void setActiveRunConfiguration();
95
96     void updateIcon();
97
98 signals:
99     void changed();
100
101 private:
102     QLabel *m_targetName;
103     QLabel *m_targetIcon;
104     QComboBox *m_runComboBox;
105     QComboBox *m_buildComboBox;
106     ProjectExplorer::Target *m_target;
107
108 public:
109     QComboBox *runSettingsComboBox() const { return m_runComboBox; }
110     QComboBox *buildSettingsComboBox() const { return m_buildComboBox; }
111 };
112
113 // main class
114
115 class MiniProjectTargetSelector : public QWidget
116 {
117     Q_OBJECT
118 public:
119     explicit MiniProjectTargetSelector(QAction *projectAction, QWidget *parent = 0);
120     void setVisible(bool visible);
121
122 signals:
123     void startupProjectChanged(ProjectExplorer::Project *project);
124
125 private slots:
126     void addProject(ProjectExplorer::Project *project);
127     void removeProject(ProjectExplorer::Project *project);
128     void addTarget(ProjectExplorer::Target *target, bool isActiveTarget = false);
129     void removeTarget(ProjectExplorer::Target *target);
130     void changeActiveTarget(ProjectExplorer::Target *target);
131     void emitStartupProjectChanged(int index);
132     void changeStartupProject(ProjectExplorer::Project *project);
133     void updateAction();
134     void paintEvent(QPaintEvent *);
135     void mousePressEvent(QMouseEvent *);
136
137 private:
138     int indexFor(ProjectExplorer::Project *project) const;
139
140     QAction *m_projectAction;
141     QComboBox *m_projectsBox;
142     QStackedWidget *m_widgetStack;
143     bool m_ignoreIndexChange;
144 };
145
146 } // namespace Internal
147 } // namespace ProjectExplorer
148
149 #endif // MINIPROJECTTARGETSELECTOR_H