OSDN Git Service

2c6df82fe212d338d50d1b834ecf78664860e43d
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / runsettingspropertiespage.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 RUNSETTINGSPROPERTIESPAGE_H
35 #define RUNSETTINGSPROPERTIESPAGE_H
36
37 #include "iprojectproperties.h"
38
39 #include <QtGui/QWidget>
40 #include <QtGui/QIcon>
41
42 QT_BEGIN_NAMESPACE
43 class QMenu;
44 class QLabel;
45 class QVBoxLayout;
46 QT_END_NAMESPACE
47
48 namespace ProjectExplorer {
49
50 class DeployConfiguration;
51 class DeployConfigurationWidget;
52 class DeployConfigurationModel;
53 class RunConfiguration;
54 class RunConfigurationModel;
55 class RunConfigWidget;
56
57 namespace Internal {
58
59 const char * const RUNSETTINGS_PANEL_ID = "ProjectExplorer.RunSettingsPanel";
60
61 namespace Ui {
62 class RunSettingsPropertiesPage;
63 }
64
65 class RunSettingsWidget;
66 class BuildStepListWidget;
67
68 class RunSettingsPanelFactory : public ITargetPanelFactory
69 {
70 public:
71     QString id() const;
72     QString displayName() const;
73     bool supports(Target *target);
74     IPropertiesPanel *createPanel(Target *target);
75 };
76
77 class RunSettingsPanel : public IPropertiesPanel
78 {
79 public:
80     RunSettingsPanel(Target *target);
81     ~RunSettingsPanel();
82
83     QString displayName() const;
84     QWidget *widget() const;
85     QIcon icon() const;
86
87 private:
88     RunSettingsWidget *m_widget;
89     QIcon m_icon;
90 };
91
92 class RunSettingsWidget : public QWidget
93 {
94     Q_OBJECT
95 public:
96     explicit RunSettingsWidget(Target *target);
97     ~RunSettingsWidget();
98
99 private slots:
100     void currentRunConfigurationChanged(int index);
101     void aboutToShowAddMenu();
102     void addRunConfiguration();
103     void removeRunConfiguration();
104     void activeRunConfigurationChanged();
105     void renameRunConfiguration();
106     void currentDeployConfigurationChanged(int index);
107     void aboutToShowDeployMenu();
108     void addDeployConfiguration();
109     void removeDeployConfiguration();
110     void activeDeployConfigurationChanged();
111     void renameDeployConfiguration();
112
113 private:
114     QString uniqueDCName(const QString &name);
115     QString uniqueRCName(const QString &name);
116     void updateDeployConfiguration(DeployConfiguration *);
117     void setConfigurationWidget(RunConfiguration *rc);
118
119     void addRunControlWidgets();
120     void addSubWidget(RunConfigWidget *subWidget);
121     void removeSubWidgets();
122
123     Target *m_target;
124     RunConfigurationModel *m_runConfigurationsModel;
125     DeployConfigurationModel *m_deployConfigurationModel;
126     Ui::RunSettingsPropertiesPage *m_ui;
127     QWidget *m_runConfigurationWidget;
128     QVBoxLayout *m_runLayout;
129     DeployConfigurationWidget *m_deployConfigurationWidget;
130     QVBoxLayout *m_deployLayout;
131     BuildStepListWidget *m_deploySteps;
132     QMenu *m_addRunMenu;
133     QMenu *m_addDeployMenu;
134     bool m_ignoreChange;
135     typedef QPair<RunConfigWidget *, QLabel *> RunConfigItem;
136     QList<RunConfigItem> m_subWidgets;
137 };
138
139 } // namespace Internal
140 } // namespace ProjectExplorer
141
142 #endif // RUNSETTINGSPROPERTIESPAGE_H