1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the tools applications of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
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
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #ifndef QDECLARATIVEVIEWER_H
43 #define QDECLARATIVEVIEWER_H
45 #include <QMainWindow>
50 #include "loggerwidget.h"
54 class QDeclarativeView;
55 class PreviewDeviceSkin;
56 class QDeclarativeTestEngine;
58 class RecordingDialog;
59 class QDeclarativeTester;
61 class QNetworkCookieJar;
62 class NetworkAccessManagerFactory;
67 class QDeclarativeViewer
73 QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
74 ~QDeclarativeViewer();
76 static void registerTypes();
81 TestImages = 0x00000004,
82 TestErrorProperty = 0x00000008,
83 SaveOnExit = 0x00000010,
84 ExitOnComplete = 0x00000020,
85 ExitOnFailure = 0x00000040,
86 Snapshot = 0x00000080,
87 TestSkipProperty = 0x00000100
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);
107 QDeclarativeView *view() const;
108 LoggerWidget *warningsWidget() const;
109 QString currentFile() const { return currentFileOrUrl; }
111 void enableExperimentalGestures();
114 void sceneResized(QSize size);
115 bool open(const QString&);
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 &);
131 virtual void keyPressEvent(QKeyEvent *);
132 virtual bool event(QEvent *);
136 void appAboutToQuit();
138 void autoStartRecording();
139 void autoStopRecording();
141 void chooseRecordingOptions();
142 void pickRecordingFile();
143 void toggleFullScreen();
144 void changeOrientation(QAction*);
145 void orientationChanged();
147 void showWarnings(bool show);
148 void warningsWidgetOpened();
149 void warningsWidgetClosed();
152 void updateSizeHints(bool initial = false);
154 QString getVideoFileName();
156 LoggerWidget *loggerWindow;
157 QDeclarativeView *canvas;
159 QString currentFileOrUrl;
163 QList<QImage*> frames;
164 QProcess* frame_stream;
165 QTimer autoStartTimer;
166 QTimer autoStopTimer;
167 QString record_dither;
169 QSize record_outsize;
170 QStringList record_args;
174 QAction *recordAction;
175 RecordingDialog *recdlg;
177 void senseImageMagick();
179 QWidget *ffmpegHelpWindow;
180 bool ffmpegAvailable;
181 bool convertAvailable;
183 QAction *rotateAction;
184 QActionGroup *orientation;
185 QAction *showWarningsWindow;
188 ScriptOptions m_scriptOptions;
189 QDeclarativeTester *tester;
191 NetworkAccessManagerFactory *namFactory;
193 bool useQmlFileBrowser;
195 QTranslator *translator;
196 void loadTranslationFile(const QString& directory);
198 void loadDummyDataFiles(const QString& directory);
200 Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeViewer::ScriptOptions)