Skip to content
Snippets Groups Projects
Commit c94382b8 authored by Alessandro Portale's avatar Alessandro Portale
Browse files

Polishing the optional QMLINSPECTOR inclusion a bit

parent 6c56fcf5
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
......@@ -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)
......
......@@ -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)
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment