Commit 606aba36 authored by Alessandro Portale's avatar Alessandro Portale

Moved some functions to helpers.cpp

parent 04d4d309
#include "qmlstandaloneapp.h"
#include <QtCore>
using namespace Qt4ProjectManager::Internal;
static bool writeFile(const QByteArray &data, const QString &targetFile)
{
const QFileInfo fileInfo(targetFile);
QDir().mkpath(fileInfo.absolutePath());
QFile file(fileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
Q_ASSERT(file.isOpen());
return file.write(data) != -1;
}
bool QmlStandaloneApp::generateFiles(QString *errorMessage) const
{
return writeFile(generateFile(QmlAppGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::AppProFile, errorMessage), path(AppPro))
&& (useExistingMainQml() ? true : writeFile(generateFile(QmlAppGeneratedFileInfo::MainQmlFile, errorMessage), path(MainQml)))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::MaemoPngIconFile, errorMessage), path(MaemoPngIcon))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop));
}
QString AbstractMobileApp::templatesRoot()
{
return QLatin1String("../../../share/qtcreator/templates/");
}
......@@ -32,34 +32,6 @@
using namespace Qt4ProjectManager::Internal;
static bool writeFile(const QByteArray &data, const QString &targetFile)
{
const QFileInfo fileInfo(targetFile);
QDir().mkpath(fileInfo.absolutePath());
QFile file(fileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
Q_ASSERT(file.isOpen());
return file.write(data) != -1;
}
bool QmlStandaloneApp::generateFiles(QString *errorMessage) const
{
return writeFile(generateFile(QmlAppGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::AppProFile, errorMessage), path(AppPro))
&& (useExistingMainQml() ? true : writeFile(generateFile(QmlAppGeneratedFileInfo::MainQmlFile, errorMessage), path(MainQml)))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::MaemoPngIconFile, errorMessage), path(MaemoPngIcon))
&& writeFile(generateFile(QmlAppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop));
}
QString AbstractMobileApp::templatesRoot()
{
return QLatin1String("../../../share/qtcreator/templates/");
}
int main(int argc, char *argv[])
{
QString errorMessage;
......
......@@ -9,5 +9,6 @@ HEADERS += \
SOURCES += \
$$APPSOURCEDIR/qmlstandaloneapp.cpp \
$$APPSOURCEDIR/abstractmobileapp.cpp \
main.cpp
main.cpp \
helpers.cpp
INCLUDEPATH += $$APPSOURCEDIR
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment