Warning, /education/kalgebra/plasmoids/graphsplasmoid/contents/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   Copyright 2012 Aleix Pol Gonzalez <aleixpol@kde.org>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2 or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 import QtQuick 2.0
0021 import org.kde.plasma.components 2.0 as PlasmaComponents
0022 import org.kde.analitza 1.0
0023 
0024 Item {
0025     property Component compactRepresentation: Component {
0026         PlasmaComponents.Button {
0027             iconSource: "kalgebra"
0028             onClicked: plasmoid.togglePopup()
0029         }
0030     }
0031     property string displayedFunction
0032     onDisplayedFunctionChanged: {
0033         plots.clear()
0034         view.addFunction(displayedFunction)
0035     }
0036     
0037     PlasmaComponents.TextField {
0038         id: input
0039         anchors {
0040             top: parent.top
0041             left: parent.left
0042             right: parent.right
0043         }
0044         onAccepted: {
0045             displayedFunction = text
0046             plasmoid.writeConfig("function", text)
0047         }
0048     }
0049     
0050     Component.onCompleted: {
0051         plasmoid.addEventListener('ConfigChanged', function() {
0052             displayedFunction = plasmoid.readConfig("function")
0053             input.text = displayedFunction
0054         });
0055     }
0056     
0057     Graph2D {
0058         id: view
0059         anchors {
0060             fill: parent
0061             topMargin: input.height
0062         }
0063         
0064         model: PlotsModel { id: plots }
0065         
0066         ticksShown: false
0067     }
0068 }