forked from qt-creator/qt-creator
Html5 app wizard. First steps.
Task-Number: QTCREATORBUG-3284
This commit is contained in:
@@ -38,6 +38,9 @@ HEADERS += \
|
|||||||
wizards/targetsetuppage.h \
|
wizards/targetsetuppage.h \
|
||||||
wizards/qmlstandaloneappwizard.h \
|
wizards/qmlstandaloneappwizard.h \
|
||||||
wizards/qmlstandaloneappwizardpages.h \
|
wizards/qmlstandaloneappwizardpages.h \
|
||||||
|
wizards/html5app.h \
|
||||||
|
wizards/html5appwizard.h \
|
||||||
|
wizards/html5appwizardpages.h \
|
||||||
wizards/abstractmobileapp.h \
|
wizards/abstractmobileapp.h \
|
||||||
wizards/qmlstandaloneapp.h \
|
wizards/qmlstandaloneapp.h \
|
||||||
wizards/abstractmobileappwizard.h \
|
wizards/abstractmobileappwizard.h \
|
||||||
@@ -101,6 +104,9 @@ SOURCES += qt4projectmanagerplugin.cpp \
|
|||||||
wizards/targetsetuppage.cpp \
|
wizards/targetsetuppage.cpp \
|
||||||
wizards/qmlstandaloneappwizard.cpp \
|
wizards/qmlstandaloneappwizard.cpp \
|
||||||
wizards/qmlstandaloneappwizardpages.cpp \
|
wizards/qmlstandaloneappwizardpages.cpp \
|
||||||
|
wizards/html5app.cpp \
|
||||||
|
wizards/html5appwizard.cpp \
|
||||||
|
wizards/html5appwizardpages.cpp \
|
||||||
wizards/abstractmobileapp.cpp \
|
wizards/abstractmobileapp.cpp \
|
||||||
wizards/qmlstandaloneapp.cpp \
|
wizards/qmlstandaloneapp.cpp \
|
||||||
wizards/abstractmobileappwizard.cpp \
|
wizards/abstractmobileappwizard.cpp \
|
||||||
@@ -138,6 +144,7 @@ FORMS += makestep.ui \
|
|||||||
wizards/testwizardpage.ui \
|
wizards/testwizardpage.ui \
|
||||||
wizards/targetsetuppage.ui \
|
wizards/targetsetuppage.ui \
|
||||||
wizards/qmlstandaloneappwizardsourcespage.ui \
|
wizards/qmlstandaloneappwizardsourcespage.ui \
|
||||||
|
wizards/html5appwizardsourcespage.ui \
|
||||||
wizards/mobilelibrarywizardoptionpage.ui \
|
wizards/mobilelibrarywizardoptionpage.ui \
|
||||||
wizards/mobileappwizardgenericoptionspage.ui \
|
wizards/mobileappwizardgenericoptionspage.ui \
|
||||||
wizards/mobileappwizardsymbianoptionspage.ui \
|
wizards/mobileappwizardsymbianoptionspage.ui \
|
||||||
|
|||||||
@@ -107,6 +107,12 @@ const char * const QML_WIZARD_TR_SCOPE = "QmlProjectManager";
|
|||||||
const char * const QML_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("QmlProjectManager", "Qt Quick Project");
|
const char * const QML_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("QmlProjectManager", "Qt Quick Project");
|
||||||
const char * const QML_WIZARD_ICON = ":/qmlproject/images/qml_wizard.png";
|
const char * const QML_WIZARD_ICON = ":/qmlproject/images/qml_wizard.png";
|
||||||
|
|
||||||
|
// Html5 wizard categories
|
||||||
|
const char * const HTML5_WIZARD_CATEGORY = "I.Projects"; // (after Qt)
|
||||||
|
const char * const HTML5_WIZARD_TR_SCOPE = QT_APP_WIZARD_TR_SCOPE;
|
||||||
|
const char * const HTML5_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("ProjectExplorer", "Other Project");
|
||||||
|
const char * const HTML5_WIZARD_ICON = ":/qmlproject/images/qml_wizard.png";
|
||||||
|
|
||||||
// Tasks
|
// Tasks
|
||||||
const char * const PROFILE_EVALUATE = "Qt4ProjectManager.ProFileEvaluate";
|
const char * const PROFILE_EVALUATE = "Qt4ProjectManager.ProFileEvaluate";
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "wizards/emptyprojectwizard.h"
|
#include "wizards/emptyprojectwizard.h"
|
||||||
#include "wizards/subdirsprojectwizard.h"
|
#include "wizards/subdirsprojectwizard.h"
|
||||||
#include "wizards/qmlstandaloneappwizard.h"
|
#include "wizards/qmlstandaloneappwizard.h"
|
||||||
|
#include "wizards/html5appwizard.h"
|
||||||
#include "customwidgetwizard/customwidgetwizard.h"
|
#include "customwidgetwizard/customwidgetwizard.h"
|
||||||
#include "profileeditorfactory.h"
|
#include "profileeditorfactory.h"
|
||||||
#include "qt4projectmanagerconstants.h"
|
#include "qt4projectmanagerconstants.h"
|
||||||
@@ -145,6 +146,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
|
|||||||
addAutoReleasedObject(new ConsoleAppWizard);
|
addAutoReleasedObject(new ConsoleAppWizard);
|
||||||
addAutoReleasedObject(new MobileAppWizard);
|
addAutoReleasedObject(new MobileAppWizard);
|
||||||
addAutoReleasedObject(new QmlStandaloneAppWizard());
|
addAutoReleasedObject(new QmlStandaloneAppWizard());
|
||||||
|
addAutoReleasedObject(new Html5AppWizard);
|
||||||
addAutoReleasedObject(new LibraryWizard);
|
addAutoReleasedObject(new LibraryWizard);
|
||||||
addAutoReleasedObject(new TestWizard);
|
addAutoReleasedObject(new TestWizard);
|
||||||
addAutoReleasedObject(new CustomWidgetWizard);
|
addAutoReleasedObject(new CustomWidgetWizard);
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ namespace Internal {
|
|||||||
struct AbstractGeneratedFileInfo
|
struct AbstractGeneratedFileInfo
|
||||||
{
|
{
|
||||||
enum FileType {
|
enum FileType {
|
||||||
MainQmlFile,
|
|
||||||
MainCppFile,
|
MainCppFile,
|
||||||
AppProFile,
|
AppProFile,
|
||||||
DeploymentPriFile,
|
DeploymentPriFile,
|
||||||
|
|||||||
230
src/plugins/qt4projectmanager/wizards/html5app.cpp
Normal file
230
src/plugins/qt4projectmanager/wizards/html5app.cpp
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** No Commercial Usage
|
||||||
|
**
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "html5app.h"
|
||||||
|
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QFile>
|
||||||
|
#include <QtCore/QRegExp>
|
||||||
|
#include <QtCore/QTextStream>
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
|
||||||
|
#ifndef CREATORLESSTEST
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
#endif // CREATORLESSTEST
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
const QString appViewerBaseName(QLatin1String("html5applicationviewer"));
|
||||||
|
const QString appViewerPriFileName(appViewerBaseName + QLatin1String(".pri"));
|
||||||
|
const QString appViewerCppFileName(appViewerBaseName + QLatin1String(".cpp"));
|
||||||
|
const QString appViewerHFileName(appViewerBaseName + QLatin1String(".h"));
|
||||||
|
const QString appViewerOriginsSubDir(appViewerBaseName + QLatin1Char('/'));
|
||||||
|
|
||||||
|
Html5App::Html5App()
|
||||||
|
: AbstractMobileApp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Html5App::~Html5App()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Html5App::setIndexHtmlFile(const QString &qmlFile)
|
||||||
|
{
|
||||||
|
m_indexHtmlFile.setFile(qmlFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Html5App::indexHtmlFile() const
|
||||||
|
{
|
||||||
|
return path(IndexHtml);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Html5App::pathExtended(int fileType) const
|
||||||
|
{
|
||||||
|
const QString htmlSubDir = QLatin1String("html/");
|
||||||
|
const QString appViewerTargetSubDir = appViewerOriginsSubDir;
|
||||||
|
const QString indexHtml = QLatin1String("index.html");
|
||||||
|
const QString pathBase = outputPathBase();
|
||||||
|
const QDir appProFilePath(pathBase);
|
||||||
|
|
||||||
|
switch (fileType) {
|
||||||
|
case IndexHtml: return useExistingIndexHtml() ? m_indexHtmlFile.canonicalFilePath()
|
||||||
|
: pathBase + htmlSubDir + indexHtml;
|
||||||
|
case IndexHtmlDeployed: return useExistingIndexHtml() ? htmlSubDir + m_indexHtmlFile.fileName()
|
||||||
|
: QString(htmlSubDir + indexHtml);
|
||||||
|
case IndexHtmlOrigin: return originsRoot() + QLatin1String("html/") + indexHtml;
|
||||||
|
case AppViewerPri: return pathBase + appViewerTargetSubDir + appViewerPriFileName;
|
||||||
|
case AppViewerPriOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerPriFileName;
|
||||||
|
case AppViewerCpp: return pathBase + appViewerTargetSubDir + appViewerCppFileName;
|
||||||
|
case AppViewerCppOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerCppFileName;
|
||||||
|
case AppViewerH: return pathBase + appViewerTargetSubDir + appViewerHFileName;
|
||||||
|
case AppViewerHOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerHFileName;
|
||||||
|
case HtmlDir: return pathBase + htmlSubDir;
|
||||||
|
case HtmlDirProFileRelative: return useExistingIndexHtml() ? appProFilePath.relativeFilePath(m_indexHtmlFile.canonicalPath())
|
||||||
|
: QString(htmlSubDir).remove(htmlSubDir.length() - 1, 1);
|
||||||
|
default: qFatal("Html5App::pathExtended() needs more work");
|
||||||
|
}
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Html5App::originsRoot() const
|
||||||
|
{
|
||||||
|
return templatesRoot() + QLatin1String("html5app/");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Html5App::mainWindowClassName() const
|
||||||
|
{
|
||||||
|
return QLatin1String("Html5ApplicationViewer");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Html5App::adaptCurrentMainCppTemplateLine(QString &line) const
|
||||||
|
{
|
||||||
|
const QLatin1Char quote('"');
|
||||||
|
bool adaptLine = true;
|
||||||
|
if (line.contains(QLatin1String("// MAINHTML"))) {
|
||||||
|
insertParameter(line, quote + path(IndexHtmlDeployed) + quote);
|
||||||
|
}
|
||||||
|
return adaptLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Html5App::handleCurrentProFileTemplateLine(const QString &line,
|
||||||
|
QTextStream &proFileTemplate, QTextStream &proFile,
|
||||||
|
bool &uncommentNextLine) const
|
||||||
|
{
|
||||||
|
if (line.contains(QLatin1String("# DEPLOYMENTFOLDERS"))) {
|
||||||
|
// Eat lines
|
||||||
|
QString nextLine;
|
||||||
|
while (!(nextLine = proFileTemplate.readLine()).isNull()
|
||||||
|
&& !nextLine.contains(QLatin1String("# DEPLOYMENTFOLDERS_END")))
|
||||||
|
{ }
|
||||||
|
if (nextLine.isNull())
|
||||||
|
return;
|
||||||
|
QStringList folders;
|
||||||
|
proFile << "folder_01.source = " << path(HtmlDirProFileRelative) << endl;
|
||||||
|
proFile << "folder_01.target = ." << endl;
|
||||||
|
folders.append(QLatin1String("folder_01"));
|
||||||
|
proFile << "DEPLOYMENTFOLDERS = " << folders.join(QLatin1String(" ")) << endl;
|
||||||
|
} else if (line.contains(QLatin1String("# INCLUDE_DEPLOYMENT_PRI"))) {
|
||||||
|
proFileTemplate.readLine(); // eats 'include(deployment.pri)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef CREATORLESSTEST
|
||||||
|
Core::GeneratedFiles Html5App::generateFiles(QString *errorMessage) const
|
||||||
|
{
|
||||||
|
Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
|
||||||
|
// if (!useExistingMainQml()) {
|
||||||
|
files.append(file(generateFile(Html5AppGeneratedFileInfo::IndexHtmlFile, errorMessage), path(IndexHtml)));
|
||||||
|
files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
||||||
|
// }
|
||||||
|
|
||||||
|
files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
|
||||||
|
files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
|
||||||
|
files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH)));
|
||||||
|
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
#endif // CREATORLESSTEST
|
||||||
|
|
||||||
|
bool Html5App::useExistingIndexHtml() const
|
||||||
|
{
|
||||||
|
return !m_indexHtmlFile.filePath().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray Html5App::generateFileExtended(int fileType,
|
||||||
|
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const
|
||||||
|
{
|
||||||
|
QByteArray data;
|
||||||
|
switch (fileType) {
|
||||||
|
case Html5AppGeneratedFileInfo::IndexHtmlFile:
|
||||||
|
data = readBlob(path(IndexHtmlOrigin), errorMessage);
|
||||||
|
break;
|
||||||
|
case Html5AppGeneratedFileInfo::AppViewerPriFile:
|
||||||
|
data = readBlob(path(AppViewerPriOrigin), errorMessage);
|
||||||
|
data.append(readBlob(path(DeploymentPriOrigin), errorMessage));
|
||||||
|
*comment = ProFileComment;
|
||||||
|
*versionAndCheckSum = true;
|
||||||
|
break;
|
||||||
|
case Html5AppGeneratedFileInfo::AppViewerCppFile:
|
||||||
|
data = readBlob(path(AppViewerCppOrigin), errorMessage);
|
||||||
|
*versionAndCheckSum = true;
|
||||||
|
break;
|
||||||
|
case Html5AppGeneratedFileInfo::AppViewerHFile:
|
||||||
|
default:
|
||||||
|
data = readBlob(path(AppViewerHOrigin), errorMessage);
|
||||||
|
*versionAndCheckSum = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Html5App::stubVersionMinor() const
|
||||||
|
{
|
||||||
|
return StubVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<AbstractGeneratedFileInfo> Html5App::updateableFiles(const QString &mainProFile) const
|
||||||
|
{
|
||||||
|
QList<AbstractGeneratedFileInfo> result;
|
||||||
|
static const struct {
|
||||||
|
int fileType;
|
||||||
|
QString fileName;
|
||||||
|
} files[] = {
|
||||||
|
{Html5AppGeneratedFileInfo::AppViewerPriFile, appViewerPriFileName},
|
||||||
|
{Html5AppGeneratedFileInfo::AppViewerHFile, appViewerHFileName},
|
||||||
|
{Html5AppGeneratedFileInfo::AppViewerCppFile, appViewerCppFileName}
|
||||||
|
};
|
||||||
|
const QFileInfo mainProFileInfo(mainProFile);
|
||||||
|
const int size = sizeof(files) / sizeof(files[0]);
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
const QString fileName = mainProFileInfo.dir().absolutePath()
|
||||||
|
+ QLatin1Char('/') + appViewerOriginsSubDir + files[i].fileName;
|
||||||
|
if (!QFile::exists(fileName))
|
||||||
|
continue;
|
||||||
|
Html5AppGeneratedFileInfo file;
|
||||||
|
file.fileType = files[i].fileType;
|
||||||
|
file.fileInfo = QFileInfo(fileName);
|
||||||
|
file.currentVersion = AbstractMobileApp::makeStubVersion(Html5App::StubVersion);
|
||||||
|
result.append(file);
|
||||||
|
}
|
||||||
|
if (result.count() != size)
|
||||||
|
result.clear(); // All files must be found. No wrong/partial updates, please.
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int Html5App::StubVersion = 10;
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
111
src/plugins/qt4projectmanager/wizards/html5app.h
Normal file
111
src/plugins/qt4projectmanager/wizards/html5app.h
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** No Commercial Usage
|
||||||
|
**
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef HTML5APP_H
|
||||||
|
#define HTML5APP_H
|
||||||
|
|
||||||
|
#include "abstractmobileapp.h"
|
||||||
|
|
||||||
|
#include <QtCore/QHash>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
struct Html5AppGeneratedFileInfo : public AbstractGeneratedFileInfo
|
||||||
|
{
|
||||||
|
enum ExtendedFileType {
|
||||||
|
IndexHtmlFile = ExtendedFile,
|
||||||
|
AppViewerPriFile,
|
||||||
|
AppViewerCppFile,
|
||||||
|
AppViewerHFile
|
||||||
|
};
|
||||||
|
|
||||||
|
Html5AppGeneratedFileInfo() : AbstractGeneratedFileInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Html5App : public AbstractMobileApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum ExtendedFileType {
|
||||||
|
IndexHtml = ExtendedFile,
|
||||||
|
IndexHtmlDeployed,
|
||||||
|
IndexHtmlOrigin,
|
||||||
|
AppViewerPri,
|
||||||
|
AppViewerPriOrigin,
|
||||||
|
AppViewerCpp,
|
||||||
|
AppViewerCppOrigin,
|
||||||
|
AppViewerH,
|
||||||
|
AppViewerHOrigin,
|
||||||
|
HtmlDir,
|
||||||
|
HtmlDirProFileRelative,
|
||||||
|
ModulesDir
|
||||||
|
};
|
||||||
|
|
||||||
|
Html5App();
|
||||||
|
virtual ~Html5App();
|
||||||
|
|
||||||
|
void setIndexHtmlFile(const QString &qmlFile);
|
||||||
|
QString indexHtmlFile() const;
|
||||||
|
|
||||||
|
#ifndef CREATORLESSTEST
|
||||||
|
virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const;
|
||||||
|
#else
|
||||||
|
bool generateFiles(QString *errorMessage) const;
|
||||||
|
#endif // CREATORLESSTEST
|
||||||
|
bool useExistingIndexHtml() const;
|
||||||
|
|
||||||
|
static const int StubVersion;
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual QByteArray generateFileExtended(int fileType,
|
||||||
|
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const;
|
||||||
|
virtual QString pathExtended(int fileType) const;
|
||||||
|
virtual QString originsRoot() const;
|
||||||
|
virtual QString mainWindowClassName() const;
|
||||||
|
virtual int stubVersionMinor() const;
|
||||||
|
virtual bool adaptCurrentMainCppTemplateLine(QString &line) const;
|
||||||
|
virtual void handleCurrentProFileTemplateLine(const QString &line,
|
||||||
|
QTextStream &proFileTemplate, QTextStream &proFile,
|
||||||
|
bool &uncommentNextLine) const;
|
||||||
|
QList<AbstractGeneratedFileInfo> updateableFiles(const QString &mainProFile) const;
|
||||||
|
|
||||||
|
QFileInfo m_indexHtmlFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
#endif // HTML5APP_H
|
||||||
162
src/plugins/qt4projectmanager/wizards/html5appwizard.cpp
Normal file
162
src/plugins/qt4projectmanager/wizards/html5appwizard.cpp
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** No Commercial Usage
|
||||||
|
**
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "mobileappwizardpages.h"
|
||||||
|
|
||||||
|
#include "html5app.h"
|
||||||
|
#include "html5appwizard.h"
|
||||||
|
#include "html5appwizardpages.h"
|
||||||
|
#include "targetsetuppage.h"
|
||||||
|
|
||||||
|
#include "qt4projectmanagerconstants.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/baseprojectwizarddialog.h>
|
||||||
|
#include <projectexplorer/customwizard/customwizard.h>
|
||||||
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class Html5AppWizardDialog : public AbstractMobileAppWizardDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Html5AppWizardDialog(QWidget *parent = 0);
|
||||||
|
|
||||||
|
private:
|
||||||
|
class Html5AppWizardSourcesPage *m_htmlSourcesPage;
|
||||||
|
friend class Html5AppWizard;
|
||||||
|
};
|
||||||
|
|
||||||
|
Html5AppWizardDialog::Html5AppWizardDialog(QWidget *parent)
|
||||||
|
: AbstractMobileAppWizardDialog(parent)
|
||||||
|
, m_htmlSourcesPage(0)
|
||||||
|
{
|
||||||
|
setWindowTitle(tr("New Html5 Application"));
|
||||||
|
setIntroDescription(tr("This wizard generates a Html5 application project."));
|
||||||
|
|
||||||
|
m_htmlSourcesPage = new Html5AppWizardSourcesPage;
|
||||||
|
addPageWithTitle(m_htmlSourcesPage, tr("Html Sources"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Html5AppWizardPrivate
|
||||||
|
{
|
||||||
|
class Html5App *app;
|
||||||
|
class Html5AppWizardDialog *wizardDialog;
|
||||||
|
friend class Html5AppWizard;
|
||||||
|
};
|
||||||
|
|
||||||
|
Html5AppWizard::Html5AppWizard()
|
||||||
|
: AbstractMobileAppWizard(parameters())
|
||||||
|
, m_d(new Html5AppWizardPrivate)
|
||||||
|
{
|
||||||
|
m_d->app = new Html5App;
|
||||||
|
m_d->wizardDialog = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Html5AppWizard::~Html5AppWizard()
|
||||||
|
{
|
||||||
|
delete m_d->app;
|
||||||
|
delete m_d;
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::BaseFileWizardParameters Html5AppWizard::parameters()
|
||||||
|
{
|
||||||
|
Core::BaseFileWizardParameters parameters(ProjectWizard);
|
||||||
|
parameters.setIcon(QIcon(QLatin1String(Constants::ICON_QML_STANDALONE)));
|
||||||
|
parameters.setDisplayName(tr("Html5 Application"));
|
||||||
|
parameters.setId(QLatin1String("QA.HTML5A Application"));
|
||||||
|
parameters.setDescription(tr("Creates an Html5 application project that can contain "
|
||||||
|
"both Html5 and C++ code and includes a Webkit view.\n\n"
|
||||||
|
"You can build the application and deploy it on desktop and "
|
||||||
|
"mobile target platforms. For example, you can create signed "
|
||||||
|
"Symbian Installation System (SIS) packages for this type of "
|
||||||
|
"projects."));
|
||||||
|
parameters.setCategory(QLatin1String(Constants::HTML5_WIZARD_CATEGORY));
|
||||||
|
parameters.setDisplayCategory(QCoreApplication::translate(Constants::HTML5_WIZARD_TR_SCOPE,
|
||||||
|
Constants::HTML5_WIZARD_TR_CATEGORY));
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractMobileAppWizardDialog *Html5AppWizard::createWizardDialogInternal(QWidget *parent) const
|
||||||
|
{
|
||||||
|
m_d->wizardDialog = new Html5AppWizardDialog(parent);
|
||||||
|
return m_d->wizardDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Html5AppWizard::projectPathChanged(const QString &path) const
|
||||||
|
{
|
||||||
|
m_d->wizardDialog->m_targetsPage->setImportInfos(TargetSetupPage::importInfosForKnownQtVersions(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Html5AppWizard::prepareGenerateFiles(const QWizard *w,
|
||||||
|
QString *errorMessage) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
|
const Html5AppWizardDialog *wizard = qobject_cast<const Html5AppWizardDialog*>(w);
|
||||||
|
const QString mainQmlFile = wizard->m_htmlSourcesPage->mainHtmlFile();
|
||||||
|
m_d->app->setIndexHtmlFile(mainQmlFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Html5AppWizard::postGenerateFilesInternal(const Core::GeneratedFiles &l,
|
||||||
|
QString *errorMessage)
|
||||||
|
{
|
||||||
|
const bool success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
|
||||||
|
if (success && !m_d->app->indexHtmlFile().isEmpty()) {
|
||||||
|
ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, m_d->app->indexHtmlFile());
|
||||||
|
Core::EditorManager::instance()->openEditor(m_d->app->indexHtmlFile(),
|
||||||
|
QString(), Core::EditorManager::ModeSwitch);
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractMobileApp *Html5AppWizard::app() const
|
||||||
|
{
|
||||||
|
return m_d->app;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractMobileAppWizardDialog *Html5AppWizard::wizardDialog() const
|
||||||
|
{
|
||||||
|
return m_d->wizardDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
#include "html5appwizard.moc"
|
||||||
68
src/plugins/qt4projectmanager/wizards/html5appwizard.h
Normal file
68
src/plugins/qt4projectmanager/wizards/html5appwizard.h
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** No Commercial Usage
|
||||||
|
**
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef HTML5APPWIZARD_H
|
||||||
|
#define HTML5APPWIZARD_H
|
||||||
|
|
||||||
|
#include "abstractmobileappwizard.h"
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class Html5AppWizard : public AbstractMobileAppWizard
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
Html5AppWizard();
|
||||||
|
virtual ~Html5AppWizard();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static Core::BaseFileWizardParameters parameters();
|
||||||
|
|
||||||
|
virtual AbstractMobileApp *app() const;
|
||||||
|
virtual AbstractMobileAppWizardDialog *wizardDialog() const;
|
||||||
|
virtual AbstractMobileAppWizardDialog *createWizardDialogInternal(QWidget *parent) const;
|
||||||
|
virtual void projectPathChanged(const QString &path) const;
|
||||||
|
virtual void prepareGenerateFiles(const QWizard *wizard,
|
||||||
|
QString *errorMessage) const;
|
||||||
|
virtual bool postGenerateFilesInternal(const Core::GeneratedFiles &l,
|
||||||
|
QString *errorMessage);
|
||||||
|
|
||||||
|
class Html5AppWizardPrivate *m_d;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
#endif // HTML5APPWIZARD_H
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** No Commercial Usage
|
||||||
|
**
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "html5appwizardpages.h"
|
||||||
|
#include "ui_html5appwizardsourcespage.h"
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
|
|
||||||
|
#include <QtGui/QDesktopServices>
|
||||||
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class Html5AppWizardSourcesPagePrivate
|
||||||
|
{
|
||||||
|
Ui::Html5AppWizardSourcesPage ui;
|
||||||
|
friend class Html5AppWizardSourcesPage;
|
||||||
|
};
|
||||||
|
|
||||||
|
Html5AppWizardSourcesPage::Html5AppWizardSourcesPage(QWidget *parent)
|
||||||
|
: QWizardPage(parent)
|
||||||
|
, m_d(new Html5AppWizardSourcesPagePrivate)
|
||||||
|
{
|
||||||
|
m_d->ui.setupUi(this);
|
||||||
|
m_d->ui.mainHtmlFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
||||||
|
m_d->ui.mainHtmlFileLineEdit->setPromptDialogFilter(QLatin1String("*.html"));
|
||||||
|
m_d->ui.mainHtmlFileLineEdit->setPromptDialogTitle(tr("Select Html File"));
|
||||||
|
connect(m_d->ui.mainHtmlFileLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
|
||||||
|
connect(m_d->ui.importExistingHtmlRadioButton,
|
||||||
|
SIGNAL(toggled(bool)), SIGNAL(completeChanged()));
|
||||||
|
connect(m_d->ui.newHtmlRadioButton, SIGNAL(toggled(bool)),
|
||||||
|
m_d->ui.mainHtmlFileLineEdit, SLOT(setDisabled(bool)));
|
||||||
|
m_d->ui.newHtmlRadioButton->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Html5AppWizardSourcesPage::~Html5AppWizardSourcesPage()
|
||||||
|
{
|
||||||
|
delete m_d;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Html5AppWizardSourcesPage::mainHtmlFile() const
|
||||||
|
{
|
||||||
|
return m_d->ui.importExistingHtmlRadioButton->isChecked() ?
|
||||||
|
m_d->ui.mainHtmlFileLineEdit->path() : QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Html5AppWizardSourcesPage::isComplete() const
|
||||||
|
{
|
||||||
|
return !m_d->ui.importExistingHtmlRadioButton->isChecked()
|
||||||
|
|| m_d->ui.mainHtmlFileLineEdit->isValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
62
src/plugins/qt4projectmanager/wizards/html5appwizardpages.h
Normal file
62
src/plugins/qt4projectmanager/wizards/html5appwizardpages.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** No Commercial Usage
|
||||||
|
**
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef HTML5APPWIZARDPAGES_H
|
||||||
|
#define HTML5APPWIZARDPAGES_H
|
||||||
|
|
||||||
|
#include <QtGui/QWizardPage>
|
||||||
|
#include "html5app.h"
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class Html5AppWizardSourcesPage : public QWizardPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DISABLE_COPY(Html5AppWizardSourcesPage)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Html5AppWizardSourcesPage(QWidget *parent = 0);
|
||||||
|
virtual ~Html5AppWizardSourcesPage();
|
||||||
|
|
||||||
|
QString mainHtmlFile() const;
|
||||||
|
virtual bool isComplete() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
class Html5AppWizardSourcesPagePrivate *m_d;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
#endif // HTML5APPWIZARDPAGES_H
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Html5AppWizardSourcesPage</class>
|
||||||
|
<widget class="QWizardPage" name="Html5AppWizardSourcesPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>605</width>
|
||||||
|
<height>386</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>WizardPage</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="mainQmlFileGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Main Html File</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QRadioButton" name="newHtmlRadioButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Generate an index.html file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QRadioButton" name="importExistingHtmlRadioButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Import an existing .html file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="Utils::PathChooser" name="mainHtmlFileLineEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>12</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QRadioButton" name="loadAUrlRadioButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Load a URL</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLineEdit" name="loadAUrlLineEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>12</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="deploymentNote">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>1</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Note: Unless you chose to load an URL, all files and directories that reside in the same directory as the main Html file are deployed. You can modify the contents of the directory any time before deploying.</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>Utils::PathChooser</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header location="global">utils/pathchooser.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
<slots>
|
||||||
|
<signal>editingFinished()</signal>
|
||||||
|
<signal>browsingFinished()</signal>
|
||||||
|
</slots>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -5,9 +5,11 @@ DEFINES += \
|
|||||||
APPSOURCEDIR = $$CREATORSOURCEDIR/src/plugins/qt4projectmanager/wizards
|
APPSOURCEDIR = $$CREATORSOURCEDIR/src/plugins/qt4projectmanager/wizards
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$APPSOURCEDIR/qmlstandaloneapp.h \
|
$$APPSOURCEDIR/qmlstandaloneapp.h \
|
||||||
|
$$APPSOURCEDIR/html5app.h \
|
||||||
$$APPSOURCEDIR/abstractmobileapp.h
|
$$APPSOURCEDIR/abstractmobileapp.h
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$APPSOURCEDIR/qmlstandaloneapp.cpp \
|
$$APPSOURCEDIR/qmlstandaloneapp.cpp \
|
||||||
|
$$APPSOURCEDIR/html5app.cpp \
|
||||||
$$APPSOURCEDIR/abstractmobileapp.cpp \
|
$$APPSOURCEDIR/abstractmobileapp.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
helpers.cpp
|
helpers.cpp
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "qmlstandaloneapp.h"
|
#include "qmlstandaloneapp.h"
|
||||||
|
#include "html5app.h"
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
@@ -26,8 +27,20 @@ bool QmlStandaloneApp::generateFiles(QString *errorMessage) const
|
|||||||
&& writeFile(generateFile(QmlAppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop));
|
&& writeFile(generateFile(QmlAppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Html5App::generateFiles(QString *errorMessage) const
|
||||||
|
{
|
||||||
|
return writeFile(generateFile(Html5AppGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp))
|
||||||
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppProFile, errorMessage), path(AppPro))
|
||||||
|
&& (useExistingIndexHtml() ? true : writeFile(generateFile(Html5AppGeneratedFileInfo::IndexHtmlFile, errorMessage), path(IndexHtml)))
|
||||||
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri))
|
||||||
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp))
|
||||||
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH))
|
||||||
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::SymbianSvgIconFile, errorMessage), path(SymbianSvgIcon))
|
||||||
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::MaemoPngIconFile, errorMessage), path(MaemoPngIcon))
|
||||||
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::DesktopFile, errorMessage), path(Desktop));
|
||||||
|
}
|
||||||
|
|
||||||
QString AbstractMobileApp::templatesRoot()
|
QString AbstractMobileApp::templatesRoot()
|
||||||
{
|
{
|
||||||
return QLatin1String("../../../share/qtcreator/templates/");
|
return QLatin1String("../../../share/qtcreator/templates/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qmlstandaloneapp.h"
|
#include "qmlstandaloneapp.h"
|
||||||
|
#include "html5app.h"
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
@@ -79,5 +80,13 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Html5App sAppNew;
|
||||||
|
sAppNew.setProjectPath(projectPath);
|
||||||
|
sAppNew.setProjectName(QLatin1String("new_html5_app"));
|
||||||
|
if (!sAppNew.generateFiles(&errorMessage))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user