Minor improvements to GUI

pull/21/head
larteyoh 2 years ago
parent 38a9f9813a
commit 2fe1ba34c6

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(neroshop) # tested on Ubuntu 20.04 LTS (focal) with gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, manjaro-xfce-21.2.6 (Qonos) with gcc (GCC) 11.2.0
project(neroshop) # tested on Ubuntu 20.04 LTS (focal) with gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

@ -17,14 +17,14 @@ import "qml/components" as NeroshopComponents
import "qml/pages"
ApplicationWindow {
id: main_window
id: mainWindow
visible: true
title: qsTr("neroshop" + " v" + neroshopVersion)
width: 1280
height: 720
minimumWidth: 850
minimumHeight: 500
color: NeroshopComponents.Style.getColorByThemeName()[0]
color: NeroshopComponents.Style.getColorsByTheme()[0]
///////////////////////////
// Global Tooltip
/*NeroshopComponents.Hint {
@ -32,7 +32,7 @@ ApplicationWindow {
visible: false
}*/
header: Rectangle {
color: NeroshopComponents.Style.getColorByThemeName()[1]
color: NeroshopComponents.Style.getColorsByTheme()[1]
height: 100 // width should be set automatically to the parent's width
NeroshopComponents.SearchBar {
@ -76,7 +76,6 @@ ApplicationWindow {
console.log(source);
if (page_loader.status == Loader.Ready) console.log('Loaded')
else console.log('Not Loaded')
console.log( NeroshopComponents.Style.getColorByThemeName()[0] );
}
}
//}
@ -85,7 +84,7 @@ ApplicationWindow {
// Custom ToolBar
footer: Rectangle {
height: 40//; width: parent.width// width is automatically set to parent's width by default since this is the footer
color: NeroshopComponents.Style.getColorByThemeName()[1]
color: NeroshopComponents.Style.getColorsByTheme()[1]
Row {
anchors.fill: parent
@ -97,7 +96,7 @@ ApplicationWindow {
width: themeSwitcher.width
height: footer.height//themeSwitcher.height
color: "transparent"
border.color: "blue"
//border.color: "blue"
NeroshopComponents.ThemeSwitch {
id: themeSwitcher
@ -110,7 +109,7 @@ ApplicationWindow {
width: daemonSyncBar.width
height: footer.height
color: "transparent"
border.color: "red"
//border.color: "red"
NeroshopComponents.ProgressBar {
id: daemonSyncBar
@ -126,7 +125,7 @@ ApplicationWindow {
width: moneroDaemonSyncBar.width
height: footer.height
color: "transparent"
border.color: "plum"
//border.color: "plum"
NeroshopComponents.ProgressBar {
id: moneroDaemonSyncBar

@ -11,20 +11,20 @@ import "." as NeroshopComponents
// Grid should have two modes: Pagination mode and Infinite scroll mode
// catalog view (Grid)
Grid {
id: catalog_grid
id: catalogGrid
rows: 2
columns: 3
spacing: 5//rowSpacing: 5; columnSpacing: 5
//flow: Grid.TopToBottom
function getBox(index) { // or get_item(index)?
return catalog_grid_repeater.itemAt(index);
return catalogGridRepeater.itemAt(index);
}
function getBoxCount() {
return catalog_grid_repeater.count; // count is really just the number of items in the model :O
return catalogGridRepeater.count; // count is really just the number of items in the model :O
}
Repeater { // owns all items it instantiates
id: catalog_grid_repeater
id: catalogGridRepeater
model: (rows * columns)//fruitModel // rows and columns already set so this is useless (I think)
// product box (GridBox)
delegate: Rectangle { // delegates have a readonly "index" property that indicates the index of the delegate within the repeater
@ -32,15 +32,15 @@ import "." as NeroshopComponents
visible: true
width: 220
height: 220
color: (NeroshopComponents.Style.darkTheme) ? "#2e2e2e"/*"#121212"*/ : "#a0a0a0"// #a0a0a0 = 160,160,160
color: (NeroshopComponents.Style.darkTheme) ? "#2e2e2e"/*"#121212"*/ : "#a0a0a0"//"#ffffff"// #a0a0a0 = 160,160,160
//border.color: "white"
//border.width: 1
radius: 5
Image {
id: verified_purchase_icon
id: verifiedPurchaseIcon
source: "file:///" + neroshopResourcesDir + "/paid.png"//neroshopResourceDir + "/paid.png"
visible: true//false // only show this icon if item has been purchased previously
visible: false // only show this icon if item has been purchased previously
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: parent.top
@ -48,45 +48,35 @@ import "." as NeroshopComponents
height: 24; width: 24 // has no effect since image is scaled
fillMode:Image.PreserveAspectFit; // the image is scaled uniformly to fit button without cropping
mipmap: true
MouseArea {
id: verified_purchase_icon_mouse_area
id: verifiedPurchaseIconMouseArea
anchors.fill: parent
hoverEnabled: true
//acceptedButtons: Qt.LeftButton // for heart_icon ONLY
onEntered: {
console.log("Mouse is over paid icon")
// show tooltip - todo: show tooltip while mouse is hovered over
////if(has_purchased) {
console.log("Icon pos (" + catalog_grid_repeater.itemAt(index).children[0].x + ", " + catalog_grid_repeater.itemAt(index).children[0].y + ")")
console.log("Hint pos (" + hint.x + ", " + hint.y + ")")
console.log("Grid pos (" + catalog_grid.x + ", " + catalog_grid.y + ")")
console.log("Grid Parent pos (" + parent.x + ", " + parent.y + ")")
//hint.x = catalog_grid_repeater.itemAt(index).children[0].x//hint.anchors.left = catalog_grid_repeater.itemAt(index).left//catalog_grid_repeater.itemAt(0).horizontalCenter//.left//parent.x + ((parent.width - this.width) / 2)
//hint.y = catalog_grid_repeater.itemAt(index).children[0].y
//hint.x = catalog_grid.x + catalog_grid_repeater.itemAt(index).children[0].x// + catalog_grid_repeater.itemAt(index).children[0].width
//hint.y = catalog_grid.y + catalog_grid_repeater.itemAt(index).children[0].y
/*NeroshopComponents.Hint*/hint.show("You've previously purchased this item", -1)//(!is_favorited) ? "Add to favorites" : "Remove from favorites"
////if(has_purchased) { // if item has been purchased previously then this icon will be visible, so no need for this
let boxPositionInWindow = mapToItem(mainWindow.contentItem, verifiedPurchaseIconMouseArea.x, verifiedPurchaseIconMouseArea.y)
let box = catalogGridRepeater.itemAt(index).children[0]
catalogHint.x = boxPositionInWindow.x + (box.width - catalogHint.width) / 2
catalogHint.y = boxPositionInWindow.y + box.height + 5
catalogHint.show("You've previously purchased this item", 3000) // hide after 3 seconds
////}
}
onExited: {
hint.hide()
}
//onClicked: { // for heart_icon ColorOverlay ONLY
//if(!is_favorited) heart_icon.color = "#808080"
//else heart_icon.color = "#e05d5d"
//}
catalogHint.hide()
}
}
}
ColorOverlay {
anchors.fill: verified_purchase_icon
source: verified_purchase_icon
color: "#808080"//#808080 = 128, 128, 128//#1e509b = active color //(has_purchased) ? color: "#1e509b" : "#808080"
visible: verified_purchase_icon.visible
anchors.fill: verifiedPurchaseIcon
source: verifiedPurchaseIcon
color: (NeroshopComponents.Style.darkTheme) ? "#6699cc" : "#1e509b"//"#336699"// // activeColor
visible: verifiedPurchaseIcon.visible
}
Image {
id: heart_icon
id: heartIcon
source: "file:///" + neroshopResourcesDir + "/heart.png"//neroshopResourceDir + "/heart.png"
visible: true
anchors.right: parent.right
@ -95,36 +85,62 @@ import "." as NeroshopComponents
anchors.topMargin: 10
height: 24; width: 24 // has no effect since image is scaled
fillMode:Image.PreserveAspectFit; // the image is scaled uniformly to fit button without cropping
fillMode:Image.PreserveAspectFit; // the image is scaled uniformly to fit button without cropping
mipmap: true
MouseArea {
id: heartIconMouseArea
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton
onEntered: {
let boxPositionInWindow = mapToItem(mainWindow.contentItem, heartIconMouseArea.x, heartIconMouseArea.y)
let box = catalogGridRepeater.itemAt(index).children[0]
catalogHint.x = boxPositionInWindow.x + (box.width - catalogHint.width) / 2
catalogHint.y = boxPositionInWindow.y + box.height + 5
catalogHint.show("Add to favorites", 3000)////(!is_favorited) ? catalogHint.show("Add to favorites", -1) : catalogHint.show("Remove from favorites")
}
onExited: {
catalogHint.hide()
}
onClicked: {
/*if(!is_favorited) heartIconOverlay.color = "#808080"
else heartIconOverlay.color = "#e05d5d"*/
heartIconOverlay.color = "#e05d5d"
}
}
}
ColorOverlay {
anchors.fill: heart_icon
source: heart_icon
color:"#808080"//#808080 = 128, 128, 128//#e05d5d = active color //(is_favorited) ? color: "#e05d5d" : "#808080"
visible: heart_icon.visible
id: heartIconOverlay
anchors.fill: heartIcon
source: heartIcon
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : NeroshopComponents.Style.disabledColor//#e05d5d = active color ////(is_favorited) ? color: "#e05d5d" : "#808080"
visible: heartIcon.visible
}
Image {
id: product_image
id: productImage
source: "file:///" + neroshopResourcesDir + "/image_gallery.png"//neroshopResourceDir + "/image_gallery.png"
anchors.centerIn: parent
width: 128
height: 128
fillMode:Image.Stretch
fillMode:Image.Stretch
//mipmap: true
}
/*ColorOverlay {
anchors.fill: product_image
source: product_image
color:"#808080"//#808080 = 128, 128, 128
}*/
anchors.fill: productImage
source: productImage
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : NeroshopComponents.Style.disabledColor
visible: productImage.visible
}*/
Label {
id: product_name_label
id: productNameLabel
text: ""//name
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: product_image.bottom
anchors.top: productImage.bottom
anchors.topMargin: 10
}
} // Catalog View Box (grid box)

@ -12,6 +12,7 @@ ToolTip {
//y: (parent.y + parent.height) + 5 //anchors.top: parent.bottom; anchors.topMargin: 5
delay: 500 // shows tooltip after hovering over it for 0.5 seconds
property string direction: "up"//"down"
property alias pointer: triangleTip
contentItem: Text {
text: hint.text
@ -29,11 +30,11 @@ ToolTip {
radius: 5//10
//gradient: "NightFade"
NeroshopComponents.Triangle {
id: triangleTip
//anchors.left: hint.left//hint.horizontalCenter
//anchors.leftMargin: 100
//anchors.top: parent.top//hint.top
//anchors. :
id: pointer
//x: this.x
//y: this.y
////direction: hint.direction

@ -6,9 +6,15 @@ import "." as NeroshopComponents // Hint
RowLayout {
id: buttons_menu
NeroshopComponents.Hint {
id: navButtonHint
pointer.visible: false
delay: 0 // show immediately on hovering over button
}
Button {
id: wallet_button
id: walletButton
text: qsTr("Wallet")
//onClicked: _stackview.currentIndex = 0
display: AbstractButton.IconOnly//AbstractButton.TextUnderIcon//AbstractButton.TextBesideIcon
@ -17,18 +23,18 @@ RowLayout {
icon.color: "#ffffff"
/*contentItem: Text {
text: wallet_button.text
text: walletButton.text
color: "#ffffff"
} */
background: Rectangle {
color: wallet_button.down ? "white" : "transparent"//NeroshopComponents.Style.moneroOrangeColor
color: walletButton.down ? "white" : "transparent"//NeroshopComponents.Style.moneroOrangeColor
border.color: color
radius: 5
}
MouseArea {
//id: _mouse_area
//id: walletButtonMouseArea
anchors.fill: parent
hoverEnabled: true
onEntered: {
@ -37,6 +43,9 @@ RowLayout {
parent.icon.color = NeroshopComponents.Style.moneroOrangeColor
// Style 2
//parent.background.color = NeroshopComponents.Style.moneroOrangeColor
navButtonHint.x = parent.x + (parent.background.width - navButtonHint.width) / 2
navButtonHint.y = parent.y + parent.background.height + 5
navButtonHint.show(parent.text, -1)
}
onExited: {
// Style 1
@ -44,6 +53,7 @@ RowLayout {
parent.icon.color = "#ffffff"
// Style 2
//parent.background.color = "transparent"
navButtonHint.hide()
}
//onClicked: {}
}
@ -87,11 +97,6 @@ RowLayout {
background: Rectangle {
color: "#607848"
}
NeroshopComponents.Hint {
id: order_button_hint
text: "Orders"
}
}
Button {

@ -25,25 +25,25 @@ QtObject {
property string moneroGrayColor: "#4c4c4c"
property string moneroOrangeColor: "#ff6600" // not sure if correct color
// Functions
function getColorByThemeName() {
function getColorsByTheme() {
let primaryColor = ""
let secondaryColor = ""
if(darkTheme) {
console.log("darkTheme is on")
if(themeName.match("PurpleDust")) {
primaryColor = "#141419"
secondaryColor = "#292933"
}
else { // "DefaultDark"
else {
//themeName = "DefaultDark"
primaryColor = "#202020"// #121212 = rgb(18, 18, 18)
secondaryColor = "#2e2e2e"
}
}
else if(!darkTheme) { // "DefaultLight"
console.log("darkTheme is off")
primaryColor = "#a0a0a0"
secondaryColor = "#ffffff"
else if(!darkTheme) {
//themeName = "DefaultLight"
primaryColor = "#c1c1c5"//"#ffffff"
secondaryColor = "#909093"
}
return [primaryColor, secondaryColor];
}

@ -4,6 +4,7 @@ import QtQuick.Shapes 1.3 // (since Qt 5.10) // Shape
import QtGraphicalEffects 1.12//Qt5Compat.GraphicalEffects 1.15//= Qt6// ColorOverlay
Item {
id: triangleTip
property string direction: "up"//"down"
property string color: "white"
readonly property int parentWidth: parent.width // get the Hint (Tooltip)'s width
@ -19,6 +20,7 @@ Item {
y: parent.parentY - this.height// + 4
//transform: Rotation { origin.x: triangle.x; origin.y: triangle.y; axis { x: 0; y: 0; z: 1 } angle: 180 }
height: 24; width: 24
visible: triangleTip.visible
}
ColorOverlay {
anchors.fill: triangle

@ -7,9 +7,10 @@ import "." as NeroshopComponents
Item {
id: viewToggle
property real radius: 3;
property alias checkedButton: viewButtonGroup.checkedButton
ButtonGroup {
id: button_group
id: viewButtonGroup
buttons: column.children
exclusive: true // only one button in the group can be checked at any given time
onClicked: {
@ -25,7 +26,7 @@ Row {
Button {
checked: true
text: qsTr("Grid view")
ButtonGroup.group: button_group // attaches a button to a button group
ButtonGroup.group: viewButtonGroup // attaches a button to a button group
display: AbstractButton.IconOnly
icon.source: "file:///" + neroshopResourcesDir + "/grid.png"//neroshopResourceDir + "/grid.png"
icon.color: !this.checked ? "#39304f" : "#ffffff"// icon color is set automatically unless we set it ourselves, which we do here
@ -37,7 +38,7 @@ Row {
Button {
text: qsTr("List view")
ButtonGroup.group: button_group
ButtonGroup.group: viewButtonGroup
display: AbstractButton.IconOnly
icon.source: "file:///" + neroshopResourcesDir + "/list.png"//neroshopResourceDir + "/list.png"
icon.color: !this.checked ? "#39304f" : "#ffffff"

@ -11,14 +11,17 @@ Page {
//id: catalog_page
background: Rectangle {
//visible: true
color:"transparent" // fixes white edges on borders when grid box radius is set
color: "transparent" // fixes white edges on borders when grid box radius is set
}
NeroshopComponents.Hint {
id: hint
id: catalogHint
pointer.visible: false
delay: 500
}
NeroshopComponents.FilterBox {
id: productFilterBox
anchors.left: parent.left
anchors.leftMargin: 20
anchors.top: parent.top
@ -27,13 +30,16 @@ Page {
// Text that displays current page results information
Text {
id: pageResultsDisplay
text: "Page " + (catalog_stack.currentIndex + 1) + " of " + catalog_stack.count
font.bold: true
x: 500
y: 0
x: catalog_stack.x
y: viewToggle.y//0
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
}
NeroshopComponents.ViewToggle {
id: viewToggle
x: parent.x + (parent.width - this.width) / 2
y: parent.y + 20
}
@ -77,6 +83,7 @@ Page {
Repeater {
id: pages
model: 10 // Number of page results from search
// todo: use a Loader to switch between grid view and list view // https://forum.qt.io/topic/80826/dynamic-delegate-in-repeater/4 //// (viewToggle.checkedButton.text.match("List view")) ?
delegate: NeroshopComponents.CatalogGrid {
// To access each grid: pages.itemAt(index)
// To access each box inside the grid: pages.itemAt(gridIndex).children[gridBoxIndex] //or: pages.itemAt(gridIndex).getBox(gridBoxIndex)

Loading…
Cancel
Save