diff --git a/share/qtcreator/templates/qmlapp/app.pro b/share/qtcreator/templates/qmlapp/app.pro index f5f05da08cf894a0b2d4d1057eae8df862386a76..920f0ba990e304fd5f4fc13e8dde927187b2ce2c 100644 --- a/share/qtcreator/templates/qmlapp/app.pro +++ b/share/qtcreator/templates/qmlapp/app.pro @@ -19,13 +19,13 @@ OTHER_FILES = qml/app/app.qml # TARGETUID3 # symbian:TARGET.UID3 = 0xE1111234 -# QMLJSINSPECTOR # -#DEFINES += Q_QML_JS_INSPECTOR -contains(DEFINES, Q_QML_JS_INSPECTOR) { -# QMLJSINSPECTOR_LIB_PATH # -INSPECTOR_LIBRARY_PATH = $$PWD/../../../../share/qtcreator/qmljsdebugger -include($$INSPECTOR_LIBRARY_PATH/qmljsdebugger-lib.pri) -} +# Define to enable the Qml Inspector in debug mode +# QMLINSPECTOR # +#DEFINES += QMLINSPECTOR + +# Path to the Qml Inspector sources, which are shipped with Qt Creator +# QMLINSPECTOR_PATH # +QMLINSPECTOR_PATH = $$PWD/../../qmljsdebugger # Edit the code below on your own risk. @@ -35,6 +35,8 @@ SOURCES += cpp/main.cpp cpp/qmlapplicationview.cpp HEADERS += cpp/qmlapplicationview.h INCLUDEPATH += cpp +contains(DEFINES, QMLINSPECTOR):CONFIG(debug, debug|release):include($$QMLINSPECTOR_PATH/qmljsdebugger-lib.pri) + symbian { ICON = cpp/symbianicon.svg contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -leiksrv -lcone @@ -84,7 +86,6 @@ symbian { copydeploymentfolders.commands = $$copyCommand first.depends = $(first) copydeploymentfolders QMAKE_EXTRA_TARGETS += first copydeploymentfolders -message($$copyCommand) } } else { #linux !isEqual(PWD,$$OUT_PWD) { diff --git a/share/qtcreator/templates/qmlapp/cpp/qmlapplicationview.cpp b/share/qtcreator/templates/qmlapp/cpp/qmlapplicationview.cpp index 30a7fcb455e33ad8adb7f1ed28083c5d089c7e4b..bb230f4ebb05a0b121ce039cf8397148c29fbeec 100644 --- a/share/qtcreator/templates/qmlapp/cpp/qmlapplicationview.cpp +++ b/share/qtcreator/templates/qmlapp/cpp/qmlapplicationview.cpp @@ -21,7 +21,7 @@ class QmlApplicationViewPrivate }; QmlApplicationView::QmlApplicationView(const QString &mainQmlFile, QWidget *parent) : -#ifdef Q_QML_JS_INSPECTOR +#ifdef QMLINSPECTOR QmlViewer::QDeclarativeDesignView(parent) #else QDeclarativeView(parent) diff --git a/src/plugins/qmlprojectmanager/wizards/qmlstandaloneapp.cpp b/src/plugins/qmlprojectmanager/wizards/qmlstandaloneapp.cpp index 2e3a7418df22ff70a2337273bc035766a4b454e3..67cbb174ccffecc8e7bd6c86bef104b0f93cdf1b 100644 --- a/src/plugins/qmlprojectmanager/wizards/qmlstandaloneapp.cpp +++ b/src/plugins/qmlprojectmanager/wizards/qmlstandaloneapp.cpp @@ -140,11 +140,7 @@ QString QmlStandaloneApp::path(Path path, Location location) const const QString qmlRootFolder = QLatin1String("qml/") + (useExistingMainQml() ? m_mainQmlFile.dir().dirName() : m_projectName) + QLatin1Char('/'); -#ifdef CREATORLESSTEST - const QString sourceRoot = QLatin1String(":/qmlproject/wizards/templates/"); -#else // CREATORLESSTEST - const QString sourceRoot = Core::ICore::instance()->resourcePath() + QLatin1String("/templates/qmlapp/"); -#endif // CREATORLESSTEST + const QString templatesRoot(templatesRoot()); const QString cppSourceSubDir = QLatin1String("cpp/"); const QString cppTargetSubDir = cppSourceSubDir; const QString qmlExtension = QLatin1String(".qml"); @@ -157,13 +153,13 @@ QString QmlStandaloneApp::path(Path path, Location location) const switch (location) { case Source: { switch (path) { - case MainQml: return sourceRoot + QLatin1String("qml/app/app.qml"); - case AppProfile: return sourceRoot + QLatin1String("app.pro"); - case MainCpp: return sourceRoot + cppSourceSubDir + mainCpp; - case AppViewerCpp: return sourceRoot + cppSourceSubDir + appViewCpp; - case AppViewerH: return sourceRoot + cppSourceSubDir + appViewH; + case MainQml: return templatesRoot + QLatin1String("qml/app/app.qml"); + case AppProfile: return templatesRoot + QLatin1String("app.pro"); + case MainCpp: return templatesRoot + cppSourceSubDir + mainCpp; + case AppViewerCpp: return templatesRoot + cppSourceSubDir + appViewCpp; + case AppViewerH: return templatesRoot + cppSourceSubDir + appViewH; case SymbianSvgIcon: return !m_symbianSvgIcon.isEmpty() ? m_symbianSvgIcon - : sourceRoot + cppSourceSubDir + symbianIcon; + : templatesRoot + cppSourceSubDir + symbianIcon; default: qFatal(errorMessage); } } @@ -260,6 +256,7 @@ QByteArray QmlStandaloneApp::generateProFile(const QString *errorMessage) const { Q_UNUSED(errorMessage) + const QChar comment = QLatin1Char('#'); QFile proFile(path(AppProfile, Source)); proFile.open(QIODevice::ReadOnly); Q_ASSERT(proFile.isOpen()); @@ -290,16 +287,16 @@ QByteArray QmlStandaloneApp::generateProFile(const QString *errorMessage) const uncommentNextLine = true; } else if (line.contains(QLatin1String("# NETWORKACCESS")) && !m_networkEnabled) { uncommentNextLine = true; - } else if (line.contains(QLatin1String("# Q_QML_JS_INSPECTOR"))) { + } else if (line.contains(QLatin1String("# QMLINSPECTOR_PATH"))) { + valueOnNextLine = qmlInspectorSourcesRoot(); + } else if (line.contains(QLatin1String("# QMLINSPECTOR"))) { // ### disabled for now; figure out the private headers problem first. //uncommentNextLine = true; - } else if (line.contains(QLatin1String("# QMLJSINSPECTOR_LIB_PATH"))) { - valueOnNextLine = Core::ICore::instance()->resourcePath() + QLatin1String("/qmljsdebugger"); } // Remove all marker comments - if (line.trimmed().startsWith(QLatin1Char('#')) - && line.trimmed().endsWith(QLatin1Char('#'))) + if (line.trimmed().startsWith(comment) + && line.trimmed().endsWith(comment)) continue; if (!valueOnNextLine.isEmpty()) { @@ -310,7 +307,7 @@ QByteArray QmlStandaloneApp::generateProFile(const QString *errorMessage) const } if (uncommentNextLine) { - out << QLatin1String("#") << line << endl; + out << comment << line << endl; uncommentNextLine = false; continue; } @@ -321,6 +318,16 @@ QByteArray QmlStandaloneApp::generateProFile(const QString *errorMessage) const } #ifndef CREATORLESSTEST +QString QmlStandaloneApp::templatesRoot() +{ + return Core::ICore::instance()->resourcePath() + QLatin1String("/templates/qmlapp/"); +} + +QString QmlStandaloneApp::qmlInspectorSourcesRoot() +{ + return Core::ICore::instance()->resourcePath() + QLatin1String("/qmljsdebugger"); +} + static Core::GeneratedFile generateFileCopy(const QString &source, const QString &target, bool openEditor = false) diff --git a/src/plugins/qmlprojectmanager/wizards/qmlstandaloneapp.h b/src/plugins/qmlprojectmanager/wizards/qmlstandaloneapp.h index 540203e8cab033f44b2a304f522227a99d22dab3..81c4db3e37f9bf694aff5ce6c683899e3542ac68 100644 --- a/src/plugins/qmlprojectmanager/wizards/qmlstandaloneapp.h +++ b/src/plugins/qmlprojectmanager/wizards/qmlstandaloneapp.h @@ -97,6 +97,8 @@ public: private: QByteArray generateMainCpp(const QString *errorMessage) const; QByteArray generateProFile(const QString *errorMessage) const; + static QString templatesRoot(); + static QString qmlInspectorSourcesRoot(); QString m_projectName; QFileInfo m_projectPath;