[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/poetaster/fibonacci.git</param>
<param name="branch">main</param>
- <param name="revision">0.9-2</param>
+ <param name="revision">v1.0.0</param>
<param name="debian">N</param>
<param name="dumb">N</param>
</service>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/layouts/programmers.qml
^
|
@@ -37,7 +37,7 @@
KeyboardRow {
CharacterKey { caption: "1"; captionShifted: "q"; symView: "1"; symView2: "&" }
- CharacterKey { caption: "2"; captionShifted: "w"; symView: "2"; symView2: "" }
+ CharacterKey { caption: "2"; captionShifted: "w"; symView: "2"; symView2: "and" }
CharacterKey { caption: "3"; captionShifted: "e"; symView: "3"; symView2: "or" }
CharacterKey { caption: "4"; captionShifted: "r"; symView: "4"; symView2: "" }
CharacterKey { caption: "5"; captionShifted: "t"; symView: "5"; symView2: "nor" }
@@ -54,11 +54,11 @@
CharacterKey { caption: "8"; captionShifted: "d"; symView: "8"; symView2: "cos" }
CharacterKey { caption: "9"; captionShifted: "f"; symView: "9"; symView2: "" }
CharacterKey { caption: "0"; captionShifted: "g"; symView: "0"; symView2: "tan" }
- CharacterKey { caption: "<"; captionShifted: "h"; symView: ">"; symView2: "" }
- CharacterKey { caption: ">"; captionShifted: "j"; symView: "<"; symView2: "log" }
- CharacterKey { caption: "^"; captionShifted: "k"; symView: "="; symView2: "" }
+ CharacterKey { caption: "%"; captionShifted: "h"; symView: "%"; symView2: "" }
+ CharacterKey { caption: "^"; captionShifted: "j"; symView: "^"; symView2: "log" }
+ CharacterKey { caption: "φ"; captionShifted: "k"; symView: "φ"; symView2: "" }
CharacterKey { caption: "√"; captionShifted: "l"; symView: "√"; symView2: "√" }
- CharacterKey { caption: "π"; captionShifted: ":="; symView: "π"; symView2: "π" }
+ CharacterKey { caption: "π"; captionShifted: ":="; symView: "π"; symView2: "" }
}
KeyboardRow {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/qml/components/en_US-exprtk-functions.json
^
|
@@ -267,7 +267,7 @@
"example": ""},
{"name": "<=>",
"desc": "Swap the values of x and y. Where x and y are mutable strings. (eg: x <=> y)",
- "example": ""},
+ "example": "x <=> y"},
{"name": "[]",
"desc": "The string size operator returns the size of the string being actioned.",
"example": ""},
@@ -282,7 +282,7 @@
"example": "switch { case x > (y + z) : 2 * x / abs(y - z); case x < 3: sin(x + y); default: 1 + x; }"},
{"name": "while",
"desc": "The structure will repeatedly evaluate the internalstatement(s) 'while' the condition is true. The final statement in the final iteration will be used as the return value of the loop. eg: while ((x -= 1) > 0) { y := x + z; w := u + y; }",
- "example": "while ((x -= 1) > 0) { y := x + z; w := u + y; }"},
+ "example": "while((x+=1)<z)\n{y:=sum(r);r[0]:=r[1];r[1]:=y;a[x]:=y}\nreturn[a];"},
{"name": "repeat/until",
"desc": "The structure will repeatedly evaluate the internalstatement(s) 'until' the condition is true. The final statement in the final iteration will be used as the return value of the loop. eg: repeat y := x + z; w := u + y; until ((x += 1) > 100)",
"example": "repeat y := x + z; w := u + y; until ((x += 1) > 100)"},
@@ -309,5 +309,5 @@
"example": ""},
{"name": "[]",
"desc": "The vector size operator returns the size of the vector being actioned. eg: 1. v[] 2. max_size := max(v0[],v1[],v2[],v3[])",
- "example": ""}
+ "example": "max(v0[],v1[],v2[],v3[])"}
]
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/qml/elements/OperandEditor.qml
^
|
@@ -83,8 +83,8 @@
function flickToRightEdge(){
if((operandLabel.paintedWidth > operandEditor.flickableSize) && !atXEnd){
- //console.log("flick !!");
- //console.log(operandLabel.text);
+ console.log("flick !!");
+ console.log(operandLabel.text);
contentX = operandLabel.paintedWidth - flickable.width;
}
}
@@ -123,7 +123,8 @@
//console.log(text)
//console.log(operand)
//console.log(height)
- //console.log(width)
+ console.log(width)
+ console.log(operandEditor.flickableSize)
flickable.flickToRightEdge();
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/qml/elements/PythonGlue.qml
^
|
@@ -138,7 +138,8 @@
memoryObj.append({isLastItem: true, value: el["expr"]});
updateFakeFirstElements();
- screenObj.view.positionViewAtEnd();
+ // FIXME
+ //screenObj.view.positionViewAtEnd();
}
function stackPopHandler(nb){
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/qml/harbour-fibonacci.qml
^
|
@@ -43,6 +43,10 @@
property var currentStack: []
property bool engineLoaded
property alias memoryModel: memory
+ property string varstxt: settings.recentVars
+ //"x:=0; y:=1; var t[2]:={0,1}; z:=12; "
+ property string formtxt: settings.lastFormula
+ //"while((x+=1)<z)" +"\n"+ "{y:=sum(r);r[0]:=r[1];r[1]:=y;a[x]:=y}"+ "\n" + "return[a];"
QtObject {
id:stat
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/qml/pages/Exprtk.qml
^
|
@@ -41,7 +41,8 @@
Page {
id: exprtkPage
- property var varstxt
+
+
function format(formula, variable, result, error) {
// return result + " " + error
formula = formula.replace(/(\r\n|\n|\r)/gm, "");
@@ -101,9 +102,13 @@
const re0 = /·/g;
const re1 = /π/g;
const re2 = /√/g;
+ const re3 = /φ/g;
+ const re5 = /deg/g;
const newtxt = text.replace(re0, "*")
newtxt = newtxt.replace(re1, "pi")
newtxt = newtxt.replace(re2, "sqrt")
+ newtxt = newtxt.replace(re3, "phi")
+ newtxt = newtxt.replace(re5, "rad2deg")
return newtxt
}
@@ -121,9 +126,13 @@
onClicked: pageStack.push(Qt.resolvedUrl("Settings.qml"))
}
MenuItem {
+ text: qsTr("Operators & Functions")
+ onClicked: pageStack.push(Qt.resolvedUrl("../components/ExprtkMenu.qml"))
+ }
+ /*MenuItem {
text: qsTr("Scientific calculator")
onClicked: pageStack.replace(Qt.resolvedUrl("MainPage.qml"))
- }
+ }*/
}
PushUpMenu {
@@ -148,7 +157,7 @@
anchors.horizontalCenter: exprtkPage.Center
anchors.top: parent.Top
anchors.bottomMargin: 3 * Theme.paddingLarge
- height: pageHeader.height + formula.height + vars.height + 3 * Theme.paddingLarge
+ height: pageHeader.height + formfield.height + vars.height + 3 * Theme.paddingLarge
width: exprtkPage.width
PageHeader {
id: pageHeader
@@ -158,16 +167,19 @@
id: vars
anchors.top: pageHeader.bottom
width: listView.width
- text: "x:=0; y:=1; var t[2]:={0,1}; z:=12; "
+ text: varstxt
placeholderText: qsTr("Variables")
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhPreferNumbers
EnterKey.enabled: text.length > 0
EnterKey.onClicked: {
varstxt = text
- var txt = filterVariables(vars.text) + " " + filterVariables(formula.text)
+ formtxt = formfield.text
+ settings.recentVars = varstxt
+ settings.lastFormula = formtxt
+ var txt = filterVariables(varstxt) + " " + filterVariables(formtxt)
var res = calculator.exprtk(txt)
res.variable = text
- res.formula = formula.text
+ res.formula = formfield.text
if (res.iresults.length > 0 ) {
var resultn = ""
for (x in res.iresults) {
@@ -182,11 +194,11 @@
}
}
QueryArea {
- id: formula
+ id: formfield
anchors.top: vars.bottom
width: listView.width
height: Theme.buttonWidthSmall
- text: "while((x+=1)<z)" +"\n"+ "{y:=sum(r);r[0]:=r[1];r[1]:=y;a[x]:=y}"+ "\n" + "return[a];"
+ text: formtxt
placeholderText: qsTr("Mathematical expression")
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhPreferNumbers
EnterKey.enabled: text.length > 0
@@ -197,7 +209,7 @@
height: icon.height
icon.source: "image://theme/icon-m-acknowledge"
anchors {
- top: formula.bottom
+ top: formfield.bottom
right: parent.right
topMargin: Theme.paddingSmall
rightMargin: Theme.paddingSmall + 5
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/qml/pages/Variables.qml
^
|
@@ -17,7 +17,7 @@
text: qsTr("Clear all variables")
onClicked: remorse_variables.execute(qsTr("Clearing all variables"),
function() {
- calculator.clear()
+ //calculator.clear()
variablesListModel.clear()
//var variables=calculator.getVariables()
//for (var i in variables)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/qml/python/rpncalc_sympy_backend.py
^
|
@@ -86,6 +86,8 @@
Backend.engineFunction("ln", lambda op: sympy.log(op), operands=1)
Backend.engineFunction("e^x", lambda op: sympy.exp(op), operands=1)
Backend.engineFunction("factorial", lambda op: sympy.factorial(op), operands=1)
+Backend.engineFunction("shl", lambda op: op[0] << op[1])
+Backend.engineFunction("shr", lambda op: op[0] >> op[1])
@Backend.engineFunction(operands=2)
def mul(op):
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/qml/python/rpncalc_sympy_backend_constants.py
^
|
@@ -24,8 +24,32 @@
constantsArray = Constants.constantsArray
Constants.addConstant("pi", "π", pi)
-#Constants.addConstant("e", "e", e)
-#Constants.addConstant("phi", "phi", phi)
+
+@Constants.addConstant
+class Golden(NumberSymbol):
+
+ is_real = True
+ is_positive = True
+ is_negative = False
+ is_irrational = True
+ is_number = True
+ is_algebraic = False
+
+ val='1.6180339887498949'
+
+ def _eval_evalf(self,prec):
+ return N(self.val,prec)
+
+ def __str__(self,*args):
+ return 'φ'
+
+ def _sympystr(self,*args):
+ return self.val
+
+ def _latex(self,*args):
+ return 'φ_{0}'
+
+phi = Golden()
@Constants.addConstant
class Celerity(NumberSymbol):
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/src/calculator.cpp
^
|
@@ -15,15 +15,6 @@
#include <QString>
#include <QRegularExpressionMatchIterator>
#include <QVariantMap>
-#include <iterator>
-#include <string>
-#include <vector>
-#include <deque>
-#include <stack>
-#include <stdexcept>
-#include <cmath>
-#include <limits>
-#include <algorithm>
#include <QString>
calculator::calculator(QObject *parent) : QObject(parent) {
@@ -148,6 +139,7 @@
typedef exprtk::expression<T> expression_t;
typedef exprtk::parser<T> parser_t;
typedef exprtk::symbol_table<T> symbol_table_t;
+ //typedef exprtk::symbol_table<T> glbl_const_symbol_table_t;
// Setup global constants symbol table
T x = T(0);
@@ -157,11 +149,12 @@
T r[] = { T(0), T(1) };
// a is the accumulator
T a[] = { T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0) };
- //, T(0), T(0),T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0) };
//std::vector<double> a (100,0);
symbol_table_t symbol_table;
+ symbol_table.add_constant("phi",(1+sqrt(5))/2);
+ // pi, e, inf are in add_plural
symbol_table.add_constants();
symbol_table.add_variable("x",x);
symbol_table.add_variable("y",y);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/src/settingsmanager.cpp
^
|
@@ -3,16 +3,26 @@
SettingsManager::SettingsManager(QObject *parent) :
QObject(parent)
{
- settings = new QSettings("harbour-fibonacci", "harbour-fibonacci");
-
- if(settings->value("vibration") == QVariant()) settings->setValue("vibration", 0);
- if(settings->value("angle_unit") == QVariant()) settings->setValue("angle_unit", QString("Degree"));
- if(settings->value("reprFloatPrecision") == QVariant()) settings->setValue("reprFloatPrecision", 9);
-
- if(settings->value("symbolicMode") == QVariant()) settings->setValue("symbolicMode", true);
- if(settings->value("rationalMode") == QVariant()) settings->setValue("rationalMode", true);
- if(settings->value("autoSimplify") == QVariant()) settings->setValue("autoSimplify", true);
+ settings = new QSettings("de.poetaster/Fibonacci", "Fibonacci");
+ if(settings->value("vibration") == QVariant())
+ settings->setValue("vibration", 0);
+ if(settings->value("angle_unit") == QVariant())
+ settings->setValue("angle_unit", QString("Degree"));
+ if(settings->value("reprFloatPrecision") ==
+ QVariant()) settings->setValue("reprFloatPrecision", 9);
+
+ if(settings->value("symbolicMode") == QVariant())
+ settings->setValue("symbolicMode", true);
+ if(settings->value("rationalMode") == QVariant())
+ settings->setValue("rationalMode", true);
+ if(settings->value("autoSimplify") == QVariant())
+ settings->setValue("autoSimplify", true);
+
+ if(settings->value("recentVars") == QVariant())
+ settings->setValue("recentVars", QString("x:=0; y:=1; var t[2]:={0,1}; z:=12;"));
+ if(settings->value("lastFormula") == QVariant())
+ settings->setValue("lastFormula", QString("while((x+=1)<z)\n{y:=sum(r);r[0]:=r[1];r[1]:=y;a[x]:=y}\nreturn[a];"));
}
void SettingsManager::setVibration(int on)
@@ -39,6 +49,34 @@
return settings->value("angle_unit").toString();
}
+void SettingsManager::setRecentVars(QString vars)
+{
+ if(vars != settings->value("recentVars").toString()){
+ settings->setValue("recentVars", vars);
+ emit recentVarsChanged();
+ }
+}
+
+QString SettingsManager::recentVars()
+{
+
+ return settings->value("recentVars").toString();
+}
+
+void SettingsManager::setLastFormula(QString formula)
+{
+ if(formula != settings->value("lastFormula").toString()){
+ settings->setValue("lastFormula", formula);
+ emit lastFormulaChanged();
+ }
+}
+
+QString SettingsManager::lastFormula()
+{
+
+ return settings->value("lastFormula").toString();
+}
+
void SettingsManager::setReprFloatPrecision(int prec)
{
if(prec != reprFloatPrecision()){
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-fibonacci-1.0.0.tar.bz2/src/settingsmanager.h
^
|
@@ -13,12 +13,15 @@
Q_PROPERTY(bool autoSimplify READ autoSimplify WRITE setAutoSimplify NOTIFY autoSimplifyChanged)
Q_PROPERTY(bool symbolicMode READ symbolicMode WRITE setSymbolicMode NOTIFY symbolicModeChanged)
Q_PROPERTY(bool rationalMode READ rationalMode WRITE setRationalMode NOTIFY rationalModeChanged)
+ Q_PROPERTY(QString recentVars READ recentVars WRITE setRecentVars NOTIFY recentVarsChanged)
+ Q_PROPERTY(QString lastFormula READ lastFormula WRITE setLastFormula NOTIFY lastFormulaChanged)
public:
explicit SettingsManager(QObject *parent = 0);
Q_INVOKABLE void setVibration(int on);
Q_INVOKABLE int vibration();
+
void setAngleUnit(QString unit);
QString angleUnit();
@@ -34,6 +37,13 @@
bool rationalMode() { return settings->value("rationalMode").toBool(); }
void setRationalMode(bool enabled);
+ void setRecentVars(QString vars);
+ QString recentVars();
+
+ void setLastFormula(QString formula);
+ QString lastFormula();
+
+
private:
QSettings * settings;
@@ -43,6 +53,8 @@
void autoSimplifyChanged();
void symbolicModeChanged();
void rationalModeChanged();
+ void recentVarsChanged();
+ void lastFormulaChanged();
public slots:
|