Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
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, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QDECLARATIVEVIEWER_H
43#define QDECLARATIVEVIEWER_H
44
45#include <QMainWindow>
46#include <QTimer>
47#include <QTime>
48#include <QList>
49
50#include "loggerwidget.h"
51
52QT_BEGIN_NAMESPACE
53
54class QDeclarativeView;
55class PreviewDeviceSkin;
56class QDeclarativeTestEngine;
57class QProcess;
58class RecordingDialog;
59class QDeclarativeTester;
60class QNetworkReply;
61class QNetworkCookieJar;
62class NetworkAccessManagerFactory;
63class QTranslator;
64class QActionGroup;
65class QMenuBar;
66
67class QDeclarativeViewer
68 : public QMainWindow
69{
70 Q_OBJECT
71
72public:
73 QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
74 ~QDeclarativeViewer();
75
76 static void registerTypes();
77
78 enum ScriptOption {
79 Play = 0x00000001,
80 Record = 0x00000002,
81 TestImages = 0x00000004,
82 TestErrorProperty = 0x00000008,
83 SaveOnExit = 0x00000010,
84 ExitOnComplete = 0x00000020,
85 ExitOnFailure = 0x00000040,
86 Snapshot = 0x00000080,
87 TestSkipProperty = 0x00000100
88 };
89 Q_DECLARE_FLAGS(ScriptOptions, ScriptOption)
90 void setScript(const QString &s) { m_script = s; }
91 void setScriptOptions(ScriptOptions opt) { m_scriptOptions = opt; }
92 void setRecordDither(const QString& s) { record_dither = s; }
93 void setRecordRate(int fps);
94 void setRecordFile(const QString&);
95 void setRecordArgs(const QStringList&);
96 void setRecording(bool on);
97 bool isRecording() const { return recordTimer.isActive(); }
98 void setAutoRecord(int from, int to);
99 void setDeviceKeys(bool);
100 void setNetworkCacheSize(int size);
101 void addLibraryPath(const QString& lib);
102 void addPluginPath(const QString& plugin);
103 void setUseGL(bool use);
104 void setUseNativeFileBrowser(bool);
105 void setSizeToView(bool sizeToView);
106
107 QDeclarativeView *view() const;
108 LoggerWidget *warningsWidget() const;
109 QString currentFile() const { return currentFileOrUrl; }
110
111 void enableExperimentalGestures();
112
113public slots:
114 void sceneResized(QSize size);
115 bool open(const QString&);
116 void openFile();
117 void openUrl();
118 void reload();
119 void takeSnapShot();
120 void toggleRecording();
121 void toggleRecordingWithSelection();
122 void ffmpegFinished(int code);
123 void showProxySettings ();
124 void proxySettingsChanged ();
125 void rotateOrientation();
126 void statusChanged();
127 void setSlowMode(bool);
128 void launch(const QString &);
129
130protected:
131 virtual void keyPressEvent(QKeyEvent *);
132 virtual bool event(QEvent *);
133 void createMenu();
134
135private slots:
136 void appAboutToQuit();
137
138 void autoStartRecording();
139 void autoStopRecording();
140 void recordFrame();
141 void chooseRecordingOptions();
142 void pickRecordingFile();
143 void toggleFullScreen();
144 void changeOrientation(QAction*);
145 void orientationChanged();
146
147 void showWarnings(bool show);
148 void warningsWidgetOpened();
149 void warningsWidgetClosed();
150
151private:
152 void updateSizeHints(bool initial = false);
153
154 QString getVideoFileName();
155
156 LoggerWidget *loggerWindow;
157 QDeclarativeView *canvas;
158 QSize initialSize;
159 QString currentFileOrUrl;
160 QTimer recordTimer;
161 QString frame_fmt;
162 QImage frame;
163 QList<QImage*> frames;
164 QProcess* frame_stream;
165 QTimer autoStartTimer;
166 QTimer autoStopTimer;
167 QString record_dither;
168 QString record_file;
169 QSize record_outsize;
170 QStringList record_args;
171 int record_rate;
172 int record_autotime;
173 bool devicemode;
174 QAction *recordAction;
175 RecordingDialog *recdlg;
176
177 void senseFfmpeg();
178 QWidget *ffmpegHelpWindow;
179 bool ffmpegAvailable;
180 const bool convertAvailable;
181
182 QAction *rotateAction;
183 QActionGroup *orientation;
184 QAction *showWarningsWindow;
185
186 QString m_script;
187 ScriptOptions m_scriptOptions;
188 QDeclarativeTester *tester;
189
190 NetworkAccessManagerFactory *namFactory;
191
192 bool useQmlFileBrowser;
193
194 QTranslator *translator;
195 void loadTranslationFile(const QString& directory);
196
197 void loadDummyDataFiles(const QString& directory);
198};
199Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions)
200
201QT_END_NAMESPACE
202
203#endif
204

Warning: That file was not part of the compilation database. It may have many parsing errors.