tools/qml/qmlruntime.h
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    41 
    41 
    42 #ifndef QDECLARATIVEVIEWER_H
    42 #ifndef QDECLARATIVEVIEWER_H
    43 #define QDECLARATIVEVIEWER_H
    43 #define QDECLARATIVEVIEWER_H
    44 
    44 
    45 #include <QMainWindow>
    45 #include <QMainWindow>
    46 #include <QMenuBar>
    46 #include <QTimer>
    47 #include <private/qdeclarativetimer_p.h>
       
    48 #include <QTime>
    47 #include <QTime>
    49 #include <QList>
    48 #include <QList>
    50 
    49 
    51 #include "loggerwidget.h"
    50 #include "loggerwidget.h"
    52 
    51 
    60 class QDeclarativeTester;
    59 class QDeclarativeTester;
    61 class QNetworkReply;
    60 class QNetworkReply;
    62 class QNetworkCookieJar;
    61 class QNetworkCookieJar;
    63 class NetworkAccessManagerFactory;
    62 class NetworkAccessManagerFactory;
    64 class QTranslator;
    63 class QTranslator;
       
    64 class QActionGroup;
       
    65 class QMenuBar;
    65 
    66 
    66 class QDeclarativeViewer
    67 class QDeclarativeViewer
    67 #if defined(Q_OS_SYMBIAN)
       
    68     : public QMainWindow
    68     : public QMainWindow
    69 #else
       
    70     : public QWidget
       
    71 #endif
       
    72 {
    69 {
    73 Q_OBJECT
    70     Q_OBJECT
       
    71 
    74 public:
    72 public:
    75     QDeclarativeViewer(QWidget *parent=0, Qt::WindowFlags flags=0);
    73     QDeclarativeViewer(QWidget *parent = 0, Qt::WindowFlags flags = 0);
    76     ~QDeclarativeViewer();
    74     ~QDeclarativeViewer();
    77 
    75 
    78     static void registerTypes();
    76     static void registerTypes();
    79 
    77 
    80     enum ScriptOption {
    78     enum ScriptOption {
    93     void setRecordDither(const QString& s) { record_dither = s; }
    91     void setRecordDither(const QString& s) { record_dither = s; }
    94     void setRecordRate(int fps);
    92     void setRecordRate(int fps);
    95     void setRecordFile(const QString&);
    93     void setRecordFile(const QString&);
    96     void setRecordArgs(const QStringList&);
    94     void setRecordArgs(const QStringList&);
    97     void setRecording(bool on);
    95     void setRecording(bool on);
    98     bool isRecording() const { return recordTimer.isRunning(); }
    96     bool isRecording() const { return recordTimer.isActive(); }
    99     void setAutoRecord(int from, int to);
    97     void setAutoRecord(int from, int to);
   100     void setDeviceKeys(bool);
    98     void setDeviceKeys(bool);
   101     void setNetworkCacheSize(int size);
    99     void setNetworkCacheSize(int size);
   102     void addLibraryPath(const QString& lib);
   100     void addLibraryPath(const QString& lib);
   103     void addPluginPath(const QString& plugin);
   101     void addPluginPath(const QString& plugin);
   104     void setUseGL(bool use);
   102     void setUseGL(bool use);
   105     void setUseNativeFileBrowser(bool);
   103     void setUseNativeFileBrowser(bool);
   106     void updateSizeHints();
       
   107     void setSizeToView(bool sizeToView);
   104     void setSizeToView(bool sizeToView);
   108 
       
   109     QMenuBar *menuBar() const;
       
   110 
   105 
   111     QDeclarativeView *view() const;
   106     QDeclarativeView *view() const;
   112     LoggerWidget *warningsWidget() const;
   107     LoggerWidget *warningsWidget() const;
   113 
   108 
   114     void enableExperimentalGestures();
   109     void enableExperimentalGestures();
   122     void toggleRecording();
   117     void toggleRecording();
   123     void toggleRecordingWithSelection();
   118     void toggleRecordingWithSelection();
   124     void ffmpegFinished(int code);
   119     void ffmpegFinished(int code);
   125     void showProxySettings ();
   120     void showProxySettings ();
   126     void proxySettingsChanged ();
   121     void proxySettingsChanged ();
   127     void toggleOrientation();
   122     void rotateOrientation();
   128     void statusChanged();
   123     void statusChanged();
   129     void setSlowMode(bool);
   124     void setSlowMode(bool);
   130     void launch(const QString &);
   125     void launch(const QString &);
   131 
   126 
   132 protected:
   127 protected:
   133     virtual void keyPressEvent(QKeyEvent *);
   128     virtual void keyPressEvent(QKeyEvent *);
   134     virtual bool event(QEvent *);
   129     virtual bool event(QEvent *);
   135     void createMenu(QMenuBar *menu, QMenu *flatmenu);
   130     void createMenu();
   136 
   131 
   137 private slots:
   132 private slots:
       
   133     void appAboutToQuit();
       
   134 
   138     void autoStartRecording();
   135     void autoStartRecording();
   139     void autoStopRecording();
   136     void autoStopRecording();
   140     void recordFrame();
   137     void recordFrame();
   141     void chooseRecordingOptions();
   138     void chooseRecordingOptions();
   142     void pickRecordingFile();
   139     void pickRecordingFile();
   143     void setPortrait();
       
   144     void setLandscape();
       
   145     void startNetwork();
       
   146     void toggleFullScreen();
   140     void toggleFullScreen();
       
   141     void changeOrientation(QAction*);
   147     void orientationChanged();
   142     void orientationChanged();
   148 
   143 
   149     void showWarnings(bool show);
   144     void showWarnings(bool show);
   150     void warningsWidgetOpened();
   145     void warningsWidgetOpened();
   151     void warningsWidgetClosed();
   146     void warningsWidgetClosed();
   152 
   147 
   153 private:
   148 private:
       
   149     void updateSizeHints(bool initial = false);
       
   150 
   154     QString getVideoFileName();
   151     QString getVideoFileName();
   155     int menuBarHeight() const;
       
   156 
   152 
   157     LoggerWidget *loggerWindow;
   153     LoggerWidget *loggerWindow;
   158     QDeclarativeView *canvas;
   154     QDeclarativeView *canvas;
   159     QSize initialSize;
   155     QSize initialSize;
   160     QString currentFileOrUrl;
   156     QString currentFileOrUrl;
   161     QDeclarativeTimer recordTimer;
   157     QTimer recordTimer;
   162     QString frame_fmt;
   158     QString frame_fmt;
   163     QImage frame;
   159     QImage frame;
   164     QList<QImage*> frames;
   160     QList<QImage*> frames;
   165     QProcess* frame_stream;
   161     QProcess* frame_stream;
   166     QDeclarativeTimer autoStartTimer;
   162     QTimer autoStartTimer;
   167     QDeclarativeTimer autoStopTimer;
   163     QTimer autoStopTimer;
   168     QString record_dither;
   164     QString record_dither;
   169     QString record_file;
   165     QString record_file;
   170     QSize record_outsize;
   166     QSize record_outsize;
   171     QStringList record_args;
   167     QStringList record_args;
   172     int record_rate;
   168     int record_rate;
   173     int record_autotime;
   169     int record_autotime;
   174     bool devicemode;
   170     bool devicemode;
   175     QAction *recordAction;
   171     QAction *recordAction;
   176     QString currentSkin;
   172     QString currentSkin;
   177     bool scaleSkin;
   173     bool scaleSkin;
   178     mutable QMenuBar *mb;
       
   179     RecordingDialog *recdlg;
   174     RecordingDialog *recdlg;
   180 
   175 
   181     void senseImageMagick();
   176     void senseImageMagick();
   182     void senseFfmpeg();
   177     void senseFfmpeg();
   183     QWidget *ffmpegHelpWindow;
   178     QWidget *ffmpegHelpWindow;
   184     bool ffmpegAvailable;
   179     bool ffmpegAvailable;
   185     bool convertAvailable;
   180     bool convertAvailable;
   186 
   181 
   187     QAction *portraitOrientation;
   182     QActionGroup *orientation;
   188     QAction *landscapeOrientation;
       
   189 
       
   190     QAction *showWarningsWindow;
   183     QAction *showWarningsWindow;
   191 
   184 
   192     QString m_script;
   185     QString m_script;
   193     ScriptOptions m_scriptOptions;
   186     ScriptOptions m_scriptOptions;
   194     QDeclarativeTester *tester;
   187     QDeclarativeTester *tester;