diff --git a/.gitignore b/.gitignore
index 8d7a6b3..df7cc34 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ ui_*.h
/paysages3d-linux/
/paysages3d-linux.tar.bz2
/config.vim
+/callgrind.out.*
diff --git a/src/interface/modeler/quickapp/images/images.qrc b/src/interface/modeler/quickapp/images/images.qrc
deleted file mode 100644
index d3a2921..0000000
--- a/src/interface/modeler/quickapp/images/images.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- tab_water.png
- tab_atmosphere.png
- tab_clouds.png
- tab_render.png
- tab_terrain.png
- tab_textures.png
-
-
diff --git a/src/interface/modeler/quickapp/qml/Toolbar.qml b/src/interface/modeler/quickapp/qml/Toolbar.qml
new file mode 100644
index 0000000..46838d6
--- /dev/null
+++ b/src/interface/modeler/quickapp/qml/Toolbar.qml
@@ -0,0 +1,21 @@
+import QtQuick 2.0
+
+Rectangle {
+
+ default property alias children : inner_space.children
+ width: 70
+ height: parent.height
+ color: "#50000000"
+
+ Column {
+ id: inner_space
+ spacing: (parent.height - children.length * tool_terrain.height) / (children.length + 1)
+ anchors.centerIn: parent
+ }
+
+ Behavior on opacity {
+ PropertyAnimation {
+ duration: 200
+ }
+ }
+}
diff --git a/src/interface/modeler/quickapp/qml/ToolbarButton.qml b/src/interface/modeler/quickapp/qml/ToolbarButton.qml
index ae703b5..23c8edb 100644
--- a/src/interface/modeler/quickapp/qml/ToolbarButton.qml
+++ b/src/interface/modeler/quickapp/qml/ToolbarButton.qml
@@ -4,6 +4,8 @@ Item {
property string picture
property bool selected: false
property bool hovered: false
+ property string helptext
+ property string hovertext
width: image.width + 10
height: image.height + 10
@@ -26,14 +28,42 @@ Item {
id: image
source: parent.picture
anchors.centerIn: parent
+ width: 32
+ height: 32
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
- onEntered: parent.hovered = true
- onExited: parent.hovered = false
- onClicked: parent.selected = true
+ onEntered: {
+ parent.hovered = true;
+ tooltip_widget.hovertext = hovertext;
+ }
+ onExited: {
+ parent.hovered = false;
+ tooltip_widget.hovertext = "";
+ }
+ onClicked: {
+ parent.selected = !parent.selected;
+ if (parent.selected)
+ {
+ var toolbar = parent.parent;
+ for (var i = 0; i < toolbar.children.length; ++i)
+ {
+ var child = toolbar.children[i]
+ if (child !== parent)
+ {
+ child.selected = false;
+ }
+ }
+ tooltip_widget.helptext = helptext;
+ }
+ else
+ {
+ tooltip_widget.helptext = "";
+ }
+ }
}
}
diff --git a/src/interface/modeler/quickapp/qml/Tooltip.qml b/src/interface/modeler/quickapp/qml/Tooltip.qml
new file mode 100644
index 0000000..0ec4c3c
--- /dev/null
+++ b/src/interface/modeler/quickapp/qml/Tooltip.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+Rectangle {
+ property string helptext
+ property string hovertext
+ width: content.width
+ height: content.height
+
+ color: "#99000000"
+
+ Text {
+ id: content
+ color: "white"
+ text: parent.helptext || parent.hovertext
+ }
+}
diff --git a/src/interface/modeler/quickapp/qml/app.qrc b/src/interface/modeler/quickapp/qml/app.qrc
index 86302af..aa09ee8 100644
--- a/src/interface/modeler/quickapp/qml/app.qrc
+++ b/src/interface/modeler/quickapp/qml/app.qrc
@@ -8,5 +8,10 @@
images/tab_terrain.png
images/tab_textures.png
images/tab_water.png
+ images/tab_display.png
+ Toolbar.qml
+ images/display_topdown.png
+ images/help.png
+ Tooltip.qml
diff --git a/src/interface/modeler/quickapp/qml/images/display_topdown.png b/src/interface/modeler/quickapp/qml/images/display_topdown.png
new file mode 100644
index 0000000..442706b
Binary files /dev/null and b/src/interface/modeler/quickapp/qml/images/display_topdown.png differ
diff --git a/src/interface/modeler/quickapp/qml/images/help.png b/src/interface/modeler/quickapp/qml/images/help.png
new file mode 100644
index 0000000..fa42c5a
Binary files /dev/null and b/src/interface/modeler/quickapp/qml/images/help.png differ
diff --git a/src/interface/modeler/quickapp/qml/images/tab_display.png b/src/interface/modeler/quickapp/qml/images/tab_display.png
new file mode 100644
index 0000000..f1635ef
Binary files /dev/null and b/src/interface/modeler/quickapp/qml/images/tab_display.png differ
diff --git a/src/interface/modeler/quickapp/qml/main.qml b/src/interface/modeler/quickapp/qml/main.qml
index 2087bd4..ceee3b9 100644
--- a/src/interface/modeler/quickapp/qml/main.qml
+++ b/src/interface/modeler/quickapp/qml/main.qml
@@ -2,76 +2,79 @@ import QtQuick 2.2
import Paysages 1.0
OpenGLView {
+ id: main_ui
+ state: "Init"
- width: 640
- height: 480
+ width: 800
+ height: 600
- Item {
+ Tooltip {
+ id: tooltip_widget
+
+ anchors.top: parent.top
+ anchors.right: parent.right
+ }
+
+ Toolbar {
id: primary_toolbar
- x: 0
- y: 0
- width: 70
- height: parent.height
+ color: "#90000000"
- Rectangle {
- width: parent.height
- height: parent.width
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- transformOrigin: Item.Center
- rotation: -90
- gradient: Gradient {
- GradientStop { position: 0.0; color: "#605055FF" }
- GradientStop { position: 1.0; color: "#005055FF" }
- }
+ anchors.left: parent.left
+
+ ToolbarButton {
+ id: tool_display
+ picture: "images/tab_display.png"
+ hovertext: qsTr("Display options")
}
-
- Column {
-
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- spacing: (parent.height - 6 * tool_terrain.height) / 7
-
- ToolbarButton {
- id: tool_terrain
- picture: "images/tab_terrain.png"
- }
- ToolbarButton {
- id: tool_textures
- picture: "images/tab_textures.png"
- }
- ToolbarButton {
- id: tool_water
- picture: "images/tab_water.png"
- }
- ToolbarButton {
- id: tool_atmosphere
- picture: "images/tab_atmosphere.png"
- }
- ToolbarButton {
- id: tool_clouds
- picture: "images/tab_clouds.png"
- }
- ToolbarButton {
- id: tool_render
- picture: "images/tab_render.png"
- }
+ ToolbarButton {
+ id: tool_terrain
+ picture: "images/tab_terrain.png"
+ }
+ ToolbarButton {
+ id: tool_textures
+ picture: "images/tab_textures.png"
+ }
+ ToolbarButton {
+ id: tool_water
+ picture: "images/tab_water.png"
+ }
+ ToolbarButton {
+ id: tool_atmosphere
+ picture: "images/tab_atmosphere.png"
+ }
+ ToolbarButton {
+ id: tool_clouds
+ picture: "images/tab_clouds.png"
+ }
+ ToolbarButton {
+ id: tool_render
+ picture: "images/tab_render.png"
}
}
- Rectangle {
- id: toolbar_render
- anchors.top: primary_toolbar.top
+ Toolbar {
+ id: display_toolbar
+ opacity: 0
anchors.left: primary_toolbar.right
- width: primary_toolbar.width
- height: primary_toolbar.height
- color: "#8800FF00"
- SequentialAnimation on width {
- loops: Animation.Infinite
- PropertyAnimation { to: 0; duration: 1000 }
- PropertyAnimation { to: primary_toolbar.width; duration: 1000 }
+ ToolbarButton {
+ id: tool_display_topdown
+ picture: "images/display_topdown.png"
+ hovertext: qsTr("Top-down view")
+ helptext: qsTr("Drag the mouse on the map to change the viewpoint.")
}
}
+ states: [
+ State {
+ name: "Display Mode"
+ when: tool_display.selected
+
+ PropertyChanges {
+ target: display_toolbar
+ opacity: 1
+ }
+ }
+ ]
+
}
diff --git a/src/interface/modeler/quickapp/quickapp.pro b/src/interface/modeler/quickapp/quickapp.pro
index 61ee72a..2b227cf 100644
--- a/src/interface/modeler/quickapp/quickapp.pro
+++ b/src/interface/modeler/quickapp/quickapp.pro
@@ -53,4 +53,6 @@ DEPENDPATH += $$PWD/../../../render/opengl
OTHER_FILES += \
qml/main.qml \
qml/ToolbarButton.qml \
- qml/OpenGLView.qml
+ qml/OpenGLView.qml \
+ qml/Toolbar.qml \
+ qml/Tooltip.qml