Commit 65c0eb51 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

Merge branch '2.3'

Conflicts:
	src/plugins/debugger/qml/qmlengine.cpp

Change-Id: I46509f0c187b71bbaed7b2118a160914f8250ca4
parents 242b4280 7aaab4d0
......@@ -15,4 +15,9 @@ symbian {
}
LIBS += -L$$PWD -l$$LIBNAME
symbian {
# Work around bug in gcce toolchain (QTCREATORBUG-5589)
LIBS += -lusrt2_2.lib
}
DEFINES += QMLJSDEBUGGER
......@@ -2,7 +2,7 @@
# It enables debugging of Qt Quick applications
TEMPLATE = lib
CONFIG += staticlib
CONFIG += staticlib create_prl
QT += declarative script
DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB
......
......@@ -395,9 +395,44 @@ void NodeInstanceServer::setupDummyData(const QUrl &fileUrl)
{
if (!fileUrl.isEmpty()) {
QStringList dummyDataDirectoryList = dummyDataDirectories(QFileInfo(fileUrl.toLocalFile()).path());
foreach (const QString &dummyDataDirectory, dummyDataDirectoryList)
foreach (const QString &dummyDataDirectory, dummyDataDirectoryList) {
loadDummyDataFiles(dummyDataDirectory);
loadDummyDataContext(dummyDataDirectory);
}
}
if (m_dummyContextObject.isNull())
setupDefaultDummyData();
}
void NodeInstanceServer::setupDefaultDummyData()
{
QDeclarativeComponent component(engine());
QByteArray defaultContextObjectArray("import QtQuick 1.0\n"
"import QmlDesigner 1.0\n"
"DummyContextObject {\n"
" parent: QtObject {\n"
" property real width: 360\n"
" property real height: 640\n"
" }\n"
"}\n");
component.setData(defaultContextObjectArray, fileUrl());
m_dummyContextObject = component.create();
if (component.isError()) {
QList<QDeclarativeError> errors = component.errors();
foreach (const QDeclarativeError &error, errors) {
qWarning() << error;
}
}
if (m_dummyContextObject) {
qWarning() << "Loaded default dummy context object.";
m_dummyContextObject->setParent(this);
}
refreshBindings();
}
QList<ServerNodeInstance> NodeInstanceServer::setupInstances(const CreateSceneCommand &command)
......@@ -775,7 +810,11 @@ void NodeInstanceServer::setInstanceAuxiliaryData(const PropertyValueContainer &
if (auxiliaryContainer.instanceId() == 0 && (auxiliaryContainer.name() == QLatin1String("width") ||
auxiliaryContainer.name() == QLatin1String("height"))) {
setInstancePropertyVariant(auxiliaryContainer);
if (!auxiliaryContainer.value().isNull()) {
setInstancePropertyVariant(auxiliaryContainer);
} else {
rootNodeInstance().resetProperty(auxiliaryContainer.name());
}
}
}
......@@ -1074,13 +1113,19 @@ void NodeInstanceServer::loadDummyDataFiles(const QString& directory)
{
QDir dir(directory, "*.qml");
QList<QFileInfo> filePathList = dir.entryInfoList();
foreach (const QFileInfo &qmlFileInfo, filePathList) {
loadDummyDataFile(qmlFileInfo);
}
}
void NodeInstanceServer::loadDummyDataContext(const QString& directory)
{
QDir dir(directory+"/context", "*.qml");
QList<QFileInfo> filePathList = dir.entryInfoList();
QString baseName = QFileInfo(fileUrl().toLocalFile()).completeBaseName();
foreach (const QFileInfo &qmlFileInfo, filePathList) {
if (!qmlFileInfo.completeBaseName().contains("_dummycontext")) {
loadDummyDataFile(qmlFileInfo);
} else if (qmlFileInfo.completeBaseName() == baseName+"_dummycontext") {
if (qmlFileInfo.completeBaseName() == baseName)
loadDummyContextObjectFile(qmlFileInfo);
}
}
}
......
......@@ -172,6 +172,7 @@ protected:
virtual void initializeView(const QVector<AddImportContainer> &importVector) = 0;
virtual QList<ServerNodeInstance> setupScene(const CreateSceneCommand &command) = 0;
void loadDummyDataFiles(const QString& directory);
void loadDummyDataContext(const QString& directory);
void loadDummyDataFile(const QFileInfo& fileInfo);
void loadDummyContextObjectFile(const QFileInfo& fileInfo);
static QStringList dummyDataDirectories(const QString& directoryPath);
......@@ -192,6 +193,7 @@ protected:
void setupFileUrl(const QUrl &fileUrl);
void setupImports(const QVector<AddImportContainer> &container);
void setupDummyData(const QUrl &fileUrl);
void setupDefaultDummyData();
QList<ServerNodeInstance> setupInstances(const CreateSceneCommand &command);
QList<QDeclarativeContext*> allSubContextsForObject(QObject *object);
......
......@@ -49,14 +49,21 @@ int main(int argc, char *argv[])
{
QApplication application(argc, argv);
if (application.arguments().count() != 4)
return -1;
QCoreApplication::setOrganizationName("Nokia");
QCoreApplication::setOrganizationDomain("nokia.com");
QCoreApplication::setApplicationName("Qml2Puppet");
QCoreApplication::setApplicationVersion("1.0.0");
if (application.arguments().count() == 2 && application.arguments().at(1) == "--version") {
qDebug() << QCoreApplication::applicationVersion();
return 0;
}
if (application.arguments().count() != 4)
return -1;
#ifdef ENABLE_QT_BREAKPAD
QtSystemExceptionHandler systemExceptionHandler;
#endif
......
......@@ -146,4 +146,45 @@ void Qt4NodeInstanceServer::refreshBindings()
engine()->rootContext()->setContextProperty(QString("__%1").arg(counter++), 0); // refreshing bindings
}
void Qt4NodeInstanceServer::changeAuxiliaryValues(const ChangeAuxiliaryCommand &command)
{
NodeInstanceServer::changeAuxiliaryValues(command);
refreshScreenObject();
}
void Qt4NodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command)
{
NodeInstanceServer::changePropertyValues(command);
refreshScreenObject();
}
void Qt4NodeInstanceServer::changePropertyBindings(const ChangeBindingsCommand &command)
{
NodeInstanceServer::changePropertyBindings(command);
refreshScreenObject();
}
void Qt4NodeInstanceServer::removeProperties(const RemovePropertiesCommand &command)
{
NodeInstanceServer::removeProperties(command);
refreshScreenObject();
}
void Qt4NodeInstanceServer::refreshScreenObject()
{
if (declarativeView()) {
QObject *screen = rootContext()->contextProperty("screen").value<QObject*>();
if (screen) {
screen->metaObject()->invokeMethod(screen,
"privateSetDisplay",
Q_ARG(int, rootNodeInstance().size().width()),
Q_ARG(int, rootNodeInstance().size().height()),
Q_ARG(qreal, 210)); // TODO: dpi should be setable
}
}
}
} // QmlDesigner
......@@ -53,12 +53,18 @@ public:
QDeclarativeEngine *engine() const;
void refreshBindings();
void changeAuxiliaryValues(const ChangeAuxiliaryCommand &command);
void changePropertyValues(const ChangeValuesCommand &command);
void changePropertyBindings(const ChangeBindingsCommand &command);
void removeProperties(const RemovePropertiesCommand &command);
protected:
void initializeView(const QVector<AddImportContainer> &importVector);
void resizeCanvasSizeToRootItemSize();
void resetAllItems();
bool nonInstanceChildIsDirty(QGraphicsObject *graphicsObject) const;
QList<ServerNodeInstance> setupScene(const CreateSceneCommand &command);
void refreshScreenObject();
private:
QWeakPointer<QDeclarativeView> m_declarativeView;
......
......@@ -56,14 +56,20 @@ int main(int argc, char *argv[])
QApplication application(argc, argv);
if (application.arguments().count() != 4)
return -1;
QCoreApplication::setOrganizationName("Nokia");
QCoreApplication::setOrganizationDomain("nokia.com");
QCoreApplication::setApplicationName("QmlPuppet");
QCoreApplication::setApplicationVersion("1.1.0");
if (application.arguments().count() == 2 && application.arguments().at(1) == "--version") {
qDebug() << QCoreApplication::applicationVersion();
return 0;
}
if (application.arguments().count() != 4)
return -1;
#ifdef ENABLE_QT_BREAKPAD
QtSystemExceptionHandler systemExceptionHandler;
#endif
......
......@@ -370,6 +370,9 @@ QExtGroupBox {
}
}
QWidget {
}
}
}
}
......
......@@ -95,7 +95,8 @@ DATA_DIRS = \
DATA_FILES_SRC = \
externaltools/lrelease.xml \
externaltools/lupdate.xml \
externaltools/sort.xml
externaltools/sort.xml \
externaltools/qmlviewer.xml
unix {
macx:DATA_FILES_SRC += externaltools/vi_mac.xml
else:DATA_FILES_SRC += externaltools/vi.xml
......
......@@ -5284,7 +5284,7 @@ on slow machines. In this case, the value should be increased.</source>
<name>Git::Internal::BranchDialog</name>
<message>
<source>Would you like to delete the &lt;b&gt;unmerged&lt;/b&gt; branch &apos;%1&apos;?</source>
<translation>Möchten Sie den Branch &apos;%1&apos; löschen? Es wurde noch keine &lt;b&gt;keine&lt;/b&gt; Merge-Operation durchgeführt?</translation>
<translation>Möchten Sie den Branch &apos;%1&apos; löschen? Es wurde noch &lt;b&gt;keine&lt;/b&gt; Merge-Operation durchgeführt?</translation>
</message>
<message>
<source>Delete Branch</source>
......
IDI_ICON1 ICON DISCARDABLE "qtcreator.ico"
IDI_ICON2 ICON DISCARDABLE "winicons\c.ico"
IDI_ICON3 ICON DISCARDABLE "winicons\cpp.ico"
IDI_ICON4 ICON DISCARDABLE "winicons\h.ico"
IDI_ICON5 ICON DISCARDABLE "winicons\ui.ico"
IDI_ICON6 ICON DISCARDABLE "winicons\pro.ico"
IDI_ICON7 ICON DISCARDABLE "winicons\pri.ico"
IDI_ICON8 ICON DISCARDABLE "winicons\qml.ico"
IDI_ICON2 ICON DISCARDABLE "winicons\\c.ico"
IDI_ICON3 ICON DISCARDABLE "winicons\\cpp.ico"
IDI_ICON4 ICON DISCARDABLE "winicons\\h.ico"
IDI_ICON5 ICON DISCARDABLE "winicons\\ui.ico"
IDI_ICON6 ICON DISCARDABLE "winicons\\pro.ico"
IDI_ICON7 ICON DISCARDABLE "winicons\\pri.ico"
IDI_ICON8 ICON DISCARDABLE "winicons\\qml.ico"
......@@ -89,16 +89,11 @@ bool FindCdbBreakpoint::preVisit(AST *ast)
bool FindCdbBreakpoint::visit(FunctionDefinitionAST *ast)
{
if (ast->ctor_initializer) {
foundLine(ast->function_body->firstToken());
return false;
}
if (ast->function_body) {
if (CompoundStatementAST *stmt = ast->function_body->asCompoundStatement()) {
accept(stmt);
if (!m_breakpointLine)
foundLine(stmt->lastToken() - 1);
foundLine(ast->function_body->firstToken());
return false;
}
}
......
......@@ -263,7 +263,7 @@ void ContextPaneWidget::rePosition(const QPoint &position, const QPoint &alterna
if (pos().y() < 0)
move(alternative2);
if ((pos().y() + height()) > parentWidget()->height())
hide();
move(x(), parentWidget()->height() - height() - 10);
m_originalPos = pos();
......
......@@ -216,6 +216,8 @@ void ContextPaneWidgetImage::setProperties(QmlJS::PropertyReader *propertyReader
setPixmap(source);
} else {
m_sizeLabel->setText("");
m_fileWidget->setFileName(QUrl());
setPixmap("");
}
}
......
......@@ -237,6 +237,11 @@ void QDeclarativeDebugConnection::close()
QIODevice::close();
d->device->close();
emit stateChanged(QAbstractSocket::UnconnectedState);
QHash<QString, QDeclarativeDebugClient*>::iterator iter = d->plugins.begin();
for (; iter != d->plugins.end(); ++iter) {
iter.value()->statusChanged(QDeclarativeDebugClient::NotConnected);
}
}
}
......@@ -283,6 +288,7 @@ void QDeclarativeDebugConnection::connectToHost(const QString &hostName, quint16
QTcpSocket *socket = new QTcpSocket(d);
d->device = socket;
d->connectDeviceSignals();
d->gotHello = false;
connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
......@@ -297,6 +303,7 @@ void QDeclarativeDebugConnection::connectToOst(const QString &port)
ost->setParent(d);
d->device = ost;
d->connectDeviceSignals();
d->gotHello = false;
QIODevice::open(ReadWrite | Unbuffered);
emit stateChanged(QAbstractSocket::ConnectedState);
emit connected();
......
......@@ -78,12 +78,20 @@ QString BuildableHelperLibrary::qtInstallDataDir(const QString &qmakePath)
QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath)
{
if (qmakePath.isEmpty())
bool qmakeIsExecutable;
return BuildableHelperLibrary::qtVersionForQMake(qmakePath, &qmakeIsExecutable);
}
QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool *qmakeIsExecutable)
{
*qmakeIsExecutable = !qmakePath.isEmpty();
if (!*qmakeIsExecutable)
return QString();
QProcess qmake;
qmake.start(qmakePath, QStringList(QLatin1String("--version")));
if (!qmake.waitForStarted()) {
*qmakeIsExecutable = false;
qWarning("Cannot start '%s': %s", qPrintable(qmakePath), qPrintable(qmake.errorString()));
return QString();
}
......@@ -93,9 +101,11 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath)
return QString();
}
if (qmake.exitStatus() != QProcess::NormalExit) {
*qmakeIsExecutable = false;
qWarning("'%s' crashed.", qPrintable(qmakePath));
return QString();
}
const QString output = QString::fromLocal8Bit(qmake.readAllStandardOutput());
static QRegExp regexp(QLatin1String("(QMake version|QMake version:)[\\s]*([\\d.]*)"),
Qt::CaseInsensitive);
......
......@@ -52,7 +52,7 @@ public:
static QString findSystemQt(const Utils::Environment &env);
// return true if the qmake at qmakePath is qt4 (used by QtVersion)
static QString qtVersionForQMake(const QString &qmakePath);
static bool checkMinimumQtVersion(const QString &qtversionString, int majorVersion, int minorVersion, int patchVersion);
static QString qtVersionForQMake(const QString &qmakePath, bool *qmakeIsExecutable);
// returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion)
static QStringList possibleQMakeCommands();
......
......@@ -125,7 +125,7 @@ QString ClassNameValidatingLineEdit::createClassName(const QString &name)
// Remove spaces and convert the adjacent characters to uppercase
QString className = name;
QRegExp spaceMatcher(QLatin1String(" +(\\w)"), Qt::CaseSensitive, QRegExp::RegExp2);
QTC_ASSERT(spaceMatcher.isValid(), /**/);
QTC_CHECK(spaceMatcher.isValid());
int pos;
while ((pos = spaceMatcher.indexIn(className)) != -1) {
className.replace(pos, spaceMatcher.matchedLength(),
......
......@@ -105,14 +105,20 @@ DetailsWidgetPrivate::DetailsWidgetPrivate(QWidget *parent) :
m_hovered(false),
m_useCheckBox(false)
{
QHBoxLayout *summaryLayout = new QHBoxLayout;
summaryLayout->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
summaryLayout->setSpacing(0);
m_summaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_summaryLabel->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_summaryLabel->setContentsMargins(0, 0, 0, 0);
summaryLayout->addWidget(m_summaryLabel);
m_summaryCheckBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_summaryCheckBox->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
m_summaryCheckBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_summaryCheckBox->setAttribute(Qt::WA_LayoutUsesWidgetRect); /* broken layout on mac otherwise */
m_summaryCheckBox->setVisible(false);
m_summaryCheckBox->setContentsMargins(0, 0, 0, 0);
summaryLayout->addWidget(m_summaryCheckBox);
m_additionalSummaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
m_additionalSummaryLabel->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
......@@ -121,7 +127,7 @@ DetailsWidgetPrivate::DetailsWidgetPrivate(QWidget *parent) :
m_grid->setContentsMargins(0, 0, 0, 0);
m_grid->setSpacing(0);
m_grid->addWidget(m_summaryLabel, 0, 0);
m_grid->addLayout(summaryLayout, 0, 0);
m_grid->addWidget(m_detailsButton, 0, 2);
m_grid->addWidget(m_additionalSummaryLabel, 1, 0, 1, 3);
}
......@@ -168,7 +174,6 @@ void DetailsWidgetPrivate::updateControls()
if (m_widget)
m_widget->setVisible(m_state == DetailsWidget::Expanded || m_state == DetailsWidget::NoSummary);
m_detailsButton->setChecked(m_state == DetailsWidget::Expanded && m_widget);
//m_summaryLabel->setEnabled(m_state == DetailsWidget::Collapsed && m_widget);
m_detailsButton->setVisible(m_state != DetailsWidget::NoSummary);
m_summaryLabel->setVisible(m_state != DetailsWidget::NoSummary && !m_useCheckBox);
m_summaryCheckBox->setVisible(m_state != DetailsWidget::NoSummary && m_useCheckBox);
......@@ -202,6 +207,8 @@ DetailsWidget::DetailsWidget(QWidget *parent) :
{
setLayout(d->m_grid);
setUseCheckBox(false);
connect(d->m_detailsButton, SIGNAL(toggled(bool)),
this, SLOT(setExpanded(bool)));
connect(d->m_summaryCheckBox, SIGNAL(toggled(bool)),
......@@ -224,8 +231,6 @@ bool DetailsWidget::useCheckBox()
void DetailsWidget::setUseCheckBox(bool b)
{
d->m_useCheckBox = b;
QWidget *widget = b ? static_cast<QWidget *>(d->m_summaryCheckBox) : static_cast<QWidget *>(d->m_summaryLabel);
d->m_grid->addWidget(widget, 0, 0);
d->m_summaryLabel->setVisible(b);
d->m_summaryCheckBox->setVisible(!b);
}
......@@ -260,7 +265,7 @@ void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
QPainter p(this);
QWidget *topLeftWidget = d->m_useCheckBox ? static_cast<QWidget *>(d->m_summaryCheckBox) : static_cast<QWidget *>(d->m_summaryLabel);
QPoint topLeft(topLeftWidget->geometry().left(), contentsRect().top());
QPoint topLeft(topLeftWidget->geometry().left() - MARGIN, contentsRect().top());
const QRect paintArea(topLeft, contentsRect().bottomRight());
if (d->m_state != Expanded) {
......
......@@ -44,5 +44,8 @@
#define QTC_ASSERT(cond, action) \
if(cond){}else{qDebug()<<"ASSERTION " #cond " FAILED AT " __FILE__ ":" QTC_ASSERT_STRINGIFY(__LINE__);action;}
#define QTC_CHECK(cond) \
if(cond){}else{qDebug()<<"ASSERTION " #cond " FAILED AT " __FILE__ ":" QTC_ASSERT_STRINGIFY(__LINE__);}
#endif // QTC_ASSERT_H
......@@ -602,7 +602,7 @@ QAction *AnalyzerManagerPrivate::actionFromToolAndMode(IAnalyzerTool *tool, Star
foreach (QAction *action, m_actions)
if (m_toolFromAction.value(action) == tool && m_modeFromAction[action] == mode)
return action;
QTC_ASSERT(false, /**/);
QTC_CHECK(false);
return 0;
}
......@@ -666,9 +666,9 @@ void AnalyzerManagerPrivate::selectTool(IAnalyzerTool *tool, StartMode mode)
if (!m_defaultSettings.contains(tool)) {
QWidget *widget = tool->createWidgets();
QTC_ASSERT(widget, /**/);
QTC_CHECK(widget);
m_defaultSettings.insert(tool, m_mainWindow->saveSettings());
QTC_ASSERT(!m_controlsWidgetFromTool.contains(tool), /**/);
QTC_CHECK(!m_controlsWidgetFromTool.contains(tool));
m_controlsWidgetFromTool[tool] = widget;
m_controlsStackWidget->addWidget(widget);
}
......@@ -677,7 +677,7 @@ void AnalyzerManagerPrivate::selectTool(IAnalyzerTool *tool, StartMode mode)
loadToolSettings(tool);
QTC_ASSERT(m_controlsWidgetFromTool.contains(tool), /**/);
QTC_CHECK(m_controlsWidgetFromTool.contains(tool));
m_controlsStackWidget->setCurrentWidget(m_controlsWidgetFromTool.value(tool));
m_toolBox->setCurrentIndex(actionIndex);
......
......@@ -119,9 +119,11 @@ void AnalyzerRunControl::start()
TaskHub *hub = pm->getObject<TaskHub>();
hub->clearTasks(Constants::ANALYZERTASK_ID);
d->m_isRunning = true;
emit started();
d->m_engine->start();
if (d->m_engine->start()) {
d->m_isRunning = true;
emit started();
}
}
RunControl::StopResult AnalyzerRunControl::stop()
......
......@@ -69,7 +69,7 @@ public:
ProjectExplorer::RunConfiguration *runConfiguration);
/// Start analyzation process.
virtual void start() = 0;
virtual bool start() = 0;
/// Trigger async stop of the analyzation process.
virtual void stop() = 0;
......
......@@ -55,7 +55,8 @@ using namespace CMakeProjectManager::Internal;
//
CMakeEditor::CMakeEditor(CMakeEditorWidget *editor)
: BaseTextEditor(editor)
: BaseTextEditor(editor),
m_infoBarShown(false)
{
setContext(Core::Context(CMakeProjectManager::Constants::C_CMAKEEDITOR,
TextEditor::Constants::C_TEXTEDITOR));
......@@ -78,6 +79,11 @@ QString CMakeEditor::id() const
void CMakeEditor::markAsChanged()
{
if (!file()->isModified())
return;
if (m_infoBarShown)
return;
m_infoBarShown = true;
Core::InfoBarEntry info(QLatin1String("CMakeEditor.RunCMake"),