/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the tools applications of the Qt Toolkit.
**
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <qdeclarativeview.h>
+#include <QtQuick1/qdeclarativeview.h>
#ifdef hz
#undef hz
#endif
-#ifdef Q_WS_MAEMO_5
-# include <QMaemo5ValueButton>
-# include <QMaemo5ListPickSelector>
-# include <QWidgetAction>
-# include <QStringListModel>
-# include "ui_recopts_maemo5.h"
-#else
# include "ui_recopts.h"
-#endif
#include "qmlruntime.h"
#include <qdeclarativecontext.h>
#include <private/qabstractanimation_p.h>
#include <QSettings>
+#include <QMimeData>
#include <QXmlStreamReader>
#include <QBuffer>
#include <QNetworkReply>
+#include <QNetworkCookie>
#include <QNetworkCookieJar>
#include <QNetworkDiskCache>
#include <QNetworkAccessManager>
#include <QGraphicsObject>
#include <QNetworkProxyFactory>
#include <QKeyEvent>
+#include <QMimeData>
#include <QMutex>
#include <QMutexLocker>
#include "proxysettings.h"
#include "deviceorientation.h"
+#include <qdeclarativetester.h>
#ifdef GL_SUPPORTED
#include <QGLWidget>
#endif
-#if defined(Q_WS_S60)
-#include <aknappui.h> // For locking app orientation
-#endif
-
-#include <qdeclarativetester.h>
-
QT_BEGIN_NAMESPACE
class DragAndDropView : public QDeclarativeView
bool activeWindow;
};
-
-
-#if defined(Q_WS_MAEMO_5)
-
-class Maemo5PickerAction : public QWidgetAction {
- Q_OBJECT
-public:
- Maemo5PickerAction(const QString &text, QActionGroup *actions, QObject *parent)
- : QWidgetAction(parent), m_text(text), m_actions(actions)
- { }
-
- QWidget *createWidget(QWidget *parent)
- {
- QMaemo5ValueButton *button = new QMaemo5ValueButton(m_text, parent);
- button->setValueLayout(QMaemo5ValueButton::ValueUnderTextCentered);
- QMaemo5ListPickSelector *pick = new QMaemo5ListPickSelector(button);
- button->setPickSelector(pick);
- if (m_actions) {
- QStringList sl;
- int curIdx = -1, idx = 0;
- foreach (QAction *a, m_actions->actions()) {
- sl << a->text();
- if (a->isChecked())
- curIdx = idx;
- idx++;
- }
- pick->setModel(new QStringListModel(sl));
- pick->setCurrentIndex(curIdx);
- } else {
- button->setEnabled(false);
- }
- connect(pick, SIGNAL(selected(QString)), this, SLOT(emitTriggered()));
- return button;
- }
-
-private slots:
- void emitTriggered()
- {
- QMaemo5ListPickSelector *pick = qobject_cast<QMaemo5ListPickSelector *>(sender());
- if (!pick)
- return;
- int idx = pick->currentIndex();
-
- if (m_actions && idx >= 0 && idx < m_actions->actions().count())
- m_actions->actions().at(idx)->trigger();
- }
-
-private:
- QString m_text;
- QPointer<QActionGroup> m_actions;
-};
-
-#endif // Q_WS_MAEMO_5
-
static struct { const char *name, *args; } ffmpegprofiles[] = {
{"Maximum Quality", "-sameq"},
{"High Quality", "-qmax 2"},
RecordingDialog(QWidget *parent) : QDialog(parent)
{
setupUi(this);
-#ifndef Q_WS_MAEMO_5
hz->setValidator(new QDoubleValidator(hz));
-#endif
for (int i=0; ffmpegprofiles[i].name; ++i) {
- profile->addItem(ffmpegprofiles[i].name);
+ profile->addItem(QString::fromAscii(ffmpegprofiles[i].name));
}
}
{
int i;
for (i=0; ffmpegprofiles[i].args[0]; ++i) {
- if (ffmpegprofiles[i].args == a) {
+ if (QString::fromAscii(ffmpegprofiles[i].args) == a) {
profile->setCurrentIndex(i);
- args->setText(QLatin1String(ffmpegprofiles[i].args));
+ args->setText(QString::fromAscii(ffmpegprofiles[i].args));
return;
}
}
{
QString str = tr("Original (%1x%2)").arg(s.width()).arg(s.height());
-#ifdef Q_WS_MAEMO_5
- sizeCombo->setItemText(0, str);
-#else
sizeOriginal->setText(str);
if (sizeWidth->value()<=1) {
sizeWidth->setValue(s.width());
sizeHeight->setValue(s.height());
}
-#endif
}
void showffmpegOptions(bool b)
{
-#ifdef Q_WS_MAEMO_5
- profileLabel->setVisible(b);
- profile->setVisible(b);
- ffmpegHelp->setVisible(b);
- args->setVisible(b);
-#else
ffmpegOptions->setVisible(b);
-#endif
}
void showRateOptions(bool b)
{
-#ifdef Q_WS_MAEMO_5
- rateLabel->setVisible(b);
- rateCombo->setVisible(b);
-#else
rateOptions->setVisible(b);
-#endif
}
void setVideoRate(int rate)
{
-#ifdef Q_WS_MAEMO_5
- int idx;
- if (rate >= 60)
- idx = 0;
- else if (rate >= 50)
- idx = 2;
- else if (rate >= 25)
- idx = 3;
- else if (rate >= 24)
- idx = 4;
- else if (rate >= 20)
- idx = 5;
- else if (rate >= 15)
- idx = 6;
- else
- idx = 7;
- rateCombo->setCurrentIndex(idx);
-#else
if (rate == 24)
hz24->setChecked(true);
else if (rate == 25)
hzCustom->setChecked(true);
hz->setText(QString::number(rate));
}
-#endif
}
int videoRate() const
{
-#ifdef Q_WS_MAEMO_5
- switch (rateCombo->currentIndex()) {
- case 0: return 60;
- case 1: return 50;
- case 2: return 25;
- case 3: return 24;
- case 4: return 20;
- case 5: return 15;
- case 7: return 10;
- default: return 60;
- }
-#else
if (hz24->isChecked())
return 24;
else if (hz25->isChecked())
else {
return hz->text().toInt();
}
-#endif
}
QSize videoSize() const
{
-#ifdef Q_WS_MAEMO_5
- switch (sizeCombo->currentIndex()) {
- case 0: return QSize();
- case 1: return QSize(640,480);
- case 2: return QSize(320,240);
- case 3: return QSize(1280,720);
- default: return QSize();
- }
-#else
if (sizeOriginal->isChecked())
return QSize();
else if (size720p->isChecked())
return QSize(320,240);
else
return QSize(sizeWidth->value(), sizeHeight->value());
-#endif
}
}
}
QSettings settings;
- settings.setValue("Cookies",data);
+ settings.setValue(QLatin1String("Cookies"), data);
}
void load()
{
QMutexLocker lock(&mutex);
QSettings settings;
- QByteArray data = settings.value("Cookies").toByteArray();
+ QByteArray data = settings.value(QLatin1String("Cookies")).toByteArray();
setAllCookies(QNetworkCookie::parseCookies(data));
}
if (proxyDirty)
setupProxy();
QString protocolTag = query.protocolTag();
- if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) {
+ if (httpProxyInUse && (protocolTag == QLatin1String("http") || protocolTag == QLatin1String("https"))) {
QList<QNetworkProxy> ret;
ret << httpProxy;
return ret;
if (convertAvailable) types += tr("GIF Animation")+QLatin1String(" (*.gif)");
types += tr("Individual PNG frames")+QLatin1String(" (*.png)");
if (ffmpegAvailable) types += tr("All ffmpeg formats (*.*)");
- return QFileDialog::getSaveFileName(this, title, "", types.join(";; "));
+ return QFileDialog::getSaveFileName(this, title, QString(), types.join(QLatin1String(";; ")));
}
QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
{
QDeclarativeViewer::registerTypes();
setWindowTitle(tr("Qt QML Viewer"));
-#ifdef Q_WS_MAEMO_5
- setAttribute(Qt::WA_Maemo5StackedWindow);
-// setPalette(QApplication::palette("QLabel"));
-#endif
-
devicemode = false;
canvas = 0;
record_autotime = 0;
canvas->setFocus();
- QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
+ QObject::connect(canvas, SIGNAL(initialSizeChanged(QSize)), this, SLOT(initialSizeChanged(QSize)));
QObject::connect(canvas, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(statusChanged()));
QObject::connect(canvas->engine(), SIGNAL(quit()), this, SLOT(close()));
connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload()));
QAction *snapshotAction = new QAction(tr("&Take Snapshot"), this);
- snapshotAction->setShortcut(QKeySequence("F3"));
+ snapshotAction->setShortcut(QKeySequence(tr("F3")));
connect(snapshotAction, SIGNAL(triggered()), this, SLOT(takeSnapShot()));
recordAction = new QAction(tr("Start Recording &Video"), this);
- recordAction->setShortcut(QKeySequence("F9"));
+ recordAction->setShortcut(QKeySequence(tr("F9")));
connect(recordAction, SIGNAL(triggered()), this, SLOT(toggleRecordingWithSelection()));
QAction *recordOptions = new QAction(tr("Video &Options..."), this);
connect(recordOptions, SIGNAL(triggered()), this, SLOT(chooseRecordingOptions()));
QAction *slowAction = new QAction(tr("&Slow Down Animations"), this);
- slowAction->setShortcut(QKeySequence("Ctrl+."));
+ slowAction->setShortcut(QKeySequence(tr("Ctrl+.")));
slowAction->setCheckable(true);
connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool)));
showWarningsWindow = new QAction(tr("Show Warnings"), this);
-#if !defined(Q_OS_SYMBIAN)
showWarningsWindow->setCheckable((true));
showWarningsWindow->setChecked(loggerWindow->isVisible());
-#endif
connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool)));
QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this);
connect(fullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
rotateAction = new QAction(tr("Rotate orientation"), this);
- rotateAction->setShortcut(QKeySequence("Ctrl+T"));
+ rotateAction->setShortcut(QKeySequence(tr("Ctrl+T")));
connect(rotateAction, SIGNAL(triggered()), this, SLOT(rotateOrientation()));
orientation = new QActionGroup(this);
orientation->setExclusive(true);
connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*)));
-#if defined(Q_OS_SYMBIAN)
- QAction *autoOrientationAction = new QAction(tr("Auto-orientation"), this);
- autoOrientationAction->setCheckable(true);
-#endif
QAction *portraitAction = new QAction(tr("Portrait"), this);
portraitAction->setCheckable(true);
QAction *landscapeAction = new QAction(tr("Landscape"), this);
landscapeAction->setCheckable(true);
-#if !defined(Q_OS_SYMBIAN)
QAction *portraitInvAction = new QAction(tr("Portrait (inverted)"), this);
portraitInvAction->setCheckable(true);
QAction *landscapeInvAction = new QAction(tr("Landscape (inverted)"), this);
landscapeInvAction->setCheckable(true);
-#endif
QAction *aboutAction = new QAction(tr("&About Qt..."), this);
aboutAction->setMenuRole(QAction::AboutQtRole);
connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
-#if !defined(Q_OS_SYMBIAN)
QAction *closeAction = new QAction(tr("&Close"), this);
closeAction->setShortcuts(QKeySequence::Close);
connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
-#endif
QAction *quitAction = new QAction(tr("&Quit"), this);
quitAction->setMenuRole(QAction::QuitRole);
QMenuBar *menu = menuBar();
if (!menu)
- return;
-
-#if defined(Q_WS_MAEMO_5)
- menu->addAction(openAction);
- menu->addAction(openUrlAction);
- menu->addAction(reloadAction);
-
- menu->addAction(snapshotAction);
- menu->addAction(recordAction);
-
- menu->addAction(recordOptions);
- menu->addAction(proxyAction);
-
- menu->addAction(slowAction);
- menu->addAction(showWarningsWindow);
-
- orientation->addAction(landscapeAction);
- orientation->addAction(portraitAction);
- menu->addAction(new Maemo5PickerAction(tr("Set orientation"), orientation, this));
- menu->addAction(fullscreenAction);
- return;
-#endif // Q_WS_MAEMO_5
+ return;
QMenu *fileMenu = menu->addMenu(tr("&File"));
fileMenu->addAction(openAction);
fileMenu->addAction(openUrlAction);
fileMenu->addAction(reloadAction);
-#if !defined(Q_OS_SYMBIAN)
fileMenu->addSeparator();
fileMenu->addAction(closeAction);
fileMenu->addAction(quitAction);
QMenu *recordMenu = menu->addMenu(tr("&Recording"));
recordMenu->addAction(snapshotAction);
recordMenu->addAction(recordAction);
-#endif // ! Q_OS_SYMBIAN
QMenu *debugMenu = menu->addMenu(tr("&Debugging"));
debugMenu->addAction(slowAction);
QMenu *settingsMenu = menu->addMenu(tr("&Settings"));
settingsMenu->addAction(proxyAction);
-#if defined(Q_OS_SYMBIAN)
- settingsMenu->addAction(fullscreenAction);
-#else
settingsMenu->addAction(recordOptions);
settingsMenu->addMenu(loggerWindow->preferencesMenu());
-#endif // !Q_OS_SYMBIAN
settingsMenu->addAction(rotateAction);
QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
-#if defined(Q_OS_SYMBIAN)
- orientation->addAction(autoOrientationAction);
-#endif
orientation->addAction(portraitAction);
orientation->addAction(landscapeAction);
-#if !defined(Q_OS_SYMBIAN)
orientation->addAction(portraitInvAction);
orientation->addAction(landscapeInvAction);
-#endif
propertiesMenu->addActions(orientation->actions());
QMenu *helpMenu = menu->addMenu(tr("&Help"));
void QDeclarativeViewer::rotateOrientation()
{
-#if defined(Q_WS_S60)
- CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
- if (appUi) {
- CAknAppUi::TAppUiOrientation oldOrientation = appUi->Orientation();
- QString newOrientation;
- if (oldOrientation == CAknAppUi::EAppUiOrientationPortrait) {
- newOrientation = QLatin1String("Landscape");
- } else {
- newOrientation = QLatin1String("Portrait");
- }
- foreach (QAction *action, orientation->actions()) {
- if (action->text() == newOrientation) {
- changeOrientation(action);
- }
- }
- }
-#else
QAction *current = orientation->checkedAction();
QList<QAction *> actions = orientation->actions();
int index = actions.indexOf(current);
QAction *newOrientation = actions[(index + 1) % actions.count()];
changeOrientation(newOrientation);
-#endif
}
void QDeclarativeViewer::toggleFullScreen()
void QDeclarativeViewer::showWarnings(bool show)
{
-#if defined(Q_OS_SYMBIAN)
- loggerWindow->showMaximized();
-#else
loggerWindow->setVisible(show);
-#endif
}
void QDeclarativeViewer::warningsWidgetOpened()
// Profile
- recdlg->setArguments(record_args.join(" "));
+ recdlg->setArguments(record_args.join(QLatin1String(" ")));
if (recdlg->exec()) {
// File
record_file = recdlg->file->text();
// Rate
record_rate = recdlg->videoRate();
// Profile
- record_args = recdlg->arguments().split(" ",QString::SkipEmptyParts);
+ record_args = recdlg->arguments().split(QLatin1Char(' '),QString::SkipEmptyParts);
}
}
QString fileName = getVideoFileName();
if (fileName.isEmpty())
return;
- if (!fileName.contains(QRegExp(".[^\\/]*$")))
- fileName += ".avi";
+ if (!fileName.contains(QRegExp(QLatin1String(".[^\\/]*$"))))
+ fileName += QLatin1String(".avi");
setRecordFile(fileName);
}
}
{
QString cur = canvas->source().toLocalFile();
if (useQmlFileBrowser) {
- open("qrc:/browser/Browser.qml");
+ open(QLatin1String("qrc:/browser/Browser.qml"));
} else {
QString fileName = QFileDialog::getOpenFileName(this, tr("Open QML file"), cur, tr("QML Files (*.qml)"));
if (!fileName.isEmpty()) {
if (canvas->status() == QDeclarativeView::Ready) {
initialSize = canvas->initialSize();
updateSizeHints(true);
+ QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
}
}
void QDeclarativeViewer::loadDummyDataFiles(const QString& directory)
{
- QDir dir(directory+"/dummydata", "*.qml");
+ QDir dir(directory + QLatin1String("/dummydata"), QLatin1String("*.qml"));
QStringList list = dir.entryList();
for (int i = 0; i < list.size(); ++i) {
QString qml = list.at(i);
delete canvas->rootObject();
canvas->engine()->clearComponentCache();
QDeclarativeContext *ctxt = canvas->rootContext();
- ctxt->setContextProperty("qmlViewer", this);
-#ifdef Q_OS_SYMBIAN
- ctxt->setContextProperty("qmlViewerFolder", "E:\\"); // Documents on your S60 phone
-#else
- ctxt->setContextProperty("qmlViewerFolder", QDir::currentPath());
-#endif
-
- ctxt->setContextProperty("runtime", Runtime::instance());
+ ctxt->setContextProperty(QLatin1String("qmlViewer"), this);
+ ctxt->setContextProperty(QLatin1String("qmlViewerFolder"), QDir::currentPath());
+ ctxt->setContextProperty(QLatin1String("runtime"), Runtime::instance());
QString fileName = url.toLocalFile();
if (!fileName.isEmpty()) {
QTime t;
t.start();
+ QObject::disconnect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
canvas->setSource(url);
return true;
updateSizeHints();
}
+void QDeclarativeViewer::initialSizeChanged(QSize size)
+{
+ if (!isFullScreen() && !isMaximized()) {
+ canvas->setGeometry(0,0,size.width(),size.height());
+ layout()->setSizeConstraint(QLayout::SetFixedSize);
+ layout()->activate();
+ }
+}
+
void QDeclarativeViewer::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_0 && devicemode)
void QDeclarativeViewer::senseImageMagick()
{
QProcess proc;
- proc.start("convert", QStringList() << "-h");
+ proc.start(QLatin1String("convert"), QStringList() << QLatin1String("-h"));
proc.waitForFinished(2000);
- QString help = proc.readAllStandardOutput();
- convertAvailable = help.contains("ImageMagick");
+ QString help = QString::fromAscii(proc.readAllStandardOutput());
+ convertAvailable = help.contains(QLatin1String("ImageMagick"));
}
void QDeclarativeViewer::senseFfmpeg()
{
QProcess proc;
- proc.start("ffmpeg", QStringList() << "-h");
+ proc.start(QLatin1String("ffmpeg"), QStringList() << QLatin1String("-h"));
proc.waitForFinished(2000);
- QString ffmpegHelp = proc.readAllStandardOutput();
- ffmpegAvailable = ffmpegHelp.contains("-s ");
- ffmpegHelp = tr("Video recording uses ffmpeg:")+"\n\n"+ffmpegHelp;
+ QString ffmpegHelp = QString::fromAscii(proc.readAllStandardOutput());
+ ffmpegAvailable = ffmpegHelp.contains(QLatin1String("-s "));
+ ffmpegHelp = tr("Video recording uses ffmpeg:") + QLatin1String("\n\n") + ffmpegHelp;
QDialog *d = new QDialog(recdlg);
QVBoxLayout *l = new QVBoxLayout(d);
QTextBrowser *b = new QTextBrowser(d);
QFont f = b->font();
- f.setFamily("courier");
+ f.setFamily(QLatin1String("courier"));
b->setFont(f);
b->setText(ffmpegHelp);
l->addWidget(b);
recordTimer.start();
frame_fmt = record_file.right(4).toLower();
frame = QImage(canvas->width(),canvas->height(),QImage::Format_RGB32);
- if (frame_fmt != ".png" && (!convertAvailable || frame_fmt != ".gif")) {
+ if (frame_fmt != QLatin1String(".png") && (!convertAvailable || frame_fmt != QLatin1String(".gif"))) {
// Stream video to ffmpeg
QProcess *proc = new QProcess(this);
frame_stream = proc;
QStringList args;
- args << "-y";
- args << "-r" << QString::number(record_rate);
- args << "-f" << "rawvideo";
- args << "-pix_fmt" << (frame_fmt == ".gif" ? "rgb24" : "rgb32");
- args << "-s" << QString("%1x%2").arg(canvas->width()).arg(canvas->height());
- args << "-i" << "-";
+ args << QLatin1String("-y");
+ args << QLatin1String("-r") << QString::number(record_rate);
+ args << QLatin1String("-f") << QLatin1String("rawvideo");
+ args << QLatin1String("-pix_fmt") << (frame_fmt == QLatin1String(".gif") ? QLatin1String("rgb24") : QLatin1String("rgb32"));
+ args << QLatin1String("-s") << QString::fromAscii("%1x%2").arg(canvas->width()).arg(canvas->height());
+ args << QLatin1String("-i") << QLatin1String("-");
if (record_outsize.isValid()) {
- args << "-s" << QString("%1x%2").arg(record_outsize.width()).arg(record_outsize.height());
- args << "-aspect" << QString::number(double(canvas->width())/canvas->height());
+ args << QLatin1String("-s") << QString::fromAscii("%1x%2").arg(record_outsize.width()).arg(record_outsize.height());
+ args << QLatin1String("-aspect") << QString::number(double(canvas->width())/canvas->height());
}
args += record_args;
args << record_file;
- proc->start("ffmpeg",args);
+ proc->start(QLatin1String("ffmpeg"), args);
} else {
// Store frames, save to GIF/PNG
QString framename;
bool png_output = false;
- if (record_file.right(4).toLower()==".png") {
- if (record_file.contains('%'))
+ if (record_file.right(4).toLower() == QLatin1String(".png")) {
+ if (record_file.contains(QLatin1Char('%')))
framename = record_file;
else
- framename = record_file.left(record_file.length()-4)+"%04d"+record_file.right(4);
+ framename = record_file.left(record_file.length()-4) + QLatin1String("%04d") + record_file.right(4);
png_output = true;
} else {
- framename = "tmp-frame%04d.png";
+ framename = QLatin1String("tmp-frame%04d.png");
png_output = false;
}
foreach (QImage* img, frames) {
name.sprintf(framename.toLocal8Bit(),frame++);
if (record_outsize.isValid())
*img = img->scaled(record_outsize,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
- if (record_dither=="ordered")
+ if (record_dither==QLatin1String("ordered"))
img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::OrderedDither).save(name);
- else if (record_dither=="threshold")
+ else if (record_dither==QLatin1String("threshold"))
img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither|Qt::ThresholdDither).save(name);
- else if (record_dither=="floyd")
+ else if (record_dither==QLatin1String("floyd"))
img->convertToFormat(QImage::Format_Indexed8,Qt::PreferDither).save(name);
else
img->save(name);
if (!progress.wasCanceled()) {
if (png_output) {
- framename.replace(QRegExp("%\\d*."),"*");
+ framename.replace(QRegExp(QLatin1String("%\\d*.")), QLatin1String("*"));
qDebug() << "Wrote frames" << framename;
inputs.clear(); // don't remove them
} else {
// ImageMagick and gifsicle for GIF encoding
progress.setLabelText(tr("Converting frames to GIF file..."));
QStringList args;
- args << "-delay" << QString::number(period/10);
+ args << QLatin1String("-delay") << QString::number(period/10);
args << inputs;
args << record_file;
qDebug() << "Converting..." << record_file << "(this may take a while)";
- if (0!=QProcess::execute("convert", args)) {
+ if (0!=QProcess::execute(QLatin1String("convert"), args)) {
qWarning() << "Cannot run ImageMagick 'convert' - recorded frames not converted";
inputs.clear(); // don't remove them
qDebug() << "Wrote frames tmp-frame*.png";
} else {
- if (record_file.right(4).toLower() == ".gif") {
+ if (record_file.right(4).toLower() == QLatin1String(".gif")) {
qDebug() << "Compressing..." << record_file;
- if (0!=QProcess::execute("gifsicle", QStringList() << "-O2" << "-o" << record_file << record_file))
+ if (0!=QProcess::execute(QLatin1String("gifsicle"), QStringList() << QLatin1String("-O2")
+ << QLatin1String("-o") << record_file << record_file))
qWarning() << "Cannot run 'gifsicle' - not compressed";
}
qDebug() << "Wrote" << record_file;
loggerWindow = 0;
delete tester;
tester = 0;
+ close();
}
void QDeclarativeViewer::autoStartRecording()
{
canvas->QWidget::render(&frame);
if (frame_stream) {
- if (frame_fmt == ".gif") {
+ if (frame_fmt == QLatin1String(".gif")) {
// ffmpeg can't do 32bpp with gif
QImage rgb24 = frame.convertToFormat(QImage::Format_RGB888);
- frame_stream->write((char*)rgb24.bits(),rgb24.numBytes());
+ frame_stream->write((char*)rgb24.bits(),rgb24.byteCount());
} else {
- frame_stream->write((char*)frame.bits(),frame.numBytes());
+ frame_stream->write((char*)frame.bits(),frame.byteCount());
}
} else {
frames.append(new QImage(frame));
return;
QString o = action->text();
action->setChecked(true);
-#if defined(Q_WS_S60)
- CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
- if (appUi) {
- CAknAppUi::TAppUiOrientation orientation = appUi->Orientation();
- if (o == QLatin1String("Auto-orientation")) {
- appUi->SetOrientationL(CAknAppUi::EAppUiOrientationAutomatic);
- rotateAction->setVisible(false);
- } else if (o == QLatin1String("Portrait")) {
- appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
- rotateAction->setVisible(true);
- } else if (o == QLatin1String("Landscape")) {
- appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
- rotateAction->setVisible(true);
- }
- }
-#else
if (o == QLatin1String("Portrait"))
DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait);
else if (o == QLatin1String("Landscape"))
DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted);
else if (o == QLatin1String("Landscape (inverted)"))
DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted);
-#endif
}
void QDeclarativeViewer::orientationChanged()
#ifdef GL_SUPPORTED
if (useGL) {
QGLFormat format = QGLFormat::defaultFormat();
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
format.setSampleBuffers(true);
+ format.setSwapInterval(1);
#else
format.setSampleBuffers(false);
#endif
QSize newWindowSize = initial ? initialSize : canvas->sizeHint();
//qWarning() << "USH:" << (initial ? "INIT:" : "V2R:") << "setting fixed size " << newWindowSize;
if (!isFullScreen() && !isMaximized()) {
- canvas->setFixedSize(newWindowSize);
+ canvas->setGeometry(0,0,newWindowSize.width(),newWindowSize.height());
resize(1, 1);
layout()->setSizeConstraint(QLayout::SetFixedSize);
layout()->activate();
if (!registered) {
// registering only for exposing the DeviceOrientation::Orientation enum
- qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,7,"Orientation","");
- qmlRegisterUncreatableType<DeviceOrientation>("QtQuick",1,0,"Orientation","");
+ qmlRegisterUncreatableType<DeviceOrientation>("Qt", 4, 7, "Orientation", QString());
+ qmlRegisterUncreatableType<DeviceOrientation>("QtQuick", 1, 0, "Orientation", QString());
registered = true;
}
}