aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorMichael Winkelmann <michael.winkelmann@qt.io>2020-08-19 15:00:25 +0200
committerMichael Winkelmann <michael.winkelmann@qt.io>2020-08-20 09:33:13 +0000
commitd39a6f656fdbc3c3fafcd87d422feda721ac7311 (patch)
tree1a71814e886aae3bfd919623d4777b24c715921d /share
parent95aa7f42dee37ec50150c10863864660885a1574 (diff)
QmlPuppet: Refactor ChangeFileUrlCommand
Change-Id: I900f530109b6cdbb22d8138094443b48834d16cb Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.cpp29
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.h26
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp2
4 files changed, 17 insertions, 42 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.cpp
index d67c07be93..c1f02a647d 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.cpp
+++ b/share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.cpp
@@ -25,41 +25,14 @@
#include "changefileurlcommand.h"
-#include <QDataStream>
#include <QDebug>
namespace QmlDesigner {
-ChangeFileUrlCommand::ChangeFileUrlCommand() = default;
-
-ChangeFileUrlCommand::ChangeFileUrlCommand(const QUrl &fileUrl)
- : m_fileUrl(fileUrl)
-{
-}
-
-QUrl ChangeFileUrlCommand::fileUrl() const
-{
- return m_fileUrl;
-}
-
-QDataStream &operator<<(QDataStream &out, const ChangeFileUrlCommand &command)
-{
- out << command.fileUrl();
-
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, ChangeFileUrlCommand &command)
-{
- in >> command.m_fileUrl;
-
- return in;
-}
-
QDebug operator <<(QDebug debug, const ChangeFileUrlCommand &command)
{
return debug.nospace() << "ChangeFileUrlCommand("
- << "fileUrl: " << command.fileUrl() << ")";
+ << "fileUrl: " << command.fileUrl << ")";
}
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.h b/share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.h
index 5645274fc4..bc73f40807 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/changefileurlcommand.h
@@ -26,28 +26,30 @@
#pragma once
#include <qmetatype.h>
+#include <QDataStream>
#include <QUrl>
namespace QmlDesigner {
class ChangeFileUrlCommand
{
- friend QDataStream &operator>>(QDataStream &in, ChangeFileUrlCommand &command);
public:
- ChangeFileUrlCommand();
- explicit ChangeFileUrlCommand(const QUrl &fileUrl);
+ friend QDataStream &operator>>(QDataStream &in, ChangeFileUrlCommand &command)
+ {
+ in >> command.fileUrl;
+ return in;
+ }
- QUrl fileUrl() const;
-
-private:
- QUrl m_fileUrl;
-};
+ friend QDataStream &operator<<(QDataStream &out, const ChangeFileUrlCommand &command)
+ {
+ out << command.fileUrl;
+ return out;
+ }
+ friend QDebug operator <<(QDebug debug, const ChangeFileUrlCommand &command);
-QDataStream &operator<<(QDataStream &out, const ChangeFileUrlCommand &command);
-QDataStream &operator>>(QDataStream &in, ChangeFileUrlCommand &command);
-
-QDebug operator <<(QDebug debug, const ChangeFileUrlCommand &command);
+ QUrl fileUrl;
+};
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
index 6a0f75fe88..2e7ac11f9d 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
@@ -608,7 +608,7 @@ QList<ServerNodeInstance> NodeInstanceServer::setupInstances(const CreateSceneCo
void NodeInstanceServer::changeFileUrl(const ChangeFileUrlCommand &command)
{
- m_fileUrl = command.fileUrl();
+ m_fileUrl = command.fileUrl;
if (engine())
engine()->setBaseUrl(m_fileUrl);
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp
index 067c8c9468..5b4e21d468 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp
@@ -80,7 +80,7 @@ void Qt5TestNodeInstanceServer::createInstances(const CreateInstancesCommand &co
void Qt5TestNodeInstanceServer::changeFileUrl(const ChangeFileUrlCommand &command)
{
- setupFileUrl(command.fileUrl());
+ setupFileUrl(command.fileUrl);
refreshBindings();
collectItemChangesAndSendChangeCommands();