OSDN Git Service

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