OSDN Git Service

Merge remote branch 'origin/1.3'
[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) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** Commercial Usage
10 **
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
15 **
16 ** GNU Lesser General Public License Usage
17 **
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.
24 **
25 ** If you are unsure which license is appropriate for your use, please
26 ** contact the sales department at http://qt.nokia.com/contact.
27 **
28 **************************************************************************/
29
30 #ifndef MINIPROJECTTARGETSELECTOR_H
31 #define MINIPROJECTTARGETSELECTOR_H
32
33 #include <QtGui/QListWidget>
34
35
36 QT_BEGIN_NAMESPACE
37 class QComboBox;
38 class QLabel;
39 class QStackedWidget;
40 QT_END_NAMESPACE
41
42 namespace ProjectExplorer {
43 class Project;
44 class Target;
45 class RunConfiguration;
46 class Target;
47 class BuildConfiguration;
48
49 namespace Internal {
50
51 // helper classes
52
53 class ProjectListWidget : public QListWidget
54 {
55     Q_OBJECT
56 private:
57     ProjectExplorer::Project* m_project;
58
59 public:
60     ProjectListWidget(ProjectExplorer::Project *project, QWidget *parent = 0);
61
62     QSize sizeHint() const;
63
64     void setBuildComboPopup();
65     void setRunComboPopup();
66
67     ProjectExplorer::Project *project() const;
68
69 private slots:
70     void setTarget(int index);
71 };
72
73 class MiniTargetWidget : public QWidget
74 {
75     Q_OBJECT
76 public:
77     MiniTargetWidget(ProjectExplorer::Target *target, QWidget *parent = 0);
78     ProjectExplorer::Target *target() const;
79
80     bool hasBuildConfiguration() const;
81
82 private slots:
83     void addRunConfiguration(ProjectExplorer::RunConfiguration *runConfig);
84     void removeRunConfiguration(ProjectExplorer::RunConfiguration *buildConfig);
85     void addBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfig);
86     void removeBuildConfiguration(ProjectExplorer::BuildConfiguration *buildConfig);
87
88     void setActiveBuildConfiguration(int index);
89     void setActiveRunConfiguration(int index);
90     void setActiveBuildConfiguration();
91     void setActiveRunConfiguration();
92
93     void updateDisplayName();
94     void updateIcon();
95
96 signals:
97     void changed();
98
99 private:
100     QLabel *m_targetName;
101     QLabel *m_targetIcon;
102     QComboBox *m_runComboBox;
103     QComboBox *m_buildComboBox;
104     ProjectExplorer::Target *m_target;
105
106 public:
107     QComboBox *runSettingsComboBox() const { return m_runComboBox; }
108     QComboBox *buildSettingsComboBox() const { return m_buildComboBox; }
109 };
110
111 // main class
112
113 class MiniProjectTargetSelector : public QWidget
114 {
115     Q_OBJECT
116 public:
117     MiniProjectTargetSelector(QAction *projectAction, QWidget *parent = 0);
118     void setVisible(bool visible);
119
120 signals:
121     void startupProjectChanged(ProjectExplorer::Project *project);
122
123 private slots:
124     void addProject(ProjectExplorer::Project *project);
125     void removeProject(ProjectExplorer::Project *project);
126     void addTarget(ProjectExplorer::Target *target, bool isActiveTarget = false);
127     void removeTarget(ProjectExplorer::Target *target);
128     void emitStartupProjectChanged(int index);
129     void changeStartupProject(ProjectExplorer::Project *project);
130     void updateAction();
131     void paintEvent(QPaintEvent *);
132     void mousePressEvent(QMouseEvent *);
133
134 private:
135     int indexFor(ProjectExplorer::Project *project) const;
136
137     QAction *m_projectAction;
138     QComboBox *m_projectsBox;
139     QStackedWidget *m_widgetStack;
140 };
141
142 } // namespace Internal
143 } // namespace ProjectExplorer
144
145 #endif // MINIPROJECTTARGETSELECTOR_H