summaryrefslogtreecommitdiffstats
path: root/imports
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-09-19 15:22:39 +0200
committerShawn Rutledge <shawn.rutledge@digia.com>2013-09-19 15:50:29 +0200
commitf3ad5d64815ddb5a00162d53ccb272972e24aa11 (patch)
tree0c97707aeb101c67ad84e46312853363e393071c /imports
parent72dd7b21734ed80e3f3670a7e5c85a298a73e5a1 (diff)
initial working version with examples
try ./uq examples/flickable.qml Change-Id: Id684edaf55155fcd32fc535f16f3145d945a2697 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'imports')
-rw-r--r--imports/Diagrams/UmlSequence/Message.qml114
-rw-r--r--imports/Diagrams/UmlSequence/MessageRepeated.qml63
-rw-r--r--imports/Diagrams/UmlSequence/ObjectInstance.qml107
-rw-r--r--imports/Diagrams/UmlSequence/Return.qml80
-rw-r--r--imports/Diagrams/UmlSequence/UmlSequenceDiagram.qml82
-rw-r--r--imports/Diagrams/UmlSequence/qmldir6
-rw-r--r--imports/Diagrams/common/images/hdash5.pngbin0 -> 99 bytes
-rw-r--r--imports/Diagrams/common/images/vdash5.pngbin0 -> 103 bytes
8 files changed, 452 insertions, 0 deletions
diff --git a/imports/Diagrams/UmlSequence/Message.qml b/imports/Diagrams/UmlSequence/Message.qml
new file mode 100644
index 0000000..ed50071
--- /dev/null
+++ b/imports/Diagrams/UmlSequence/Message.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Shawn Rutledge
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the UmlQuick project
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ id: root
+ property ObjectInstance from: null
+ property ObjectInstance to: null
+ property string method
+ property string params
+ property string fromMethod
+ width: 100
+ height: 60
+ property bool toSelf: from && from === to
+ property bool backwards: from.x > to.x
+ Rectangle {
+ width: 150
+ height: 26
+ radius: 5
+ visible: toSelf
+ y: 4
+ x: -radius
+ color: "transparent"
+ border.color: "black"
+ Rectangle {
+ height: parent.height
+ width: parent.radius * 2
+ border.color: "black"
+ }
+ Text {
+ id: methodLabelToSelf
+ font.bold: true
+ text: root.method
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.top
+ }
+ Text {
+ id: paramsLabelToSelf
+ text: root.params
+ font.pointSize: 7
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+ anchors.top: parent.bottom
+ }
+ }
+ Rectangle {
+ width: parent.width
+ height: 1
+ visible: !toSelf
+ color: "black"
+ y: parent.height / 2
+ Text {
+ id: methodLabel
+ text: root.method
+ font.bold: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.top
+ }
+ Text {
+ id: paramsLabel
+ text: root.params
+ font.pointSize: 7
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+ anchors.top: parent.bottom
+ }
+ }
+ Text {
+ text: backwards || toSelf ? "<" : ">"
+ anchors.verticalCenter: parent.verticalCenter
+ x: backwards || toSelf ? 0 : parent.width - width
+ }
+
+ anchors.left: backwards ? to.horizontalCenter : from.horizontalCenter
+ anchors.right: backwards ? from.horizontalCenter : toSelf ? undefined : to.horizontalCenter
+}
diff --git a/imports/Diagrams/UmlSequence/MessageRepeated.qml b/imports/Diagrams/UmlSequence/MessageRepeated.qml
new file mode 100644
index 0000000..628952d
--- /dev/null
+++ b/imports/Diagrams/UmlSequence/MessageRepeated.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Shawn Rutledge
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the UmlQuick project
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ id: root
+ width: 200
+ height: 10
+ property int count: 0
+ default property var child
+ onParentChanged: {
+ child.parent = root.parent
+ repeatLabel.parent = root.parent
+ }
+
+ Text {
+ id: repeatLabel
+ text: "previous message repeated " + count + " times"
+ color: "brown"
+ font.italic: true
+ x: root.x
+ }
+
+ anchors.left: child.left
+}
diff --git a/imports/Diagrams/UmlSequence/ObjectInstance.qml b/imports/Diagrams/UmlSequence/ObjectInstance.qml
new file mode 100644
index 0000000..e370ba6
--- /dev/null
+++ b/imports/Diagrams/UmlSequence/ObjectInstance.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Shawn Rutledge
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the UmlQuick project
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ implicitWidth: 6 + Math.max(objectNameLabel.implicitWidth, objectClassLabel.implicitWidth, qClassLabel.implicitWidth)
+ width: implicitWidth
+ height: 45
+ border.color: "black"
+ property alias objectName: objectNameLabel.text
+ property alias objectClass: objectClassLabel.text
+ property string q
+ z: 10
+ Item {
+ anchors.centerIn: parent
+ height: objectNameLabel.height + objectClassLabel.height + qClassLabel.height
+ Text {
+ id: objectNameLabel
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ }
+ Text {
+ id: objectClassLabel
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ anchors.top: objectNameLabel.bottom
+ }
+ Text {
+ id: qClassLabel
+ width: parent.width
+ height: text ? implicitHeight : 0
+ text: root.q ? "for " + root.q : ""
+ horizontalAlignment: Text.AlignHCenter
+ anchors.top: objectClassLabel.bottom
+ }
+ }
+ Component.onCompleted: {
+ x = parent.rightmostX
+ parent.rightmostX += width + 100
+ }
+ Image {
+ id: dashline
+ x: parent.width / 2
+ y: root.height
+ z: 0
+ height: parent.parent.height - parent.y - parent.height
+ source: "../common/images/vdash5.png"
+ fillMode: Image.TileVertically
+ Repeater {
+ model: parent.height / 1000
+ Rectangle {
+ y: 500 + index * 1000
+ z: 0
+ anchors.horizontalCenter: dashline.horizontalCenter
+ rotation: -90
+ width: rotatedLabel.width
+ height: rotatedLabel.height
+ opacity: 0.6
+ Text {
+ id: rotatedLabel
+ color: "darkblue"
+ text: objectClassLabel.text
+ anchors.centerIn: parent
+ }
+ }
+ }
+ }
+}
diff --git a/imports/Diagrams/UmlSequence/Return.qml b/imports/Diagrams/UmlSequence/Return.qml
new file mode 100644
index 0000000..5522ec7
--- /dev/null
+++ b/imports/Diagrams/UmlSequence/Return.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Shawn Rutledge
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the UmlQuick project
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ id: root
+ property ObjectInstance from: null
+ property ObjectInstance to: null
+ property string method
+ property string params
+ property string fromMethod
+ width: 100
+ height: 60
+ property bool backwards: from.x > to.x
+ Image {
+ width: parent.width
+ height: 1
+ y: parent.height / 2
+ source: "../common/images/hdash5.png"
+ fillMode: Image.TileHorizontally
+ Text {
+ id: methodLabel
+ text: root.method
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.top
+ }
+ Text {
+ id: paramsLabel
+ text: root.params
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.bottom
+ }
+ }
+ Text {
+ text: backwards || toSelf ? ">" : "<"
+ anchors.verticalCenter: parent.verticalCenter
+ x: backwards || toSelf ? parent.width - width : 0
+ }
+
+ anchors.left: backwards ? to.horizontalCenter : from.horizontalCenter
+ anchors.right: backwards ? from.horizontalCenter : toSelf ? undefined : to.horizontalCenter
+}
diff --git a/imports/Diagrams/UmlSequence/UmlSequenceDiagram.qml b/imports/Diagrams/UmlSequence/UmlSequenceDiagram.qml
new file mode 100644
index 0000000..5461307
--- /dev/null
+++ b/imports/Diagrams/UmlSequence/UmlSequenceDiagram.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Shawn Rutledge
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the UmlQuick project
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Window 2.0
+import QtQuick.Controls 1.0
+
+Item {
+ id: root
+ width: 1914
+ height: 1180
+ default property alias data: col.data
+ focus: true
+ ScrollView {
+ anchors.fill: parent
+ Flickable {
+ id: flickable
+ anchors.fill: parent
+ contentHeight: col.implicitHeight * col.scale
+ contentWidth: col.width * col.scale
+ Column {
+ id: col
+ property int rightmostX: 0
+ width: rightmostX + 100
+ transformOrigin: Item.TopLeft
+// onScaleChanged: console.log("scale " + scale + " width " + width + " flickable contentwidth " + flickable.contentWidth)
+ }
+ }
+ }
+// MouseArea {
+// acceptedButtons: Qt.MiddleButton
+// anchors.fill: parent
+// onWheel: col.scale *= (wheel.angleDelta.y > 0 ? 1.4142135623731 : 0.707106781186547)
+// }
+ Keys.onPressed: {
+ console.log("pressed " + event.key + " mods " + event.modifiers)
+ if (event.modifiers === Qt.ControlModifier) {
+ if (event.key === Qt.Key_Plus || event.key === Qt.Key_Equal)
+ col.scale *= 1.4142135623731
+ else if (event.key === Qt.Key_Minus)
+ col.scale *= 0.707106781186547
+ }
+ }
+}
+
diff --git a/imports/Diagrams/UmlSequence/qmldir b/imports/Diagrams/UmlSequence/qmldir
new file mode 100644
index 0000000..72dd5a2
--- /dev/null
+++ b/imports/Diagrams/UmlSequence/qmldir
@@ -0,0 +1,6 @@
+UmlSequenceDiagram 1.0 UmlSequenceDiagram.qml
+ObjectInstance 1.0 ObjectInstance.qml
+Message 1.0 Message.qml
+MessageRepeated 1.0 MessageRepeated.qml
+Return 1.0 Return.qml
+
diff --git a/imports/Diagrams/common/images/hdash5.png b/imports/Diagrams/common/images/hdash5.png
new file mode 100644
index 0000000..ce30f89
--- /dev/null
+++ b/imports/Diagrams/common/images/hdash5.png
Binary files differ
diff --git a/imports/Diagrams/common/images/vdash5.png b/imports/Diagrams/common/images/vdash5.png
new file mode 100644
index 0000000..0cd48a2
--- /dev/null
+++ b/imports/Diagrams/common/images/vdash5.png
Binary files differ