Commit 75330ca1 authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Adjust dialog height to content

(cherry picked from commit c6a67ab8)
parent 4f64afc4
......@@ -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"
}
......
......@@ -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 {
......
......@@ -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 +
......
......@@ -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)
}
}
}
......
......@@ -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 = "";
......
......@@ -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
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment