I have made the following changes intended for : CE:Apps / qmlcalc Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.pub.meego.com//request/show/8374 Thank You, Robin Burchell [This message was auto-generated] --- Request # 8374: Messages from BOSS: State: review at 2013-03-06T00:19:52 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:w00t:branches:CE:Apps / qmlcalc -> CE:Apps / qmlcalc changes files: -------------- --- qmlcalc.changes +++ qmlcalc.changes @@ -0,0 +1,3 @@ +* Wed Mar 06 2013 Robin Burchell <[email protected]> - 0.1.1 +- Fixes: NEMO#591 - Landscape mode stopped working + old: ---- qmlcalc-0.1.0.tar.bz2 new: ---- qmlcalc-0.1.1.tar.bz2 spec files: ----------- --- qmlcalc.spec +++ qmlcalc.spec @@ -9,7 +9,7 @@ # << macros Summary: MeeGo QML Harmattan-esque calculator -Version: 0.1.0 +Version: 0.1.1 Release: 1 Group: Applications/System License: LGPL v2.1 other changes: -------------- ++++++ qmlcalc-0.1.0.tar.bz2 -> qmlcalc-0.1.1.tar.bz2 --- CalcButton.qml +++ CalcButton.qml @@ -1,4 +1,4 @@ - /**************************************************************************** +/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. @@ -39,65 +39,65 @@ ** ****************************************************************************/ - import QtQuick 1.1 +import QtQuick 1.1 - Item { - id: button +Item { + id: button - property alias operation: buttonText.text - property alias color: buttonText.color - property bool togglable: false - - signal clicked - - Text { - id: buttonText - anchors.centerIn: parent; anchors.verticalCenterOffset: -1 - font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5 - style: Text.Sunken; color: "white"; styleColor: Qt.lighter(color, 1.2); smooth: true - - Rectangle { - id: shade - anchors.centerIn: parent; - width: (parent.width > parent.height) ? parent.width : parent.height - height: width - radius: 20; color: "#63B8FF"; opacity: 0 - } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: { - doOp(operation) - button.clicked() - } - } - - states: [ - State { - name: "pressed"; when: mouseArea.pressed == true - PropertyChanges { target: shade; opacity: .4 } - PropertyChanges { target: shade; scale: 1.5 } - PropertyChanges { target: button; z: 1 } - }, + property alias operation: buttonText.text + property alias color: buttonText.color + property bool togglable: false + + signal clicked + + Text { + id: buttonText + anchors.centerIn: parent; anchors.verticalCenterOffset: -1 + font.pixelSize: parent.width > parent.height ? parent.height * .6 : parent.width * .6 + style: Text.Sunken; color: "white"; styleColor: Qt.lighter(color, 1.2); smooth: true + + Rectangle { + id: shade + anchors.centerIn: parent; + width: Math.max(parent.width, parent.height) + height: width + radius: 20; color: "#63B8FF"; opacity: 0 + } + } - State { - name: "toggled" - when: calcwindow.displayOperation == button.operation && button.togglable - PropertyChanges { target: shade; opacity: .6 } - PropertyChanges { target: shade; scale: 1.8 } + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + doOp(operation) + button.clicked() } - ] + } + + states: [ + State { + name: "pressed"; when: mouseArea.pressed == true + PropertyChanges { target: shade; opacity: .4 } + PropertyChanges { target: shade; scale: 1.5 } + PropertyChanges { target: button; z: 1 } + }, + + State { + name: "toggled" + when: calcwindow.displayOperation == button.operation && button.togglable + PropertyChanges { target: shade; opacity: .6 } + PropertyChanges { target: shade; scale: 1.5 } + } + ] - transitions: [ + transitions: [ Transition { from: "" to: "pressed" NumberAnimation { - properties: "z,scale"; - easing.type: Easing.OutExpo; - duration: 50 + properties: "z,scale"; + easing.type: Easing.OutExpo; + duration: 50 } NumberAnimation { properties: "opacity"; @@ -133,6 +133,6 @@ duration: 300 } } - ] - } + ] +} --- Display.qml +++ Display.qml @@ -1,4 +1,4 @@ - /**************************************************************************** +/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. @@ -39,19 +39,19 @@ ** ****************************************************************************/ - import QtQuick 1.1 - import "qrc:/js/calculator.js" as CalcEngine +import QtQuick 1.1 +import "qrc:/js/calculator.js" as CalcEngine Item { Text { id: displayText - text: calcwindow.displayText; + text: calcwindow.displayText.length > 0 ? calcwindow.displayText : calcwindow.previousText color: "#FF8600"; smooth: true; font.bold: true Component.onCompleted: refitText() horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter; anchors { - right: operationText.left + right: leftArrowButton.left rightMargin: 6 left: parent.left top: parent.top @@ -81,18 +81,7 @@ } } - Text { - id: operationText - font.bold: true; font.pixelSize: parent.height * .7 - color: "#CD6600"; smooth: true - anchors { - leftMargin: 6; - verticalCenterOffset: -3; verticalCenter: parent.verticalCenter; - right: leftArrowButton.left } - text: calcwindow.displayOperation - } - - CalcButton { + CalcButton { id: leftArrowButton width: height; height: parent.height * 0.6; @@ -101,6 +90,5 @@ right: parent.right; rightMargin: 6 verticalCenter: parent.verticalCenter; verticalCenterOffset: -1 } - } - + } } --- HistoryDisplay.qml +++ HistoryDisplay.qml @@ -0,0 +1,104 @@ +import QtQuick 1.1 +import "qrc:/js/calculator.js" as CalcEngine + +Flickable { + id: scrollArea + contentWidth: text.paintedWidth + contentHeight: text.paintedHeight + clip: true + flickableDirection: Flickable.VerticalFlick + + property string historyText: "" + property string currentText: "" + property bool hasOperation: false + + function updateText() { + var re = "" + var hadOperation = hasOperation + hasOperation = false + + if (calcwindow.displayPrevious != "") + re = calcwindow.displayPrevious + " " + if (calcwindow.displayOperation != "") { + re += "<span style='color:#cd6600'>" + calcwindow.displayOperation + "</span> " + hasOperation = true + } + + re += calcwindow.displayText + + if (currentText != "" && calcwindow.displayPrevious == "" && hadOperation) { + historyText += currentText + "<div align=right><span style='color:#cd6600'>=</span> " + calcwindow.displayText + "</div>" + currentText = "" + } else + currentText = re + } + + Component.onCompleted: updateText() + onHeightChanged: scrollArea.contentY = Math.max(0, scrollArea.contentHeight - scrollArea.height) + + TextEdit { + id: text + width: scrollArea.width + height: scrollArea.height + + color: "white" + font.pixelSize: 40 + readOnly: true + + text: historyText + "<div align=left>" + currentText + "</div>" + + onTextChanged: { + scrollArea.contentY = Math.max(0, scrollArea.contentHeight - scrollArea.height) + } + } + + MouseArea { + width: scrollArea.width + height: scrollArea.contentHeight + + onClicked: { + var pos = text.positionAt(mouse.x, mouse.y)-1 + + // TextEdit offers no way to get plain text directly. The text property + // returns a ton of HTML, but these positions are based on plain text. + // The only way I can find to get that is through selectedText. + text.selectAll() + var str = text.selectedText.toString() + text.deselect() + + for (; pos >= 0; pos--) { + if ((str[pos] < '0' || str[pos] > '9') && + str[pos] != '-' && str[pos] != '.') + break + } + pos++ + + var end + for (end = pos; end < str.length; end++) { + if ((str[end] < '0' || str[end] > '9') && + str[end] != '-' && str[end] != '.') + break + } + if (end == pos) + return + + var word = str.substr(pos, end - pos) + if (word == '-') + return + + for (var i = 0; i < word.length; i++) { + if (word[i] != '-') + calcwindow.doOp(word[i]) + } + + if (word[0] == '-') + calcwindow.doOp(CalcEngine.plusminus) + + // Fake an equals sign after; this ensures that further number input + // will replace the number instead of appending to it, but operators + // work as normal. + calcwindow.doOp('=') + } + } +} + --- calculator.js +++ calculator.js @@ -1,4 +1,3 @@ - var rotateLeft = "\u2939" var rotateRight = "\u2935" var leftArrow = "\u2190" @@ -7,107 +6,110 @@ var squareRoot = "\u221a" var plusminus = "\u00b1" +var currentText = "0" +var lastText = "" +// currentOperation -var curVal = 0 var memory = 0 var lastOp = "" var timer = 0 var currentOperation = "" - function disabled(op) { - if (op == "." && calcwindow.displayText.toString().indexOf(".") != -1) { - return true - } else if (op == squareRoot && calcwindow.displayText.toString().search(/-/) != -1) { - return true - } else { - return false - } - } +function disabled(op) { + if (op == "." && currentText.toString().indexOf(".") != -1) { + return true + } else if (op == squareRoot && currentText.toString().search(/-/) != -1) { + return true + } else { + return false + } +} function doOperation(op) { if (disabled(op)) { return } - if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) { - if (calcwindow.displayText.toString().length >= 14) - return; // No arbitrary length numbers - if (lastOp.toString().length == 1 && - ((lastOp >= "0" && lastOp <= "9") || - lastOp == ".") || - lastOp == leftArrow) { - if (calcwindow.displayText == "0") - calcwindow.displayText = op.toString() - else - calcwindow.displayText = calcwindow.displayText + op.toString() - } else { - calcwindow.displayText = op - } - lastOp = op - calcwindow.displayOperation = "" - return - } - lastOp = op - - if (currentOperation == "+") { - calcwindow.displayText = Number(calcwindow.displayText.valueOf()) + Number(curVal.valueOf()) - } else if (currentOperation == "-") { - calcwindow.displayText = Number(curVal) - Number(calcwindow.displayText.valueOf()) - } else if (currentOperation == multiplication) { - calcwindow.displayText = Number(curVal) * Number(calcwindow.displayText.valueOf()) - } else if (currentOperation == division) { - calcwindow.displayText = Number(Number(curVal) / - Number(calcwindow.displayText.valueOf())).toString() - } else if (currentOperation == "=") { - } - - if (op == "+" || op == "-" || op == multiplication || op == division) { - calcwindow.displayOperation = op - currentOperation = op - curVal = calcwindow.displayText.valueOf() - return - } - - currentOperation = "" - calcwindow.displayOperation = "" - - curVal = 0 - - if (op == "1/x") { - calcwindow.displayText = (1 / calcwindow.displayText.valueOf()).toString() - } else if (op == "x^2") { - calcwindow.displayText = (calcwindow.displayText.valueOf() * - calcwindow.displayText.valueOf()).toString() - } else if (op == "Abs") { - calcwindow.displayText = (Math.abs(calcwindow.displayText.valueOf())).toString() - } else if (op == "Int") { - calcwindow.displayText = (Math.floor(calcwindow.displayText.valueOf())).toString() - } else if (op == plusminus) { - calcwindow.displayText = (calcwindow.displayText.valueOf() * -1).toString() - } else if (op == squareRoot) { - calcwindow.displayText = (Math.sqrt(calcwindow.displayText.valueOf())).toString() - } else if (op == "mc") { - memory = 0; - } else if (op == "m+") { - memory += calcwindow.displayText.valueOf() - } else if (op == "mr") { - calcwindow.displayText = memory.toString() - } else if (op == "m-") { - memory = calcwindow.displayText.valueOf() - } else if (op == leftArrow) { - calcwindow.displayText = calcwindow.displayText.toString().slice(0, -1) - if (calcwindow.displayText.length == 0) { - calcwindow.displayText = "0" - } - } else if (op == "Off") { - Qt.quit(); - } else if (op == "C") { - calcwindow.displayText = "0" - } else if (op == "AC") { - curVal = 0 - memory = 0 - lastOp = "" - calcwindow.displayText ="0" - } - } + if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) { + if (currentText.toString().length >= 14) + return; // No arbitrary length numbers + if (currentText == "0" || lastOp == '=') + currentText = op.toString() + else + currentText = currentText + op.toString() + lastOp = op + calcwindow.displayOperation = "" + return + } + lastOp = op + + if (op == plusminus) { + if (Number(currentText.valueOf()) != 0) + currentText = (currentText.valueOf() * -1).toString() + else if (currentText == "-") + currentText = "0" + else + currentText = "-" + return + } + + if (currentOperation == "+") { + currentText = Number(currentText.valueOf()) + Number(lastText.valueOf()) + } else if (currentOperation == "-") { + currentText = Number(lastText.valueOf()) - Number(currentText.valueOf()) + } else if (currentOperation == multiplication) { + currentText = Number(lastText.valueOf()) * Number(currentText.valueOf()) + } else if (currentOperation == division) { + currentText = Number(Number(lastText.valueOf()) / + Number(currentText.valueOf())).toString() + } else if (currentOperation == "=") { + } + + if (op == "+" || op == "-" || op == multiplication || op == division) { + calcwindow.displayOperation = op + currentOperation = op + lastText = currentText + currentText = "" + return + } + + currentOperation = "" + calcwindow.displayOperation = "" + + lastText = "" + + if (op == "1/x") { + currentText = (1 / currentText.valueOf()).toString() + } else if (op == "x^2") { + currentText = (currentText.valueOf() * + currentText.valueOf()).toString() + } else if (op == "Abs") { + currentText = (Math.abs(currentText.valueOf())).toString() + } else if (op == "Int") { + currentText = (Math.floor(currentText.valueOf())).toString() + } else if (op == squareRoot) { + currentText = (Math.sqrt(currentText.valueOf())).toString() + } else if (op == "mc") { + memory = 0; + } else if (op == "m+") { + memory += currentText.valueOf() + } else if (op == "mr") { + currentText = memory.toString() + } else if (op == "m-") { + memory = currentText.valueOf() + } else if (op == leftArrow) { + currentText = currentText.toString().slice(0, -1) + if (currentText.length == 0) { + currentText = "0" + } + } else if (op == "Off") { + Qt.quit(); + } else if (op == "C") { + currentText = "0" + } else if (op == "AC") { + memory = 0 + lastOp = "" + currentText ="0" + } +} --- debian +++ debian -(directory) --- debian/changelog +++ debian/changelog @@ -1,5 +0,0 @@ -qmlcalc (0.1-1) unstable; urgency=low - - * Initial release - - -- Robin Burchell <robin+qmlcalc @viroteck.net> Wed, 27 Jul 2011 15:17:45 +0100 --- debian/compat +++ debian/compat @@ -1 +0,0 @@ -7 --- debian/control +++ debian/control @@ -1,13 +0,0 @@ -Source: qmlcalc -Section: user/Other -Priority: extra -Maintainer: Robin Burchell <[email protected]> -Build-Depends: debhelper (>= 7), dpatch -Standards-Version: 3.8.4 -Homepage: <insert the upstream URL, if relevant> - -Package: qmlcalc -Architecture: any -Depends: qt-components, ${shlibs:Depends}, ${misc:Depends} -Description: <insert up to 60 chars description> - <insert long description, indented with spaces> --- debian/copyright +++ debian/copyright @@ -1,26 +0,0 @@ -This package was debianized by: - - Robin Burchell <[email protected]> on Wed, 27 Jul 2011 15:17:45 +0100 - -It was downloaded from: - - <url://example.com or remove> - -Upstream Author(s): - - Robin Burchell <[email protected]> - -Copyright: - - Copyright (C) 2011 Robin Burchell - -License: - - <specify license> - -The Debian packaging is: - - Copyright C) 2011, Robin Burchell <[email protected]> - - <specify license of debianized version or remove> - --- debian/rules +++ debian/rules @@ -1,93 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - - - - - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - - touch configure-stamp - qmake -recursive - - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - - # Add here commands to compile the package. - $(MAKE) - #docbook-to-man debian/myprogram.sgml > myprogram.1 - - touch $@ - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) clean - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_prep - dh_installdirs - - # Add here commands to install the package into debian/myprogram. - $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/qmlcalc install - - -# Build architecture-independent files here. -binary-indep: install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples -# dh_install -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_python -# dh_installinit -# dh_installcron -# dh_installinfo - dh_installman - dh_link - dh_strip - dh_compress - dh_fixperms -# dh_perl -# dh_makeshlibs - dh_installdeb - dh_shlibdeps - - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure --- debian/substvars +++ debian/substvars @@ -1 +0,0 @@ -shlibs:Depends=libc6 (>= 2.1.3), libc6 (>= 2.3.6-6~), libgcc1 (>= 1:4.1.1), libqjson0, libqt4-network (>= 4.7.4~git20110517), libqtcore4 (>= 4.7.4~git20110517), libqtgui4 (>= 4.7.4~git20110517), libstdc++6 (>= 4.1.1) --- main.qml +++ main.qml @@ -1,4 +1,4 @@ - /**************************************************************************** +/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. @@ -39,122 +39,150 @@ ** ****************************************************************************/ - import QtQuick 1.1 - import com.nokia.meego 1.0 - import "qrc:/js/calculator.js" as CalcEngine +import QtQuick 1.1 +import com.nokia.meego 1.0 +import "qrc:/js/calculator.js" as CalcEngine - PageStackWindow { +PageStackWindow { id: calcwindow Component.onCompleted: { theme.inverted = true } - function doOp(operation) { CalcEngine.doOperation(operation) } - property string displayOperation: "" property string displayText: "0" + property string displayPrevious: "" - initialPage: Page { - orientationLock: PageOrientation.LockPortrait - - Item { - id: main - state: "orientation Portrait" - //+ runtime.orientation - - width: parent.width; height: parent.height; anchors.centerIn: parent - - Column { - id: box; spacing: 8 - - anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 } + function doOp(operation) { + CalcEngine.doOperation(operation) + displayOperation = CalcEngine.currentOperation + displayText = CalcEngine.currentText + displayPrevious = CalcEngine.lastText + history.updateText() + } - Display { - id: display - width: box.width-3 - height: 150 - } + initialPage: Page { + Item { + id: main + anchors.fill: parent + anchors.margins: 6 + anchors.topMargin: 0 + + Column { + id: box; spacing: 8 + + anchors { + top: parent.top + left: parent.left + right: parent.right + } + + Display { + id: display + width: box.width-3 + height: 150 + } - Rectangle { + Rectangle { height: 1 - width: grid.width * 0.8 + width: box.width color: "#444444" anchors { horizontalCenter: parent.horizontalCenter; verticalCenterOffset: -1 } - } + } + } - // TODO: optimise for landscape layout - Grid { - property real h: ((box.height - (display.height)) / 6) - ((spacing * (6 - 1)) / 6) - id: grid; rows: 6; columns: 3; spacing: 6 - - property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns) - - CalcButton { width: grid.w; height: grid.h; color: '#333333'; operation: "C" } - CalcButton { width: grid.w; height: grid.h; operation: CalcEngine.division; togglable: true } - CalcButton { width: grid.w; height: grid.h; operation: CalcEngine.multiplication; togglable: true } - - CalcButton { width: grid.w; height: grid.h; operation: CalcEngine.plusminus } - CalcButton { width: grid.w; height: grid.h; operation: "-"; togglable: true } - CalcButton { width: grid.w; height: grid.h; operation: "+"; togglable: true } - - CalcButton { width: grid.w; height: grid.h; operation: "7"; } - CalcButton { width: grid.w; height: grid.h; operation: "8"; } - CalcButton { width: grid.w; height: grid.h; operation: "9"; } - - CalcButton { width: grid.w; height: grid.h; operation: "4"; } - CalcButton { width: grid.w; height: grid.h; operation: "5"; } - CalcButton { width: grid.w; height: grid.h; operation: "6"; } - - CalcButton { width: grid.w; height: grid.h; operation: "1"; } - CalcButton { width: grid.w; height: grid.h; operation: "2"; } - CalcButton { width: grid.w; height: grid.h; operation: "3"; } - - CalcButton { width: grid.w; height: grid.h; operation: "0"; } - CalcButton { width: grid.w; height: grid.h; operation: "." } - CalcButton { width: grid.w; height: grid.h; operation: "="; color: '#FCB514' } - - /* - * TODO: fit these into some kind of advanced layout - CalcButton { width: grid.w; height: grid.h; operation: CalcEngine.squareRoot } - CalcButton { width: grid.w; height: grid.h; operation: "x^2" } - CalcButton { width: grid.w; height: grid.h; operation: "1/x" } - CalcButton { width: grid.w; height: grid.h; color: 'green'; operation: "mc" } - CalcButton { width: grid.w; height: grid.h; color: 'green'; operation: "m+" } - CalcButton { width: grid.w; height: grid.h; color: 'green'; operation: "m-" } - CalcButton { width: grid.w; height: grid.h; color: 'green'; operation: "mr" } - CalcButton { width: grid.w; height: grid.h; color: 'purple'; operation: "Off" } - CalcButton { width: grid.w; height: grid.h; color: 'purple'; operation: "AC" } - */ - } - } - /* - states: [ - State { - name: "orientation " + Orientation.Landscape - PropertyChanges { target: main; rotation: 90; width: - calcwindow.height; height: calcwindow.width } - }, - State { - name: "orientation " + Orientation.PortraitInverted - PropertyChanges { target: main; rotation: 180; } - }, - State { - name: "orientation " + Orientation.LandscapeInverted - PropertyChanges { target: main; rotation: 270; width: - calcwindow.height; height: calcwindow.width } - } - ] - */ - transitions: Transition { - SequentialAnimation { - RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint } - NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint } - } - } - } - } - } + HistoryDisplay { + id: history + anchors.right: grid.left + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: 12 + } + + Rectangle { + anchors.left: history.right + anchors.leftMargin: 24 + anchors.top: parent.top + anchors.topMargin: 12 + anchors.bottom: parent.bottom + anchors.bottomMargin: 12 + + width: 1 + color: "#444444" + visible: history.visible + } + + Grid { + id: grid + spacing: 6 + rows: 6 + columns: 3 + anchors.top: box.bottom + + property real w: ((main.width - x) / columns) - ((spacing * (columns - 1)) / columns) + property real h: ((main.height - y) / rows) - ((spacing * (rows - 1)) / rows) + + CalcButton { width: grid.w; height: grid.h; color: '#333333'; operation: "C" } + CalcButton { width: grid.w; height: grid.h; operation: CalcEngine.division; togglable: true } + CalcButton { width: grid.w; height: grid.h; operation: CalcEngine.multiplication; togglable: true } + + CalcButton { width: grid.w; height: grid.h; operation: CalcEngine.plusminus } + CalcButton { width: grid.w; height: grid.h; operation: "-"; togglable: true } + CalcButton { width: grid.w; height: grid.h; operation: "+"; togglable: true } + + CalcButton { width: grid.w; height: grid.h; operation: "7"; } + CalcButton { width: grid.w; height: grid.h; operation: "8"; } + CalcButton { width: grid.w; height: grid.h; operation: "9"; } + + CalcButton { width: grid.w; height: grid.h; operation: "4"; } + CalcButton { width: grid.w; height: grid.h; operation: "5"; } + CalcButton { width: grid.w; height: grid.h; operation: "6"; } + + CalcButton { width: grid.w; height: grid.h; operation: "1"; } + CalcButton { width: grid.w; height: grid.h; operation: "2"; } + CalcButton { width: grid.w; height: grid.h; operation: "3"; } + + CalcButton { width: grid.w; height: grid.h; operation: "0"; } + CalcButton { width: grid.w; height: grid.h; operation: "." } + CalcButton { width: grid.w; height: grid.h; operation: "="; color: '#FCB514' } + } + + states: [ + State { + name: "portait" + when: screen.currentOrientation == Screen.Portrait + PropertyChanges { + target: history + visible: false + } + PropertyChanges { + target: box + visible: true + } + }, + State { + name: "landscape" + when: screen.currentOrientation == Screen.Landscape + PropertyChanges { + target: history + visible: true + } + PropertyChanges { + target: box + visible: false + } + AnchorChanges { + target: grid + anchors.left: main.horizontalCenter + anchors.top: main.top + } + } + ] + } + } +} --- qmlcalc.pro +++ qmlcalc.pro @@ -19,7 +19,8 @@ calculator.js \ main.qml \ Display.qml \ - CalcButton.qml + CalcButton.qml \ + HistoryDisplay.qml target.path = /usr/bin --- res.qrc +++ res.qrc @@ -3,6 +3,7 @@ <file>CalcButton.qml</file> <file>Display.qml</file> <file>main.qml</file> + <file>HistoryDisplay.qml</file> </qresource> <qresource prefix="/js"> <file>calculator.js</file> --- rpm +++ rpm +(directory) --- rpm/qmlcalc.spec +++ rpm/qmlcalc.spec @@ -0,0 +1,65 @@ +# +# Do NOT Edit the Auto-generated Part! +# Generated by: spectacle version 0.25 +# + +Name: qmlcalc + +# >> macros +# << macros + +Summary: MeeGo QML Harmattan-esque calculator +Version: 0.1.0 +Release: 1 +Group: Applications/System +License: LGPL v2.1 +URL: http://github.com/nemomobile/qmlcalc +Source0: %{name}-%{version}.tar.bz2 +Source100: qmlcalc.yaml +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(QtDeclarative) +BuildRequires: pkgconfig(QtGui) +BuildRequires: pkgconfig(qdeclarative-boostable) +BuildRequires: desktop-file-utils + +%description +Calculator application written using QML + + + +%prep +%setup -q -n %{name}-%{version} + +# >> setup +# << setup + +%build +# >> build pre +# << build pre + +%qmake + +make %{?jobs:-j%jobs} + +# >> build post +# << build post + +%install +rm -rf %{buildroot} +# >> install pre +# << install pre +%qmake_install + +# >> install post +# << install post + +desktop-file-install --delete-original \ + --dir %{buildroot}%{_datadir}/applications \ + %{buildroot}%{_datadir}/applications/*.desktop + +%files +%defattr(-,root,root,-) +%{_bindir}/qmlcalc +%{_datadir}/applications/qmlcalc.desktop +# >> files +# << files --- rpm/qmlcalc.yaml +++ rpm/qmlcalc.yaml @@ -0,0 +1,23 @@ +Name: qmlcalc +Summary: MeeGo QML Harmattan-esque calculator +Version: 0.1.0 +Release: 1 +Group: Applications/System +License: LGPL v2.1 +URL: http://github.com/nemomobile/qmlcalc +Sources: + - "%{name}-%{version}.tar.bz2" +Description: | + Calculator application written using QML + +PkgConfigBR: + - x11 + - QtDeclarative + - QtGui + - qdeclarative-boostable +Configure: none +Builder: qmake +Files: + - "%{_bindir}/qmlcalc" + - "%{_datadir}/applications/qmlcalc.desktop" + ++++++ qmlcalc.yaml --- qmlcalc.yaml +++ qmlcalc.yaml @@ -1,6 +1,6 @@ Name: qmlcalc Summary: MeeGo QML Harmattan-esque calculator -Version: 0.1.0 +Version: 0.1.1 Release: 1 Group: Applications/System License: LGPL v2.1
