forked from qt-creator/qt-creator
Implemented "import" and "Url" options for html5 app wizard
This commit is contained in:
@@ -8,8 +8,11 @@ int main(int argc, char *argv[])
|
|||||||
Html5ApplicationViewer viewer;
|
Html5ApplicationViewer viewer;
|
||||||
viewer.setOrientation(Html5ApplicationViewer::ScreenOrientationAuto); // ORIENTATION
|
viewer.setOrientation(Html5ApplicationViewer::ScreenOrientationAuto); // ORIENTATION
|
||||||
viewer.showExpanded();
|
viewer.showExpanded();
|
||||||
viewer.loadFile(QLatin1String("html/index.html")); // HTMLFILE
|
#if 1 // DELETE_LINE
|
||||||
// viewer.loadUrl(QUrl(QLatin1String("http://dev.sencha.com/deploy/touch/examples/kitchensink/")));
|
viewer.loadFile(QLatin1String("html/index.html")); // MAINHTMLFILE
|
||||||
|
#else // DELETE_LINE
|
||||||
|
viewer.loadUrl(QUrl(QLatin1String("http://dev.sencha.com/deploy/touch/examples/kitchensink/"))); // MAINHTMLURL
|
||||||
|
#endif // DELETE_LINE
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,6 +219,8 @@ QByteArray AbstractMobileApp::generateMainCpp(QString *errorMessage) const
|
|||||||
}
|
}
|
||||||
insertParameter(line, mainWindowClassName() + QLatin1String("::")
|
insertParameter(line, mainWindowClassName() + QLatin1String("::")
|
||||||
+ QLatin1String(orientationString));
|
+ QLatin1String(orientationString));
|
||||||
|
} else if (line.contains(QLatin1String("// DELETE_LINE"))) {
|
||||||
|
continue; // omit this line in the output
|
||||||
} else {
|
} else {
|
||||||
adaptLine = adaptCurrentMainCppTemplateLine(line);
|
adaptLine = adaptCurrentMainCppTemplateLine(line);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ const QString appViewerOriginsSubDir(appViewerBaseName + QLatin1Char('/'));
|
|||||||
|
|
||||||
Html5App::Html5App()
|
Html5App::Html5App()
|
||||||
: AbstractMobileApp()
|
: AbstractMobileApp()
|
||||||
|
, m_mainHtmlMode(ModeGenerate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,30 +62,36 @@ Html5App::~Html5App()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Html5App::setIndexHtmlFile(const QString &qmlFile)
|
void Html5App::setMainHtml(Mode mode, const QString &data)
|
||||||
{
|
{
|
||||||
m_indexHtmlFile.setFile(qmlFile);
|
Q_ASSERT(mode != ModeGenerate || data.isEmpty());
|
||||||
|
m_mainHtmlMode = mode;
|
||||||
|
m_mainHtmlData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Html5App::indexHtmlFile() const
|
Html5App::Mode Html5App::mainHtmlMode() const
|
||||||
{
|
{
|
||||||
return path(IndexHtml);
|
return m_mainHtmlMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Html5App::pathExtended(int fileType) const
|
QString Html5App::pathExtended(int fileType) const
|
||||||
{
|
{
|
||||||
const QString htmlSubDir = QLatin1String("html/");
|
|
||||||
const QString appViewerTargetSubDir = appViewerOriginsSubDir;
|
const QString appViewerTargetSubDir = appViewerOriginsSubDir;
|
||||||
const QString indexHtml = QLatin1String("index.html");
|
const QString indexHtml = QLatin1String("index.html");
|
||||||
const QString pathBase = outputPathBase();
|
const QString pathBase = outputPathBase();
|
||||||
const QDir appProFilePath(pathBase);
|
const QDir appProFilePath(pathBase);
|
||||||
|
const bool generateHtml = m_mainHtmlMode == ModeGenerate;
|
||||||
|
const bool importHtml = m_mainHtmlMode == ModeImport;
|
||||||
|
const QFileInfo importedHtmlFile(m_mainHtmlData);
|
||||||
|
const QString htmlSubDir = importHtml ? importedHtmlFile.canonicalPath().split(QLatin1Char('/')).last() + QLatin1Char('/')
|
||||||
|
: QString::fromLatin1("html/");
|
||||||
|
|
||||||
switch (fileType) {
|
switch (fileType) {
|
||||||
case IndexHtml: return useExistingIndexHtml() ? m_indexHtmlFile.canonicalFilePath()
|
case MainHtml: return generateHtml ? pathBase + htmlSubDir + indexHtml
|
||||||
: pathBase + htmlSubDir + indexHtml;
|
: importedHtmlFile.canonicalFilePath();
|
||||||
case IndexHtmlDeployed: return useExistingIndexHtml() ? htmlSubDir + m_indexHtmlFile.fileName()
|
case MainHtmlDeployed: return generateHtml ? QString(htmlSubDir + indexHtml)
|
||||||
: QString(htmlSubDir + indexHtml);
|
: htmlSubDir + importedHtmlFile.fileName();
|
||||||
case IndexHtmlOrigin: return originsRoot() + QLatin1String("html/") + indexHtml;
|
case MainHtmlOrigin: return originsRoot() + QLatin1String("html/") + indexHtml;
|
||||||
case AppViewerPri: return pathBase + appViewerTargetSubDir + appViewerPriFileName;
|
case AppViewerPri: return pathBase + appViewerTargetSubDir + appViewerPriFileName;
|
||||||
case AppViewerPriOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerPriFileName;
|
case AppViewerPriOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerPriFileName;
|
||||||
case AppViewerCpp: return pathBase + appViewerTargetSubDir + appViewerCppFileName;
|
case AppViewerCpp: return pathBase + appViewerTargetSubDir + appViewerCppFileName;
|
||||||
@@ -92,8 +99,8 @@ QString Html5App::pathExtended(int fileType) const
|
|||||||
case AppViewerH: return pathBase + appViewerTargetSubDir + appViewerHFileName;
|
case AppViewerH: return pathBase + appViewerTargetSubDir + appViewerHFileName;
|
||||||
case AppViewerHOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerHFileName;
|
case AppViewerHOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerHFileName;
|
||||||
case HtmlDir: return pathBase + htmlSubDir;
|
case HtmlDir: return pathBase + htmlSubDir;
|
||||||
case HtmlDirProFileRelative: return useExistingIndexHtml() ? appProFilePath.relativeFilePath(m_indexHtmlFile.canonicalPath())
|
case HtmlDirProFileRelative: return generateHtml ? QString(htmlSubDir).remove(htmlSubDir.length() - 1, 1)
|
||||||
: QString(htmlSubDir).remove(htmlSubDir.length() - 1, 1);
|
: appProFilePath.relativeFilePath(importedHtmlFile.canonicalPath());
|
||||||
default: qFatal("Html5App::pathExtended() needs more work");
|
default: qFatal("Html5App::pathExtended() needs more work");
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
@@ -113,8 +120,16 @@ bool Html5App::adaptCurrentMainCppTemplateLine(QString &line) const
|
|||||||
{
|
{
|
||||||
const QLatin1Char quote('"');
|
const QLatin1Char quote('"');
|
||||||
bool adaptLine = true;
|
bool adaptLine = true;
|
||||||
if (line.contains(QLatin1String("// MAINHTML"))) {
|
if (line.contains(QLatin1String("// MAINHTMLFILE"))) {
|
||||||
insertParameter(line, quote + path(IndexHtmlDeployed) + quote);
|
if (m_mainHtmlMode != ModeUrl)
|
||||||
|
insertParameter(line, quote + path(MainHtmlDeployed) + quote);
|
||||||
|
else
|
||||||
|
adaptLine = false;
|
||||||
|
} else if (line.contains(QLatin1String("// MAINHTMLURL"))) {
|
||||||
|
if (m_mainHtmlMode == ModeUrl)
|
||||||
|
insertParameter(line, quote + m_mainHtmlData + quote);
|
||||||
|
else
|
||||||
|
adaptLine = false;
|
||||||
}
|
}
|
||||||
return adaptLine;
|
return adaptLine;
|
||||||
}
|
}
|
||||||
@@ -133,10 +148,10 @@ void Html5App::handleCurrentProFileTemplateLine(const QString &line,
|
|||||||
Core::GeneratedFiles Html5App::generateFiles(QString *errorMessage) const
|
Core::GeneratedFiles Html5App::generateFiles(QString *errorMessage) const
|
||||||
{
|
{
|
||||||
Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
|
Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
|
||||||
// if (!useExistingMainQml()) {
|
if (m_mainHtmlMode == ModeGenerate) {
|
||||||
files.append(file(generateFile(Html5AppGeneratedFileInfo::IndexHtmlFile, errorMessage), path(IndexHtml)));
|
files.append(file(generateFile(Html5AppGeneratedFileInfo::MainHtmlFile, errorMessage), path(MainHtml)));
|
||||||
files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
|
||||||
// }
|
}
|
||||||
|
|
||||||
files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
|
files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
|
||||||
files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
|
files.append(file(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
|
||||||
@@ -146,18 +161,13 @@ Core::GeneratedFiles Html5App::generateFiles(QString *errorMessage) const
|
|||||||
}
|
}
|
||||||
#endif // CREATORLESSTEST
|
#endif // CREATORLESSTEST
|
||||||
|
|
||||||
bool Html5App::useExistingIndexHtml() const
|
|
||||||
{
|
|
||||||
return !m_indexHtmlFile.filePath().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray Html5App::generateFileExtended(int fileType,
|
QByteArray Html5App::generateFileExtended(int fileType,
|
||||||
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const
|
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const
|
||||||
{
|
{
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
switch (fileType) {
|
switch (fileType) {
|
||||||
case Html5AppGeneratedFileInfo::IndexHtmlFile:
|
case Html5AppGeneratedFileInfo::MainHtmlFile:
|
||||||
data = readBlob(path(IndexHtmlOrigin), errorMessage);
|
data = readBlob(path(MainHtmlOrigin), errorMessage);
|
||||||
break;
|
break;
|
||||||
case Html5AppGeneratedFileInfo::AppViewerPriFile:
|
case Html5AppGeneratedFileInfo::AppViewerPriFile:
|
||||||
data = readBlob(path(AppViewerPriOrigin), errorMessage);
|
data = readBlob(path(AppViewerPriOrigin), errorMessage);
|
||||||
@@ -215,6 +225,7 @@ QList<AbstractGeneratedFileInfo> Html5App::updateableFiles(const QString &mainPr
|
|||||||
QList<DeploymentFolder> Html5App::deploymentFolders() const
|
QList<DeploymentFolder> Html5App::deploymentFolders() const
|
||||||
{
|
{
|
||||||
QList<DeploymentFolder> result;
|
QList<DeploymentFolder> result;
|
||||||
|
if (m_mainHtmlMode != ModeUrl)
|
||||||
result.append(DeploymentFolder(path(HtmlDirProFileRelative), QLatin1String(".")));
|
result.append(DeploymentFolder(path(HtmlDirProFileRelative), QLatin1String(".")));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Internal {
|
|||||||
struct Html5AppGeneratedFileInfo : public AbstractGeneratedFileInfo
|
struct Html5AppGeneratedFileInfo : public AbstractGeneratedFileInfo
|
||||||
{
|
{
|
||||||
enum ExtendedFileType {
|
enum ExtendedFileType {
|
||||||
IndexHtmlFile = ExtendedFile,
|
MainHtmlFile = ExtendedFile,
|
||||||
AppViewerPriFile,
|
AppViewerPriFile,
|
||||||
AppViewerCppFile,
|
AppViewerCppFile,
|
||||||
AppViewerHFile
|
AppViewerHFile
|
||||||
@@ -60,9 +60,9 @@ class Html5App : public AbstractMobileApp
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum ExtendedFileType {
|
enum ExtendedFileType {
|
||||||
IndexHtml = ExtendedFile,
|
MainHtml = ExtendedFile,
|
||||||
IndexHtmlDeployed,
|
MainHtmlDeployed,
|
||||||
IndexHtmlOrigin,
|
MainHtmlOrigin,
|
||||||
AppViewerPri,
|
AppViewerPri,
|
||||||
AppViewerPriOrigin,
|
AppViewerPriOrigin,
|
||||||
AppViewerCpp,
|
AppViewerCpp,
|
||||||
@@ -74,18 +74,23 @@ public:
|
|||||||
ModulesDir
|
ModulesDir
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Mode {
|
||||||
|
ModeGenerate,
|
||||||
|
ModeImport,
|
||||||
|
ModeUrl
|
||||||
|
};
|
||||||
|
|
||||||
Html5App();
|
Html5App();
|
||||||
virtual ~Html5App();
|
virtual ~Html5App();
|
||||||
|
|
||||||
void setIndexHtmlFile(const QString &qmlFile);
|
void setMainHtml(Mode mode, const QString &data = QString());
|
||||||
QString indexHtmlFile() const;
|
Mode mainHtmlMode() const;
|
||||||
|
|
||||||
#ifndef CREATORLESSTEST
|
#ifndef CREATORLESSTEST
|
||||||
virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const;
|
virtual Core::GeneratedFiles generateFiles(QString *errorMessage) const;
|
||||||
#else
|
#else
|
||||||
bool generateFiles(QString *errorMessage) const;
|
bool generateFiles(QString *errorMessage) const;
|
||||||
#endif // CREATORLESSTEST
|
#endif // CREATORLESSTEST
|
||||||
bool useExistingIndexHtml() const;
|
|
||||||
|
|
||||||
static const int StubVersion;
|
static const int StubVersion;
|
||||||
|
|
||||||
@@ -104,6 +109,8 @@ private:
|
|||||||
QList<DeploymentFolder> deploymentFolders() const;
|
QList<DeploymentFolder> deploymentFolders() const;
|
||||||
|
|
||||||
QFileInfo m_indexHtmlFile;
|
QFileInfo m_indexHtmlFile;
|
||||||
|
Mode m_mainHtmlMode;
|
||||||
|
QString m_mainHtmlData;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -130,18 +130,18 @@ void Html5AppWizard::prepareGenerateFiles(const QWizard *w,
|
|||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
const Html5AppWizardDialog *wizard = qobject_cast<const Html5AppWizardDialog*>(w);
|
const Html5AppWizardDialog *wizard = qobject_cast<const Html5AppWizardDialog*>(w);
|
||||||
const QString mainQmlFile = wizard->m_htmlSourcesPage->mainHtmlFile();
|
m_d->app->setMainHtml(wizard->m_htmlSourcesPage->mainHtmlMode(),
|
||||||
m_d->app->setIndexHtmlFile(mainQmlFile);
|
wizard->m_htmlSourcesPage->mainHtmlData());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Html5AppWizard::postGenerateFilesInternal(const Core::GeneratedFiles &l,
|
bool Html5AppWizard::postGenerateFilesInternal(const Core::GeneratedFiles &l,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
const bool success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
|
const bool success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
|
||||||
if (success && !m_d->app->indexHtmlFile().isEmpty()) {
|
const QString mainHtmlFile = m_d->app->path(Html5App::MainHtml);
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, m_d->app->indexHtmlFile());
|
if (success && !mainHtmlFile.isEmpty()) {
|
||||||
Core::EditorManager::instance()->openEditor(m_d->app->indexHtmlFile(),
|
ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, mainHtmlFile);
|
||||||
QString(), Core::EditorManager::ModeSwitch);
|
Core::EditorManager::instance()->openEditor(mainHtmlFile, QString(), Core::EditorManager::ModeSwitch);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,15 +54,16 @@ Html5AppWizardSourcesPage::Html5AppWizardSourcesPage(QWidget *parent)
|
|||||||
, m_d(new Html5AppWizardSourcesPagePrivate)
|
, m_d(new Html5AppWizardSourcesPagePrivate)
|
||||||
{
|
{
|
||||||
m_d->ui.setupUi(this);
|
m_d->ui.setupUi(this);
|
||||||
m_d->ui.mainHtmlFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
m_d->ui.importLineEdit->setExpectedKind(Utils::PathChooser::File);
|
||||||
m_d->ui.mainHtmlFileLineEdit->setPromptDialogFilter(QLatin1String("*.html"));
|
m_d->ui.importLineEdit->setPromptDialogFilter(QLatin1String("*.html"));
|
||||||
m_d->ui.mainHtmlFileLineEdit->setPromptDialogTitle(tr("Select Html File"));
|
m_d->ui.importLineEdit->setPromptDialogTitle(tr("Select Html File"));
|
||||||
connect(m_d->ui.mainHtmlFileLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
|
connect(m_d->ui.importLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
|
||||||
connect(m_d->ui.importExistingHtmlRadioButton,
|
connect(m_d->ui.importRadioButton,
|
||||||
SIGNAL(toggled(bool)), SIGNAL(completeChanged()));
|
SIGNAL(toggled(bool)), SIGNAL(completeChanged()));
|
||||||
connect(m_d->ui.newHtmlRadioButton, SIGNAL(toggled(bool)),
|
connect(m_d->ui.generateRadioButton, SIGNAL(toggled(bool)), SLOT(setLineEditsEnabled()));
|
||||||
m_d->ui.mainHtmlFileLineEdit, SLOT(setDisabled(bool)));
|
connect(m_d->ui.importRadioButton, SIGNAL(toggled(bool)), SLOT(setLineEditsEnabled()));
|
||||||
m_d->ui.newHtmlRadioButton->setChecked(true);
|
connect(m_d->ui.urlRadioButton, SIGNAL(toggled(bool)), SLOT(setLineEditsEnabled()));
|
||||||
|
m_d->ui.generateRadioButton->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Html5AppWizardSourcesPage::~Html5AppWizardSourcesPage()
|
Html5AppWizardSourcesPage::~Html5AppWizardSourcesPage()
|
||||||
@@ -70,16 +71,35 @@ Html5AppWizardSourcesPage::~Html5AppWizardSourcesPage()
|
|||||||
delete m_d;
|
delete m_d;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Html5AppWizardSourcesPage::mainHtmlFile() const
|
Html5App::Mode Html5AppWizardSourcesPage::mainHtmlMode() const
|
||||||
{
|
{
|
||||||
return m_d->ui.importExistingHtmlRadioButton->isChecked() ?
|
Html5App::Mode result = Html5App::ModeGenerate;
|
||||||
m_d->ui.mainHtmlFileLineEdit->path() : QString();
|
if (m_d->ui.importRadioButton->isChecked())
|
||||||
|
result = Html5App::ModeImport;
|
||||||
|
else if (m_d->ui.urlRadioButton->isChecked())
|
||||||
|
result = Html5App::ModeUrl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Html5AppWizardSourcesPage::mainHtmlData() const
|
||||||
|
{
|
||||||
|
switch (mainHtmlMode()) {
|
||||||
|
case Html5App::ModeImport: return m_d->ui.importLineEdit->path();
|
||||||
|
case Html5App::ModeUrl: return m_d->ui.urlLineEdit->text();
|
||||||
|
default:
|
||||||
|
case Html5App::ModeGenerate: return QString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Html5AppWizardSourcesPage::isComplete() const
|
bool Html5AppWizardSourcesPage::isComplete() const
|
||||||
{
|
{
|
||||||
return !m_d->ui.importExistingHtmlRadioButton->isChecked()
|
return mainHtmlMode() != Html5App::ModeImport || m_d->ui.importLineEdit->isValid();
|
||||||
|| m_d->ui.mainHtmlFileLineEdit->isValid();
|
}
|
||||||
|
|
||||||
|
void Html5AppWizardSourcesPage::setLineEditsEnabled()
|
||||||
|
{
|
||||||
|
m_d->ui.importLineEdit->setEnabled(m_d->ui.importRadioButton->isChecked());
|
||||||
|
m_d->ui.urlLineEdit->setEnabled(m_d->ui.urlRadioButton->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -49,9 +49,13 @@ public:
|
|||||||
explicit Html5AppWizardSourcesPage(QWidget *parent = 0);
|
explicit Html5AppWizardSourcesPage(QWidget *parent = 0);
|
||||||
virtual ~Html5AppWizardSourcesPage();
|
virtual ~Html5AppWizardSourcesPage();
|
||||||
|
|
||||||
QString mainHtmlFile() const;
|
Html5App::Mode mainHtmlMode() const;
|
||||||
|
QString mainHtmlData() const;
|
||||||
virtual bool isComplete() const;
|
virtual bool isComplete() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setLineEditsEnabled();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Html5AppWizardSourcesPagePrivate *m_d;
|
class Html5AppWizardSourcesPagePrivate *m_d;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,16 +21,16 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="newHtmlRadioButton">
|
<widget class="QRadioButton" name="generateRadioButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Generate an index.html file</string>
|
<string>Generate an index.html file</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="importExistingHtmlRadioButton">
|
<widget class="QRadioButton" name="importRadioButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Import an existing .html file</string>
|
<string>Import an existing .html file</string>
|
||||||
@@ -38,9 +38,9 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="Utils::PathChooser" name="mainHtmlFileLineEdit">
|
<widget class="Utils::PathChooser" name="importLineEdit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -61,9 +61,9 @@
|
|||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="loadAUrlRadioButton">
|
<widget class="QRadioButton" name="urlRadioButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load a URL</string>
|
<string>Load a URL</string>
|
||||||
@@ -71,9 +71,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLineEdit" name="loadAUrlLineEdit">
|
<widget class="QLineEdit" name="urlLineEdit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>http://</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -105,7 +108,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<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>
|
<string>Note: Unless you chose to load a 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>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ bool Html5App::generateFiles(QString *errorMessage) const
|
|||||||
{
|
{
|
||||||
return writeFile(generateFile(Html5AppGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp))
|
return writeFile(generateFile(Html5AppGeneratedFileInfo::MainCppFile, errorMessage), path(MainCpp))
|
||||||
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppProFile, errorMessage), path(AppPro))
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppProFile, errorMessage), path(AppPro))
|
||||||
&& (useExistingIndexHtml() ? true : writeFile(generateFile(Html5AppGeneratedFileInfo::IndexHtmlFile, errorMessage), path(IndexHtml)))
|
&& (mainHtmlMode() != ModeGenerate ? true : writeFile(generateFile(Html5AppGeneratedFileInfo::MainHtmlFile, errorMessage), path(MainHtml)))
|
||||||
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri))
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri))
|
||||||
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp))
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp))
|
||||||
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH))
|
&& writeFile(generateFile(Html5AppGeneratedFileInfo::AppViewerHFile, errorMessage), path(AppViewerH))
|
||||||
|
|||||||
@@ -84,6 +84,27 @@ int main(int argc, char *argv[])
|
|||||||
Html5App sAppNew;
|
Html5App sAppNew;
|
||||||
sAppNew.setProjectPath(projectPath);
|
sAppNew.setProjectPath(projectPath);
|
||||||
sAppNew.setProjectName(QLatin1String("new_html5_app"));
|
sAppNew.setProjectName(QLatin1String("new_html5_app"));
|
||||||
|
qDebug() << sAppNew.path(Html5App::MainHtml);
|
||||||
|
if (!sAppNew.generateFiles(&errorMessage))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Html5App sAppNew;
|
||||||
|
sAppNew.setProjectPath(projectPath);
|
||||||
|
sAppNew.setProjectName(QLatin1String("html5_imported_scenario_01"));
|
||||||
|
sAppNew.setMainHtml(Html5App::ModeImport, QLatin1String("../appwizards/htmlimportscenario_01/themainhtml.html"));
|
||||||
|
qDebug() << sAppNew.path(Html5App::MainHtml);
|
||||||
|
if (!sAppNew.generateFiles(&errorMessage))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Html5App sAppNew;
|
||||||
|
sAppNew.setProjectPath(projectPath);
|
||||||
|
sAppNew.setProjectName(QLatin1String("html5_url"));
|
||||||
|
sAppNew.setMainHtml(Html5App::ModeUrl, QLatin1String("http://www.jqtouch.com/preview/demos/main/"));
|
||||||
|
qDebug() << sAppNew.path(Html5App::MainHtml);
|
||||||
if (!sAppNew.generateFiles(&errorMessage))
|
if (!sAppNew.generateFiles(&errorMessage))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user