summaryrefslogtreecommitdiff
path: root/services/_SmartCalc.qml
blob: fd9f134df9317ef0287a93941fd18fb949930562 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
pragma Singleton
// pragma ComponentBehavior: Bound

import QtQuick
import Quickshell
import Quickshell.Io

import qs.config

import core

Singleton {
    id: root

    property var result: Calc.result
	property int result_type: Calc.result_type
	readonly property var resultType: ({
        "Math": Calc.Math,
        "Unit": Calc.Unit,
        "Currency": Calc.Currency,
        "Crypto": Calc.Crypto,
        "Time": Calc.Time,
        "Date": Calc.Date,
        "Unset": Calc.Unset
    })

    function query(input: string) {
	    console.log(input)
	   	Calc.query(input);
    }


    // FIXME: we'll prolly need to reset() everytime here after it finish just so the next time another component using it won't be affected by the previous query
    function reset() {
		Calc.reset();
	}
}