targetsettingspanel.h 3.42 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
Tobias Hunger's avatar
Tobias Hunger committed
2
**
Eike Ziller's avatar
Eike Ziller committed
3
4
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
Tobias Hunger's avatar
Tobias Hunger committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
Tobias Hunger's avatar
Tobias Hunger committed
7
**
hjk's avatar
hjk committed
8
9
10
11
** 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
Eike Ziller's avatar
Eike Ziller committed
12
13
** a written agreement between you and The Qt Company.  For licensing terms and
** conditions see http://www.qt.io/terms-conditions.  For further information
Eike Ziller's avatar
Eike Ziller committed
14
** use the contact form at http://www.qt.io/contact-us.
Tobias Hunger's avatar
Tobias Hunger committed
15
16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17
** Alternatively, this file may be used under the terms of the GNU Lesser
Eike Ziller's avatar
Eike Ziller committed
18
19
20
21
22
23
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
Tobias Hunger's avatar
Tobias Hunger committed
24
**
Eike Ziller's avatar
Eike Ziller committed
25
26
** In addition, as a special exception, The Qt Company gives you certain additional
** rights.  These rights are described in The Qt Company LGPL Exception
con's avatar
con committed
27
28
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
29
****************************************************************************/
Tobias Hunger's avatar
Tobias Hunger committed
30
31
32
33

#ifndef TARGETSETTINGSPANEL_H
#define TARGETSETTINGSPANEL_H

34
#include <QWidget>
Tobias Hunger's avatar
Tobias Hunger committed
35

36
37
38
QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
39
class QStackedWidget;
40
41
QT_END_NAMESPACE

42
43
namespace Utils { class FileName; }

Tobias Hunger's avatar
Tobias Hunger committed
44
45
46
namespace ProjectExplorer {

class Target;
47
class Project;
48
class ProjectImporter;
49
class Kit;
50
class PanelsWidget;
Tobias Hunger's avatar
Tobias Hunger committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64

namespace Internal {

class TargetSettingsWidget;

class TargetSettingsPanelWidget : public QWidget
{
    Q_OBJECT
public:
    TargetSettingsPanelWidget(Project *project);
    ~TargetSettingsPanelWidget();

    void setupUi();

65
66
67
    int currentSubIndex() const;
    void setCurrentSubIndex(int subIndex);

68
69
protected:
    bool event(QEvent *event);
Tobias Hunger's avatar
Tobias Hunger committed
70
private slots:
71
    void currentTargetChanged(int targetIndex, int subIndex);
72
    void showTargetToolTip(const QPoint &globalPos, int targetIndex);
Tobias Hunger's avatar
Tobias Hunger committed
73
    void targetAdded(ProjectExplorer::Target *target);
74
    void removedTarget(ProjectExplorer::Target *target);
Tobias Hunger's avatar
Tobias Hunger committed
75
    void activeTargetChanged(ProjectExplorer::Target *target);
76
    void updateTargetButtons();
Tobias Hunger's avatar
Tobias Hunger committed
77
    void renameTarget();
78
    void openTargetPreferences();
79
    void importTarget();
Tobias Hunger's avatar
Tobias Hunger committed
80

81
82
83
84
85
    void removeTarget();
    void menuShown(int targetIndex);
    void addActionTriggered(QAction *action);
    void changeActionTriggered(QAction *action);
    void duplicateActionTriggered(QAction *action);
Tobias Hunger's avatar
Tobias Hunger committed
86
private:
87
    void importTarget(const Utils::FileName &path);
88
89
    void createAction(Kit *k, QMenu *menu);

90
    Target *m_currentTarget;
Tobias Hunger's avatar
Tobias Hunger committed
91
    Project *m_project;
92
    ProjectImporter *m_importer;
Tobias Hunger's avatar
Tobias Hunger committed
93
94
95
96
    TargetSettingsWidget *m_selector;
    QStackedWidget *m_centralWidget;
    QWidget *m_noTargetLabel;
    PanelsWidget *m_panelWidgets[2];
97
    QList<Target *> m_targets;
98
99
100
    QMenu *m_targetMenu;
    QMenu *m_changeMenu;
    QMenu *m_duplicateMenu;
101
    QMenu *m_addMenu;
102
    QAction *m_lastAction;
103
    QAction *m_importAction;
104
    int m_menuTargetIndex;
105
    static int s_targetSubIndex;
Tobias Hunger's avatar
Tobias Hunger committed
106
107
108
109
110
111
};

} // namespace Internal
} // namespace ProjectExplorer

#endif // TARGETSETTINGSPANEL_H