From 3e8f44e5e073e0a12f0dfbc4683241d1aacaeec1 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 31 Jan 2013 18:12:14 +0100 Subject: [PATCH] UI cleanup --- brmbar3/brmbar-gui-qt4/BarButton.qml | 20 +++++- brmbar3/brmbar-gui-qt4/BarClock.qml | 5 +- brmbar3/brmbar-gui-qt4/BarScrollBar.qml | 6 +- brmbar3/brmbar-gui-qt4/BarTextHint.qml | 5 +- brmbar3/brmbar-gui-qt4/BarcodeInput.qml | 1 - brmbar3/brmbar-gui-qt4/BasePage.qml | 2 - brmbar3/brmbar-gui-qt4/ChargeCredit.qml | 10 ++- brmbar3/brmbar-gui-qt4/ItemEdit.qml | 66 +++++++++---------- brmbar3/brmbar-gui-qt4/ItemInfo.qml | 10 ++- brmbar3/brmbar-gui-qt4/MainPage.qml | 2 - brmbar3/brmbar-gui-qt4/Management.qml | 2 - brmbar3/brmbar-gui-qt4/Receipt.qml | 6 +- brmbar3/brmbar-gui-qt4/StockMgmt.qml | 2 - brmbar3/brmbar-gui-qt4/UserInfo.qml | 9 ++- brmbar3/brmbar-gui-qt4/UserMgmt.qml | 4 +- brmbar3/brmbar-gui-qt4/Withdraw.qml | 8 +-- .../brmbar-gui-qt4.qmlproject.user | 4 +- brmbar3/brmbar-gui-qt4/main.qml | 7 +- 18 files changed, 79 insertions(+), 90 deletions(-) diff --git a/brmbar3/brmbar-gui-qt4/BarButton.qml b/brmbar3/brmbar-gui-qt4/BarButton.qml index b5d8a30..48971ff 100644 --- a/brmbar3/brmbar-gui-qt4/BarButton.qml +++ b/brmbar3/brmbar-gui-qt4/BarButton.qml @@ -1,16 +1,30 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 Rectangle { id: rectangle1 width: 240 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 property string text: "Button" property int fontSize: 0.768 * 60 - property variant btnColor: "#aaaaaa" + property string btnColor: "#aaaaaa" signal buttonClick onButtonClick: { /* Supplied by component user. */ } diff --git a/brmbar3/brmbar-gui-qt4/BarClock.qml b/brmbar3/brmbar-gui-qt4/BarClock.qml index c348457..a444a2e 100644 --- a/brmbar3/brmbar-gui-qt4/BarClock.qml +++ b/brmbar3/brmbar-gui-qt4/BarClock.qml @@ -1,4 +1,3 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 Rectangle { @@ -6,8 +5,8 @@ Rectangle { width: 320 height: 65 property variant now: new Date() - property variant textColor: "#000000" - property variant textSize: 0.768 * 16 + property string textColor: "#000000" + property real textSize: 0.768 * 16 Timer { id: clockUpdater interval: 1000 // update clock every second diff --git a/brmbar3/brmbar-gui-qt4/BarScrollBar.qml b/brmbar3/brmbar-gui-qt4/BarScrollBar.qml index d93a9d1..ec9c5a7 100644 --- a/brmbar3/brmbar-gui-qt4/BarScrollBar.qml +++ b/brmbar3/brmbar-gui-qt4/BarScrollBar.qml @@ -10,9 +10,9 @@ Rectangle { property int scrollbarWidth: 20 - property variant color: "white" - property variant baseOpacityOff: 0.4 - property variant baseOpacityOn: 0.9 + property string color: "white" + property real baseOpacityOff: 0.4 + property real baseOpacityOn: 0.9 radius: vertical ? width/2 : height/2 diff --git a/brmbar3/brmbar-gui-qt4/BarTextHint.qml b/brmbar3/brmbar-gui-qt4/BarTextHint.qml index 777daf5..6720a90 100644 --- a/brmbar3/brmbar-gui-qt4/BarTextHint.qml +++ b/brmbar3/brmbar-gui-qt4/BarTextHint.qml @@ -1,4 +1,3 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 Item { @@ -6,8 +5,8 @@ Item { width: 894 height: 80 - property variant hint_goal: "" - property variant hint_action: "" + property string hint_goal: "" + property string hint_action: "" Text { id: text1 diff --git a/brmbar3/brmbar-gui-qt4/BarcodeInput.qml b/brmbar3/brmbar-gui-qt4/BarcodeInput.qml index 9aa069a..851f8c0 100644 --- a/brmbar3/brmbar-gui-qt4/BarcodeInput.qml +++ b/brmbar3/brmbar-gui-qt4/BarcodeInput.qml @@ -1,4 +1,3 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 TextInput { diff --git a/brmbar3/brmbar-gui-qt4/BasePage.qml b/brmbar3/brmbar-gui-qt4/BasePage.qml index 952a821..d5db8a4 100644 --- a/brmbar3/brmbar-gui-qt4/BasePage.qml +++ b/brmbar3/brmbar-gui-qt4/BasePage.qml @@ -1,6 +1,4 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Rectangle { width: 1024 diff --git a/brmbar3/brmbar-gui-qt4/ChargeCredit.qml b/brmbar3/brmbar-gui-qt4/ChargeCredit.qml index 07f2bdc..7dc3084 100644 --- a/brmbar3/brmbar-gui-qt4/ChargeCredit.qml +++ b/brmbar3/brmbar-gui-qt4/ChargeCredit.qml @@ -1,14 +1,12 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page anchors.fill: parent - property variant username: "" - property variant userdbid: "" - property variant amount: credit_pad.enteredText + property string username: "" + property string userdbid: "" + property string amount: credit_pad.enteredText Text { id: item_name @@ -64,7 +62,7 @@ Item { status_text.setStatus("Unknown barcode", "#ff4444") return } - if (acct.acctype == "debt") { + if (acct.acctype === "debt") { username = acct.name userdbid = acct.id } else { diff --git a/brmbar3/brmbar-gui-qt4/ItemEdit.qml b/brmbar3/brmbar-gui-qt4/ItemEdit.qml index d5ecb27..759417e 100644 --- a/brmbar3/brmbar-gui-qt4/ItemEdit.qml +++ b/brmbar3/brmbar-gui-qt4/ItemEdit.qml @@ -1,16 +1,14 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page anchors.fill: parent - property variant item_name: item_name_pad.enteredText - property variant dbid: "" - property variant info: "" - property variant buy_price: item_buyprice_pad.enteredText - property variant price: item_sellprice_pad.enteredText + property string item_name: item_name_pad.enteredText + property string dbid: "" + property string info: "" + property string buy_price: item_buyprice_pad.enteredText + property string price: item_sellprice_pad.enteredText property string barcode: "" state: "normal" @@ -28,7 +26,7 @@ Item { /* TODO: Allow override. */ return } - if (info.dbid == "") { + if (info.dbid === "") { status_text.setStatus("Press [Create] first", "#ff4444") return } @@ -310,35 +308,35 @@ Item { width: 360 text: dbid == "" ? "Create" : "Save" onButtonClick: { - var xi = info; - xi["name"] = page.item_name; - xi["buy_price"] = page.buy_price; - xi["price"] = page.price; - info = xi + var xi = info; + xi["name"] = page.item_name; + xi["buy_price"] = page.buy_price; + xi["price"] = page.price; + info = xi - var res; - if (dbid == "") { - res = shop.newItem(info) - if (!res) { - status_text.setStatus("Please fill all values first.", "#ff4444") - return - } - } else { - res = shop.saveItem(dbid, info) - } + var res; + if (dbid == "") { + res = shop.newItem(info) + if (!res) { + status_text.setStatus("Please fill all values first.", "#ff4444") + return + } + } else { + res = shop.saveItem(dbid, info) + } - if (res.cost) { - status_text.setStatus((dbid == "" ? "Stocked!" : "Restocked!") + " Take " + res.cost + " from the money box.", "#ffff7c") - } else { - status_text.setStatus(dbid == "" ? "Item created" : "Changes saved", "#ffff7c") - } + if (res.cost) { + status_text.setStatus((dbid == "" ? "Stocked!" : "Restocked!") + " Take " + res.cost + " from the money box.", "#ffff7c") + } else { + status_text.setStatus(dbid == "" ? "Item created" : "Changes saved", "#ffff7c") + } - if (dbid == "") { - dbid = res.dbid - var xi = info; xi["dbid"] = page.dbid; info = xi - } else { - loadPage("StockMgmt") - } + if (dbid == "") { + dbid = res.dbid + xi = info; xi["dbid"] = page.dbid; info = xi + } else { + loadPage("StockMgmt") + } } } diff --git a/brmbar3/brmbar-gui-qt4/ItemInfo.qml b/brmbar3/brmbar-gui-qt4/ItemInfo.qml index 8d765b0..b7d9fb5 100644 --- a/brmbar3/brmbar-gui-qt4/ItemInfo.qml +++ b/brmbar3/brmbar-gui-qt4/ItemInfo.qml @@ -1,14 +1,12 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page anchors.fill: parent - property variant name: "" - property variant dbid: "" - property variant price: "" + property string name: "" + property string dbid: "" + property string price: "" Text { id: item_name @@ -52,7 +50,7 @@ Item { status_text.setStatus("Unknown barcode", "#ff4444") return } - if (acct.acctype != "debt") { + if (acct.acctype !== "debt") { loadPageByAcct(acct) return } diff --git a/brmbar3/brmbar-gui-qt4/MainPage.qml b/brmbar3/brmbar-gui-qt4/MainPage.qml index 5c6b5b1..18ff58b 100644 --- a/brmbar3/brmbar-gui-qt4/MainPage.qml +++ b/brmbar3/brmbar-gui-qt4/MainPage.qml @@ -1,6 +1,4 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page diff --git a/brmbar3/brmbar-gui-qt4/Management.qml b/brmbar3/brmbar-gui-qt4/Management.qml index e316ca0..c547976 100644 --- a/brmbar3/brmbar-gui-qt4/Management.qml +++ b/brmbar3/brmbar-gui-qt4/Management.qml @@ -1,6 +1,4 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page diff --git a/brmbar3/brmbar-gui-qt4/Receipt.qml b/brmbar3/brmbar-gui-qt4/Receipt.qml index 5e7288b..573986a 100644 --- a/brmbar3/brmbar-gui-qt4/Receipt.qml +++ b/brmbar3/brmbar-gui-qt4/Receipt.qml @@ -1,14 +1,12 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page anchors.fill: parent property variant user - property variant description: item_name_pad.enteredText - property variant amount: amount_pad.enteredText + property string description: item_name_pad.enteredText + property string amount: amount_pad.enteredText state: "normal" diff --git a/brmbar3/brmbar-gui-qt4/StockMgmt.qml b/brmbar3/brmbar-gui-qt4/StockMgmt.qml index 394c7eb..0be284c 100644 --- a/brmbar3/brmbar-gui-qt4/StockMgmt.qml +++ b/brmbar3/brmbar-gui-qt4/StockMgmt.qml @@ -1,6 +1,4 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page diff --git a/brmbar3/brmbar-gui-qt4/UserInfo.qml b/brmbar3/brmbar-gui-qt4/UserInfo.qml index ab4b0c2..3a76dea 100644 --- a/brmbar3/brmbar-gui-qt4/UserInfo.qml +++ b/brmbar3/brmbar-gui-qt4/UserInfo.qml @@ -1,13 +1,12 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 Item { id: page anchors.fill: parent - property variant name: "" - property variant dbid: "" - property variant negbalance: "" + property string name: "" + property string dbid: "" + property string negbalance: "" Text { id: item_name @@ -43,7 +42,7 @@ Item { status_text.setStatus("Unknown barcode", "#ff4444") return } - if (acct.acctype == "recharge") { + if (acct.acctype === "recharge") { loadPage("ChargeCredit", { "username": name, "userdbid": dbid, "amount": acct.amount }) return } diff --git a/brmbar3/brmbar-gui-qt4/UserMgmt.qml b/brmbar3/brmbar-gui-qt4/UserMgmt.qml index b77e840..b8ee7c8 100644 --- a/brmbar3/brmbar-gui-qt4/UserMgmt.qml +++ b/brmbar3/brmbar-gui-qt4/UserMgmt.qml @@ -1,6 +1,4 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page @@ -17,7 +15,7 @@ Item { status_text.setStatus("Unknown barcode", "#ff4444") return } - if (acct.acctype != "debt") { + if (acct.acctype !== "debt") { loadPageByAcct(acct) return } diff --git a/brmbar3/brmbar-gui-qt4/Withdraw.qml b/brmbar3/brmbar-gui-qt4/Withdraw.qml index a936f7e..463fb9c 100644 --- a/brmbar3/brmbar-gui-qt4/Withdraw.qml +++ b/brmbar3/brmbar-gui-qt4/Withdraw.qml @@ -1,14 +1,12 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 -import QtQuick 1.0 Item { id: page anchors.fill: parent - property variant username: "" - property variant userdbid: "" - property variant amount: withdraw_pad.enteredText + property string username: "" + property string userdbid: "" + property string amount: withdraw_pad.enteredText Text { id: item_name diff --git a/brmbar3/brmbar-gui-qt4/brmbar-gui-qt4.qmlproject.user b/brmbar3/brmbar-gui-qt4/brmbar-gui-qt4.qmlproject.user index eeee7ab..0a23204 100644 --- a/brmbar3/brmbar-gui-qt4/brmbar-gui-qt4.qmlproject.user +++ b/brmbar3/brmbar-gui-qt4/brmbar-gui-qt4.qmlproject.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget @@ -112,7 +112,7 @@ ProjectExplorer.Project.Updater.EnvironmentId - {a277f310-b549-4ad7-87ca-cd03f76f19ff} + {524378aa-09e0-4345-892b-1bd47313bcaf} ProjectExplorer.Project.Updater.FileVersion diff --git a/brmbar3/brmbar-gui-qt4/main.qml b/brmbar3/brmbar-gui-qt4/main.qml index 5c43528..9eefbc6 100644 --- a/brmbar3/brmbar-gui-qt4/main.qml +++ b/brmbar3/brmbar-gui-qt4/main.qml @@ -1,4 +1,3 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 BasePage { @@ -17,11 +16,11 @@ BasePage { } function loadPageByAcct(acct) { - if (acct.acctype == "inventory") { + if (acct.acctype === "inventory") { 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"] }) - } else if (acct.acctype == "recharge") { + } else if (acct.acctype === "recharge") { loadPage("ChargeCredit", { amount: acct["amount"] }) } }