OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmljsinspector / qmlinspectortoolbar.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 QMLINSPECTORTOOLBAR_H
35 #define QMLINSPECTORTOOLBAR_H
36
37 #include <QObject>
38 #include <QIcon>
39
40 QT_FORWARD_DECLARE_CLASS(QAction)
41 QT_FORWARD_DECLARE_CLASS(QColor)
42 QT_FORWARD_DECLARE_CLASS(QToolButton)
43
44 namespace Core {
45     class Context;
46 }
47
48 namespace Utils {
49     class StyledBar;
50     class FilterLineEdit;
51 }
52
53 namespace QmlJSInspector {
54
55 class ToolBarColorBox;
56
57 namespace Internal {
58
59 class QmlInspectorToolbar : public QObject
60 {
61     Q_OBJECT
62 public:
63     enum DesignTool {
64         NoTool = 0,
65         SelectionToolMode = 1,
66         MarqueeSelectionToolMode = 2,
67         MoveToolMode = 3,
68         ResizeToolMode = 4,
69         ColorPickerMode = 5,
70         ZoomMode = 6
71     };
72
73     explicit QmlInspectorToolbar(QObject *parent = 0);
74     void createActions(const Core::Context &context);
75     QWidget *widget() const;
76
77 public slots:
78     void setEnabled(bool value);
79     void enable();
80     void disable();
81
82     void activateColorPicker();
83     void activateSelectTool();
84     void activateZoomTool();
85     void setAnimationSpeed(qreal slowdownFactor);
86     void setDesignModeBehavior(bool inDesignMode);
87     void setShowAppOnTop(bool showAppOnTop);
88     void setSelectedColor(const QColor &color);
89
90 signals:
91     void applyChangesFromQmlFileTriggered(bool isChecked);
92
93     void designModeSelected(bool checked);
94     void reloadSelected();
95     void colorPickerSelected();
96     void selectToolSelected();
97     void zoomToolSelected();
98
99     void showAppOnTopSelected(bool isChecked);
100     void animationSpeedChanged(qreal slowdownFactor = 1.0f);
101
102 private slots:
103     void activateDesignModeOnClick();
104     void activatePlayOnClick();
105     void activateColorPickerOnClick();
106     void activateSelectToolOnClick();
107     void activateZoomOnClick();
108
109     void showAppOnTopClick();
110
111     void changeToDefaultAnimSpeed();
112     void changeToHalfAnimSpeed();
113     void changeToFourthAnimSpeed();
114     void changeToEighthAnimSpeed();
115     void changeToTenthAnimSpeed();
116
117     void activateFromQml();
118
119     void updatePlayAction();
120     void updatePauseAction();
121
122 private:
123     QAction *m_fromQmlAction;
124     QAction *m_observerModeAction;
125     QAction *m_playAction;
126     QAction *m_selectAction;
127     QAction *m_zoomAction;
128     QAction *m_colorPickerAction;
129
130     QAction *m_showAppOnTopAction;
131
132     QAction *m_defaultAnimSpeedAction;
133     QAction *m_halfAnimSpeedAction;
134     QAction *m_fourthAnimSpeedAction;
135     QAction *m_eighthAnimSpeedAction;
136     QAction *m_tenthAnimSpeedAction;
137     QAction *m_menuPauseAction;
138
139     QToolButton *m_playButton;
140     QIcon m_playIcon;
141     QIcon m_pauseIcon;
142
143     ToolBarColorBox *m_colorBox;
144
145     bool m_emitSignals;
146     bool m_isRunning;
147     qreal m_animationSpeed;
148     qreal m_previousAnimationSpeed;
149
150     DesignTool m_activeTool;
151
152     Utils::StyledBar *m_barWidget;
153 };
154
155 } // namespace Internal
156 } // namespace QmlJSInspector
157
158 #endif // QMLINSPECTORTOOLBAR_H