UI cleanup

This commit is contained in:
Pavol Rusnak 2013-01-31 18:12:14 +01:00
parent 1ba8099e8e
commit 3e8f44e5e0
18 changed files with 79 additions and 90 deletions

View file

@ -1,16 +1,30 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
Rectangle { Rectangle {
id: rectangle1 id: rectangle1
width: 240 width: 240
height: 83 height: 83
color: "#000000" gradient: Gradient {
GradientStop {
position: 0
color: "#888888"
}
GradientStop {
position: 0.5
color: "#000000"
}
GradientStop {
position: 1
color: "#888888"
}
}
border.color: btnColor border.color: btnColor
property string text: "Button" property string text: "Button"
property int fontSize: 0.768 * 60 property int fontSize: 0.768 * 60
property variant btnColor: "#aaaaaa" property string btnColor: "#aaaaaa"
signal buttonClick signal buttonClick
onButtonClick: { /* Supplied by component user. */ } onButtonClick: { /* Supplied by component user. */ }

View file

@ -1,4 +1,3 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
Rectangle { Rectangle {
@ -6,8 +5,8 @@ Rectangle {
width: 320 width: 320
height: 65 height: 65
property variant now: new Date() property variant now: new Date()
property variant textColor: "#000000" property string textColor: "#000000"
property variant textSize: 0.768 * 16 property real textSize: 0.768 * 16
Timer { Timer {
id: clockUpdater id: clockUpdater
interval: 1000 // update clock every second interval: 1000 // update clock every second

View file

@ -10,9 +10,9 @@ Rectangle {
property int scrollbarWidth: 20 property int scrollbarWidth: 20
property variant color: "white" property string color: "white"
property variant baseOpacityOff: 0.4 property real baseOpacityOff: 0.4
property variant baseOpacityOn: 0.9 property real baseOpacityOn: 0.9
radius: vertical ? width/2 : height/2 radius: vertical ? width/2 : height/2

View file

@ -1,4 +1,3 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
Item { Item {
@ -6,8 +5,8 @@ Item {
width: 894 width: 894
height: 80 height: 80
property variant hint_goal: "" property string hint_goal: ""
property variant hint_action: "" property string hint_action: ""
Text { Text {
id: text1 id: text1

View file

@ -1,4 +1,3 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
TextInput { TextInput {

View file

@ -1,6 +1,4 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Rectangle { Rectangle {
width: 1024 width: 1024

View file

@ -1,14 +1,12 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page
anchors.fill: parent anchors.fill: parent
property variant username: "" property string username: ""
property variant userdbid: "" property string userdbid: ""
property variant amount: credit_pad.enteredText property string amount: credit_pad.enteredText
Text { Text {
id: item_name id: item_name
@ -64,7 +62,7 @@ Item {
status_text.setStatus("Unknown barcode", "#ff4444") status_text.setStatus("Unknown barcode", "#ff4444")
return return
} }
if (acct.acctype == "debt") { if (acct.acctype === "debt") {
username = acct.name username = acct.name
userdbid = acct.id userdbid = acct.id
} else { } else {

View file

@ -1,16 +1,14 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page
anchors.fill: parent anchors.fill: parent
property variant item_name: item_name_pad.enteredText property string item_name: item_name_pad.enteredText
property variant dbid: "" property string dbid: ""
property variant info: "" property string info: ""
property variant buy_price: item_buyprice_pad.enteredText property string buy_price: item_buyprice_pad.enteredText
property variant price: item_sellprice_pad.enteredText property string price: item_sellprice_pad.enteredText
property string barcode: "" property string barcode: ""
state: "normal" state: "normal"
@ -28,7 +26,7 @@ Item {
/* TODO: Allow override. */ /* TODO: Allow override. */
return return
} }
if (info.dbid == "") { if (info.dbid === "") {
status_text.setStatus("Press [Create] first", "#ff4444") status_text.setStatus("Press [Create] first", "#ff4444")
return return
} }
@ -310,35 +308,35 @@ Item {
width: 360 width: 360
text: dbid == "" ? "Create" : "Save" text: dbid == "" ? "Create" : "Save"
onButtonClick: { onButtonClick: {
var xi = info; var xi = info;
xi["name"] = page.item_name; xi["name"] = page.item_name;
xi["buy_price"] = page.buy_price; xi["buy_price"] = page.buy_price;
xi["price"] = page.price; xi["price"] = page.price;
info = xi info = xi
var res; var res;
if (dbid == "") { if (dbid == "") {
res = shop.newItem(info) res = shop.newItem(info)
if (!res) { if (!res) {
status_text.setStatus("Please fill all values first.", "#ff4444") status_text.setStatus("Please fill all values first.", "#ff4444")
return return
} }
} else { } else {
res = shop.saveItem(dbid, info) res = shop.saveItem(dbid, info)
} }
if (res.cost) { if (res.cost) {
status_text.setStatus((dbid == "" ? "Stocked!" : "Restocked!") + " Take " + res.cost + " from the money box.", "#ffff7c") status_text.setStatus((dbid == "" ? "Stocked!" : "Restocked!") + " Take " + res.cost + " from the money box.", "#ffff7c")
} else { } else {
status_text.setStatus(dbid == "" ? "Item created" : "Changes saved", "#ffff7c") status_text.setStatus(dbid == "" ? "Item created" : "Changes saved", "#ffff7c")
} }
if (dbid == "") { if (dbid == "") {
dbid = res.dbid dbid = res.dbid
var xi = info; xi["dbid"] = page.dbid; info = xi xi = info; xi["dbid"] = page.dbid; info = xi
} else { } else {
loadPage("StockMgmt") loadPage("StockMgmt")
} }
} }
} }

View file

@ -1,14 +1,12 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page
anchors.fill: parent anchors.fill: parent
property variant name: "" property string name: ""
property variant dbid: "" property string dbid: ""
property variant price: "" property string price: ""
Text { Text {
id: item_name id: item_name
@ -52,7 +50,7 @@ Item {
status_text.setStatus("Unknown barcode", "#ff4444") status_text.setStatus("Unknown barcode", "#ff4444")
return return
} }
if (acct.acctype != "debt") { if (acct.acctype !== "debt") {
loadPageByAcct(acct) loadPageByAcct(acct)
return return
} }

View file

@ -1,6 +1,4 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page

View file

@ -1,6 +1,4 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page

View file

@ -1,14 +1,12 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page
anchors.fill: parent anchors.fill: parent
property variant user property variant user
property variant description: item_name_pad.enteredText property string description: item_name_pad.enteredText
property variant amount: amount_pad.enteredText property string amount: amount_pad.enteredText
state: "normal" state: "normal"

View file

@ -1,6 +1,4 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page

View file

@ -1,13 +1,12 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
Item { Item {
id: page id: page
anchors.fill: parent anchors.fill: parent
property variant name: "" property string name: ""
property variant dbid: "" property string dbid: ""
property variant negbalance: "" property string negbalance: ""
Text { Text {
id: item_name id: item_name
@ -43,7 +42,7 @@ Item {
status_text.setStatus("Unknown barcode", "#ff4444") status_text.setStatus("Unknown barcode", "#ff4444")
return return
} }
if (acct.acctype == "recharge") { if (acct.acctype === "recharge") {
loadPage("ChargeCredit", { "username": name, "userdbid": dbid, "amount": acct.amount }) loadPage("ChargeCredit", { "username": name, "userdbid": dbid, "amount": acct.amount })
return return
} }

View file

@ -1,6 +1,4 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page
@ -17,7 +15,7 @@ Item {
status_text.setStatus("Unknown barcode", "#ff4444") status_text.setStatus("Unknown barcode", "#ff4444")
return return
} }
if (acct.acctype != "debt") { if (acct.acctype !== "debt") {
loadPageByAcct(acct) loadPageByAcct(acct)
return return
} }

View file

@ -1,14 +1,12 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
import QtQuick 1.0
Item { Item {
id: page id: page
anchors.fill: parent anchors.fill: parent
property variant username: "" property string username: ""
property variant userdbid: "" property string userdbid: ""
property variant amount: withdraw_pad.enteredText property string amount: withdraw_pad.enteredText
Text { Text {
id: item_name id: item_name

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.5.0, 2012-09-05T02:10:11. --> <!-- Written by Qt Creator 2.5.0, 2013-01-31T18:05:42. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -112,7 +112,7 @@
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QString">{a277f310-b549-4ad7-87ca-cd03f76f19ff}</value> <value type="QString">{524378aa-09e0-4345-892b-1bd47313bcaf}</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable> <variable>ProjectExplorer.Project.Updater.FileVersion</variable>

View file

@ -1,4 +1,3 @@
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1 import QtQuick 1.1
BasePage { BasePage {
@ -17,11 +16,11 @@ BasePage {
} }
function loadPageByAcct(acct) { function loadPageByAcct(acct) {
if (acct.acctype == "inventory") { if (acct.acctype === "inventory") {
loadPage("ItemInfo", { name: acct["name"], dbid: acct["id"], price: acct["price"] }) loadPage("ItemInfo", { name: acct["name"], dbid: acct["id"], price: acct["price"] })
} else if (acct.acctype == "debt") { } else if (acct.acctype === "debt") {
loadPage("UserInfo", { name: acct["name"], dbid: acct["id"], negbalance: acct["negbalance"] }) loadPage("UserInfo", { name: acct["name"], dbid: acct["id"], negbalance: acct["negbalance"] })
} else if (acct.acctype == "recharge") { } else if (acct.acctype === "recharge") {
loadPage("ChargeCredit", { amount: acct["amount"] }) loadPage("ChargeCredit", { amount: acct["amount"] })
} }
} }