forked from brmlab/brmbar-github
brmbar v3: Add support for numpad touch entry, use in charge and withdrawal screens
This commit is contained in:
parent
586b2411cf
commit
27f9b35b52
5 changed files with 81 additions and 45 deletions
|
@ -6,9 +6,9 @@
|
||||||
+ User management
|
+ User management
|
||||||
+ List of users
|
+ List of users
|
||||||
+ Withdrawal of user credit
|
+ Withdrawal of user credit
|
||||||
- Numerical manual entry support
|
+ Numerical manual entry support
|
||||||
- Use for credit charge
|
+ Use for credit charge
|
||||||
- Use for withdrawal
|
+ Use for withdrawal
|
||||||
- Alphanumeric manual entry support
|
- Alphanumeric manual entry support
|
||||||
- Use in item editor
|
- Use in item editor
|
||||||
- Restocking view (Stock management)
|
- Restocking view (Stock management)
|
||||||
|
|
39
brmbar3/brmbar-gui-qt4/BarKeyboard.qml
Normal file
39
brmbar3/brmbar-gui-qt4/BarKeyboard.qml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
import Qt 4.7
|
||||||
|
|
||||||
|
Grid {
|
||||||
|
property string keys: ""
|
||||||
|
property int gridRows: 0
|
||||||
|
property int gridColumns: 0
|
||||||
|
property int buttonWidth: 70
|
||||||
|
property int buttonHeight: 70
|
||||||
|
|
||||||
|
property bool shift: false
|
||||||
|
|
||||||
|
signal letterBackspace()
|
||||||
|
signal letterEntered(string letter)
|
||||||
|
|
||||||
|
rows: gridRows
|
||||||
|
columns: gridColumns
|
||||||
|
spacing: 1
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: keys.length
|
||||||
|
BarButton {
|
||||||
|
width: buttonWidth; height: buttonHeight
|
||||||
|
property string key: keys.charAt(index)
|
||||||
|
property bool special: key == "^" || key == "<"
|
||||||
|
|
||||||
|
text: key == "^" ? "shift" : key == "<" ? "bksp" : shift ? key.toUpperCase() : key
|
||||||
|
fontSize: special ? 20 : 44
|
||||||
|
|
||||||
|
onButtonClick: {
|
||||||
|
if (key == "^")
|
||||||
|
shift = !shift
|
||||||
|
else if (key == "<")
|
||||||
|
letterBackspace()
|
||||||
|
else
|
||||||
|
letterEntered(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
brmbar3/brmbar-gui-qt4/BarNumPad.qml
Normal file
9
brmbar3/brmbar-gui-qt4/BarNumPad.qml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import Qt 4.7
|
||||||
|
|
||||||
|
BarKeyboard {
|
||||||
|
keys: "7894561230.<"
|
||||||
|
gridRows: 4
|
||||||
|
gridColumns: 3
|
||||||
|
buttonWidth: 80
|
||||||
|
buttonHeight: 70
|
||||||
|
}
|
|
@ -12,13 +12,14 @@ Item {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: item_name
|
id: item_name
|
||||||
x: 65
|
x: 422
|
||||||
y: 156
|
y: 156
|
||||||
width: 537
|
width: 537
|
||||||
height: 160
|
height: 80
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
text: parent.username ? parent.username : "Credit charge"
|
text: parent.username ? parent.username : "Credit charge"
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
font.pointSize: 44
|
font.pointSize: 44
|
||||||
}
|
}
|
||||||
|
@ -26,7 +27,7 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
id: text3
|
id: text3
|
||||||
x: 611
|
x: 611
|
||||||
y: 156
|
y: 256
|
||||||
height: 160
|
height: 160
|
||||||
width: 348
|
width: 348
|
||||||
color: "#ffff7c"
|
color: "#ffff7c"
|
||||||
|
@ -39,8 +40,17 @@ Item {
|
||||||
BarTextHint {
|
BarTextHint {
|
||||||
x: 65
|
x: 65
|
||||||
y: 430
|
y: 430
|
||||||
hint_goal: parent.amount ? (parent.username ? "Charge now?" : "Charge user:") : "Charge credit:"
|
hint_goal: (parent.username ? "" : parent.amount ? "Charge user:" : "Charge credit:")
|
||||||
hint_action: !(parent.amount && parent.userdbid) ? "Scan barcode now" : ""
|
hint_action: (parent.username ? (parent.amount ? "" : "(or scan barcode now)") : "Scan barcode now")
|
||||||
|
}
|
||||||
|
|
||||||
|
BarNumPad {
|
||||||
|
id: credit_pad
|
||||||
|
x: 65
|
||||||
|
y: 195
|
||||||
|
visible: parent.username != ""
|
||||||
|
onLetterEntered: { amount = amount.toString() + letter; }
|
||||||
|
onLetterBackspace: { amount = amount.toString().replace(/.$/, ''); }
|
||||||
}
|
}
|
||||||
|
|
||||||
BarcodeInput {
|
BarcodeInput {
|
||||||
|
@ -89,22 +99,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
|
||||||
id: text1
|
|
||||||
x: 112
|
|
||||||
y: 333
|
|
||||||
width: 800
|
|
||||||
height: 80
|
|
||||||
color: "#ffffff"
|
|
||||||
text: "Put "+amount+" Kč in the money box now."
|
|
||||||
visible: amount ? true : false
|
|
||||||
anchors.horizontalCenterOffset: 0
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
font.pointSize: 36
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
function chargeCredit() {
|
function chargeCredit() {
|
||||||
var balance = shop.chargeCredit(amount, userdbid)
|
var balance = shop.chargeCredit(amount, userdbid)
|
||||||
status_text.setStatus("Charged! "+username+"'s credit is "+balance+".", "#ffff7c")
|
status_text.setStatus("Charged! "+username+"'s credit is "+balance+".", "#ffff7c")
|
||||||
|
|
|
@ -12,13 +12,14 @@ Item {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: item_name
|
id: item_name
|
||||||
x: 65
|
x: 422
|
||||||
y: 156
|
y: 156
|
||||||
width: 537
|
width: 537
|
||||||
height: 160
|
height: 80
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
text: parent.username ? parent.username : "Credit withdrawal"
|
text: parent.username ? parent.username : "Credit withdrawal"
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
font.pointSize: 44
|
font.pointSize: 44
|
||||||
}
|
}
|
||||||
|
@ -26,7 +27,7 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
id: text3
|
id: text3
|
||||||
x: 611
|
x: 611
|
||||||
y: 156
|
y: 256
|
||||||
height: 160
|
height: 160
|
||||||
width: 348
|
width: 348
|
||||||
color: "#ffff7c"
|
color: "#ffff7c"
|
||||||
|
@ -39,8 +40,17 @@ Item {
|
||||||
BarTextHint {
|
BarTextHint {
|
||||||
x: 65
|
x: 65
|
||||||
y: 430
|
y: 430
|
||||||
hint_goal: parent.amount ? (parent.username ? "Withdraw amount?" : "Withdraw:") : "Withdraw:"
|
hint_goal: (parent.username ? "" : parent.amount ? "Withdraw:" : "Withdraw amount?")
|
||||||
hint_action: !(parent.amount && parent.userdbid) ? "Scan barcode now" : ""
|
hint_action: (parent.username ? (parent.amount ? "" : "(or scan barcode now)") : "Scan barcode now")
|
||||||
|
}
|
||||||
|
|
||||||
|
BarNumPad {
|
||||||
|
id: withdraw_pad
|
||||||
|
x: 65
|
||||||
|
y: 195
|
||||||
|
visible: parent.username != ""
|
||||||
|
onLetterEntered: { amount = amount.toString() + letter; }
|
||||||
|
onLetterBackspace: { amount = amount.toString().replace(/.$/, ''); }
|
||||||
}
|
}
|
||||||
|
|
||||||
BarcodeInput {
|
BarcodeInput {
|
||||||
|
@ -89,22 +99,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
|
||||||
id: text1
|
|
||||||
x: 112
|
|
||||||
y: 333
|
|
||||||
width: 800
|
|
||||||
height: 80
|
|
||||||
color: "#ffffff"
|
|
||||||
text: "Take "+amount+" Kč from the money box now."
|
|
||||||
visible: amount ? true : false
|
|
||||||
anchors.horizontalCenterOffset: 0
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
font.pointSize: 36
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
function withdrawCredit() {
|
function withdrawCredit() {
|
||||||
var balance = shop.withdrawCredit(amount, userdbid)
|
var balance = shop.withdrawCredit(amount, userdbid)
|
||||||
status_text.setStatus("Withdrawn! "+username+"'s credit is "+balance+".", "#ffff7c")
|
status_text.setStatus("Withdrawn! "+username+"'s credit is "+balance+".", "#ffff7c")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue