Polish and fix qmlvideofx example

Change-Id: I30f6d7d2af784ba018a659a16aceb4876a4b1be6
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2012-12-18 15:11:44 +01:00
committed by The Qt Project
parent 5739d43eef
commit 416168db8a
33 changed files with 122 additions and 123 deletions

View File

@@ -41,36 +41,18 @@
#include "filereader.h"
#include "trace.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QTextStream>
QString adjustPath(const QString &path)
{
#ifdef Q_OS_UNIX
#ifdef Q_OS_MAC
if (!QDir::isAbsolutePath(path))
return QCoreApplication::applicationDirPath()
+ QLatin1String("/../Resources/") + path;
#else
QString pathInInstallDir;
const QString applicationDirPath = QCoreApplication::applicationDirPath();
pathInInstallDir = QString::fromLatin1("%1/../%2").arg(applicationDirPath, path);
if (QFileInfo(pathInInstallDir).exists())
return pathInInstallDir;
#endif
#endif
return path;
}
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QTextStream>
QString FileReader::readFile(const QString &fileName)
{
qtTrace() << "FileReader::readFile" << "fileName" << fileName;
QString content;
QFile file(adjustPath(fileName));
QFile file(fileName);
if (file.open(QIODevice::ReadOnly)) {
QTextStream stream(&file);
content = stream.readAll();