This repository has been archived by the owner on Feb 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
PrintCostCalculator.qml
83 lines (75 loc) · 2.1 KB
/
PrintCostCalculator.qml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2015 Jaime van Kessel.
// PrintCostCalculator is released under the terms of the AGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Window 2.2
import QtQuick.Controls 1.2
import UM 1.0 as UM
UM.Dialog
{
modality: Qt.NonModal
id: base;
width: 250 * Screen.devicePixelRatio;
height: 110 * Screen.devicePixelRatio;
visible: true;
title: qsTr("Calculate print cost")
property real material_amount_length: manager.materialAmountLength == -1 ? 0 : manager.materialAmountLength
property real pi: 3.1415
property real material_radius: 0.5 * manager.materialDiameter
property real material_amount_volume: pi * material_radius * material_radius * material_amount_length / 1000000
property real density: manager.density
property real kg_material: material_amount_volume * density
property real price_per_kg : manager.pricePerKg
Column
{
anchors.fill: parent;
Row
{
Text
{
text: "Density: "
}
TextField
{
id: density_field
text: density
Keys.onReleased:
{
manager.setDensity(density_field.text)
}
}
}
Row
{
Text
{
text: "Cost per kg: "
}
TextField
{
id: cost_field
text: price_per_kg
Keys.onReleased:
{
manager.setPricePerKG(cost_field.text)
}
}
}
Text
{
text: "Weight of print " + Math.round(kg_material * 100 ) / 100 + " kg"
}
Text
{
text: "Print cost: " + Math.round(price_per_kg * kg_material * 100) / 100
}
Button
{
//: Add Printer wizarad button
text: qsTr("Cancel");
onClicked:
{
base.visible = false;
}
}
}
}