Commit 29e11eaa authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Port kde mobile variant to Kirigami

parent fb36cfb3
......@@ -5,7 +5,6 @@ import widgets 1.0
KAlgebraPage
{
ListModel { id: resultsModel }
Analitza {
id: a
variables: app.variables
......@@ -86,7 +85,7 @@ KAlgebraPage
currentIndex: -1
clip: true
model: resultsModel
model: ListModel { id: resultsModel }
role: "element"
title: "Results:"
}
......
import org.kde.plasma.components 2.0
Button {}
install( FILES
Label.qml Button.qml CalcButton.qml ExpressionInput.qml
Keyboard.qml RealInput.qml SimpleListView.qml
Keyboard.qml SimpleListView.qml
KAlgebraPage.qml KAlgebraMobile.qml
KAlgebraPage.qml KAlgebraMobile.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kalgebramobile/plugins/widgets/
)
install(FILES
../qtcontrols/AddButton.qml ../qtcontrols/ComboBox.qml ../qtcontrols/Dialog.qml ../qtcontrols/Label.qml
../qtcontrols/Button.qml ../qtcontrols/CalcButton.qml ../qtcontrols/RealInput.qml ../qtcontrols/ExpressionInput.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kalgebramobile/plugins/widgets/
)
import QtQuick 2.0
Button
{
onClicked: doOp(text)
}
\ No newline at end of file
import org.kde.plasma.components 2.0
TextField
{
id: input
placeholderText: "Enter the expression to calculate..."
// Keys.onPressed: {
// console.log("bum :: "+text);
// hints.text=text;
// }
//
// ToolTip {
// id: hints
// }
// height: input.font.pixelSize+5
}
// Rectangle
// {
// color: "green"
// }
\ No newline at end of file
import QtQuick 2.0
import QtQuick.Window 2.1
import org.kde.plasma.components 2.0
import org.kde.kquickcontrolsaddons 2.0
import QtQuick 2.2
import QtQuick.Layouts 1.2
import org.kde.kirigami 1.0
import org.kde.analitza 1.0
import org.kde.kalgebra.mobile 1.0
import org.kde.plasma.core 2.0
Window {
height: 400
width: 300
ApplicationWindow
{
id: rootItem
height: 600
width: 600
visible: true
Rectangle {
anchors.fill: parent
color: "black"
opacity: .2
}
function goToPage(path, deco) {
// var toOpen = plugins.pluginPath(idx)
try {
var component = Qt.createComponent(path)
if (component.status == Component.Ready)
pageStack.push(component);
else
console.log("Error loading component:", component.errorString());
} catch (e) {
console.log("error: "+e)
}
}
Page {
id: init
anchors.margins: 10
ListView {
anchors.fill: parent
spacing: 5
move: Transition {
NumberAnimation {
properties: "x,y"
easing.type: Easing.InOutQuad
}
}
delegate: ListItem {
height: 100
enabled: true
Column {
anchors.fill: parent
spacing: 10
QIconItem {
id: icon
width: 50
height: 50
anchors.horizontalCenter: parent.horizontalCenter
icon: decoration
}
globalDrawer: GlobalDrawer {
id: drawer
title: "KAlgebra"
titleIcon: "kalgebra"
Text {
id: description
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
text: i18n("%1<br/>\n<em>%2</em>", title, subtitle)
}
Instantiator {
delegate: Action {
text: title
iconName: decoration
onTriggered: {
var component = Qt.createComponent(model.path);
if (component.status == Component.Error) {
console.log("error", component.errorString());
return;
}
onClicked: goToPage(model.path, decoration)
try {
rootItem.pageStack.clear();
var obj = component.createObject(component);
rootItem.pageStack.push(obj)
} catch(e) {
console.log("error", e)
}
}
model: PluginsModel { id: plugins }
}
tools: ToolBarLayout {}
}
ToolBar {
id: toolBar
z: 10
width: parent.width
height: 40
anchors.top: parent.top
Image {
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
leftMargin: 5
}
source: "qrc:/kde-edu-logo.png"
height: parent.height
fillMode: Image.PreserveAspectFit
smooth: true
MouseArea {
anchors.fill: parent
onClicked: Qt.openUrlExternally("http://edu.kde.org")
model: PluginsModel {}
onObjectAdded: {
var acts = [];
for(var v in drawer.actions) {
acts.push(drawer.actions[v]);
}
acts.splice(index, 0, object)
drawer.actions = acts;
}
onObjectRemoved: {
var acts = [];
for(var v in drawer.actions) {
acts.push(drawer.actions[v]);
}
drawer.actions.splice(drawer.actions.indexOf(object), 1)
drawer.actions = acts;
}
}
actions: []
}
PageStack
{
id: pageStack
width: parent.width
anchors {
top: toolBar.bottom
bottom: parent.bottom
}
initialPage: init
toolBar: toolBar
Component.onCompleted: {
drawer.actions[0].trigger()
}
}
import org.kde.plasma.components 2.0
import org.kde.kirigami 1.0
import QtQuick 2.1
Page {
id: page
height: 100
width: 100
anchors.margins: 10
tools: ToolBarLayout {
ToolButton {
iconSource: "go-previous"
text: i18n("Back")
onClicked: page.pageStack.pop()
}
Page
{
readonly property real dp: Units.devicePixelRatio
title: "KAlgebra"
default property alias contents: item.data
Item {
id: item
anchors.fill: parent
}
}
import org.kde.plasma.components 2.0
import QtQuick 2.0
Label {
onLinkActivated: Qt.openUrlExternally(link)
}
import QtQuick 2.0
import org.kde.plasma.components 2.0
TextField
{
property double value: parseFloat(text)
property alias minimumValue: realvalidator.bottom
property alias maximumValue: realvalidator.top
inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText
text: value.toString()
validator: DoubleValidator { id: realvalidator }
onTextChanged: value=parseFloat(text)
Component.onCompleted: text=value
}
\ No newline at end of file
import org.kde.plasma.components 2.0
import org.kde.kirigami 1.0
import QtQuick.Controls 1.1
import QtQuick 2.0
ListView
......@@ -6,21 +7,8 @@ ListView
id: scrollList
property string role: ""
property string title: ""
delegate: Label { text: model[role] }
delegate: BasicListItem { label: model[role] }
header: Label { visible: ListView.view.title!=""; text: ListView.view.title }
clip: true
ScrollBar {
id: scrollBar
orientation: Qt.Vertical
flickableItem: scrollList
stepSize: 40
scrollButtonInterval: 50
anchors {
top: scrollList.top
right: scrollList.right
bottom: scrollList.bottom
}
}
}
Markdown is supported
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