Commit 96d991bb authored by Lasse Holmstedt's avatar Lasse Holmstedt

QML Observer: Build together on runtime with debugging tools

Moved qmljsdebugger to a dir under qml/, made qmlobserver compile
without creator dependencies and made it compile with debugging
helpers.

Reviewed-by: hjk
parent 5d985812
......@@ -12,24 +12,24 @@ include($$PWD/private_headers.pri)
## Input
HEADERS += \
include/jsdebuggeragent.h \
include/qmljsdebugger_global.h
$$PWD/include/jsdebuggeragent.h \
$$PWD/include/qmljsdebugger_global.h
SOURCES += \
jsdebuggeragent.cpp
$$PWD/jsdebuggeragent.cpp
contains(DEFINES, QMLOBSERVER) {
include($$PWD/editor/editor.pri)
HEADERS += \
include/qdeclarativeviewobserver.h \
include/qdeclarativeobserverservice.h \
include/qmlobserverconstants.h \
qdeclarativeviewobserver_p.h
$$PWD/include/qdeclarativeviewobserver.h \
$$PWD/include/qdeclarativeobserverservice.h \
$$PWD/include/qmlobserverconstants.h \
$$PWD/qdeclarativeviewobserver_p.h
SOURCES += \
qdeclarativeviewobserver.cpp \
qdeclarativeobserverservice.cpp
$$PWD/qdeclarativeviewobserver.cpp \
$$PWD/qdeclarativeobserverservice.cpp
}
OTHER_FILES += qmljsdebugger.pri
OTHER_FILES += $$PWD/qmljsdebugger.pri
Nokia Qt LGPL Exception version 1.0
As a special exception to the GNU Lesser General Public License version 2.1, the object code form of a "work that uses the Library" may incorporate material from a header file that is part of the Library. You may distribute such object code under terms of your choice, provided that the incorporated material (i) does not exceed more than 5% of the total size of the Library; and (ii) is limited to numerical parameters, data structure layouts, accessors, macros, inline functions and templates.
\ No newline at end of file
This diff is collapsed.
......@@ -52,8 +52,8 @@ class DeviceOrientation : public QObject
Q_OBJECT
Q_ENUMS(Orientation)
public:
enum Orientation {
UnknownOrientation,
enum Orientation {
UnknownOrientation,
Portrait,
Landscape,
PortraitInverted,
......
......@@ -53,9 +53,9 @@
QT_BEGIN_NAMESPACE
QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
QDeclarativeView *parent)
: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts),
: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts),
testscript(0), hasCompleted(false), hasFailed(false)
{
parent->viewport()->installEventFilter(this);
......@@ -68,7 +68,7 @@ QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer
QDeclarativeTester::~QDeclarativeTester()
{
if (!hasFailed &&
if (!hasFailed &&
options & QDeclarativeViewer::Record &&
options & QDeclarativeViewer::SaveOnExit)
save();
......
......@@ -11,13 +11,15 @@ HEADERS += $$PWD/qmlruntime.h \
$$PWD/proxysettings.h \
$$PWD/qdeclarativetester.h \
$$PWD/deviceorientation.h \
$$PWD/loggerwidget.h
$$PWD/loggerwidget.h \
$$PWD/crumblepath.h
SOURCES += $$PWD/qmlruntime.cpp \
$$PWD/proxysettings.cpp \
$$PWD/qdeclarativetester.cpp \
$$PWD/loggerwidget.cpp
$$PWD/loggerwidget.cpp \
$$PWD/crumblepath.cpp
RESOURCES += $$PWD/qmlruntime.qrc
......
TEMPLATE = app
DEFINES += QMLOBSERVER
include(qml.pri)
SOURCES += main.cpp
exists($$PWD/qmljsdebugger/qmljsdebugger-lib.pri) {
# for building helpers within QT_INSTALL_DATA, we deploy the lib inside the observer directory.
include($$PWD/qmljsdebugger/qmljsdebugger-lib.pri)
} else {
include($$PWD/../qmljsdebugger/qmljsdebugger-lib.pri)
}
DESTDIR = $$IDE_BIN_PATH
mac {
QMAKE_INFO_PLIST=Info_mac.plist
TARGET=QMLObserver
ICON=qml.icns
} else {
TARGET=qmlobserver
}
......@@ -56,8 +56,8 @@
#include <qdeclarativeviewobserver.h>
#include <qdeclarativeobserverservice.h>
#include <utils/crumblepath.h>
#include "crumblepath.h"
#include "qmlruntime.h"
#include <qdeclarativecontext.h>
#include <qdeclarativeengine.h>
......@@ -537,7 +537,7 @@ class CrumblePathResizer : public QObject
{
Q_OBJECT
public:
CrumblePathResizer(Utils::CrumblePath *crumblePathWidget, QObject *parent = 0) :
CrumblePathResizer(CrumblePath *crumblePathWidget, QObject *parent = 0) :
QObject(parent),
m_crumblePathWidget(crumblePathWidget)
{
......@@ -616,7 +616,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
canvas = new QDeclarativeView(this);
observer = new QmlJSDebugger::QDeclarativeViewObserver(canvas, this);
if (!(flags & Qt::FramelessWindowHint)) {
m_crumblePathWidget = new Utils::CrumblePath(canvas);
m_crumblePathWidget = new CrumblePath(canvas);
#ifndef Q_WS_MAC
m_crumblePathWidget->setStyleSheet("QWidget { border-bottom: 1px solid black; }");
#endif
......
......@@ -52,9 +52,8 @@
namespace QmlJSDebugger {
class QDeclarativeViewObserver;
}
namespace Utils {
class CrumblePath;
}
class CrumblePath;
QT_BEGIN_NAMESPACE
......@@ -217,7 +216,7 @@ private:
bool useQmlFileBrowser;
QWidget *m_centralWidget;
Utils::CrumblePath *m_crumblePathWidget;
CrumblePath *m_crumblePathWidget;
QTranslator *translator;
void loadTranslationFile(const QString& directory);
......
......@@ -76,6 +76,7 @@ public:
QPointer<ProjectExplorer::Project> project;
QStringList sourceFiles;
QStringList importPaths;
QString qmlDumpPath;
};
class WorkingCopy
......
......@@ -380,13 +380,7 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
// Figure out engine according to toolchain, executable, attach or default.
DebuggerEngineType engineType = NoEngineType;
DebuggerLanguages activeLangs = DebuggerPlugin::instance()->activeLanguages();
/*bool isQmlExecutable = sp.executable.endsWith(_("qmlviewer")) || sp.executable.endsWith(_("qmlobserver"));
#ifdef Q_OS_MAC
isQmlExecutable = sp.executable.endsWith(_("QMLViewer.app")) || sp.executable.endsWith(_("QMLObserver.app"));
#endif
if (isQmlExecutable && sp.startMode != AttachCore)
engineType = QmlEngineType;
else */if (sp.executable.endsWith(_(".js")))
if (sp.executable.endsWith(_(".js")))
engineType = ScriptEngineType;
else if (sp.executable.endsWith(_(".py")))
engineType = PdbEngineType;
......
......@@ -110,7 +110,8 @@ QString DebuggingHelperLibrary::copy(const QString &qtInstallData,
errorMessage->clear();
return directory;
}
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary", "The debugger helpers could not be built in any of the directories:\n- %1\n\nReason: %2")
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
"The debugger helpers could not be built in any of the directories:\n- %1\n\nReason: %2")
.arg(directories.join(QLatin1String("\n- ")), *errorMessage);
return QString();
}
......
......@@ -42,7 +42,6 @@
#include <texteditor/itexteditor.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <qt4projectmanager/qmldumptool.h>
#include <QDir>
#include <QFile>
......@@ -474,25 +473,13 @@ void ModelManager::onLoadPluginTypes(const QString &libraryPath, const QString &
if (m_runningQmldumps.values().contains(canonicalLibraryPath))
return;
// TODO shouldn't be static - instead, if project changes, qmldump should probably change too.
static QString qmldumpPath;
if (qmldumpPath.isNull()) {
ProjectExplorer::Project *activeProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
qmldumpPath = Qt4ProjectManager::QmlDumpTool::qmlDumpToolForProject(activeProject);
// ### no support for .qmlproject projects or cmake projects.
QFileInfo qmldumpFileInfo(qmldumpPath);
if (!qmldumpFileInfo.exists()) {
qWarning() << "ModelManager::loadQmlPluginTypes: qmldump executable does not exist at" << qmldumpPath;
qmldumpPath.clear();
} else if (!qmldumpFileInfo.isFile()) {
qWarning() << "ModelManager::loadQmlPluginTypes: " << qmldumpPath << " is not a file";
qmldumpPath.clear();
}
ProjectExplorer::Project *activeProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
if (!activeProject)
return;
}
if (qmldumpPath.isEmpty())
ProjectInfo info = projectInfo(activeProject);
if (info.qmlDumpPath.isEmpty())
return;
QProcess *process = new QProcess(this);
......@@ -501,7 +488,7 @@ void ModelManager::onLoadPluginTypes(const QString &libraryPath, const QString &
QStringList args;
args << importPath;
args << importUri;
process->start(qmldumpPath, args);
process->start(info.qmlDumpPath, args);
m_runningQmldumps.insert(process, canonicalLibraryPath);
}
......
......@@ -32,7 +32,6 @@
#include "qmlprojectmanagerconstants.h"
#include "qmlprojecttarget.h"
#include "projectexplorer/projectexplorer.h"
#include <coreplugin/mimedatabase.h>
#include <projectexplorer/buildconfiguration.h>
#include <coreplugin/editormanager/editormanager.h>
......@@ -45,6 +44,7 @@
#include <utils/detailswidget.h>
#include <qt4projectmanager/qtversionmanager.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qt4projectmanager/qmlobservertool.h>
#include <QFormLayout>
#include <QComboBox>
......@@ -371,47 +371,19 @@ QString QmlProjectRunConfiguration::viewerDefaultPath() const
{
QString path;
// Search for QmlObserver
#ifdef Q_OS_MAC
const QString qmlObserverName = QLatin1String("QMLObserver.app");
#else
const QString qmlObserverName = QLatin1String("qmlobserver");
#endif
QDir appDir(QCoreApplication::applicationDirPath());
QString qmlObserverPath;
#ifdef Q_OS_WIN
qmlObserverPath = appDir.absoluteFilePath(qmlObserverName + QLatin1String(".exe"));
#else
qmlObserverPath = appDir.absoluteFilePath(qmlObserverName);
#endif
if (QFileInfo(qmlObserverPath).exists()) {
return qmlObserverPath;
}
// Search for QmlViewer
// prepend creator/bin dir to search path (only useful for special creator-qml package)
const QString searchPath = QCoreApplication::applicationDirPath()
+ Utils::SynchronousProcess::pathSeparator()
+ QString::fromLocal8Bit(qgetenv("PATH"));
#ifdef Q_OS_MAC
const QString qmlViewerName = QLatin1String("QMLViewer");
#else
const QString qmlViewerName = QLatin1String("qmlviewer");
#endif
path = Utils::SynchronousProcess::locateBinary(searchPath, qmlViewerName);
if (!path.isEmpty())
return path;
// Try to locate default path in Qt Versions
Qt4ProjectManager::QtVersionManager *qtVersions = Qt4ProjectManager::QtVersionManager::instance();
foreach (Qt4ProjectManager::QtVersion *version, qtVersions->validVersions()) {
if (!version->qmlviewerCommand().isEmpty()
&& version->supportsTargetId(Qt4ProjectManager::Constants::DESKTOP_TARGET_ID)) {
return version->qmlviewerCommand();
if (version->supportsTargetId(Qt4ProjectManager::Constants::DESKTOP_TARGET_ID)) {
// Search for QmlObserver
const QString qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
path = Qt4ProjectManager::QmlObserverTool::toolByInstallData(qtInstallData);
if (path.isEmpty() && !version->qmlviewerCommand().isEmpty()) {
path = version->qmlviewerCommand();
break;
}
}
}
......
......@@ -55,9 +55,8 @@ bool QmlDumpTool::canBuild(const QString &installHeadersDir)
return QFile::exists(qDeclHeader);
}
QString QmlDumpTool::qmlDumpToolForProject(ProjectExplorer::Project *project)
QString QmlDumpTool::toolForProject(ProjectExplorer::Project *project)
{
qDebug() << "current project:" << project;
if (project->id() == Qt4ProjectManager::Constants::QT4PROJECT_ID) {
Qt4Project *qt4Project = static_cast<Qt4Project*>(project);
if (qt4Project && qt4Project->activeTarget()
......@@ -65,16 +64,15 @@ QString QmlDumpTool::qmlDumpToolForProject(ProjectExplorer::Project *project)
QtVersion *version = qt4Project->activeTarget()->activeBuildConfiguration()->qtVersion();
if (version->isValid()) {
QString qtInstallData = version->versionInfo().value("QT_INSTALL_DATA");
QString toolByInstallData = qmlDumpToolByInstallData(qtInstallData);
qDebug () << toolByInstallData;
return toolByInstallData;
QString toolPath = toolByInstallData(qtInstallData);
return toolPath;
}
}
}
return QString();
}
QString QmlDumpTool::qmlDumpToolByInstallData(const QString &qtInstallData)
QString QmlDumpTool::toolByInstallData(const QString &qtInstallData)
{
if (!Core::ICore::instance())
return QString();
......@@ -123,8 +121,8 @@ QString QmlDumpTool::copy(const QString &qtInstallData, QString *errorMessage)
errorMessage->clear();
return directory;
}
*errorMessage = QCoreApplication::tr("ProjectExplorer::QmlDumpTool",
"The debugger helpers could not be built in any of the directories:\n- %1\n\nReason: %2")
*errorMessage = QCoreApplication::translate("ProjectExplorer::QmlDumpTool",
"qmldump could not be built in any of the directories:\n- %1\n\nReason: %2")
.arg(directories.join(QLatin1String("\n- ")), *errorMessage);
return QString();
}
......
......@@ -47,8 +47,8 @@ class QT4PROJECTMANAGER_EXPORT QmlDumpTool : public Utils::BuildableHelperLibrar
{
public:
static bool canBuild(const QString &installHeadersDir);
static QString qmlDumpToolForProject(ProjectExplorer::Project *project);
static QString qmlDumpToolByInstallData(const QString &qtInstallData);
static QString toolForProject(ProjectExplorer::Project *project);
static QString toolByInstallData(const QString &qtInstallData);
static QStringList locationsByInstallData(const QString &qtInstallData);
// Build the helpers and return the output log/errormessage.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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