summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-21 20:05:21 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-10-21 21:12:58 (GMT)
commit75330ca1072aa7e0f15077a3c85b4d1627739d00 (patch)
tree0d9b9d087378493e7feda87d3edb1569b49c04c5
parent4f64afc4b3409485821c597f5f702ff8fe205d8a (diff)
Adjust dialog height to content
(cherry picked from commit c6a67ab81f3ed53096b3e85db71b13a1c45a2bd0)
-rw-r--r--src/apps/marble-maps/AboutDialog.qml23
-rw-r--r--src/apps/marble-maps/MainScreen.qml78
-rw-r--r--src/apps/marble-maps/PlacemarkDialog.qml2
-rw-r--r--src/apps/marble-maps/Search.qml6
-rw-r--r--src/apps/marble-maps/SearchField.qml2
-rw-r--r--src/apps/marble-maps/Waypoint.qml8
6 files changed, 74 insertions, 45 deletions
diff --git a/src/apps/marble-maps/AboutDialog.qml b/src/apps/marble-maps/AboutDialog.qml
index 0831a49..7851976 100644
--- a/src/apps/marble-maps/AboutDialog.qml
+++ b/src/apps/marble-maps/AboutDialog.qml
@@ -17,6 +17,8 @@ import org.kde.marble 0.20
Item {
id: root
+ //height: Math.max(marbleText.height, groupText.height, devText.height, attributionText.height)
+ height: Screen.pixelDensity * 2 + attributionText.height
SystemPalette {
id: palette
@@ -34,9 +36,9 @@ Item {
anchors.fill: parent
Item {
+ id: marbleItem
Text {
id: marbleText
- anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: marbleLogo.left
@@ -51,20 +53,20 @@ Item {
Image {
id: marbleLogo
anchors.right: parent.right
- anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: Screen.pixelDensity * 2
+ height: 0.8 * marbleText.height
fillMode: Image.PreserveAspectFit
source: "qrc:/konqi/globe.png"
}
}
Item {
+ id: supportItem
Text {
id: groupText
anchors.left: parent.left
anchors.right: groupKonqi.left
- anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: Screen.pixelDensity * 1
anchors.leftMargin: Screen.pixelDensity * 2
@@ -77,22 +79,21 @@ Item {
Image {
id: groupKonqi
anchors.right: parent.right
- anchors.top: parent.top
anchors.bottom: parent.bottom
- anchors.topMargin: Screen.pixelDensity * 3
anchors.bottomMargin: Screen.pixelDensity * 3
anchors.rightMargin: Screen.pixelDensity * 2
+ height: 0.8 * groupText.height
fillMode: Image.PreserveAspectFit
source: "qrc:/konqi/group.png"
}
}
Item {
+ id: devItem
Text {
id: devText
anchors.left: parent.left
anchors.right: devKonqi.left
- anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: Screen.pixelDensity * 1
anchors.leftMargin: Screen.pixelDensity * 2
@@ -105,21 +106,19 @@ Item {
Image {
id: devKonqi
anchors.right: parent.right
- anchors.top: parent.top
anchors.bottom: parent.bottom
- anchors.topMargin: Screen.pixelDensity * 3
anchors.bottomMargin: Screen.pixelDensity * 3
anchors.rightMargin: Screen.pixelDensity * 2
+ height: 0.8 * devText.height
fillMode: Image.PreserveAspectFit
source: "qrc:/konqi/app-dev.png"
}
}
Item {
-
+ id: attributionItem
Text {
id: attributionText
- anchors.top: parent.top
anchors.left: parent.left
anchors.right: devQtKonqi.left
anchors.bottom: parent.bottom
@@ -135,11 +134,11 @@ Item {
Image {
id: devQtKonqi
anchors.right: parent.right
- anchors.top: parent.top
anchors.bottom: parent.bottom
- anchors.topMargin: Screen.pixelDensity * 3
anchors.bottomMargin: Screen.pixelDensity * 3
anchors.rightMargin: Screen.pixelDensity * 2
+ height: 0.8 * attributionText.height
+
fillMode: Image.PreserveAspectFit
source: "qrc:/konqi/dev-qt.png"
}
diff --git a/src/apps/marble-maps/MainScreen.qml b/src/apps/marble-maps/MainScreen.qml
index 77e0831..3bad3c5 100644
--- a/src/apps/marble-maps/MainScreen.qml
+++ b/src/apps/marble-maps/MainScreen.qml
@@ -92,7 +92,7 @@ ApplicationWindow {
height: width
source: "qrc:///ic_place.png"
onPlacemarkChanged: {
- placemarkDialog.item.placemark = placemark
+ placemarkDialog.placemark = placemark
}
}
@@ -122,7 +122,7 @@ ApplicationWindow {
id: routing
anchors.fill: parent
marbleItem: marbleMaps
- routingProfile: routeEditor.item.routingProfile
+ routingProfile: routeEditor.routingProfile
}
PositionMarker {
@@ -256,7 +256,7 @@ ApplicationWindow {
navigationManager.visible = true
} else if (dialogContainer.currentIndex === dialogContainer.place) {
dialogContainer.currentIndex = dialogContainer.routing
- placemarkDialog.item.addToRoute()
+ placemarkDialog.addToRoute()
} else {
dialogContainer.currentIndex = dialogContainer.routing
navigationManager.visible = false
@@ -277,23 +277,24 @@ ApplicationWindow {
State {
name: "placeAction"
when: dialogContainer.currentIndex === dialogContainer.place
- PropertyChanges { target: routeEditorButton; iconSource: placemarkDialog.item.actionIconSource }
+ PropertyChanges { target: routeEditorButton; iconSource: placemarkDialog.actionIconSource }
}
]
}
}
- TabView {
+ Item {
id: dialogContainer
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
- tabsVisible: false
- frameVisible: false
visible: currentIndex >= 0
- height: visible ? 0.33 * root.height : 0
+
+ property var contentItem: routeEditor
+
+ height: visible ? contentItem.height : 0
readonly property int none: -1
readonly property int routing: 0
@@ -302,29 +303,58 @@ ApplicationWindow {
readonly property int settings: 3
readonly property int developer: 4
- currentIndex: none
+ property int currentIndex: none
Keys.onBackPressed: currentIndex = none
- Tab {
- active: true
- id: routeEditor
- RouteEditor {
- anchors.fill: parent
+ onCurrentIndexChanged:
+ {
+ switch (currentIndex) {
+ case none:
+ case routing: contentItem = routeEditor; break;
+ case place: contentItem = placemarkDialog; break;
+ case about: contentItem = aboutDialog; break;
+ case settings: contentItem = settingsDialog; break;
+ case developer: contentItem = developerDialog; break;
}
+
}
- Tab {
- active: true
+ RouteEditor {
+ id: routeEditor
+ visible: dialogContainer.currentIndex === dialogContainer.routing
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+ PlacemarkDialog {
id: placemarkDialog
- PlacemarkDialog {
- anchors.fill: parent
- map: marbleMaps
- }
+ visible: dialogContainer.currentIndex === dialogContainer.place
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ map: marbleMaps
+ }
+ AboutDialog {
+ id: aboutDialog
+ visible: dialogContainer.currentIndex === dialogContainer.about
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+ SettingsDialog {
+ id: settingsDialog
+ visible: dialogContainer.currentIndex === dialogContainer.settings
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+ DeveloperDialog {
+ id: developerDialog
+ visible: dialogContainer.currentIndex === dialogContainer.developer
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
}
-
- Tab { AboutDialog {} }
- Tab { active: true; SettingsDialog {} }
- Tab { active: true; DeveloperDialog {} }
}
BorderImage {
diff --git a/src/apps/marble-maps/PlacemarkDialog.qml b/src/apps/marble-maps/PlacemarkDialog.qml
index f4cbc70..2affb8d 100644
--- a/src/apps/marble-maps/PlacemarkDialog.qml
+++ b/src/apps/marble-maps/PlacemarkDialog.qml
@@ -19,7 +19,7 @@ Item {
id: root
property var placemark: null
- property string actionIconSource: routeEditor.item.currentProfileIcon
+ property string actionIconSource: routeEditor.currentProfileIcon
property alias map: bookmarks.map
height: placemark === null ? 0 : Screen.pixelDensity * 6 +
diff --git a/src/apps/marble-maps/Search.qml b/src/apps/marble-maps/Search.qml
index e64d350..2d0024f 100644
--- a/src/apps/marble-maps/Search.qml
+++ b/src/apps/marble-maps/Search.qml
@@ -58,7 +58,7 @@ Item {
if (routingManager) {
routingManager.addSearchResultAsPlacemark(backend.selectedPlacemark);
}
- placemarkDialog.item.placemark = backend.selectedPlacemark;
+ placemarkDialog.placemark = backend.selectedPlacemark;
}
}
@@ -120,8 +120,8 @@ Item {
onClicked: {
bookmarksView.currentIndex = index
dialogContainer.focus = true
- placemarkDialog.item.placemark = bookmarks.placemark(index);
- marbleMaps.centerOn(placemarkDialog.item.placemark.longitude, placemarkDialog.item.placemark.latitude)
+ placemarkDialog.placemark = bookmarks.placemark(index);
+ marbleMaps.centerOn(placemarkDialog.placemark.longitude, placemarkDialog.placemark.latitude)
}
}
}
diff --git a/src/apps/marble-maps/SearchField.qml b/src/apps/marble-maps/SearchField.qml
index 7ff6c34..fdc6726 100644
--- a/src/apps/marble-maps/SearchField.qml
+++ b/src/apps/marble-maps/SearchField.qml
@@ -101,7 +101,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
- placemarkDialog.item.placemark = null;
+ placemarkDialog.placemark = null;
dialogContainer.currentIndex = dialogContainer.none
routing.clearSearchResultPlacemarks();
field.text = "";
diff --git a/src/apps/marble-maps/Waypoint.qml b/src/apps/marble-maps/Waypoint.qml
index 1310932..f5627b6 100644
--- a/src/apps/marble-maps/Waypoint.qml
+++ b/src/apps/marble-maps/Waypoint.qml
@@ -32,15 +32,15 @@ Item {
id: image
onClicked: {
if (type == "searchResult") {
- if (placemarkDialog.item.placemark === placemark) {
- placemarkDialog.item.placemark = null
+ if (placemarkDialog.placemark === placemark) {
+ placemarkDialog.placemark = null
dialogContainer.currentIndex = dialogContainer.none
} else {
- placemarkDialog.item.placemark = placemark
+ placemarkDialog.placemark = placemark
dialogContainer.currentIndex = dialogContainer.place
}
} else {
- routeEditor.item.currentIndex = index
+ routeEditor.currentIndex = index
dialogContainer.currentIndex = dialogContainer.routing
}
}