aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cord-Landwehr <[email protected]>2014-08-11 23:40:02 +0200
committerAndreas Cord-Landwehr <[email protected]>2014-08-12 09:30:12 +0200
commit2744242281c1247f2835162aabd7f3fab82cffce (patch)
tree14944ce5aaac1ad9993296b433838fc2a6f7ce2d
parente8fa998618262d1a2dd5bbcc472b2a538cb9b59f (diff)
More porting for profile dialogs.
-rw-r--r--src/qml/CheckListItem.qml54
-rw-r--r--src/qml/ProfileDetailsItem.qml104
-rw-r--r--src/qml/ProfileDetailsViewFavorites.qml7
-rw-r--r--src/qml/ProfileDetailsViewUser.qml258
4 files changed, 204 insertions, 219 deletions
diff --git a/src/qml/CheckListItem.qml b/src/qml/CheckListItem.qml
index 41f0f81..0a15666 100644
--- a/src/qml/CheckListItem.qml
+++ b/src/qml/CheckListItem.qml
@@ -27,23 +27,20 @@ Item {
id: root
property alias title: label.text
- property string iconSource
+ property string iconName
property alias label: label
property bool checked: false
signal stateChanged(bool checked)
- height: padding.height + bg.margins.top + bg.margins.bottom
+ height: 15 + 30 + 15
state: mouseArea.containsMouse? "hover": "normal"
-//FIXME
-// PlasmaCore.FrameSvgItem {
-// id: bg
-// imagePath: "widgets/viewitem"
-// prefix: "hover"
-// opacity: 0
-// anchors.fill: parent
-// }
+ Rectangle {
+ id: bg
+ radius: 8
+ anchors.fill: parent
+ }
Item {
id: padding
@@ -51,10 +48,10 @@ Item {
anchors {
fill: parent
- topMargin: bg.margins.top
- rightMargin: bg.margins.right
- bottomMargin: bg.margins.bottom
- leftMargin: bg.margins.left
+ topMargin: 5
+ rightMargin: 5
+ bottomMargin: 5
+ leftMargin: 5
}
width: parent.width
@@ -62,12 +59,12 @@ Item {
QIconItem {
id: iconItem
- visible: !!root.iconSource
+ visible: !!root.iconName
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
- icon: root.iconSource
+ icon: root.iconName
width: theme.smallIconSize
height: theme.smallIconSize
enabled: root.checked
@@ -109,30 +106,7 @@ Item {
name: "hover"
PropertyChanges {
target: bg
- opacity: 1
- }
- }
- ]
-
- transitions: [
- Transition {
- from: "normal"
- to: "hover"
- NumberAnimation {
- target: bg
- property: "opacity"
- duration: 250
- easing.type: Easing.OutCubic
- }
- },
- Transition {
- from: "hover"
- to: "normal"
- NumberAnimation {
- target: bg
- property: "opacity"
- duration: 250
- easing.type: Easing.OutCubic
+ opacity: 1.7
}
}
]
diff --git a/src/qml/ProfileDetailsItem.qml b/src/qml/ProfileDetailsItem.qml
index c01bd70..1b5c03f 100644
--- a/src/qml/ProfileDetailsItem.qml
+++ b/src/qml/ProfileDetailsItem.qml
@@ -1,6 +1,6 @@
/*
- * Copyright 2012 Sebastian Gottfried <[email protected]>
- * Copyright 2013 Andreas Cord-Landwehr <[email protected]>
+ * Copyright 2012 Sebastian Gottfried <[email protected]>
+ * Copyright 2013-2014 Andreas Cord-Landwehr <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -21,6 +21,7 @@
import QtQuick 2.1
import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
import artikulate 1.0
Item {
@@ -35,53 +36,54 @@ Item {
id: locale
}*/
-//FIXME
-// Item {
-// id: infoContainer
-// width: root.width
-// height: root.height
-// anchors.centerIn: parent
-// visible: profile != null
-//
-// PlasmaComponents.TabBar {
-// id: tabbar
-// width: parent.width
-// anchors { top: parent.top }
-//
-// PlasmaComponents.TabButton {
-// text: i18n("Learner")
-// tab: userPage
-// }
-// PlasmaComponents.TabButton {
-// text: i18n("Favorite Languages")
-// tab: favoriteLanguages
-// }
-// }
-//
-// PlasmaComponents.TabGroup {
-// width: parent.width
-// height: root.height - tabbar.height
-// anchors {
-// top: tabbar.bottom
-// left: tabbar.left
-// right: tabbar.right
-// }
-// ProfileDetailsViewUser {
-// id: userPage
-// profile: root.profile
-// onDeletionRequest: {
-// root.deletionRequest()
-// }
-// }
-//
-// ProfileDetailsViewFavorites {
-// id: favoriteLanguages
-// anchors.fill: parent
-// width: parent.width
-// height: parent.height
-// profile: root.profile
-// profileManager: root.manager
-// }
-// }
-// }
+ Item {
+ id: infoContainer
+ width: root.width
+ height: root.height
+ anchors.centerIn: parent
+ visible: profile != null
+
+ TabView {
+ anchors.fill: parent
+ anchors.margins: 4
+
+ ProfileDetailsViewUser {
+ id: userPage
+ width: parent.width
+ height: parent.height
+ profile: root.profile
+ onDeletionRequest: {
+ root.deletionRequest()
+ }
+ }
+
+ ProfileDetailsViewFavorites {
+ id: favoriteLanguages
+ width: parent.width
+ height: parent.height
+ profile: root.profile
+ profileManager: root.manager
+ }
+
+ style: TabViewStyle {
+ frameOverlap: 1
+ tab: Rectangle {
+ id: tabRect
+ color: styleData.selected ? "#c0e7f9" : "#ffffff"
+ border.width: 0
+ implicitWidth: Math.max(text.width + 8, 80)
+ implicitHeight: 24
+ Text {
+ id: text
+ anchors.centerIn: parent
+ text: styleData.title
+ color: "black"
+ }
+ }
+ frame: Rectangle {
+ color: "#c0e7f9"
+ }
+ }
+ }
+ }
}
diff --git a/src/qml/ProfileDetailsViewFavorites.qml b/src/qml/ProfileDetailsViewFavorites.qml
index 922edcd..5ce88d1 100644
--- a/src/qml/ProfileDetailsViewFavorites.qml
+++ b/src/qml/ProfileDetailsViewFavorites.qml
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 Sebastian Gottfried <[email protected]>
+ * Copyright 2012 Sebastian Gottfried <[email protected]>
* Copyright 2013-2014 Andreas Cord-Landwehr <[email protected]>
*
* This program is free software; you can redistribute it and/or
@@ -23,8 +23,9 @@ import QtQuick 2.1
import QtQuick.Controls 1.2
import artikulate 1.0
-PlasmaComponents.Page {
+Tab {
id: root
+ title: i18n("Favorite Languages")
anchors.fill: parent
property Learner profile: null
@@ -48,7 +49,7 @@ PlasmaComponents.Page {
delegate : CheckListItem {
id: goalSelector
property LearningGoal goal: model.dataRole
- width: languageList.width - scrollbar.width
+ width: languageList.width - 10
title: model.title
iconName: "favorites"
onStateChanged: {
diff --git a/src/qml/ProfileDetailsViewUser.qml b/src/qml/ProfileDetailsViewUser.qml
index c4928bb..d2d1c42 100644
--- a/src/qml/ProfileDetailsViewUser.qml
+++ b/src/qml/ProfileDetailsViewUser.qml
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 Sebastian Gottfried <[email protected]>
+ * Copyright 2012 Sebastian Gottfried <[email protected]>
* Copyright 2013-2014 Andreas Cord-Landwehr <[email protected]>
*
* This program is free software; you can redistribute it and/or
@@ -23,8 +23,9 @@ import QtQuick 2.1
import QtQuick.Controls 1.2
import artikulate 1.0
-PlasmaComponents.Page {
+Tab {
id: root
+ title: i18n("Learner")
anchors.fill: parent
property Learner profile: null
@@ -43,159 +44,166 @@ PlasmaComponents.Page {
onProfileChanged: update()
- Image {
- id: imageLearner
- width: 120
- height: 120
+ Column {
anchors {
top: root.top
right: root.right
topMargin: 30
- rightMargin: 30
+ leftMargin: 30
}
- cache: false
- source: profile.imageUrl ? profile.imageUrl : "../images/user-identity.png"
-
- Connections {
- target: profile
- onImageUrlChanged: {
- imageLearner.source = "" // trigger reload
- if (profile.imageUrl) {
- imageLearner.source = profile.imageUrl
- } else {
- imageLearner.source = "../images/user-identity.png"
+ Row {
+ Image {
+ id: imageLearner
+ width: 120
+ height: 120
+ fillMode: Image.Pad
+ cache: false
+ source: profile.imageUrl ? profile.imageUrl : "../images/user-identity.png"
+
+ Connections {
+ target: profile
+ onImageUrlChanged: {
+ imageLearner.source = "" // trigger reload
+ if (profile.imageUrl) {
+ imageLearner.source = profile.imageUrl
+ } else {
+ imageLearner.source = "../images/user-identity.png"
+ }
+ }
}
}
- }
- }
- Label {
- anchors {
- right: imageLearner.left
- rightMargin: 30
- top: imageLearner.top
- topMargin: Math.floor(0.25*imageLearner.height)
+ Label {
+ anchors {
+ top: imageLearner.top
+ topMargin: Math.floor(0.25 * imageLearner.height)
+ }
+ height: paintedHeight
+ font.pointSize: theme.fontPointSize * 1.2
+ text: root.profile != null ? root.profile.name : ""
+ }
}
- height: paintedHeight
- font.pointSize: theme.defaultFont.pointSize * 1.2
- text: root.profile != null ? root.profile.name : ""
- }
- Row {
- id: editComponent
- spacing: 10
- visible: root.state == "info"
- anchors {
- horizontalCenter: parent.horizontalCenter
- top: imageLearner.bottom
- topMargin: 30
- }
- ToolButton {
- iconName: "document-edit"
- text: i18n("Edit")
- onClicked: root.state = "editor"
- }
- ToolButton {
- iconName: "edit-delete"
- text: i18n("Delete")
- enabled: profileManager.profileCount > 1
- onClicked: root.state = "deleteConfirmation"
- }
- ToolButton {
- iconName: "insert-image"
- text: i18n("Change Image")
- onClicked: profileManager.openImageFileDialog()
- }
- }
- Item {
- id: editorContainer
- width: parent.width - 40
- height: editorContainer.height
- anchors {
- horizontalCenter: parent.horizontalCenter
- top: imageLearner.bottom
- topMargin: 30
+ Row {
+ id: editComponent
+ spacing: 10
+ visible: root.state == "info"
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ top: imageLearner.bottom
+ topMargin: 30
+ }
+ ToolButton {
+ iconName: "document-edit"
+ text: i18n("Edit")
+ onClicked: root.state = "editor"
+ }
+ ToolButton {
+ iconName: "edit-delete"
+ text: i18n("Delete")
+ enabled: profileManager.profileCount > 1
+ onClicked: root.state = "deleteConfirmation"
+ }
+ ToolButton {
+ iconName: "insert-image"
+ text: i18n("Change Image")
+ onClicked: profileManager.openImageFileDialog()
+ }
}
- Column {
- id: profileForm
-
- property alias name: nameTextField.text
- property alias doneButtonIconSource: doneBtn.iconName
- property alias doneButtonText: doneBtn.text
-
- width: parent.width
+ Item {
+ id: editorContainer
+ visible: false
+ width: parent.width - 40
height: editorContainer.height
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ top: imageLearner.bottom
+ topMargin: 30
+ }
+
+ Column {
+ id: profileForm
- spacing: 15
+ property alias name: nameTextField.text
+ property alias doneButtonIconSource: doneBtn.iconName
+ property alias doneButtonText: doneBtn.text
- TextField {
- id: nameTextField
width: parent.width
- placeholderText: i18n("Name")
- }
-
- Button {
- id: doneBtn
- anchors.horizontalCenter: parent.horizontalCenter
- text: i18n("Done")
- enabled: nameTextField.text !== ""
- iconName: "dialog-ok"
- onClicked: {
- root.profile.name = profileForm.name
- if (root.profile.id === -1) {
- profileManager.addProfile(profile)
- }
- else {
- profileManager.sync(root.profile)
+ height: editorContainer.height
+
+ spacing: 15
+
+ TextField {
+ id: nameTextField
+ width: parent.width
+ placeholderText: i18n("Name")
+ }
+
+ Button {
+ id: doneBtn
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: i18n("Done")
+ enabled: nameTextField.text !== ""
+ iconName: "dialog-ok"
+ onClicked: {
+ root.profile.name = profileForm.name
+ if (root.profile.id === -1) {
+ profileManager.addProfile(profile)
+ }
+ else {
+ profileManager.sync(root.profile)
+ }
+ root.update()
+ root.state = "info"
}
- root.update()
- root.state = "info"
}
}
}
- }
-
- Item {
- id: deleteConfirmationContainer
- width: parent.width - 40
- height: editorContainer.height
- anchors {
- top: editComponent.top
- }
- Column {
- width: parent.width
- height: parent.height
- spacing: 15
+ Item {
+ id: deleteConfirmationContainer
+ width: parent.width - 40
+ height: editorContainer.height
+ visible: false
- Label {
- property string name
- id: deleteConfirmationLabel
+ anchors {
+ top: editComponent.top
+ }
+ Column {
width: parent.width
- text: i18n("Do you really want to delete this identity \"<b>%1</b>\"?", name)
- wrapMode: Text.Wrap
- horizontalAlignment: Text.AlignHCenter
- }
- Row {
- spacing: 10
- anchors.horizontalCenter: parent.horizontalCenter
- ToolButton {
- iconName: "edit-delete"
- text: i18n("Delete")
- onClicked: {
- deletionRequest()
- }
+ height: parent.height
+ spacing: 15
+
+ Label {
+ property string name
+ id: deleteConfirmationLabel
+ width: parent.width
+ text: i18n("Do you really want to delete this identity \"<b>%1</b>\"?", name)
+ wrapMode: Text.Wrap
+ horizontalAlignment: Text.AlignHCenter
}
- ToolButton {
- text: i18n("Cancel")
- onClicked: root.state = "info"
+ Row {
+ spacing: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ ToolButton {
+ iconName: "edit-delete"
+ text: i18n("Delete")
+ onClicked: {
+ deletionRequest()
+ }
+ }
+ ToolButton {
+ text: i18n("Cancel")
+ onClicked: root.state = "info"
+ }
}
}
}
}
+
states: [
State {
name: "info"