summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2012-10-17 11:07:04 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-17 22:51:31 +0200
commitb4e2cf5e4755828222f5a86dcb95c25584f89870 (patch)
tree60fc5fe64822fea7aa5687e21e9ac89008899659 /tools
parent5156fd1abb747b162dde52ce411968f84a42e8fd (diff)
QtQuick1: Make the examples test for QtQuick1 pass.
- Fix check to indicate immediate errors, skip the loading state and check for errors after loading again. - Exclude all broken examples. - Exclude Mac .app folders - Fix the DeclarativeViewer to check for the presence of the ImageMagick and ffmpeg executables only once, reducing test time. - Do not check for ImageMagick by running its command line tool 'convert' on Windows, since Windows has a tool of the same name that converts file systems (!). - Fix doc snippets to load correctly. - Introduce defines in case WebKit or XmlPatterns are not present (which existed in Qt 4). Task-number: QTQAINFRA-428 Change-Id: Icc0a983bc42857b41ab1d9e93336f8265bfbec36 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com> Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qml/qmlruntime.cpp49
-rw-r--r--tools/qml/qmlruntime.h3
2 files changed, 37 insertions, 15 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index b84acd57..6c235d5b 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -486,10 +486,30 @@ QString QDeclarativeViewer::getVideoFileName()
return QFileDialog::getSaveFileName(this, title, QString(), types.join(QLatin1String(";; ")));
}
+// Check for presence of ImageMagick by launching its command line
+// convert tool except on Windows, where convert.exe is a file system converter.
+static bool senseImageMagick()
+{
+#ifdef Q_OS_WIN
+ return false;
+#else
+ static int imageMagickFound = -1;
+ if (imageMagickFound == -1) {
+ QProcess proc;
+ proc.start(QLatin1String("convert"), QStringList(QLatin1String("-h")));
+ imageMagickFound = proc.waitForStarted() && proc.waitForFinished(2000)
+ && proc.readAllStandardOutput().contains("ImageMagick") ?
+ 1 : 0;
+ }
+ return imageMagickFound != 0;
+#endif
+}
+
QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
: QMainWindow(parent, flags)
, loggerWindow(new LoggerWidget(this))
, frame_stream(0)
+ , convertAvailable(senseImageMagick())
, rotateAction(0)
, orientation(0)
, showWarningsWindow(0)
@@ -510,7 +530,6 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
recdlg = new RecordingDialog(this);
connect(recdlg->pickfile, SIGNAL(clicked()), this, SLOT(pickRecordingFile()));
senseFfmpeg();
- senseImageMagick();
if (!ffmpegAvailable)
recdlg->showffmpegOptions(false);
if (!ffmpegAvailable && !convertAvailable)
@@ -1052,23 +1071,27 @@ bool QDeclarativeViewer::event(QEvent *event)
return QWidget::event(event);
}
-void QDeclarativeViewer::senseImageMagick()
+// Detect ffmpeg, return its help string.
+static inline QString detectFfmpeg()
{
- QProcess proc;
- proc.start(QLatin1String("convert"), QStringList() << QLatin1String("-h"));
- proc.waitForFinished(2000);
- QString help = QString::fromLatin1(proc.readAllStandardOutput());
- convertAvailable = help.contains(QLatin1String("ImageMagick"));
+ static QString ffmpegHelp;
+ if (ffmpegHelp.isNull()) {
+ QProcess proc;
+ proc.start(QLatin1String("ffmpeg"), QStringList(QLatin1String("-h")));
+ if (proc.waitForStarted() && proc.waitForFinished(2000)) {
+ ffmpegHelp = QString::fromLocal8Bit(proc.readAllStandardOutput());
+ } else {
+ ffmpegHelp = QLatin1String("");
+ }
+ }
+ return ffmpegHelp;
}
void QDeclarativeViewer::senseFfmpeg()
{
- QProcess proc;
- proc.start(QLatin1String("ffmpeg"), QStringList() << QLatin1String("-h"));
- proc.waitForFinished(2000);
- QString ffmpegHelp = QString::fromLatin1(proc.readAllStandardOutput());
+ const QString ffmpegHelp = detectFfmpeg();
ffmpegAvailable = ffmpegHelp.contains(QLatin1String("-s "));
- ffmpegHelp = tr("Video recording uses ffmpeg:") + QLatin1String("\n\n") + ffmpegHelp;
+ const QString text = tr("Video recording uses ffmpeg:") + QLatin1String("\n\n") + ffmpegHelp;
QDialog *d = new QDialog(recdlg);
QVBoxLayout *l = new QVBoxLayout(d);
@@ -1076,7 +1099,7 @@ void QDeclarativeViewer::senseFfmpeg()
QFont f = b->font();
f.setFamily(QLatin1String("courier"));
b->setFont(f);
- b->setText(ffmpegHelp);
+ b->setText(text);
l->addWidget(b);
d->setLayout(l);
ffmpegHelpWindow = d;
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index 2fd5f967..76674d04 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -174,11 +174,10 @@ private:
QAction *recordAction;
RecordingDialog *recdlg;
- void senseImageMagick();
void senseFfmpeg();
QWidget *ffmpegHelpWindow;
bool ffmpegAvailable;
- bool convertAvailable;
+ const bool convertAvailable;
QAction *rotateAction;
QActionGroup *orientation;