Commit 5cf11e2b authored by Aurindam Jana's avatar Aurindam Jana Committed by hjk
Browse files

Qml Debugging: Default option for Qt Quick application



Qt Quick applications should have Qml Debugging enabled
by default.

Task-number: QTCREATORBUG-8208
Change-Id: I794249567b15071098f0ac8ba5f2a8e5f2be4ffb
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 776f078d
......@@ -76,7 +76,7 @@ AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fil
m_makefileParserThread(0)
{
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
const QFileInfo fileInfo(m_fileName);
m_projectName = fileInfo.absoluteDir().dirName();
......
......@@ -110,7 +110,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
m_lastEditor(0)
{
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
m_file = new CMakeFile(this, fileName);
......
......@@ -70,7 +70,7 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName)
m_fileName(fileName)
{
setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguage(Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
QFileInfo fileInfo(m_fileName);
QDir dir = fileInfo.dir();
......
......@@ -92,7 +92,7 @@ public:
Target *m_activeTarget;
EditorConfiguration *m_editorConfiguration;
Core::Context m_projectContext;
Core::Context m_projectLanguage;
Core::Context m_projectLanguages;
QVariantMap m_pluginSettings;
SettingsAccessor *m_accessor;
};
......@@ -400,9 +400,9 @@ void Project::setProjectContext(Core::Context context)
d->m_projectContext = context;
}
void Project::setProjectLanguage(Core::Context language)
void Project::setProjectLanguages(Core::Context language)
{
d->m_projectLanguage = language;
d->m_projectLanguages = language;
}
Core::Context Project::projectContext() const
......@@ -410,9 +410,9 @@ Core::Context Project::projectContext() const
return d->m_projectContext;
}
Core::Context Project::projectLanguage() const
Core::Context Project::projectLanguages() const
{
return d->m_projectLanguage;
return d->m_projectLanguages;
}
QVariant Project::namedSettings(const QString &name) const
......
......@@ -114,7 +114,7 @@ public:
static QString projectDirectory(const QString &top);
virtual Core::Context projectContext() const;
virtual Core::Context projectLanguage() const;
virtual Core::Context projectLanguages() const;
QVariant namedSettings(const QString &name) const;
void setNamedSettings(const QString &name, const QVariant &value);
......@@ -148,7 +148,7 @@ protected:
virtual bool setupTarget(Target *t);
virtual void setProjectContext(Core::Context context);
virtual void setProjectLanguage(Core::Context language);
virtual void setProjectLanguages(Core::Context language);
private slots:
void changeEnvironment();
......
......@@ -1809,11 +1809,11 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
if (d->m_currentProject) {
oldContext.add(d->m_currentProject->projectContext());
oldContext.add(d->m_currentProject->projectLanguage());
oldContext.add(d->m_currentProject->projectLanguages());
}
if (project) {
newContext.add(project->projectContext());
newContext.add(project->projectLanguage());
newContext.add(project->projectLanguages());
}
Core::ICore::updateAdditionalContexts(oldContext, newContext);
......
......@@ -157,23 +157,11 @@ bool DebuggerRunConfigurationAspect::useCppDebugger() const
return m_useCppDebugger;
}
static bool isQtQuickAppProject(Project *project)
{
const QString projectDirectory = project->projectDirectory();
// Qt Quick 1 wizard generated file
const QString qq1FilePath = projectDirectory
+ QLatin1String("/qmlapplicationviewer/qmlapplicationviewer.pri");
// Qt Quick 2 wizard generated file
const QString qq2FilePath = projectDirectory
+ QLatin1String("/qtquick2applicationviewer/qtquick2applicationviewer.pri");
const QStringList projectFiles = project->files(Project::ExcludeGeneratedFiles);
return projectFiles.contains(qq1FilePath) || projectFiles.contains(qq2FilePath);
}
bool DebuggerRunConfigurationAspect::useQmlDebugger() const
{
if (m_useQmlDebugger == DebuggerRunConfigurationAspect::AutoEnableQmlDebugger)
return isQtQuickAppProject(m_runConfiguration->target()->project());
return m_runConfiguration->target()->project()->projectLanguages().contains(
ProjectExplorer::Constants::LANG_QMLJS);
return m_useQmlDebugger == DebuggerRunConfigurationAspect::EnableQmlDebugger;
}
......
......@@ -64,7 +64,7 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
m_modelManager(QmlJS::ModelManagerInterface::instance())
{
setProjectContext(Core::Context(QmlProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguage(Core::Context(QmlProjectManager::Constants::LANG_QML));
setProjectLanguages(Core::Context(QmlProjectManager::Constants::LANG_QML));
QFileInfo fileInfo(m_fileName);
m_projectName = fileInfo.completeBaseName();
......
......@@ -348,7 +348,7 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
m_activeTarget(0)
{
setProjectContext(Core::Context(Qt4ProjectManager::Constants::PROJECT_ID));
setProjectLanguage(Core::Context(ProjectExplorer::Constants::LANG_CXX));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
m_asyncUpdateTimer.setSingleShot(true);
m_asyncUpdateTimer.setInterval(3000);
......@@ -599,10 +599,27 @@ void Qt4Project::updateQmlJSCodeModel()
QList<Qt4ProFileNode *> proFiles = findQt4ProFiles(rootProjectNode());
projectInfo.importPaths.clear();
bool hasQmlLib = false;
foreach (Qt4ProFileNode *node, proFiles) {
projectInfo.importPaths.append(node->variableValue(QmlImportPathVar));
if (!hasQmlLib) {
QStringList qtLibs = node->variableValue(QtVar);
hasQmlLib = qtLibs.contains(QLatin1String("declarative")) ||
qtLibs.contains(QLatin1String("qml")) ||
qtLibs.contains(QLatin1String("quick"));
}
}
// If the project directory has a pro/pri file that includes a qml or quick or declarative
// library then chances of the project being a QML project is quite high.
// This assumption fails when there are no QDeclarativeEngine/QDeclarativeView (QtQuick 1)
// or QQmlEngine/QQuickView (QtQuick 2) instances.
Core::Context pl(ProjectExplorer::Constants::LANG_CXX);
if (projectInfo.sourceFiles.count() && hasQmlLib)
pl.add(ProjectExplorer::Constants::LANG_QMLJS);
setProjectLanguages(pl);
bool preferDebugDump = false;
projectInfo.tryQmlDump = false;
......
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