aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2015-06-02 11:22:05 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2015-06-02 12:12:01 (GMT)
commit594617c89af8abca238f9e77c7b9b1ab0ec4e8c0 (patch)
tree4cff46fd6c1bf46b26d27c39426839c3529da018
parent00d90c30371310cd1aef0c0ac1ecac8d37d504d1 (diff)
Qt5: Port InitialProfileForm.qml And Friends
The app welcome screen works again, but for some reason the new profile doesn't end up in the database.
-rw-r--r--src/qml/DetailedRadioButton.qml22
-rw-r--r--src/qml/HomeScreen.qml41
-rw-r--r--src/qml/InitialProfileForm.qml84
-rw-r--r--src/qml/ProfileForm.qml15
-rw-r--r--src/qml/main.qml5
5 files changed, 60 insertions, 107 deletions
diff --git a/src/qml/DetailedRadioButton.qml b/src/qml/DetailedRadioButton.qml
index acfacd5..041d9dd 100644
--- a/src/qml/DetailedRadioButton.qml
+++ b/src/qml/DetailedRadioButton.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2014 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,11 +16,11 @@
* 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
-Column {
+ColumnLayout {
id: root
property alias checked: radioButton.checked
@@ -31,18 +32,17 @@ Column {
Row {
id: radioButtonRow
- width: parent.width
+ Layout.fillWidth: true
spacing: Math.round(label.height / 4)
- PlasmaComponents.RadioButton {
+ RadioButton {
id: radioButton
anchors.verticalCenter: parent.verticalCenter
}
- PlasmaComponents.Label {
+ Label {
id: label
anchors.verticalCenter: parent.verticalCenter
- height: paintedHeight
/*
* The text wrapping of the label doesn't work if it is invible
* (wrapped at every character), hence the following hack.
@@ -61,7 +61,7 @@ Column {
}
Row {
- width: parent.width
+ Layout.fillWidth: true
spacing: radioButtonRow.spacing
Item {
@@ -69,11 +69,9 @@ Column {
height: hint.height
}
- PlasmaComponents.Label {
+ Label {
id: hint
- font.pointSize: theme.smallestFont.pointSize
font.italic: true
- height: paintedHeight
width: visible? parent.width - radioButton.width - parent.spacing: 0
wrapMode: Text.Wrap
opacity: radioButton.opacity
diff --git a/src/qml/HomeScreen.qml b/src/qml/HomeScreen.qml
index 3f8d498..c92f001 100644
--- a/src/qml/HomeScreen.qml
+++ b/src/qml/HomeScreen.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
FocusScope {
@@ -68,22 +69,24 @@ FocusScope {
preferences.writeConfig()
}
- Column {
+ ColumnLayout {
anchors.fill: parent
- spacing: header.margins.bottom / 2
- PlasmaComponents.ToolBar {
+ ToolBar {
visible: homeScreenAccordion.opacity > 0
id: header
- width: parent.width
- tools: Row {
+ Layout.fillWidth: true
+
+ RowLayout {
+ anchors.fill: parent
anchors.leftMargin: 3
anchors.rightMargin: 3
spacing: 5
- PlasmaComponents.ToolButton {
+ ToolButton {
+ // TODO: Find a better control here which supports both an icon and a label
id: profileButton
- iconSource: "user-identity"
+ // iconName: "user-identity"
text: d.profile !== null? d.profile.name: ""
onClicked: {
if (profileSelectorSheet.isOpen()) {
@@ -94,20 +97,18 @@ FocusScope {
}
}
checked: profileSelectorSheet.isOpen()
- width: minimumWidth
}
Item {
- height: parent.height
- width: parent.width - profileButton.width - configureButton.width - (parent.children.length - 1) * parent.spacing
+ Layout.fillWidth: true
}
- PlasmaComponents.ToolButton {
+ ToolButton {
id: configureButton
- iconSource: "configure"
+ iconName: "configure"
onClicked: {
var position = mapToItem(null, 0, height)
- showMenu(position.x, position.y)
+ ktouch.showMenu(position.x, position.y)
}
}
}
@@ -115,9 +116,10 @@ FocusScope {
Item {
id: content
- width: parent.width
- height: parent.height - header.height
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ /*
CourseSelector {
id: homeScreenAccordion
opacity: 1 - initialProfileForm.opacity
@@ -128,6 +130,7 @@ FocusScope {
anchors.fill: parent
onLessonSelected: screen.lessonSelected(course, lesson, d.profile)
}
+ */
InitialProfileForm {
id: initialProfileForm
@@ -143,6 +146,7 @@ FocusScope {
}
}
+ /*
SheetDialog {
id: profileSelectorSheet
anchors.fill: parent
@@ -161,6 +165,7 @@ FocusScope {
}
}
}
+ */
}
}
}
diff --git a/src/qml/InitialProfileForm.qml b/src/qml/InitialProfileForm.qml
index a410803..da1e609 100644
--- a/src/qml/InitialProfileForm.qml
+++ b/src/qml/InitialProfileForm.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,10 +16,9 @@
* 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 ktouch 1.0
FocusScope {
@@ -32,74 +32,24 @@ FocusScope {
profileDataAccess.addProfile(profile)
}
- PlasmaCore.FrameSvgItem {
+ GroupBox {
id: frame
anchors.centerIn: parent
+ title: i18n("Welcome to Typewriting Trainer")
width: form.width + 150
height: form.height + 80
- imagePath: "widgets/frame"
- prefix: "raised"
- Column {
- id: layout
-
- anchors {
- fill: parent
- topMargin: frame.margins.top
- rightMargin: frame.margins.right
- bottomMargin: frame.margins.bottom
- leftMargin: frame.margins.left
- }
-
- spacing: 0
-
- Item {
- id: header
- height: 20
- width: parent.width
-
- Row {
- anchors.centerIn: parent
- spacing: 6
-
- QIconItem {
- icon: QIcon("ktouch")
- width: theme.smallIconSize
- height: theme.smallIconSize
- }
-
- PlasmaComponents.Label {
- id: titleLabel
- text: i18n("Welcome to Typewriting Trainer")
- height: paintedHeight
- }
-
- }
- }
-
- PlasmaCore.SvgItem {
- id: line
- width: parent.width
- height: naturalSize.height
- elementId: "horizontal-line"
- svg: PlasmaCore.Svg {
- imagePath: "widgets/line"
- }
- }
-
- Item {
- id: content
- width: parent.width
- height: parent.height - header.height - line.height
-
- ProfileForm {
- id: form
- width: 400
- anchors.centerIn: parent
- doneButtonIconSource: "go-next-view"
- doneButtonText: i18n("Start Training")
- onDone: save()
- }
+ Item {
+ id: content
+ anchors.fill: parent
+
+ ProfileForm {
+ id: form
+ width: 400
+ anchors.centerIn: parent
+ doneButtonIconSource: "go-next-view"
+ doneButtonText: i18n("Start Training")
+ onDone: save()
}
}
}
diff --git a/src/qml/ProfileForm.qml b/src/qml/ProfileForm.qml
index a11d9c5..165208d 100644
--- a/src/qml/ProfileForm.qml
+++ b/src/qml/ProfileForm.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
Column {
@@ -39,13 +40,13 @@ Column {
spacing: 15
- PlasmaComponents.Label {
+ Label {
id: welcomeLabel
width: parent.width
text: i18n("Before you start training, please introduce yourself:")
}
- PlasmaComponents.TextField {
+ TextField {
id: nameTextField
width: parent.width
placeholderText: i18n("Name")
@@ -79,12 +80,12 @@ Column {
}
}
- PlasmaComponents.Button {
+ Button {
id: doneBtn
anchors.horizontalCenter: parent.horizontalCenter
text: i18n("Done")
enabled: nameTextField.text !== "" && (beginnerRadioButton.checked || advancedRadioButton.checked)
- iconSource: "dialog-ok"
+ iconName: "dialog-ok"
onClicked: done()
}
}
diff --git a/src/qml/main.qml b/src/qml/main.qml
index 02f4112..6145356 100644
--- a/src/qml/main.qml
+++ b/src/qml/main.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
@@ -117,7 +118,6 @@ Item {
id: customLessonCopy
}
- /*
HomeScreen {
id: homeScreen
anchors.fill: parent
@@ -154,6 +154,7 @@ Item {
}
}
+ /*
TrainingScreen {
id: trainingScreen
anchors.fill: parent
@@ -190,7 +191,6 @@ Item {
opacity: 0
}
- /*
SequentialAnimation
{
id: switchScreenAnimation
@@ -230,5 +230,4 @@ Item {
}
}
}
- */
}