Refacoring. Saner Api for QtQuickApp.

Now using an explicit Mode (generated, imported) instead of empty
or set filename convention. Just like in Html5App.
This commit is contained in:
Alessandro Portale
2011-02-09 21:39:46 +01:00
parent 8eb0bb7507
commit 8678af3240
10 changed files with 79 additions and 82 deletions

View File

@@ -144,18 +144,22 @@ void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w,
{
Q_UNUSED(errorMessage)
const QtQuickAppWizardDialog *wizard = qobject_cast<const QtQuickAppWizardDialog*>(w);
const QString mainQmlFile = wizard->m_qmlSourcesPage->mainQmlFile();
m_d->app->setMainQmlFile(mainQmlFile);
if (wizard->m_qmlSourcesPage->mainQmlMode() == QtQuickApp::ModeGenerate) {
m_d->app->setMainQml(QtQuickApp::ModeGenerate);
} else {
const QString mainQmlFile = wizard->m_qmlSourcesPage->mainQmlFile();
m_d->app->setMainQml(QtQuickApp::ModeImport, mainQmlFile);
}
}
bool QtQuickAppWizard::postGenerateFilesInternal(const Core::GeneratedFiles &l,
QString *errorMessage)
{
const bool success = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l, errorMessage);
if (success && !m_d->app->mainQmlFile().isEmpty()) {
ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, m_d->app->mainQmlFile());
Core::EditorManager::instance()->openEditor(m_d->app->mainQmlFile(),
QString(), Core::EditorManager::ModeSwitch);
const QString mainQmlFile = m_d->app->path(QtQuickApp::MainQml);
if (success && !mainQmlFile.isEmpty()) {
ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, mainQmlFile);
Core::EditorManager::instance()->openEditor(mainQmlFile, QString(), Core::EditorManager::ModeSwitch);
}
return success;
}