diff --git a/brmbar3/TODO b/brmbar3/TODO index 92cc486..47ccbe6 100644 --- a/brmbar3/TODO +++ b/brmbar3/TODO @@ -6,9 +6,9 @@ + User management + List of users + Withdrawal of user credit -- Numerical manual entry support - - Use for credit charge - - Use for withdrawal ++ Numerical manual entry support + + Use for credit charge + + Use for withdrawal - Alphanumeric manual entry support - Use in item editor - Restocking view (Stock management) diff --git a/brmbar3/brmbar-gui-qt4/BarKeyboard.qml b/brmbar3/brmbar-gui-qt4/BarKeyboard.qml new file mode 100644 index 0000000..a8f5ba5 --- /dev/null +++ b/brmbar3/brmbar-gui-qt4/BarKeyboard.qml @@ -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) + } + } + } +} diff --git a/brmbar3/brmbar-gui-qt4/BarNumPad.qml b/brmbar3/brmbar-gui-qt4/BarNumPad.qml new file mode 100644 index 0000000..0537190 --- /dev/null +++ b/brmbar3/brmbar-gui-qt4/BarNumPad.qml @@ -0,0 +1,9 @@ +import Qt 4.7 + +BarKeyboard { + keys: "7894561230.<" + gridRows: 4 + gridColumns: 3 + buttonWidth: 80 + buttonHeight: 70 +} diff --git a/brmbar3/brmbar-gui-qt4/ChargeCredit.qml b/brmbar3/brmbar-gui-qt4/ChargeCredit.qml index 71d277e..ccc56d6 100644 --- a/brmbar3/brmbar-gui-qt4/ChargeCredit.qml +++ b/brmbar3/brmbar-gui-qt4/ChargeCredit.qml @@ -12,13 +12,14 @@ Item { Text { id: item_name - x: 65 + x: 422 y: 156 width: 537 - height: 160 + height: 80 color: "#ffffff" text: parent.username ? parent.username : "Credit charge" wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter font.pointSize: 44 } @@ -26,7 +27,7 @@ Item { Text { id: text3 x: 611 - y: 156 + y: 256 height: 160 width: 348 color: "#ffff7c" @@ -39,8 +40,17 @@ Item { BarTextHint { x: 65 y: 430 - hint_goal: parent.amount ? (parent.username ? "Charge now?" : "Charge user:") : "Charge credit:" - hint_action: !(parent.amount && parent.userdbid) ? "Scan barcode now" : "" + hint_goal: (parent.username ? "" : parent.amount ? "Charge user:" : "Charge credit:") + 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 { @@ -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() { var balance = shop.chargeCredit(amount, userdbid) status_text.setStatus("Charged! "+username+"'s credit is "+balance+".", "#ffff7c") diff --git a/brmbar3/brmbar-gui-qt4/Withdraw.qml b/brmbar3/brmbar-gui-qt4/Withdraw.qml index cba13d5..fe56f12 100644 --- a/brmbar3/brmbar-gui-qt4/Withdraw.qml +++ b/brmbar3/brmbar-gui-qt4/Withdraw.qml @@ -12,13 +12,14 @@ Item { Text { id: item_name - x: 65 + x: 422 y: 156 width: 537 - height: 160 + height: 80 color: "#ffffff" text: parent.username ? parent.username : "Credit withdrawal" wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter font.pointSize: 44 } @@ -26,7 +27,7 @@ Item { Text { id: text3 x: 611 - y: 156 + y: 256 height: 160 width: 348 color: "#ffff7c" @@ -39,8 +40,17 @@ Item { BarTextHint { x: 65 y: 430 - hint_goal: parent.amount ? (parent.username ? "Withdraw amount?" : "Withdraw:") : "Withdraw:" - hint_action: !(parent.amount && parent.userdbid) ? "Scan barcode now" : "" + hint_goal: (parent.username ? "" : parent.amount ? "Withdraw:" : "Withdraw amount?") + 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 { @@ -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() { var balance = shop.withdrawCredit(amount, userdbid) status_text.setStatus("Withdrawn! "+username+"'s credit is "+balance+".", "#ffff7c")