aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2015-06-05 12:31:18 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2015-06-05 12:31:18 (GMT)
commit148765963503077c1033345a032df84c63d02e25 (patch)
tree14c8104b7a49b5f6d13366ad39f80ebb34fce9d1
parent442b70c94757cb1ef162120f7009e2761b5520c5 (diff)
Qt5: Port CourseSelector.qml And Friends
With this most of the functionality of the home screen is there again. Still missing is the profile managment form and the custom lesson dialog has some severe layout issues.
-rw-r--r--src/application.cpp8
-rw-r--r--src/qml/CourseDescriptionItem.qml19
-rw-r--r--src/qml/CoursePage.qml7
-rw-r--r--src/qml/CourseSelector.qml66
-rw-r--r--src/qml/CustomLessonSelector.qml86
-rw-r--r--src/qml/HomeScreen.qml7
-rw-r--r--src/qml/InlineToolbar.qml12
-rw-r--r--src/qml/LessonLockedNotice.qml30
-rw-r--r--src/qml/LessonPreview.qml2
-rw-r--r--src/qml/LessonSelector.qml52
-rw-r--r--src/qml/LessonSelectorBase.qml21
-rw-r--r--src/qml/ListItem.qml107
-rw-r--r--src/qml/main.qml8
13 files changed, 213 insertions, 212 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 533dad4..fc8cb2c 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -18,7 +18,7 @@
#include "application.h"
#include <QQmlEngine>
-#include <QJSValue>
+#include <QQmlContext>
#include <KDeclarative/KDeclarative>
@@ -77,10 +77,10 @@ void Application::setupDeclarativeBindings(QQmlEngine* qmlEngine)
kDeclarative.setDeclarativeEngine(qmlEngine);
kDeclarative.setupBindings();
- QJSValue globalObject = qmlEngine->globalObject();
+ QQmlContext* rootContext = qmlEngine->rootContext();
- globalObject.setProperty("utils", qmlEngine->newQObject(new Utils()));
- globalObject.setProperty("strFormatter", qmlEngine->newQObject(new StringFormatter()));
+ rootContext->setContextProperty("utils", new Utils());
+ rootContext->setContextProperty("strFormatter", new StringFormatter());
}
void Application::registerQmlTypes()
diff --git a/src/qml/CourseDescriptionItem.qml b/src/qml/CourseDescriptionItem.qml
index 7d3be36..1ac8a7c 100644
--- a/src/qml/CourseDescriptionItem.qml
+++ b/src/qml/CourseDescriptionItem.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import ktouch 1.0
Rectangle {
@@ -26,9 +27,14 @@ Rectangle {
property string description
property bool active: false
- height: active || content.opacity > 0? childrenRect.height: 0
+ SystemPalette {
+ id: palette
+ colorGroup: SystemPalette.Active
+ }
+
+ height: active || content.opacity > 0? content.height: 0
visible: height > 0
- color: theme.backgroundColor
+ color: palette.base
Behavior on height {
NumberAnimation {
@@ -68,11 +74,10 @@ Rectangle {
}
}
- PlasmaComponents.Label {
+ Label {
id: descriptionLabel
anchors.centerIn: parent
width: parent.width - 10
- font.pointSize: theme.smallestFont.pointSize
}
}
diff --git a/src/qml/CoursePage.qml b/src/qml/CoursePage.qml
index c29c84d..8a0c82a 100644
--- a/src/qml/CoursePage.qml
+++ b/src/qml/CoursePage.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import ktouch 1.0
Item {
diff --git a/src/qml/CourseSelector.qml b/src/qml/CourseSelector.qml
index 6d5413f..5747a47 100644
--- a/src/qml/CourseSelector.qml
+++ b/src/qml/CourseSelector.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import ktouch 1.0
Item {
@@ -107,16 +108,22 @@ Item {
property int currentIndex: -1
}
- Column {
+ SystemPalette {
+ id: palette
+ colorGroup: SystemPalette.Active
+ }
+
+ ColumnLayout {
anchors.fill: parent
+ spacing: 0
Rectangle {
id: head
- width: parent.width
- height: Math.ceil(courseTitleLabel.height + 6)
- color: theme.backgroundColor
+ Layout.fillWidth: true
+ height: Math.ceil(Math.max(courseTitleLabel.height, courseDescriptionButton.height) + 6)
+ color: palette.base
- Row {
+ RowLayout {
anchors {
fill: parent
leftMargin: 5
@@ -125,10 +132,10 @@ Item {
bottomMargin: 3
}
- PlasmaComponents.Label {
+ Label {
+ anchors.verticalCenter: parent.verticalCenter
id: courseTitleLabel
- height: paintedHeight
- font.pointSize: 1.5 * theme.defaultFont.pointSize
+ font.pointSize: 1.5 * Qt.font({'family': 'sansserif'}).pointSize
text: coursePageContainer.activePage.course.title
}
@@ -138,20 +145,22 @@ Item {
width: 3
}
- PlasmaComponents.ToolButton {
+ ToolButton {
id: courseDescriptionButton
- iconSource: "dialog-information"
+ anchors.verticalCenter: parent.verticalCenter
+ iconName: "dialog-information"
checkable: true
}
Item {
- width: parent.width - courseTitleLabel.width - smallSpacer.width - courseDescriptionButton.width - previousButton.width - nextButton.width - (parent.children.length - 1) * parent.spacing
- height: parent.height
+ Layout.fillWidth: true
+ Layout.fillHeight: true
}
- PlasmaComponents.ToolButton {
+ ToolButton {
id: previousButton
- iconSource: "arrow-left"
+ anchors.verticalCenter: parent.verticalCenter
+ iconName: "arrow-left"
enabled: priv.currentIndex > 0
visible: courseRepeater.count > 0
onClicked: {
@@ -160,9 +169,9 @@ Item {
}
}
- PlasmaComponents.ToolButton {
+ ToolButton {
id: nextButton
- iconSource: "arrow-right"
+ iconName: "arrow-right"
enabled: priv.currentIndex < courseRepeater.count
visible: courseRepeater.count > 0
onClicked: {
@@ -173,11 +182,16 @@ Item {
}
}
- CourseDescriptionItem {
- id: courseDescriptionItem
- width: parent.width
- active: courseDescriptionButton.checked
- description: coursePageContainer.activePage.course.description
+ Item {
+ Layout.fillWidth: true
+ Layout.minimumHeight: courseDescriptionItem.height
+ Layout.maximumHeight: courseDescriptionItem.height
+ CourseDescriptionItem {
+ id: courseDescriptionItem
+ active: courseDescriptionButton.checked
+ description: coursePageContainer.activePage.course.description
+ width: parent.width
+ }
}
Item {
@@ -185,8 +199,8 @@ Item {
property CoursePage activePage: page0
property CoursePage inactivePage: page1
- width: parent.width
- height: parent.height - head.height - courseDescriptionItem.height
+ Layout.fillWidth: true
+ Layout.fillHeight: true
CoursePage {
id: page0
diff --git a/src/qml/CustomLessonSelector.qml b/src/qml/CustomLessonSelector.qml
index 3fd9eb0..28c2bca 100644
--- a/src/qml/CustomLessonSelector.qml
+++ b/src/qml/CustomLessonSelector.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import ktouch 1.0
Item {
@@ -54,10 +55,10 @@ Item {
}
function createNewLesson() {
- tmpLesson.id = uuid()
+ tmpLesson.id = utils.uuid()
tmpLesson.title = ""
tmpLesson.text = ""
- if (showCustomLessonDialog(tmpLesson, root.keyboardLayout)) {
+ if (ktouch.showCustomLessonDialog(tmpLesson, root.keyboardLayout)) {
profileDataAccess.storeCustomLesson(tmpLesson, root.profile, keyboardLayoutName)
update()
lessonList.currentIndex = lessonList.count - 2
@@ -66,7 +67,7 @@ Item {
function editLesson() {
tmpLesson.copyFrom(base.selectedLesson)
- if (showCustomLessonDialog(tmpLesson, root.keyboardLayout)) {
+ if (ktouch.showCustomLessonDialog(tmpLesson, root.keyboardLayout)) {
profileDataAccess.storeCustomLesson(tmpLesson, root.profile, keyboardLayoutName)
update()
}
@@ -122,41 +123,40 @@ Item {
anchors.fill: parent
- list: ListView {
- id: lessonList
- anchors.fill: parent
-
- model: course.isValid? course.lessonCount + 1: 0
-
- clip: true
-
- delegate: ListItem {
- property Lesson lesson: index < course.lessonCount? course.lesson(index): null
- property bool isNewButton: index == course.lessonCount
- width: lessonList.width - scrollBar.width
- onClicked: {
- lessonList.currentIndex = index
- if (isNewButton) {
- createNewLesson()
+ list: ScrollView {
+ width: 500
+ height: 500
+ ListView {
+ id: lessonList
+ anchors.fill: parent
+
+ model: course.isValid? course.lessonCount + 1: 0
+
+ clip: true
+
+ delegate: ListItem {
+ property Lesson lesson: index < course.lessonCount? course.lesson(index): null
+ property bool isNewButton: index == course.lessonCount
+ width: lessonList.width
+ onClicked: {
+ lessonList.currentIndex = index
+ if (isNewButton) {
+ createNewLesson()
+ }
}
- }
- onDoubleClicked: {
- if (!isNewButton) {
- lessonSelected(course, lesson)
+ onDoubleClicked: {
+ if (!isNewButton) {
+ lessonSelected(course, lesson)
+ }
}
+ title: isNewButton? i18n("Create New Custom Lesson"): (lesson? lesson.title: "")
+ iconSource: isNewButton? "list-add": ""
+ label.font.italic: isNewButton
}
- title: isNewButton? i18n("Create New Custom Lesson"): (lesson? lesson.title: "")
- iconSource: isNewButton? "list-add": ""
- label.font.italic: isNewButton
- }
-
- onCurrentIndexChanged: updateSelectedLesson()
- onModelChanged: selectLastLesson()
+ onCurrentIndexChanged: updateSelectedLesson()
- PlasmaComponents.ScrollBar {
- id: scrollBar
- flickableItem: lessonList
+ onModelChanged: selectLastLesson()
}
}
@@ -170,16 +170,14 @@ Item {
}
opacity: base.selectedLesson !== null? 1: 0
content: [
- PlasmaComponents.ToolButton {
+ ToolButton {
iconSource: "document-edit"
text: i18n("Edit")
onClicked: editLesson()
- width: minimumWidth
},
- PlasmaComponents.ToolButton {
+ ToolButton {
iconSource: "edit-delete"
text: i18n("Delete")
- width: minimumWidth
onClicked: deleteLesson()
}
]
@@ -204,23 +202,21 @@ Item {
}
opacity: !!lastDeletedLesson? 1: 0
content: [
- PlasmaComponents.Label {
+ Label {
text: i18n("'%1' deleted.", undoToolbar.lastDeletedLessonTitle)
},
Item {
width: 5
height: 1
},
- PlasmaComponents.ToolButton {
+ ToolButton {
iconSource: "edit-undo"
text: i18n("Undo")
- width: minimumWidth
onClicked: undoLessonDeletion()
},
- PlasmaComponents.ToolButton {
+ ToolButton {
iconSource: "dialog-close"
text: i18n("Dismiss")
- width: minimumWidth
onClicked: confirmLessonDeletion()
}
]
diff --git a/src/qml/HomeScreen.qml b/src/qml/HomeScreen.qml
index c92f001..b8199d8 100644
--- a/src/qml/HomeScreen.qml
+++ b/src/qml/HomeScreen.qml
@@ -71,9 +71,10 @@ FocusScope {
ColumnLayout {
anchors.fill: parent
+ spacing: 0
ToolBar {
- visible: homeScreenAccordion.opacity > 0
+ visible: courseSelector.opacity > 0
id: header
Layout.fillWidth: true
@@ -119,9 +120,8 @@ FocusScope {
Layout.fillWidth: true
Layout.fillHeight: true
- /*
CourseSelector {
- id: homeScreenAccordion
+ id: courseSelector
opacity: 1 - initialProfileForm.opacity
courseModel: screen.courseModel
profile: d.profile
@@ -130,7 +130,6 @@ FocusScope {
anchors.fill: parent
onLessonSelected: screen.lessonSelected(course, lesson, d.profile)
}
- */
InitialProfileForm {
id: initialProfileForm
diff --git a/src/qml/InlineToolbar.qml b/src/qml/InlineToolbar.qml
index d456035..b67d3b6 100644
--- a/src/qml/InlineToolbar.qml
+++ b/src/qml/InlineToolbar.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
Item {
@@ -29,10 +28,15 @@ Item {
width: contentArea.width + 6
height: contentArea.height + 6
+ SystemPalette {
+ id: palette
+ colorGroup: SystemPalette.Active
+ }
+
Rectangle {
anchors.fill: parent
id: background
- color: "#888"
+ color: pallete.mid
opacity: 0.7
radius: 3
}
diff --git a/src/qml/LessonLockedNotice.qml b/src/qml/LessonLockedNotice.qml
index 98f21a5..3e9110c 100644
--- a/src/qml/LessonLockedNotice.qml
+++ b/src/qml/LessonLockedNotice.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.qtextracomponents 0.1
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
+import QtGraphicalEffects 1.0
+import org.kde.kquickcontrolsaddons 2.0
+import ktouch 1.0
+
Item {
id: root
@@ -25,11 +30,15 @@ Item {
width: content.width + 40
height: content.height + 40
+ SystemPalette {
+ id: palette
+ colorGroup: SystemPalette.Active
+ }
+
Rectangle {
- anchors.fill: parent
id: background
- color: "#000"
- opacity: 0.7
+ anchors.fill: parent
+ color: palette.base
radius: 15
}
@@ -49,17 +58,16 @@ Item {
QIconItem {
id: icon
anchors.horizontalCenter: parent.horizontalCenter
- icon: QIcon("object-locked")
- width: theme.enormousIconSize
- height: theme.enormousIconSize
+ icon: "object-locked"
+ width: 128
+ height: 128
}
- PlasmaComponents.Label {
+ Label {
id: text
text: i18n("Complete Previous Lessons to Unlock")
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
- color: "#fff"
font.weight: Font.Bold
wrapMode: Text.Wrap
}
diff --git a/src/qml/LessonPreview.qml b/src/qml/LessonPreview.qml
index d648c0a..034bd18 100644
--- a/src/qml/LessonPreview.qml
+++ b/src/qml/LessonPreview.qml
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
+import QtQuick 2.4
import ktouch 1.0
Item {
diff --git a/src/qml/LessonSelector.qml b/src/qml/LessonSelector.qml
index 9ca39ac..85976fd 100644
--- a/src/qml/LessonSelector.qml
+++ b/src/qml/LessonSelector.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import ktouch 1.0
Item {
@@ -86,32 +87,31 @@ Item {
LessonSelectorBase {
anchors.fill: parent
- list: ListView {
- id: lessonList
- property int lastUnlockedIndex: 0
+ list:ScrollView {
anchors.fill: parent
- model: course.isValid? course.lessonCount: 0
- clip: true
- delegate: ListItem {
- property Lesson lesson: index < course.lessonCount? course.lesson(index): null
- property bool locked: index > lessonList.lastUnlockedIndex
- width: lessonList.width - scrollBar.width
- onClicked: lessonList.currentIndex = index
- onDoubleClicked: {
- if (!locked) {
- lessonSelected(course, lesson)
+ ListView {
+ anchors.fill: parent
+ id: lessonList
+ property int lastUnlockedIndex: 0
+ model: course.isValid? course.lessonCount: 0
+ spacing: 3
+ clip: true
+ delegate: ListItem {
+ property Lesson lesson: index < course.lessonCount? course.lesson(index): null
+ property bool locked: index > lessonList.lastUnlockedIndex
+ width: lessonList.width
+ onClicked: lessonList.currentIndex = index
+ onDoubleClicked: {
+ if (!locked) {
+ lessonSelected(course, lesson)
+ }
}
- }
- iconSource: locked? "object-locked": ""
- label.opacity: locked? 0.5: 1.0
- title: lesson? lesson.title: ""
-
- }
- onModelChanged: update()
+ iconSource: locked? "object-locked": ""
+ label.opacity: locked? 0.5: 1.0
+ title: lesson? lesson.title: ""
- PlasmaComponents.ScrollBar {
- id: scrollBar
- flickableItem: lessonList
+ }
+ onModelChanged: update()
}
}
diff --git a/src/qml/LessonSelectorBase.qml b/src/qml/LessonSelectorBase.qml
index e0cca1b..c87fdee 100644
--- a/src/qml/LessonSelectorBase.qml
+++ b/src/qml/LessonSelectorBase.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import ktouch 1.0
Item {
@@ -39,9 +40,10 @@ Item {
id: listContainer
height: parent.height
width: Math.round((parent.width - parent.spacing) / 2)
+
}
- Column {
+ ColumnLayout {
id: column
width: parent.width - listContainer.width - parent.spacing
height: parent.height
@@ -49,8 +51,9 @@ Item {
LessonPreview {
id: lessonPreview
- width: parent.width
- height: parent.height - startButtonContainer.height
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
lesson: selectedLesson
LessonLockedNotice {
@@ -61,15 +64,15 @@ Item {
Item {
id: startButtonContainer
- width: parent.width
+ Layout.fillWidth: true
height: Math.round(1.5 * startButton.height)
- PlasmaComponents.Button {
+ Button {
id: startButton
anchors.centerIn: parent
text: i18n("Start Training")
enabled: selectedLesson !== null && !selectedLessonLocked
- iconSource: "go-next-view"
+ iconName: "go-next-view"
onClicked: startButtonClicked()
}
}
diff --git a/src/qml/ListItem.qml b/src/qml/ListItem.qml
index b8a609b..2185b57 100644
--- a/src/qml/ListItem.qml
+++ b/src/qml/ListItem.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,41 +16,55 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.qtextracomponents 0.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
+import org.kde.kquickcontrolsaddons 2.0
+import ktouch 1.0
Item {
id: root
property alias title: label.text
property string iconSource
property alias label: label
+ property bool isCurrent: ListView.isCurrentItem;
signal clicked
signal doubleClicked
- height: padding.height + bg.margins.top + bg.margins.bottom
- state: ListView.isCurrentItem? "selected": mouseArea.containsMouse? "hover": "normal"
+ height: 2 * content.height
- PlasmaCore.FrameSvgItem {
+ SystemPalette {
+ id: listItemPallete
+ colorGroup: SystemPalette.Active
+ }
+
+ Rectangle {
id: bg
- imagePath: "widgets/viewitem"
- prefix: "hover"
- opacity: 0
anchors.fill: parent
+ color: Qt.rgba(listItemPallete.highlight.r, listItemPallete.highlight.g, listItemPallete.highlight.b, 0.3)
+ radius: 0.2 * height
+ border {
+ width: 1
+ color: listItemPallete.highlight
+ }
+ opacity: root.isCurrent || mouseArea.containsMouse? 1: 0
+ Behavior on opacity {
+ NumberAnimation {
+ duration: 150
+ }
+ }
}
Item {
- id: padding
+ id: content
anchors {
- fill: parent
- topMargin: bg.margins.top
- rightMargin: bg.margins.right
- bottomMargin: bg.margins.bottom
- leftMargin: bg.margins.left
+ verticalCenter: parent.verticalCenter
+ left: parent.left
+ right: parent.right
+ leftMargin: 5
+ rightMargin: 5
}
- width: parent.width
height: Math.max(label.height, label.height)
QIconItem {
@@ -59,12 +74,12 @@ Item {
left: parent.left
verticalCenter: parent.verticalCenter
}
- icon: QIcon(root.iconSource)
- width: theme.smallIconSize
- height: theme.smallIconSize
+ icon: root.iconSource
+ width: 22
+ height: 22
}
- PlasmaComponents.Label {
+ Label {
id: label
elide: Text.ElideRight
anchors {
@@ -72,7 +87,6 @@ Item {
right: parent.right
verticalCenter: parent.verticalCenter
}
- height: paintedHeight
}
}
@@ -83,53 +97,4 @@ Item {
onClicked: root.clicked()
onDoubleClicked: root.doubleClicked()
}
-
- states: [
- State {
- name: "normal"
- PropertyChanges {
- target: bg
- opacity: 0
- }
- },
- State {
- name: "hover"
- PropertyChanges {
- target: bg
- opacity: 1
- prefix: "hover"
- }
- },
- State {
- name: "selected"
- PropertyChanges {
- target: bg
- opacity: 1
- prefix: "selected"
- }
- }
- ]
-
- 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
- }
- }
- ]
}
diff --git a/src/qml/main.qml b/src/qml/main.qml
index 6145356..69e4537 100644
--- a/src/qml/main.qml
+++ b/src/qml/main.qml
@@ -19,8 +19,14 @@
import QtQuick 2.4
import ktouch 1.0
-Item {
+Rectangle {
+ SystemPalette {
+ id: activePallete
+ colorGroup: SystemPalette.Active
+ }
+
id: main
+ color: activePallete.window
function switchScreen(from, to) {
switchScreenAnimation.from = from