Add Banner.qml and some other qml files

pull/21/head
larteyoh 2 years ago
parent 2fe1ba34c6
commit 014e7bd0e7

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

@ -24,20 +24,15 @@ ApplicationWindow {
height: 720
minimumWidth: 850
minimumHeight: 500
color: NeroshopComponents.Style.getColorsByTheme()[0]
///////////////////////////
// Global Tooltip
/*NeroshopComponents.Hint {
id: hint
visible: false
}*/
color: NeroshopComponents.Style.getColorsFromTheme()[0]
header: Rectangle {
color: NeroshopComponents.Style.getColorsByTheme()[1]
color: NeroshopComponents.Style.getColorsFromTheme()[1]
height: 100 // width should be set automatically to the parent's width
NeroshopComponents.SearchBar {
id: searchBar
visible: (!page_loader.source.toString().match("qml/pages/MainPage.qml")) ? true : false;
visible: (!pageLoader.source.toString().match("qml/pages/MainPage.qml")) ? true : false;
anchors.left: parent.left
anchors.leftMargin: 20
@ -47,7 +42,7 @@ ApplicationWindow {
NeroshopComponents.NavigationalBar {
id: navBar
visible: (!page_loader.source.toString().match("qml/pages/MainPage.qml")) ? true : false;
visible: (!pageLoader.source.toString().match("qml/pages/MainPage.qml")) ? true : false;
anchors.left: parent.right
anchors.leftMargin: (-this.width - 20)
@ -59,10 +54,10 @@ ApplicationWindow {
//ScrollView {
StackView {
anchors.fill: parent
////initialItem: page_loader
////initialItem: pageLoader
}
Loader {
id: page_loader
id: pageLoader
//anchors.centerIn: parent // place at center of parent // <= don't use this EVER. Not for loading pages
anchors.fill: parent
//source: "qrc:/qml/pages/MainPage.qml"
@ -74,7 +69,7 @@ ApplicationWindow {
onSourceChanged: {
console.log(source);
if (page_loader.status == Loader.Ready) console.log('Loaded')
if (pageLoader.status == Loader.Ready) console.log('Loaded')
else console.log('Not Loaded')
}
}
@ -84,7 +79,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.getColorsByTheme()[1]
color: NeroshopComponents.Style.getColorsFromTheme()[1]
Row {
anchors.fill: parent
@ -101,7 +96,6 @@ ApplicationWindow {
NeroshopComponents.ThemeSwitch {
id: themeSwitcher
width: 40
//anchors.fill: parent
}
}
@ -113,13 +107,20 @@ ApplicationWindow {
NeroshopComponents.ProgressBar {
id: daemonSyncBar
radius: 20//5
foregroundColor: "#564978"//"#6b5b95"
//backgroundColor: ""
radius: 20
foregroundColor: "#564978"
//textObject.visible: true
anchors.top: parent.top
anchors.topMargin: (parent.height - this.height) / 2 // center vertically on footer (height)
}
anchors.verticalCenter: parent.verticalCenter//anchors.top: parent.top; anchors.topMargin: (parent.height - this.height) / 2 // center vertically on footer (height)
NeroshopComponents.Hint {
visible: parent.hovered
x: parent.x + (parent.width - this.width) / 2 // Popups don't have anchors :(
height: contentHeight + 20; width: parent.width
bottomMargin : footer.height + 5
text: qsTr("neroshop-daemon (neromon) \nStatus: %1 \nProgress: %2").arg((parent.value < 1.0) ? "synchronizing" : "connected").arg((parent.value * 100).toString() + "%")
pointer.visible: false
}
}
}
Rectangle {
width: moneroDaemonSyncBar.width
@ -133,9 +134,9 @@ ApplicationWindow {
foregroundColor: NeroshopComponents.Style.moneroOrangeColor
backgroundColor: NeroshopComponents.Style.moneroGrayColor
//textObject.visible: true
textObject.color: "#ffffff"
anchors.top: parent.top
anchors.topMargin: (parent.height - this.height) / 2
//textObject.text: "wallet sync: " + (this.value * 100).toString() + "%"
//textObject.color: "#ffffff"
anchors.verticalCenter: parent.verticalCenter//anchors.top: parent.top; anchors.topMargin: (parent.height - this.height) / 2
}
}
//Rectangle {
@ -151,6 +152,3 @@ ApplicationWindow {
// error: /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake will set Qt5_FOUND to FALSE so package "Qt5" is considered to be NOT FOUND due to Qml and Quick configuration files (/usr/lib/x86_64-linux-gnu/cmake/Qt5Qml/Qt5QmlConfig.cmake; /usr/lib/x86_64-linux-gnu/cmake/Qt5Quick/Qt5QuickConfig.cmake) not being found (fix: sudo apt install qtdeclarative5-dev)
// error: module "QtQuick" is not installed (fix: qml-module-qtquick-controls qml-module-qtquick-controls2). This will also install qml-module-qtgraphicaleffects, qml-module-qtquick-layouts, qml-module-qtquick-window2, and qml-module-qtquick2
// error: module "QtQuick.Shapes" is not installed (fix: qml-module-qtquick-shapes)
// todo: create a top banner with a dot-styled pagination (See: PageIndicator)
// todo: create a custom message box dialog in MessageBox.qml

@ -2,6 +2,7 @@
<qresource prefix="/">
<file>main.qml</file>
<!-- qml sources: components -->
<file>qml/components/Banner.qml</file>
<file>qml/components/CatalogGrid.qml</file>
<file>qml/components/FilterBox.qml</file>
<file>qml/components/Hint.qml</file>
@ -15,11 +16,17 @@
<file>qml/components/Triangle.qml</file>
<file>qml/components/ViewToggle.qml</file>
<!-- qml sources: pages -->
<file>qml/pages/CartPage.qml</file>
<file>qml/pages/CatalogPage.qml</file>
<file>qml/pages/HomePage.qml</file>
<file>qml/pages/MainPage.qml</file>
<file>qml/pages/OrderCheckoutPage.qml</file>
<file>qml/pages/ProductPage.qml</file>
<file>qml/pages/settings/SettingsAccount.qml</file>
<file>qml/pages/settings/SettingsMessages.qml</file>
<file>qml/pages/settings/SettingsOrders.qml</file>
<file>qml/pages/settings/SettingsSellersHub.qml</file>
<file>qml/pages/settings/SettingsWallet.qml</file>
<!-- fonts -->
<file>fonts/FiraCode-Bold.ttf</file>
<file>fonts/FiraCode-Light.ttf</file>

@ -0,0 +1,62 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
//import QtQuick.Layouts 1.12
//import QtGraphicalEffects 1.12
// Banner will be changed more frequently than the other components and will contain the latest news from Monero news sources, featured items, product deals, etc.
Item {
id: banner
implicitWidth: 300; implicitHeight: 150 // default size
property real radius: 0
// Reminder: SwipeView is non-visual, only the Rectangles are!
SwipeView {
id: view
//implicitWidth: parent.width
//implicitHeight: parent.height
/*Repeater {
model: 6
Loader {
active: SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem
sourceComponent: Text {
text: index
Component.onCompleted: console.log("created:", index)
Component.onDestruction: console.log("destroyed:", index)
}
}
}*/
currentIndex: indicator.currentIndex//0
anchors.fill: parent
interactive: true
orientation: Qt.Horizontal
//property alias currentItem:
Rectangle {
id: firstPage
color: "blue"
width: parent.parent.width; height: parent.parent.height//width: 500; height: 500
radius: banner.radius
}
Rectangle {
id: secondPage
color: "red"
width: parent.parent.width; height: parent.parent.height//width: 500; height: 500
radius: banner.radius
}
Rectangle {
id: thirdPage
color: "purple"
width: parent.parent.width; height: parent.parent.height//width: 500; height: 500
radius: banner.radius
}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.bottom: view.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
}

@ -12,7 +12,7 @@ import "." as NeroshopComponents
// catalog view (Grid)
Grid {
id: catalogGrid
rows: 2
rows: 20//2
columns: 3
spacing: 5//rowSpacing: 5; columnSpacing: 5
//flow: Grid.TopToBottom
@ -22,20 +22,57 @@ import "." as NeroshopComponents
function getBoxCount() {
return catalogGridRepeater.count; // count is really just the number of items in the model :O
}
property bool hideProductDetails: true//false // hides product name, price, and star ratings if set to true
Repeater { // owns all items it instantiates
id: catalogGridRepeater
model: (rows * columns)//fruitModel // rows and columns already set so this is useless (I think)
model: (rows * columns)// 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
id: product_box
visible: true
width: 220
height: 220
width: (hideProductDetails) ? 250 : 300//220 : 250//300
height: (hideProductDetails) ? 300 : 400//220 : 250//220
color: (NeroshopComponents.Style.darkTheme) ? "#2e2e2e"/*"#121212"*/ : "#a0a0a0"//"#ffffff"// #a0a0a0 = 160,160,160
//border.color: "white"
//border.width: 1
border.color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
border.width: 0
radius: 5
clip: true // So that productNameLabel will be clipped to the Rectangle's bounding rectangle and will not go past it
Image {
id: productImage
source: "file:///" + neroshopResourcesDir + "/image_gallery.png"
anchors.horizontalCenter: parent.horizontalCenter//anchors.centerIn: parent
anchors.top: heartIconButton.top//parent.top
anchors.topMargin: 20
width: 128
height: 128
fillMode:Image.Stretch
mipmap: true
MouseArea {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton
onEntered: {
catalogGridRepeater.itemAt(index).border.width = 1
}
onExited: {
catalogGridRepeater.itemAt(index).border.width = 0
}
onClicked: {
navBar.uncheckAllButtons() // Uncheck all navigational buttons
console.log("Loading product page ...");
////pageLoader.source = "../pages/ProductPage.qml"
}
}
}
/*ColorOverlay {
anchors.fill: productImage
source: productImage
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : NeroshopComponents.Style.disabledColor
visible: productImage.visible
}*/
Image {
id: verifiedPurchaseIcon
@ -49,24 +86,19 @@ 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
NeroshopComponents.Hint {
id: verifiedPurchaseIconHint
visible: verifiedPurchaseIconMouse.hovered ? true : false
text: qsTr("You've previously purchased this item")
pointer.visible: false
delay: 500; timeout: 3000 // hide after 3 seconds
}
MouseArea {
id: verifiedPurchaseIconMouseArea
anchors.fill: parent
hoverEnabled: true
onEntered: {
////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: {
catalogHint.hide()
}
}
HoverHandler {
id: verifiedPurchaseIconMouse
acceptedDevices: PointerDevice.Mouse
}
}
ColorOverlay {
anchors.fill: verifiedPurchaseIcon
@ -74,75 +106,116 @@ import "." as NeroshopComponents
color: (NeroshopComponents.Style.darkTheme) ? "#6699cc" : "#1e509b"//"#336699"// // activeColor
visible: verifiedPurchaseIcon.visible
}
Image {
id: heartIcon
source: "file:///" + neroshopResourcesDir + "/heart.png"//neroshopResourceDir + "/heart.png"
visible: true
Button { // heartIconButton must be drawn over the productImage
id: heartIconButton
text: qsTr("Add to favorites")
display: AbstractButton.IconOnly // will only show the icon and not the text
hoverEnabled: true
////containmentMask: this.icon // When the mouse is pointing at the icon's bounding box instead of the button's then the border will appear
//width: 24; height: 24
anchors.right: parent.right
anchors.rightMargin: 10
anchors.rightMargin: 5//10
anchors.top: parent.top
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
mipmap: true
anchors.topMargin: 5//10
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 {
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: productImage
source: "file:///" + neroshopResourcesDir + "/image_gallery.png"//neroshopResourceDir + "/image_gallery.png"
anchors.centerIn: parent
width: 128
height: 128
fillMode:Image.Stretch
//mipmap: true
}
/*ColorOverlay {
anchors.fill: productImage
source: productImage
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : NeroshopComponents.Style.disabledColor
visible: productImage.visible
}*/
icon.source: "file:///" + neroshopResourcesDir + "/heart.png"
icon.color: "#ffffff"
icon.height: 24; icon.width: 24
background: Rectangle {
color: "transparent"
radius: 3//0
border.color: {
if(NeroshopComponents.Style.darkTheme && parent.hovered) {
return "#ffffff"
}
else if(!NeroshopComponents.Style.darkTheme && parent.hovered) {
return "#000000"
}
else return "transparent"
}//parent.hovered ? "#ffffff" : "transparent"
}
NeroshopComponents.Hint {
id: heartIconButtonHint
visible: parent.hovered
text: parent.text
pointer.visible: false
delay: 500; timeout: 3000
}
onClicked: {
icon.color = "#e05d5d"
}
}
// todo: maybe use a Flow for text wrapping? // Reminder: Flow children cannot have anchors or positions set!!
Label {
id: productNameLabel
text: ""//name
text: qsTr("A really extremely long as product name that can probably not fit the entire grid")//qsTr("Product name")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
visible: !catalogGrid.hideProductDetails
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: productImage.bottom
anchors.topMargin: 10
}
wrapMode: Text.WordWrap
elide: Text.ElideRight
}
Label {
id: priceFiat
text: qsTr("%1 %2 %3").arg("$").arg("0.00").arg("USD")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
visible: !catalogGrid.hideProductDetails
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: productNameLabel.bottom
anchors.topMargin: 10
}
Image {
id: moneroSymbol
source: "file:///" + neroshopResourcesDir + "/monero_symbol.png"//"/monero_symbol_white.png"
visible: !catalogGrid.hideProductDetails
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: priceFiat.bottom
anchors.topMargin: 5//10
width: 16; height: 16
fillMode:Image.PreserveAspectFit
mipmap: true
}
Label {
id: priceMonero
text: qsTr("0.000000000000 %1").arg("XMR")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
visible: !catalogGrid.hideProductDetails
anchors.left: moneroSymbol.right
anchors.leftMargin: 5
anchors.verticalCenter: moneroSymbol.verticalCenter
}
states: [
State {
name: "wide text"
when: parent.children[4].contentWidth > parent.width//.children[4].text.length > 20
PropertyChanges {
target: parent.children[4];
width: 5000
height: parent.children[4].paintedHeight
}
}/*,
State {
name: "not wide text"
when: catalogGridRepeater.itemAt(index).children[4].text.length <= 20
PropertyChanges {
target: catalogGridRepeater.itemAt(index).children[4];
width: dummy_text.paintedWidth
height: catalogGridRepeater.itemAt(index).children[4].paintedHeight
}*/
]
} // Catalog View Box (grid box)
} // Repeater
} // Catalog View (grid)

@ -4,11 +4,13 @@ import QtQuick.Layouts 1.12
import "." as NeroshopComponents
Pane {//Item {
Pane {
width: 250; height: 540
background: Rectangle {
color: "#a0a0a0"//(NeroshopComponents.Style.darkTheme) ? "#2e2e2e"/*"#121212"*/ : "#a0a0a0"
}
color: (NeroshopComponents.Style.darkTheme) ? "#2e2e2e"/*"#121212"*/ : "#a0a0a0"
radius: 3
}
// conditionGroup
ButtonGroup {
id: conditionButtonGroup
buttons: conditionColumn.children
@ -27,77 +29,146 @@ Pane {//Item {
}
}
}
ScrollView { // inherits Pane
//ScrollBar.horizontal.policy: ScrollBar.AlwaysOn
//ScrollBar.vertical.policy: ScrollBar.AlwaysOn
width: parent.width + 50; height: 500
Column {//ColumnLayout {
id: conditionColumn
anchors.fill: parent
Text {
text: qsTr("Condition");
font.bold: true
}
CheckBox {
id: conditionParentBox
text: qsTr("Any")//qsTr("Parent")
checkState: conditionButtonGroup.checkState
}
CheckBox {
//checked: false
text: qsTr("New")
leftPadding: indicator.width
ButtonGroup.group: conditionButtonGroup
}
CheckBox {
text: qsTr("Used")
leftPadding: indicator.width
ButtonGroup.group: conditionButtonGroup
// priceGroup
ButtonGroup {
id: priceButtonGroup
buttons: priceColumn.children
exclusive: false // more than one button in the group can be checked at any given time
checkState: priceParentBox.checkState
onClicked: {
console.log("Selected price range:", button.text)
if(checkState == Qt.Unchecked) {
console.log("checkState: NO button is checked")
}
CheckBox {
text: qsTr("Refurbished/Renewed")
leftPadding: indicator.width
ButtonGroup.group: conditionButtonGroup
if(checkState == Qt.Checked) {
console.log("checkState: All buttons are checked")
}
if(checkState == Qt.PartiallyChecked) {
console.log("checkState: One or more buttons are checked")
}
}
// todo: sort by category, price, ratings, brand, color, etc.
//////////////
/* ColumnLayout {
id: aColumn
//anchors.fill: parent
Text {
qsTr("a")
font.bold: true
}
Flickable {
id: flickable
anchors.fill: parent
clip: true // The area in which the contents of the filterBox will be bounded to (set width and height) // If clip is false then the contents will go beyond/outside of the filterBox's bounds
contentWidth: columnLayout.width
contentHeight: columnLayout.height
ColumnLayout {
id: columnLayout//filterOptions
width: flickable.width// - 10//- 20
Frame {
Layout.fillWidth: true
background: Rectangle {
color: "transparent"
border.color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"//"#21be2b"
radius: 2
opacity: 0.1
}
ColumnLayout {
id: conditionColumn
width: parent.width
Label {
text: qsTr("Condition")
font.bold: true
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
}
CheckBox {
id: conditionParentBox
checkState: conditionButtonGroup.checkState
Text {
text: qsTr("Any")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
anchors.left: parent.right
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: (parent.height - this.contentHeight) / 2
}
}
CheckBox {
ButtonGroup.group: conditionButtonGroup
Text {
text: qsTr("New")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
anchors.left: parent.right
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: (parent.height - this.contentHeight) / 2
}
}
CheckBox {
ButtonGroup.group: conditionButtonGroup
Text {
text: qsTr("Used")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
anchors.left: parent.right
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: (parent.height - this.contentHeight) / 2
}
}
CheckBox {
ButtonGroup.group: conditionButtonGroup
Text {
text: qsTr("Refurbished/Renewed")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
anchors.left: parent.right
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: (parent.height - this.contentHeight) / 2
}
}
}
}
CheckBox {
id: aParentBox
text: qsTr("Any")
checkState: aButtonGroup.checkState
Frame {
Layout.fillWidth: true
background: Rectangle {
color: "transparent"
border.color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"//"#21be2b"
radius: 2
opacity: 0.1
}
ColumnLayout {
id: priceColumn
width: parent.width
Label {
text: qsTr("Price")
font.bold: true
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
}
// todo: maybe use a slider to set the price range instead?
CheckBox {
id: priceParentBox
checkState: priceButtonGroup.checkState
Text {
text: qsTr("Any")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
anchors.left: parent.right
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: (parent.height - this.contentHeight) / 2
}
}
CheckBox {
ButtonGroup.group: priceButtonGroup
Text {
text: qsTr("$0.00-$1.00")
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
anchors.left: parent.right
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: (parent.height - this.contentHeight) / 2
}
}
}
}
//CheckBox {
// text: qsTr("")
// leftPadding: indicator.width
// ButtonGroup.group: aButtonGroup
//}
}*/
}
/*ButtonGroup {
id: aButtonGroup
buttons: aColumn.children
exclusive: true
onClicked: {
console.log("Selected ", button.text)
}
// CatalogPage has a scrollbar so there's no longer any need for this
/*ScrollBar.vertical: ScrollBar {
//width: 20
policy: ScrollBar.AsNeeded//ScrollBar.AlwaysOn
}*/
}
ScrollView {
ColumnLayout {
id: aColumn
//anchors.fill: parent
Text { font.bold: true }
CheckBox { text: qsTr("Test") }
//CheckBox { text: qsTr("") }
}
}*/
// todo: sort by category, price, ratings, brand, color, etc.
}

@ -5,29 +5,38 @@ import "." as NeroshopComponents // Triangle (in Triangle.qml)
ToolTip {
id: hint
text: ""//"position: " + tooltip_arrow.position + " (" + tooltip_arrow.offsetX + ")"//qsTr("A descriptive tool tip of what the button does")
visible: false//true//false
width: contentWidth + 20; height: 50 //width: (text.length * 10) + 20// assuming each character is 10 pixels in width
text: ""//qsTr("A descriptive tool tip of what the button does")
visible: false
implicitWidth: contentWidth + 20; implicitHeight: contentHeight + 20 //width: (text.length * 10) + 20// assuming each character is 10 pixels in width
//x: parent.x + ((parent.width - this.width) / 2) //anchors.left: parent.left; anchors.leftMargin: (parent.width - this.width) / 2
//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
property alias textObject: hintText
property alias rect: hint.background
property string textColor: "#ffffff"
property string color: "#0a0a0a"
readonly property alias backgroundColor: hint.color
property string borderColor: "#ffffff"
property real borderWidth: 0
property real radius: 5//10
contentItem: Text {
id: hintText
text: hint.text
font: hint.font
color: "#ffffff"
color: hint.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
}
background: Rectangle {
color: "#000000"// #0a0a0a = 10, 10, 10
color: hint.color
opacity: 0.9
border.color: "#ffffff"
border.width: 0
radius: 5//10
border.color: hint.borderColor
border.width: hint.borderWidth
radius: hint.radius
//gradient: "NightFade"
NeroshopComponents.Triangle {
id: triangleTip

@ -1,152 +1,236 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
//import QtGraphicalEffects 1.12// replaced with "import Qt5Compat.GraphicalEffects 1.15" in Qt6// ColorOverlay
import "." as NeroshopComponents // Hint
RowLayout {
id: buttons_menu
id: navBar
readonly property string defaultButtonColor: "#6b5b95"
property bool useDefaultButtonColor: false
function getCheckedButton() {
return navBarButtonGroup.checkedButton;
}
function uncheckAllButtons() {
navBarButtonGroup.checkState = Qt.Unchecked;
}
NeroshopComponents.Hint {
id: navButtonHint
pointer.visible: false
delay: 0 // show immediately on hovering over button
ButtonGroup {
id: navBarButtonGroup
exclusive: true
//checkState: conditionParentBox.checkState
onClicked: {
console.log("Selected", button.text, "button")
button.checked = true
if(button.text == walletButton.text) {
pageLoader.source = "../pages/settings/SettingsWallet.qml"//_stackview.currentIndex = 0
}
if(button.text == sellersHubButton.text) {
pageLoader.source = "../pages/settings/SettingsSellersHub.qml"
}
if(button.text == messagesButton.text) {
pageLoader.source = "../pages/settings/SettingsMessages.qml"
}
if(button.text == ordersButton.text) {
pageLoader.source = "../pages/settings/SettingsOrders.qml"
}
if(button.text == accountSettingsButton.text) {
pageLoader.source = "../pages/settings/SettingsAccount.qml"
}
}
}
Button {
id: walletButton
text: qsTr("Wallet")
//onClicked: _stackview.currentIndex = 0
display: AbstractButton.IconOnly//AbstractButton.TextUnderIcon//AbstractButton.TextBesideIcon
ButtonGroup.group: navBarButtonGroup // attaches a button to a button group
display: AbstractButton.IconOnly
//checkable: true
icon.source: "file:///" + neroshopResourcesDir + "/wallet.png"//neroshopResourceDir + "/wallet.png"
icon.color: "#ffffff"
/*contentItem: Text {
text: walletButton.text
color: "#ffffff"
} */
icon.source: "file:///" + neroshopResourcesDir + "/wallet.png"
icon.color: (!checked && this.hovered) ? NeroshopComponents.Style.moneroOrangeColor : "#ffffff"
//property string reservedColor: NeroshopComponents.Style.moneroOrangeColor
background: Rectangle {
color: walletButton.down ? "white" : "transparent"//NeroshopComponents.Style.moneroOrangeColor
border.color: color
color: (parent.checked) ? NeroshopComponents.Style.moneroOrangeColor : "transparent"
border.color: NeroshopComponents.Style.moneroOrangeColor
border.width: (!parent.checked && parent.hovered) ? 1 : 0
radius: 5
}
MouseArea {
//id: walletButtonMouseArea
anchors.fill: parent
hoverEnabled: true
onEntered: {
// Style 1
parent.background.border.color = NeroshopComponents.Style.moneroOrangeColor
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
parent.background.border.color = "transparent"
parent.icon.color = "#ffffff"
// Style 2
//parent.background.color = "transparent"
navButtonHint.hide()
}
//onClicked: {}
}
}
NeroshopComponents.Hint {
id: walletButtonHint
visible: parent.hovered
text: parent.text
pointer.visible: false
delay: 0 // Show immediately on hovering over button
//textObject.font.bold: true
}
}
Button {
text: qsTr("Seller Hub")
//onClicked: _stackview.currentIndex = 0
id: sellersHubButton
text: qsTr("Sellers' Hub")
ButtonGroup.group: navBarButtonGroup
display: AbstractButton.IconOnly//AbstractButton.TextBesideIcon
icon.source: "file:///" + neroshopResourcesDir + "/shop.png"//neroshopResourceDir + "/shop.png"
icon.color: "#ffffff"
icon.source: "file:///" + neroshopResourcesDir + "/shop.png"
icon.color: (!checked && this.hovered) ? reservedColor : "#ffffff"
property string reservedColor: (useDefaultButtonColor) ? defaultButtonColor : "royalblue"
background: Rectangle {
color: "royalblue"//"#808080"
}
color: (parent.checked) ? parent.reservedColor : "transparent"
border.color: parent.reservedColor
border.width: (!parent.checked && parent.hovered) ? 1 : 0
radius: 5
}
NeroshopComponents.Hint {
visible: parent.hovered
text: parent.text
pointer.visible: false
delay: 0 // Show immediately on hovering over button
//textObject.font.bold: true
}
}
Button {
text: qsTr("Messages")// todo: replace text with message_count
//onClicked: _stackview.currentIndex = 0
id: messagesButton
text: (messagesButton.dummy_count > 0) ? qsTr("Messages : %1").arg(dummy_count.toString()) : qsTr("Messages")
ButtonGroup.group: navBarButtonGroup
display: AbstractButton.IconOnly//AbstractButton.TextBesideIcon
property int dummy_count: 0
icon.source: "file:///" + neroshopResourcesDir + "/mail.png"//neroshopResourceDir + "/mail.png"
icon.color: "#ffffff"
icon.source: "file:///" + neroshopResourcesDir + "/mail.png"
icon.color: (!checked && this.hovered) ? reservedColor : "#ffffff"
property string reservedColor: (useDefaultButtonColor) ? defaultButtonColor : "#524656"
background: Rectangle {
color: "#524656"
}
color: (parent.checked) ? parent.reservedColor : "transparent"
border.color: parent.reservedColor
border.width: (!parent.checked && parent.hovered) ? 1 : 0
radius: 5
}
NeroshopComponents.Hint {
visible: parent.hovered
text: parent.text
pointer.visible: false
delay: 0
//textObject.font.bold: true
}
}
Button {
id: order_button
id: ordersButton
text: qsTr("Orders")
//onClicked: _stackview.currentIndex = 0
ButtonGroup.group: navBarButtonGroup
display: AbstractButton.IconOnly//AbstractButton.TextBesideIcon
icon.source: "file:///" + neroshopResourcesDir + "/order.png"//neroshopResourceDir + "/order.png"
icon.color: "#ffffff"
icon.source: "file:///" + neroshopResourcesDir + "/order.png"
icon.color: (!checked && this.hovered) ? reservedColor : "#ffffff"
property string reservedColor: (useDefaultButtonColor) ? defaultButtonColor : "#607848"
background: Rectangle {
color: "#607848"
}
color: (parent.checked) ? parent.reservedColor : "transparent"
border.color: parent.reservedColor
border.width: (!parent.checked && parent.hovered) ? 1 : 0
radius: 5
}
NeroshopComponents.Hint {
visible: parent.hovered
text: parent.text
pointer.visible: false
delay: 0
//textObject.font.bold: true
}
}
Button {
id: account_button
text: qsTr("User")//"Account Settings"
//onClicked: _stackview.currentIndex = 0
id: accountSettingsButton
text: qsTr("Account Settings")//qsTr("User")
ButtonGroup.group: navBarButtonGroup
display: AbstractButton.IconOnly//AbstractButton.TextBesideIcon
//flat: true
//highlighted: true
icon.source: "file:///" + neroshopResourcesDir + "/user.png"//neroshopResourceDir + "/user.png"
icon.color: "#ffffff"
icon.source: "file:///" + neroshopResourcesDir + "/user.png"
icon.color: (!checked && this.hovered) ? reservedColor : "#ffffff"
property string reservedColor: (useDefaultButtonColor) ? defaultButtonColor : "#cd8500"
background: Rectangle {
color: "#cd8500"
}
color: (parent.checked) ? parent.reservedColor : "transparent"
border.color: parent.reservedColor
border.width: (!parent.checked && parent.hovered) ? 1 : 0
radius: 5
}
NeroshopComponents.Hint {
visible: parent.hovered
text: parent.text
pointer.visible: false
delay: 0
//textObject.font.bold: true
}
}
Button {
id: cart_button
id: cartButton
////ButtonGroup.group: navBarButtonGroup
////autoExclusive: true
// reference: https://doc.qt.io/qt-5/qml-qtquick-layouts-layout.html
// fix alignment to StackLayout parent (no longer needed since we've set the preffered size, I think?)
Layout.alignment: Qt.AlignTop
// tell the layout that this child will have unique dimensions from the other children
Layout.preferredHeight : 40
Layout.preferredWidth : 100
property string reservedColor: "#323232"//(useDefaultButtonColor) ? defaultButtonColor : "#323232"
background: Rectangle {
//width: cart_button.width; height: cart_button.height//width: 100; height: 40
color: "#323232"
//width: cartButton.width; height: cartButton.height//width: 100; height: 40
color: parent.reservedColor//(parent.checked) ? parent.reservedColor : "transparent"
//border.color: parent.reservedColor
//border.width: (!parent.checked && parent.hovered) ? 1 : 0
radius: 5
}
Text {
id: cart_button_text
id: cartButtonText
text: "0"
color: "#ffffff"
font.bold: true
anchors.left: cart_button.background.left
anchors.left: cartButton.background.left
anchors.leftMargin: 20
anchors.top: cart_button.background.top
anchors.topMargin: (cart_button.background.height - this.height) / 2
anchors.top: cartButton.background.top
anchors.topMargin: (cartButton.background.height - this.height) / 2
}
Image {
source: "file:///" + neroshopResourcesDir + "/cart.png"//neroshopResourceDir + "/cart.png"
id: cartButtonIcon
source: "file:///" + neroshopResourcesDir + "/cart.png"
height: 24; width: 24
anchors.left: cart_button_text.right
anchors.left: cartButtonText.right
anchors.leftMargin: 10
anchors.top: cart_button.background.top
anchors.topMargin: (cart_button.background.height - this.height) / 2
anchors.top: cartButton.background.top
anchors.topMargin: (cartButton.background.height - this.height) / 2
}
/*ColorOverlay {
anchors.fill: cartButtonIcon
source: cartButtonIcon
color: "#ffffff"//(!parent.checked && parent.hovered) ? parent.reservedColor : "#ffffff"
visible: cartButtonIcon.visible
}*/
NeroshopComponents.Hint {
visible: parent.hovered
text: "Cart"
pointer.visible: false
delay: 0
//textObject.font.bold: true
}
onClicked: {
navBar.uncheckAllButtons();
pageLoader.source = "../pages/CartPage.qml"
}
}
}

@ -13,14 +13,16 @@ Row {//RowLayout {
property alias numberField: currentPageTextField
property int currentIndex: 0
property int count: 0
property real buttonWidth: 150
property string buttonColor: "#50446f"//NeroshopComponents.Style.neroshopPurpleColor
property real buttonRadius: 5
property real radius: buttonRadius
property bool showDirectionalIcons: false
Button {
id: backButton
text: qsTr("%1 Previous").arg(FontAwesome.arrowAltCircleLeft)//.arg(FontAwesome.angleLeft)//qsTr("<")
width: 150
text: (!showDirectionalIcons) ? qsTr("Previous") : qsTr("%1 Previous").arg(FontAwesome.arrowAltCircleLeft)//.arg(FontAwesome.angleLeft)//qsTr("<")
width: paginationBar.buttonWidth
property bool disabled: (paginationBar.currentIndex == 0)//visible: (paginationBar.currentIndex != 0)
background: Rectangle {
color: paginationBar.buttonColor
@ -40,11 +42,12 @@ Row {//RowLayout {
width: 50
//readOnly: true
text: qsTr((parent.currentIndex + 1).toString())
//horizontalAlignment: TextInput.AlignHCenter
verticalAlignment: TextInput.AlignVCenter
inputMethodHints: Qt.ImhDigitsOnly // for Android and iOS - typically used for input of languages such as Chinese or Japanese
validator: RegExpValidator{ regExp: /[0-9]*/ }
selectByMouse: true
color: "black" // textColor
color: "#000000" // textColor
background: Rectangle {
radius: paginationBar.radius
//opacity: 0.0
@ -53,8 +56,8 @@ Row {//RowLayout {
Button {
id: forwardButton
text: qsTr("Next %1").arg(FontAwesome.arrowAltCircleRight)//.arg(FontAwesome.angleRight)//qsTr(">")
width: 150
text: (!showDirectionalIcons) ? qsTr("Next") : qsTr("Next %1").arg(FontAwesome.arrowAltCircleRight)//.arg(FontAwesome.angleRight)//qsTr(">")
width: paginationBar.buttonWidth
property bool disabled: (paginationBar.currentIndex == (count - 1))
background: Rectangle {
color: paginationBar.buttonColor

@ -38,7 +38,7 @@ ProgressBar {
text: (progressBar.value * 100).toString() + "%" // todo: for moneroDaemonSyncBar, display blocks (e.g 1509/16098674 blocks remaining)
anchors.centerIn: parent
visible: false
font.bold: true
//font.bold: true
color: "#000000"
}
}

@ -25,7 +25,7 @@ QtObject {
property string moneroGrayColor: "#4c4c4c"
property string moneroOrangeColor: "#ff6600" // not sure if correct color
// Functions
function getColorsByTheme() {
function getColorsFromTheme() {
let primaryColor = ""
let secondaryColor = ""

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../components" as NeroshopComponents

@ -7,13 +7,61 @@ import QtGraphicalEffects 1.12//Qt5Compat.GraphicalEffects 1.15//= Qt6// ColorOv
import "../components" as NeroshopComponents
Page {
ScrollView {//Page {//Flickable {
function resetScrollBar() {
catalogScrollView.ScrollBar.vertical.position = 0.0
console.log("Scrollbar reset")
}
function goToNextPage() {
catalogStack.currentIndex = catalogStack.currentIndex + 1
if(catalogStack.currentIndex >= (catalogStack.count - 1)) catalogStack.currentIndex = (catalogStack.count - 1)
resetScrollBar()
}
function goToPrevPage() {
catalogStack.currentIndex = catalogStack.currentIndex - 1
if(catalogStack.currentIndex <= 0) catalogStack.currentIndex = 0
resetScrollBar()
}
function setCurrentPageIndex(numberInput) {
// if numberInput is greater than (count - 1) then equal it to (count - 1)
if(Number(numberInput) >= (catalogStack.count - 1)) {
numberInput = (catalogStack.count - 1)
}
// if numberInput is less than 0 then equal it to 0
if(Number(numberInput) <= 0) {
numberInput = 0
}
catalogStack.currentIndex = numberInput
////resetScrollBar()
}
function getPageCount() { // Returns total number of grid pages belonging to the catalog StackLayout
return catalogStack.count;
}
function getCurrentPageIndex() {
return catalogStack.currentIndex;
}
function getItemsCount() {
// ... boxesPerGrid * pageCount
}
//id: catalog_page
background: Rectangle {
//visible: true
color: "transparent" // fixes white edges on borders when grid box radius is set
}
id: catalogScrollView
anchors.fill: parent
ScrollBar.vertical.policy: ScrollBar.AlwaysOn//ScrollBar.AsNeeded//ScrollBar.AlwaysOn
clip: true // The area in which the contents of the filterBox will be bounded to (set width and height) // If clip is false then the contents will go beyond/outside of the filterBox's bounds
//contentWidth: mainWindow.width//catalogStack.width
contentHeight: catalogStack.height + 200//100 for viewToggle space and 100 for pagination space //mainWindow.height
NeroshopComponents.ViewToggle {
id: viewToggle
anchors.horizontalCenter: catalogStack.horizontalCenter//parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 20
}
NeroshopComponents.Hint {
id: catalogHint
pointer.visible: false
@ -31,52 +79,22 @@ Page {
// Text that displays current page results information
Text {
id: pageResultsDisplay
text: "Page " + (catalog_stack.currentIndex + 1) + " of " + catalog_stack.count
text: "Page " + (catalogStack.currentIndex + 1) + " of " + catalogStack.count
font.bold: true
x: catalog_stack.x
y: viewToggle.y//0
anchors.left: catalogStack.left
anchors.top: viewToggle.top//0
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
}
NeroshopComponents.ViewToggle {
id: viewToggle
x: parent.x + (parent.width - this.width) / 2
y: parent.y + 20
}
// stackview functions
function goToNextPage() {
catalog_stack.currentIndex = catalog_stack.currentIndex + 1
if(catalog_stack.currentIndex >= (catalog_stack.count - 1)) catalog_stack.currentIndex = (catalog_stack.count - 1)
}
function goToPrevPage() {
catalog_stack.currentIndex = catalog_stack.currentIndex - 1
if(catalog_stack.currentIndex <= 0) catalog_stack.currentIndex = 0
}
function setCurrentPageIndex(numberInput) {
// if numberInput is greater than (count - 1) then equal it to (count - 1)
if(Number(numberInput) >= (catalog_stack.count - 1)) {
numberInput = (catalog_stack.count - 1)
}
// if numberInput is less than 0 then equal it to 0
if(Number(numberInput) <= 0) {
numberInput = 0
}
catalog_stack.currentIndex = numberInput
}
function getPageCount() { // Returns total number of grid pages belonging to the catalog StackLayout
return catalog_stack.count;
}
function getCurrentPageIndex() {
return catalog_stack.currentIndex;
}
function getItemsCount() {
// ... boxesPerGrid * pageCount
}
// Pagination mode (Infinite Scroll mode replaces the StackLayout with a ScrollView)
StackLayout {
id: catalog_stack
anchors.centerIn: parent
id: catalogStack
//anchors.horizontalCenter: viewToggle.horizontalCenter
anchors.left: (productFilterBox.visible) ? productFilterBox.right : parent.left
anchors.leftMargin: (productFilterBox.visible) ? 10 : 20
anchors.top: viewToggle.bottom
anchors.topMargin: 50
currentIndex: 0
width: NeroshopComponents.CatalogGrid.width; height: NeroshopComponents.CatalogGrid.height//width: pages.itemAt(this.currentIndex).width; height: pages.itemAt(this.currentIndex).height;//width: catalog.width; height: catalog.height
@ -106,12 +124,17 @@ Page {
firstButton.onClicked: { if(!firstButton.disabled) goToPrevPage() }
secondButton.onClicked: { if(!secondButton.disabled) goToNextPage() }
numberField.onEditingFinished: { setCurrentPageIndex(numberField.text - 1) }
currentIndex: catalog_stack.currentIndex
count: catalog_stack.count
currentIndex: catalogStack.currentIndex
count: catalogStack.count
// For Row ONLY, NOT RowLayout (use Layout.alignment for RowLayout instead)
anchors.left: catalog_stack.left
anchors.leftMargin: (catalog_stack.width - this.width) / 2
anchors.top: catalog_stack.bottom
anchors.horizontalCenter: catalogStack.horizontalCenter
anchors.top: catalogStack.bottom
anchors.topMargin: 20
}
}
}
// This is not necessaary unless you are using a Flickable
/*ScrollBar.vertical: ScrollBar {
//width: 20
policy: ScrollBar.AlwaysOn//ScrollBar.AsNeeded//ScrollBar.AlwaysOn
}*/ // Scrollbar
//} // Flickable
} // Page

@ -6,12 +6,29 @@ import QtQuick.Shapes 1.3 // (since Qt 5.10) // Shape
import QtGraphicalEffects 1.12//Qt5Compat.GraphicalEffects 1.15//= Qt6// ColorOverlay
import "../components" as NeroshopComponents // Tooltip
// number to string: my_number.toString()
// string to number: Number(my_string)
Page {
id: home_page
id: homePage
background: Rectangle {
//visible: true
color:"transparent" // fixes white edges on borders when grid box radius is set
color: "transparent" // Make transparent to blend in with theme
}
ScrollView {
id: scrollView
anchors.fill: parent
anchors.margins: 20
ScrollBar.vertical.policy: ScrollBar.AsNeeded//ScrollBar.AlwaysOn
clip: true
GridLayout {
anchors.fill: parent
NeroshopComponents.Banner {
id: topBanner
Layout.preferredWidth: scrollView.width//width: scrollView.width//homePage.width // will not fill page if you use parent.width. Use scrollView.width instead
Layout.row: 0 // sets the row position
//anchors.horizontalCenter: scrollView.horizontalCenter// Centered in parent horizontally (x-axis) // To fill entire homePage screen use: anchors.fill: parent
radius: 15
}
}
} // ScrollView
}

@ -15,16 +15,16 @@ import "../components" as NeroshopComponents
Page {
id: main_page
title: qsTr("Main Page")
//Rectangle {
// color:"red"
//}
Rectangle {
color: "transparent"
}
///////////////////////////
function copy_to_clipboard() {
function copyToClipboard() {
// If text edit string is empty, exit function
if(!seed_display_edit.text) return;
if(!seedDisplayEdit.text) return;
// Select all text from edit then copy the selected text
seed_display_edit.selectAll()
seed_display_edit.copy()
seedDisplayEdit.selectAll()
seedDisplayEdit.copy()
console.log("Copied to clipboard");
}
///////////////////////////
@ -32,42 +32,38 @@ Page {
// id: wallet
//}
///////////////////////////
function generate_keys() {
function generateWalletKeys() {
// generate a unique wallet seed (mnemonic)
let error = Wallet.create_random_wallet(wallet_password_create_edit.text, wallet_password_confirm_edit.text, neroshopWalletDir + "/auth")//"wallet")
let error = Wallet.create_random_wallet(walletPasswordField.text, walletPasswordConfirmField.text, neroshopWalletDir + "/auth")//"wallet")
// if wallet passwords don't match, display error message
let WALLET_PASSWORD_NO_MATCH = 2
let WALLET_ALREADY_EXISTS = 3;
if(error == WALLET_PASSWORD_NO_MATCH) {//if(wallet_password_confirm_edit.text != wallet_password_create_edit.text) {
//important_message_field.x = wallet_password_confirm_edit.x
important_message_field.text = qsTr("Wallet passwords do not match")
important_message_field.visible = true
/*message_box.text = qsTr("Wallet passwords do not match")
message_box.open()*/
if(error == WALLET_PASSWORD_NO_MATCH) {//if(walletPasswordConfirmField.text != walletPasswordField.text) {
//walletMessageField.x = walletPasswordConfirmField.x
walletHint.show(qsTr("Wallet passwords do not match"), -1)
}
else if(error == WALLET_ALREADY_EXISTS) {
important_message_field.text = qsTr("A wallet file with the same name already exists")
important_message_field.visible = true
walletHint.show(qsTr("A wallet file with the same name already exists"), -1)
}
// then copy the mnemonic to the seed display edit
seed_display_edit.text = Wallet.get_mnemonic()
seedDisplayEdit.text = Wallet.get_mnemonic()
// show important message (only if wallet keys were successfully created)
if(seed_display_edit.text) {
//important_message_field.x = (genkey_page.width / 2) - (important_message_field.width / 2)// place at center of genkey_page//generate_key_button.x
//important_message_field.y = generate_key_button.y + generate_key_button.height + 20
important_message_field.text = qsTr("These words are the key to your account. Please store them safely!")
important_message_field.visible = true
if(seedDisplayEdit.text) {
//walletMessageField.x = (registerPage.width / 2) - (walletMessageField.width / 2)// place at center of registerPage//generate_key_button.x
//walletMessageField.y = generate_key_button.y + generate_key_button.height + 20
walletMessageField.text = qsTr("These words are the key to your account. Please store them safely!")
walletMessageField.visible = true
// clear wallet password text fields
wallet_password_create_edit.text = "";
wallet_password_confirm_edit.text = "";
walletPasswordField.text = "";
walletPasswordConfirmField.text = "";
}
}
///////////////////////////
function register_wallet() {
function registerWallet() {
// if not key generated, then generate key
if(!seed_display_edit.text) {
message_box.text = qsTr("Please generate your keys before registering")
message_box.open()
if(!seedDisplayEdit.text) {
messageBox.text = qsTr("Please generate your keys before registering")
messageBox.open()
return; // exit function and do not proceed any further
}
// do a regex check on the username before proceeding
@ -75,12 +71,12 @@ Page {
// register the wallet primary key to the database
// switch (login) to home page
//stack.push(home_page)
page_loader.source = "home_page.qml"
pageLoader.source = "HomePage.qml"
}
///////////////////////////
// consists of login and registration menus
MessageDialog {
id: message_box
id: messageBox
//visible: false
title: "message"
text: "It's so cool that you are using Qt Quick."
@ -94,7 +90,7 @@ Page {
}
///////////////////////////
FileDialog {
id: wallet_file_dialog
id: walletFileDialog
fileMode: FileDialog.OpenFile
currentFile: wallet_upload_edit.text // currentFile is deprecated since Qt 6.3. Use selectedFile instead
folder: neroshopWalletDir//StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/neroshop"//StandardPaths.writableLocation(StandardPaths.AppDataLocation) // refer to https://doc.qt.io/qt-5/qstandardpaths.html#StandardLocation-enum
@ -102,74 +98,95 @@ Page {
//options: FileDialog.ReadOnly // will not allow you to create folders while file dialog is opened
}
///////////////////////////
TabBar {
id: buttonsBar
width: parent.width
anchors.top: parent.top
anchors.topMargin: 0//20
anchors.horizontalCenter: parent.horizontalCenter//x: authStack.x + (authStack.width / 2) - (this.width / 2) // center the x
//y: (authStack.y + authStack.height) + 5// 5 is the padding // lower the y
property string buttonColor: NeroshopComponents.Style.moneroGrayColor
TabButton { // must be used in conjunction with a TabBar according to: https://doc.qt.io/qt-5/qml-qtquick-controls2-tabbutton.html
text: qsTr("Register")
width: implicitWidth
onClicked: authStack.currentIndex = 0
background: Rectangle {
color: buttonsBar.buttonColor//"#00aebf"
}
}
TabButton {
id: login_button//auth_walletfile_button
text: qsTr("Login with Wallet file")
width: implicitWidth
onClicked: authStack.currentIndex = 1
contentItem: Text {
//font.family: "Consolas";
//font.pointSize: 10;
//font.bold: true
text: login_button.text
color: "#ffffff" // white text
}
background: Rectangle {
color: buttonsBar.buttonColor//NeroshopComponents.Style.moneroOrangeColor//"#ff6600"//parent.down ? "#bbbbbb" :
//(parent.hovered ? "#d6d6d6" : "#f6f6f6")
radius: 0
//border.color: login_button.hovered ? "#ffffff" : this.color//"#ffffff"//control.down ? "#17a81a" : "#21be2b"
}
}
TabButton {
text: qsTr("Login with Seed (Mnemonic)")
width: implicitWidth
onClicked: authStack.currentIndex = 2
background: Rectangle {
color: buttonsBar.buttonColor//NeroshopComponents.Style.moneroGrayColor
}
}
TabButton {
text: qsTr("Login with Keys")
width: implicitWidth
onClicked: authStack.currentIndex = 3
background: Rectangle {
color: buttonsBar.buttonColor//"#402ef7"
}
}
TabButton {
text: qsTr("Login with Hardware wallet")
width: implicitWidth
//onClicked: authStack.currentIndex = 4
background: Rectangle {
color: buttonsBar.buttonColor//"red"
}
}
}
///////////////////////////
StackLayout { // Perfect for a stack of items where only one item is visible at a time//ColumnLayout { // From top to bottom
id: auth_stack // auth_menu inside home menu
id: authStack // auth_menu inside home menu
//anchors.fill: parent // will fill entire Window area
currentIndex: 1
width: 800//500
height: 500//300
x: parent.width / 2 - this.width / 2 // window is the id of ApplicationWindow
y: parent.height / 2 - this.height / 2
currentIndex: buttonsBar.currentIndex//currentIndex: 1
width: parent.width
height: parent.height
anchors.top: buttonsBar.bottom//y: parent.height / 2 - this.height / 2
anchors.topMargin: 0
anchors.left: buttonsBar.left
anchors.leftMargin: 0
// generate auth keys page
Rectangle {
id: genkey_page
id: registerPage
color: (NeroshopComponents.Style.darkTheme) ? "#2e2e2e" : "#a0a0a0"//160, 160, 160
// optional pseudonym edit
TextField {
id: opt_username_edit
placeholderText: qsTr("Pseudonym (optional)")
placeholderTextColor: "#696969" // dim gray
color:"#6b5b95"
//x: seed_display_scrollview.x
anchors.left: seed_display_scrollview.left
//y: seed_display_scrollview.y + seed_display_scrollview.height + 30
anchors.top: seed_display_scrollview.bottom
anchors.topMargin: 30
selectByMouse: true
width: 300
background: Rectangle {
color: (NeroshopComponents.Style.darkTheme) ? "transparent": "#101010"//"#101010" = rgb(16, 16, 16)
border.color: "#696969" // dim gray//"#ffffff"
border.width: (NeroshopComponents.Style.darkTheme) ? 1 : 0
}
//validator: RegExpValidator { regExp: /^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$/ } // validator: RegularExpressionValidator { regularExpression: /[0-9A-F]+/ } // since Qt 5.14
}
// register button
Button {
id: wallet_register_button
text: qsTr("Register")
//x: copy_button.x//opt_username_edit.x + opt_username_edit.width + 50
anchors.left: opt_username_edit.right//copy_button.left
anchors.leftMargin: 20
//y: opt_username_edit.y + verticalCenter of username_edit
anchors.top: opt_username_edit.top
anchors.topMargin: (opt_username_edit.height / 2) - (this.height / 2)
width: 180//copy_button.width
height: 60 + 5//50 // width will be set automatically based on text length
onClicked: register_wallet()
contentItem: Text {
font.family: "Consolas"; //font.family: NeroshopComponents.Style.fontFiraCodeLight.name
//font.pointSize: 10
font.bold: true
text: wallet_register_button.text
color: "#ffffff" // white
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: "#6b5b95" // #ff6600 is the monero orange color
radius: 0
}
}
// change wallet path edit
// ...
// wallet password create edit
TextField {
id: wallet_password_create_edit
id: walletPasswordField
placeholderText: qsTr("Wallet Password")
placeholderTextColor: "#a9a9a9" // darkgray
color: NeroshopComponents.Style.moneroOrangeColor//"#ff6600" // textColor
@ -193,22 +210,39 @@ Page {
}
// wallet password confirm edit
TextField {
id: wallet_password_confirm_edit
id: walletPasswordConfirmField
placeholderText: qsTr("Confirm Wallet Password")
placeholderTextColor: "#a9a9a9" // darkgray
color: NeroshopComponents.Style.moneroOrangeColor//"#ff6600" // textColor
echoMode: TextInput.Password
inputMethodHints: Qt.ImhSensitiveData
selectByMouse: true
x: wallet_password_create_edit.x
y: wallet_password_create_edit.y + wallet_password_create_edit.height + 5
width: wallet_password_create_edit.width; height: wallet_password_create_edit.height
x: walletPasswordField.x
y: walletPasswordField.y + walletPasswordField.height + 5
width: walletPasswordField.width; height: walletPasswordField.height
background: Rectangle {
color: NeroshopComponents.Style.moneroGrayColor
border.color: parent.placeholderTextColor
border.width: (NeroshopComponents.Style.darkTheme) ? 1 : 0
}
}
// tooltip
NeroshopComponents.Hint {
id: walletHint
text: "This is the wallet password and psuedonym error message tooltip"
height: walletPasswordField.height + walletPasswordConfirmField.height + 5 // 5 is the gap between the two
x: walletPasswordField.x + walletPasswordField.width + 5//anchors.left: walletPasswordField.right
//anchors.leftMargin: 0
y: walletPasswordField.y//anchors.top: walletPasswordField.top
visible: false
color: "firebrick"
rect.opacity: 1.0
//textColor: "#ffffff"
//borderColor:
//borderWidth:
radius: 0
}
// generate key button
Button {
id: generate_key_button
@ -218,11 +252,11 @@ Page {
width: 150
height: 60 + 5//50 // width will be set automatically based on text length
onClicked: generate_keys()
onClicked: generateWalletKeys()
contentItem: Text {
font.family: "Consolas";
font.pointSize: 10;
//font.family: "Consolas";
//font.pointSize: 10;
font.bold: true
text: generate_key_button.text
color: "#ffffff" // white
@ -237,12 +271,13 @@ Page {
}
// Important message box
TextField {
id: important_message_field
id: walletMessageField
visible: false
x: (genkey_page.width / 2) - (this.width / 2)// place at center of genkey_page//generate_key_button.x
y: generate_key_button.y + generate_key_button.height + 20
/*x: seed_display_scrollview.x
y: seed_display_scrollview.y + seed_display_scrollview.height + 10*/
anchors.horizontalCenter: registerPage.horizontalCenter// place at center of registerPage//generate_key_button.x
anchors.top: generate_key_button.bottom
anchors.topMargin: 20
/*x: seedDisplayScrollView.x
y: seedDisplayScrollView.y + seedDisplayScrollView.height + 10*/
readOnly: true
//text: qsTr("")
color: "#ffffff"// text color
@ -252,15 +287,15 @@ Page {
}
// wallet seed display
ScrollView {
id: seed_display_scrollview
id: seedDisplayScrollView
//anchors.fill: parent
width: 500//300
height: 250//150
x: generate_key_button.x//20
y: (important_message_field.visible) ? important_message_field.y + important_message_field.height + 20 : generate_key_button.y + generate_key_button.height + 20//genkey_page.height - this.height - 20
y: (walletMessageField.visible) ? walletMessageField.y + walletMessageField.height + 20 : generate_key_button.y + generate_key_button.height + 20//registerPage.height - this.height - 20
TextArea {
id: seed_display_edit
id: seedDisplayEdit
readOnly: true
//text: qsTr("")
color: "#000000" // text color
@ -279,11 +314,11 @@ Page {
onClicked: (mouse)=> {
// left mouse = displayListOptions()
if ((mouse.button == Qt.LeftButton)) {
//console.log("Left mouse clicked on seed_display_edit");
//console.log("Left mouse clicked on seedDisplayEdit");
}
// right mouse = selectAll()
if ((mouse.button == Qt.RightButton)) {
//console.log("Right mouse clicked on seed_display_edit");
//console.log("Right mouse clicked on seedDisplayEdit");
}
}
/*onEntered: {
@ -299,23 +334,23 @@ Page {
focus: true
x: seed_display_mouse_area.mouseX
y: seed_display_mouse_area.mouseY
}*/
}*/
}
}
// copy_button (copies to the clipboard)
Button {
id: copy_button
width: 100; height: seed_display_scrollview.height//50
//x: (seed_display_scrollview.x + seed_display_scrollview.width) + (genkey_page.width / 2) - ((this.width + seed_display_scrollview.width + 10) / 2) //(seed_display_scrollview.x + seed_display_scrollview.width) + 5
anchors.left: seed_display_scrollview.right//seed_display_scrollview.horizontalCenter
anchors.leftMargin: (parent.width / 2) - ((this.width + seed_display_scrollview.width + 10) / 2)
//y: seed_display_scrollview.y + (seed_display_scrollview.height / 2) - (this.height / 2)
anchors.top: seed_display_scrollview.top
anchors.topMargin: (seed_display_scrollview.height / 2) - (this.height / 2)
width: 100; height: seedDisplayScrollView.height//50
//x: (seedDisplayScrollView.x + seedDisplayScrollView.width) + (registerPage.width / 2) - ((this.width + seedDisplayScrollView.width + 10) / 2) //(seedDisplayScrollView.x + seedDisplayScrollView.width) + 5
anchors.left: seedDisplayScrollView.right//seedDisplayScrollView.horizontalCenter
anchors.leftMargin: (parent.width / 2) - ((this.width + seedDisplayScrollView.width + 10) / 2)
//y: seedDisplayScrollView.y + (seedDisplayScrollView.height / 2) - (this.height / 2)
anchors.top: seedDisplayScrollView.top
anchors.topMargin: (seedDisplayScrollView.height / 2) - (this.height / 2)
text: qsTr("Copy") // rather have an icon with a tooltip than a text
display: AbstractButton.IconOnly // will only show the icon and not the text
// this only works on selected text
onClicked: copy_to_clipboard()//seed_display_edit.copy()//copy_to_clipboard()
onClicked: copyToClipboard()//seedDisplayEdit.copy()//copyToClipboard()
ToolTip.delay: 500 // shows tooltip after hovering for 0.5 second
ToolTip.visible: hovered
@ -331,7 +366,55 @@ Page {
border.color: this.parent.hovered ? "#ffffff" : this.color
}
}
} // eof genkey_page
// optional pseudonym edit
TextField {
id: optNameEdit
placeholderText: qsTr("Pseudonym (optional)")
placeholderTextColor: "#696969" // dim gray
color:"#6b5b95"
//x: seedDisplayScrollView.x
anchors.left: seedDisplayScrollView.left
//y: seedDisplayScrollView.y + seedDisplayScrollView.height + 30
anchors.top: seedDisplayScrollView.bottom
anchors.topMargin: 30
selectByMouse: true
width: 300
background: Rectangle {
color: (NeroshopComponents.Style.darkTheme) ? "transparent": "#101010"//"#101010" = rgb(16, 16, 16)
border.color: "#696969" // dim gray//"#ffffff"
border.width: (NeroshopComponents.Style.darkTheme) ? 1 : 0
}
//validator: RegExpValidator { regExp: /^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$/ } // validator: RegularExpressionValidator { regularExpression: /[0-9A-F]+/ } // since Qt 5.14
}
// register button
Button {
id: wallet_register_button
text: qsTr("Register")
anchors.left: optNameEdit.right
anchors.leftMargin: 20
anchors.verticalCenter: optNameEdit.verticalCenter
width: 180//copy_button.width
height: 60 + 5//50 // width will be set automatically based on text length
onClicked: registerWallet()
contentItem: Text {
//font.family: "Consolas"; //font.family: NeroshopComponents.Style.fontFiraCodeLight.name
//font.pointSize: 10
font.bold: true
text: wallet_register_button.text
color: "#ffffff" // white
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: "#6b5b95" // #ff6600 is the monero orange color
radius: 0
}
}
} // eof registerPage
// walletfile auth page
// Upload button with read-only textfield
Rectangle {
@ -354,7 +437,7 @@ Page {
y: 20 // top_margin
width: 300; height: 30
readOnly: true
text: wallet_file_dialog.file//property url source: wallet_file_dialog.file; text: this.source
text: walletFileDialog.file//property url source: walletFileDialog.file; text: this.source
////placeholderText: qsTr("...") // eh ... probably not necessary (better to just leave it blank)
// change TextField color
background: Rectangle {
@ -367,7 +450,7 @@ Page {
Button {
id: wallet_upload_button
text: qsTr("Upload")
onClicked: wallet_file_dialog.open()
onClicked: walletFileDialog.open()
display: AbstractButton.IconOnly//AbstractButton.TextBesideIcon//AbstractButton.TextOnly
//hoverEnabled: true
x: wallet_upload_edit.x + wallet_upload_edit.width + 5
@ -455,65 +538,5 @@ Page {
id: keys_auth_page
color: (NeroshopComponents.Style.darkTheme) ? "#2e2e2e" : "#a0a0a0"
}
}
///////////////////////////
RowLayout {//TabBar {
//id: access_buttons_container
x: auth_stack.x + (auth_stack.width / 2) - (this.width / 2) // center the x
y: (auth_stack.y + auth_stack.height) + 5// 5 is the padding // lower the y
Button {//TabButton { // must be used in conjunction with a TabBar according to: https://doc.qt.io/qt-5/qml-qtquick-controls2-tabbutton.html
text: qsTr("register (genkey)")
onClicked: auth_stack.currentIndex = 0
background: Rectangle {
color: "#00aebf"
}
}
Button {//TabButton {
id: login_button//auth_walletfile_button
text: qsTr("auth_with_walletfile")
onClicked: auth_stack.currentIndex = 1
contentItem: Text {
font.family: "Consolas";
font.pointSize: 10;
font.bold: true
text: login_button.text
color: "#ffffff" // white text
}
background: Rectangle {
color: NeroshopComponents.Style.moneroOrangeColor//"#ff6600"//parent.down ? "#bbbbbb" :
//(parent.hovered ? "#d6d6d6" : "#f6f6f6")
radius: 0
border.color: login_button.hovered ? "#ffffff" : this.color//"#ffffff"//control.down ? "#17a81a" : "#21be2b"
}
}
Button {//TabButton {
text: qsTr("auth_with_seed")
onClicked: auth_stack.currentIndex = 2
background: Rectangle {
color: NeroshopComponents.Style.moneroGrayColor
}
}
Button {//TabButton {
text: qsTr("auth_with_keys")
onClicked: auth_stack.currentIndex = 3
background: Rectangle {
color: "#402ef7"
}
}
Button {//TabButton {
text: qsTr("auth_with_hw")
//onClicked: auth_stack.currentIndex = 4
background: Rectangle {
color: "red"
}
}
}
}

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../../components" as NeroshopComponents

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../../components" as NeroshopComponents

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../../components" as NeroshopComponents

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../../components" as NeroshopComponents

@ -0,0 +1,57 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
//import QtGraphicalEffects 1.12
// Wallet and Wallet Daemon settings page
import "../../components" as NeroshopComponents
Page {
id: walletSettingsPage
Rectangle {
color: "#0a0a0a"
visible: true
}
ScrollView {
id: scrollView
anchors.fill: parent
anchors.margins: 20
ScrollBar.vertical.policy: ScrollBar.AsNeeded//ScrollBar.AlwaysOn
clip: true
ColumnLayout {
id: walletSettings
anchors.fill: parent
RowLayout {
Rectangle {
id: balanceDisplay
radius: 5
//color: "#0a0a0a"
Image {
//id: lockedIcon
}
Label {
id: balanceLockedLabel
}
Label {
id: balanceLocked
}
}
/*Image {
//id: unlockedIcon
}
Label {
id: balanceUnlockedLabel
}
Label {
id: balanceUnlocked
}*/
} // RowLayout
} // root Layout
} // ScrollView
}

@ -42,11 +42,6 @@ int main(int argc, char *argv[]) {
if(!Icon::load_all()) {
neroshop::print("Failed to load all icons", 1);
}
unsigned char * data = Icon::get<unsigned char *>("upload");
int size = Icon::get<int>("upload");
// Print icon information
std::cout << "Icon info (upload): \n" << "data=" << data << "\n" << "size=" << size << "\n";
////////////////////////////////////////////////////////
// Configuration file must be loaded right after Qt Application object has been created so that we can get the correct config location
// open configuration script

Loading…
Cancel
Save