Some minor changes to the GUI

pull/21/head
larteyoh 2 years ago
parent 1dda727ebd
commit ed1fb0b523

@ -50,7 +50,10 @@ Coming soon
### Compiling neroshop from source
**0. Clone neroshop (and its submodules)**
```bash
git clone --recurse-submodules https://github.com/larteyoh/testshop.git && cd testshop
git clone --recurse-submodules https://github.com/larteyoh/testshop.git
```
```bash
cd testshop
```

@ -41,6 +41,11 @@ Object {
property string lockOpen: "\uf3c1"
property string eye: "\uf06e"
property string eyeSlash: "\uf070"
property string check: "\uf00c"
property string xmark: "\uf00d"
property string circleInfo: "\uf05a"
property string triangleExclamation: "\uf071"
property string circleExclamation: "\uf06a"
////property string terminal: ""
////property string upload: "\u"
////property string ?: "\u"

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

@ -4,6 +4,7 @@
<!-- qml sources: components -->
<file>qml/components/Banner.qml</file>
<file>qml/components/CatalogGrid.qml</file>
<file>qml/components/CatalogList.qml</file>
<file>qml/components/FilterBox.qml</file>
<file>qml/components/Hint.qml</file>
<file>qml/components/NavigationalBar.qml</file>

@ -0,0 +1,9 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
//import QtGraphicalEffects 1.12
import "../../fonts/FontAwesome"//import FontAwesome 1.0
import "." as NeroshopComponents

@ -36,7 +36,7 @@ Popup {
anchors.verticalCenter: titleBar.verticalCenter
anchors.right: titleBar.right
anchors.rightMargin: 10
text: qsTr("\uf00d")
text: qsTr(FontAwesome.xmark)
contentItem: Text {
text: closeButton.text
color: "#ffffff"
@ -207,9 +207,9 @@ Popup {
ComboBox {
id: themeBox
currentIndex: model.indexOf(NeroshopComponents.Style.themeName)//Component.onCompleted: currentIndex = model.indexOf(NeroshopComponents.Style.themeName) // Set the initial currentIndex to the index in the array containing themeName string
displayText: currentText//"Theme: " + currentText
property string lastUsedDarkTheme: "DefaultDark"
property string lastUsedLightTheme: "DefaultLight"
displayText: currentText
property string lastUsedDarkTheme: (Script.getBoolean("neroshop.generalsettings.application.theme.dark")) ? Script.getString("neroshop.generalsettings.application.theme.name") : "DefaultDark"
property string lastUsedLightTheme: (!Script.getBoolean("neroshop.generalsettings.application.theme.dark")) ? Script.getString("neroshop.generalsettings.application.theme.name") : "DefaultLight"
model: ["DefaultDark", "DefaultLight", "PurpleDust"]
onActivated: {
if(currentText == "PurpleDust") {
@ -225,7 +225,7 @@ Popup {
lastUsedLightTheme = currentText
}
displayText = currentText
NeroshopComponents.Style.themeName = currentText // update the theme name
NeroshopComponents.Style.themeName = displayText // update the actual theme (name)
themeSwitcher.checked = !NeroshopComponents.Style.darkTheme // update the theme switch
// NOTE: on app launch, the theme will ALWAYS be reset back to its default unless you change the theme settings in your configuration file
//todo: change theme in configuration file too

@ -34,26 +34,36 @@ Page {
//}
///////////////////////////
function generateWalletKeys() {
// check if wallet has already been generated so that this function does not repeat
if(Wallet.getMnemonic().length > 0) {
walletMessageArea.text = qsTr("Wallet has already been generated. One wallet per session to reduce spam")
walletMessageArea.messageCode = 1
// todo: if user decides to re-generate wallet keys, then destroy the current monero_wallet object and recreate it
return;
}
// generate a unique wallet seed (mnemonic)
let error = Wallet.create_random_wallet(walletPasswordField.text, walletPasswordConfirmField.text, neroshopWalletDir + "/auth")//"wallet")
let folderUrlToString = walletFolderDialog.folder.toString().replace("file://","")
let error = Wallet.createRandomWallet(walletPasswordField.text, walletPasswordConfirmField.text, (walletNameField.text) ? qsTr(folderUrlToString + "/%1").arg(walletNameField.text) : qsTr(folderUrlToString + "/%1").arg(walletNameField.placeholderText))//walletPathField.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(walletPasswordConfirmField.text != walletPasswordField.text) {
//walletMessageField.x = walletPasswordConfirmField.x
walletHint.show(qsTr("Wallet passwords do not match"), -1)
if(error == WALLET_PASSWORD_NO_MATCH) {//if(walletPasswordConfirmField.text != walletPasswordField.text || !walletPasswordField.acceptableInput) {
walletMessageArea.text = (walletPasswordConfirmField.length > 0) ? qsTr("Wallet passwords do not match") : qsTr("Wallet password not confirmed")
walletMessageArea.messageCode = 1
return
}
else if(error == WALLET_ALREADY_EXISTS) {
walletHint.show(qsTr("A wallet file with the same name already exists"), -1)
walletMessageArea.text = qsTr("A wallet file with the same name already exists")
walletMessageArea.messageCode = 1
return
}
// then copy the mnemonic to the seed display edit
seedDisplayEdit.text = Wallet.get_mnemonic()
walletSeedDisplayRepeater.model = Wallet.getMnemonicModel()//walletSeedDisplay.model = Wallet.getMnemonicModel()////seedDisplayEdit.text = Wallet.getMnemonic()
// show important message (only if wallet keys were successfully created)
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
if(walletSeedDisplayRepeater.model) {
walletMessageArea.text = qsTr("These %1 words are the key to your account. Please store them safely!").arg(walletSeedDisplayRepeater.count)
walletMessageArea.messageCode = 0
//walletMessageArea.visible = true
// clear wallet password text fields
walletPasswordField.text = "";
walletPasswordConfirmField.text = "";
@ -106,14 +116,22 @@ Page {
//onRejected: console.log("Cancel clicked")
}
///////////////////////////
// for login page
FileDialog {
id: walletFileDialog
fileMode: FileDialog.OpenFile
currentFile: wallet_upload_edit.text // currentFile is deprecated since Qt 6.3. Use selectedFile instead
currentFile: walletFileField.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
nameFilters: ["Wallet files (*.keys)"]
//options: FileDialog.ReadOnly // will not allow you to create folders while file dialog is opened
}
///////////////////////////
// for registration page
FolderDialog {
id: walletFolderDialog
currentFolder: walletPathField.text
folder: StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/neroshop"
}
///////////////////////////
/* Button { // must be used in conjunction with a TabBar according to: https://doc.qt.io/qt-5/qml-qtquick-controls2-tabbutton.html
text: qsTr("Register")
@ -185,216 +203,325 @@ Page {
id: registerPage
color: NeroshopComponents.Style.getColorsFromTheme()[0]
///////////////////////////
Button {
id: pageRedirectButton
anchors.verticalCenter: parent.verticalCenter//Layout.alignment: Qt.AlignVCenter// | Qt::AlignRight //or Qt::AlignLeft
anchors.right: parent.right//anchors.left: parent.left
anchors.rightMargin: 20
implicitWidth: 60; height: implicitWidth
text: qsTr(FontAwesome.angleRight)//qsTr(FontAwesome.angleLeft)
Button {
id: pageRedirectButton
anchors.verticalCenter: parent.verticalCenter//Layout.alignment: Qt.AlignVCenter | Qt::AlignRight
anchors.right: parent.right
anchors.rightMargin: 20
implicitWidth: 60; height: implicitWidth
text: qsTr(FontAwesome.angleRight)
background: Rectangle {
color: "#6b5b95"//"#121212"
radius: 100
border.color: parent.contentItem.color//(NeroshopComponents.Style.darkTheme) ? parent.contentItem.color : "#000000"
border.width: (parent.hovered) ? 1 : 0
}
background: Rectangle {
color: "#6b5b95"//"#121212"
radius: 100
border.color: parent.contentItem.color//(NeroshopComponents.Style.darkTheme) ? parent.contentItem.color : "#000000"
border.width: (parent.hovered) ? 1 : 0
}
contentItem: Text {
text: parent.text
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
font.family: FontAwesome.fontFamily
font.pixelSize: (parent.width / 2)
}
contentItem: Text {
text: parent.text
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
font.family: FontAwesome.fontFamily
font.pixelSize: (parent.width / 2)
}
onClicked: {
mainPageStack.currentIndex = mainPageStack.currentIndex + 1
}
}
// change wallet path edit
// ...
// wallet password create edit
TextField {
id: walletPasswordField
placeholderText: qsTr("Wallet Password")
placeholderTextColor: "#a9a9a9" // darkgray
color: NeroshopComponents.Style.moneroOrangeColor//"#ff6600" // textColor
echoMode: TextInput.Password//TextInput.PasswordEchoOnEdit
inputMethodHints: Qt.ImhSensitiveData
selectByMouse: true
//validator: RegularExpressionValidator { regularExpression: "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$" }
//x: generate_key_button.x + generate_key_button.width + 15
anchors.left: generate_key_button.right // generate_key_button.x + the width of generate_key_button
anchors.leftMargin: 15
//y: generate_key_button.y
anchors.top: generate_key_button.top//generate_key_button.verticalCenter = will place text field at center of generate_key_button vertically (y)
onClicked: {
mainPageStack.currentIndex = mainPageStack.currentIndex + 1
}
}
GridLayout {
anchors.horizontalCenter: parent.horizontalCenter//(walletSeedDisplayRepeater.model) ? this.horizontalCenter : parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.topMargin: 20
//anchors.left: parent.left
//anchors.leftMargin: pageRedirectButton.width + 20
//width: 800
////anchors.rightMargin: pageRedirectButton.width + 20//anchors.margins: 50
columns: 2 // Set column limit to 2
columnSpacing: 100 // The default value is 5. Same with rowSpacing
////rows: 10
////rowSpacing: 15
// Reminder: Layout. functions work for items inside Layouts but not for the Layout itself!
// wallet name creation text
Text {
id: walletNameText
Layout.row: 0
Layout.column: 0
text: qsTr("Wallet name")
//visible: !walletSeedDisplayRepeater.model
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
font.bold: true
}
// wallet name creation field
TextField {
id: walletNameField
Layout.preferredWidth: 500
Layout.preferredHeight: 50//width: 500; height: 50
Layout.row: 1
Layout.column: 0
Layout.topMargin: (walletNameText.visible) ? 5 : 0
//visible: !walletSeedDisplayRepeater.model
placeholderText: qsTr("auth"); placeholderTextColor: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000" // textColor
selectByMouse: true
// todo: validator regex for preventing special characters like: * . " / \ [ ] : ; | , from being added to the wallet name
width: 300//; height: generate_key_button.height / 2
background: Rectangle {
color: NeroshopComponents.Style.moneroGrayColor//#4c4c4c = monero gray color//"#404040" = 64, 64, 64
border.color: parent.placeholderTextColor
border.width: (NeroshopComponents.Style.darkTheme) ? 1 : 0
}
// todo: maybe add a regex validator
}
// wallet password confirm edit
TextField {
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: 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
background: Rectangle {
color: (NeroshopComponents.Style.darkTheme) ? "#101010" : "#ffffff"
border.color: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
radius: 3
}
}
// wallet password creation field
TextField {
id: walletPasswordField
Layout.preferredWidth: 500
Layout.preferredHeight: 50//width: 500; height: 50
Layout.row: 2
Layout.column: 0
//visible: !walletSeedDisplayRepeater.model
placeholderText: qsTr("Wallet Password")
placeholderTextColor: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
color: NeroshopComponents.Style.moneroOrangeColor // textColor
echoMode: (!walletPasswordVisibilityToggle.checked) ? TextInput.Normal : TextInput.Password//TextInput.PasswordEchoOnEdit
inputMethodHints: Qt.ImhSensitiveData
selectByMouse: true
//validator: RegularExpressionValidator { regularExpression: "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$" }
background: Rectangle {
color: walletNameField.background.color
border.color: (!parent.acceptableInput) ? walletPasswordStatusMark.invalidColor : parent.placeholderTextColor//walletPasswordConfirmField.background.border.color////((parent.length > 0 && walletPasswordConfirmField.length == 0) ? ((walletPasswordConfirmField.text != walletPasswordField.text || !walletPasswordField.acceptableInput) ? walletPasswordStatusMark.invalidColor : walletPasswordStatusMark.validColor) : walletPasswordConfirmField.background.border.color)
border.width: (!parent.acceptableInput) ? 2 : 1//walletPasswordConfirmField.background.border.width////(parent.length > 0 && walletPasswordConfirmField.length == 0) ? 2 : walletPasswordConfirmField.background.border.width
radius: 3
}
// todo: maybe add a regex validator
rightPadding: 15 + walletPasswordVisibilityToggle.width
// wallet password visibility toggle
Button {
id: walletPasswordVisibilityToggle
text: (checked) ? FontAwesome.eye : FontAwesome.eyeSlash//icon.source:
anchors.right: parent.right
anchors.rightMargin: 15
anchors.verticalCenter: parent.verticalCenter
implicitWidth: 24; implicitHeight: 24
checkable: true
checked: true//false
// checked = show, unchecked = hide. Passwords are hidden by default
background: Rectangle {
color: "transparent"
}
contentItem: Text {
text: parent.text
color: (parent.checked) ? "#a9a9a9" : "#696969"
verticalAlignment: Text.AlignVCenter
font.bold: true
}
}
}
// wallet password confirmation field
TextField {
id: walletPasswordConfirmField
Layout.preferredWidth: 500
Layout.preferredHeight: 50//width: 500; height: 50
Layout.row: 3
Layout.column: 0
//Layout.topMargin: 5
//rightPadding
//visible: !walletSeedDisplayRepeater.model
placeholderText: qsTr("Confirm Wallet Password")
placeholderTextColor: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
color: walletPasswordField.color//NeroshopComponents.Style.moneroOrangeColor // textColor
echoMode: (!walletPasswordVisibilityToggle.checked) ? TextInput.Normal : TextInput.Password
inputMethodHints: Qt.ImhSensitiveData
selectByMouse: true
background: Rectangle {
color: walletPasswordField.background.color//NeroshopComponents.Style.moneroGrayColor
border.color: (parent.length > 0) ? walletPasswordStatusMark.color : parent.placeholderTextColor
border.width: (parent.length > 0) ? 2 : 1
radius: 3
}
rightPadding: 30 + walletPasswordStatusMark.contentWidth//double rightmargin size
// wallet password validation status mark
Text {
id: walletPasswordStatusMark
property string validColor: "#50b954"
property string invalidColor: "#f17982"
anchors.right: parent.right
anchors.rightMargin: 15
anchors.verticalCenter: parent.verticalCenter
text: (walletPasswordConfirmField.text != walletPasswordField.text || !walletPasswordField.acceptableInput) ? qsTr(FontAwesome.xmark) : qsTr(FontAwesome.check)
visible: (walletPasswordConfirmField.length > 0)
font.bold: true
font.family: FontAwesome.fontFamily
color: (walletPasswordConfirmField.text != walletPasswordField.text || !walletPasswordField.acceptableInput) ? invalidColor : validColor
}
}
// wallet path text
Text {
id: walletPathText
Layout.row: 4
Layout.column: 0
Layout.topMargin: 10
text: qsTr("Wallet path")
//visible: !walletSeedDisplayRepeater.model
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
font.bold: true
}
// wallet path field
TextField {
id: walletPathField
Layout.row: 5
Layout.column: 0
Layout.preferredWidth: 500; Layout.preferredHeight: 50
Layout.topMargin: (walletPathText.visible) ? 5 : 0
//visible: !walletSeedDisplayRepeater.model
text: walletFolderDialog.folder////(walletNameField.text) ? qsTr(walletFolderDialog.folder + "/%1.keys").arg(walletNameField.text) : qsTr(walletFolderDialog.folder + "/%1.keys").arg(walletNameField.placeholderText)
color: "#000000"//(NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000" // textColor
selectByMouse: true
readOnly: true
}
// generate key button
Button {
id: generate_key_button
text: qsTr("Generate Keys")
x: 20
y: 20
width: 150
height: 60 + 5//50 // width will be set automatically based on text length
background: Rectangle {
color: "#708090"//(NeroshopComponents.Style.darkTheme) ? "#101010" : "#ffffff"
border.color: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969" // if path exists, make border.color green, if not then make red
radius: 3
}
}
RowLayout {
Layout.row: 6
Layout.column: 0
//visible: !walletSeedDisplayRepeater.model
// wallet path change or upload button
Button {
id: walletPathChangeButton
Layout.topMargin: 10
Layout.preferredWidth: walletPathField.width / 4//walletPathChangeButtonText.contentWidth + 20
Layout.preferredHeight: 50//walletPathField.Layout.preferredHeight
text: qsTr("Change")
//display: AbstractButton.IconOnly//AbstractButton.TextBesideIcon//AbstractButton.TextOnly
//icon.source: "file:///" + neroshopResourcesDir + "/change.png"
//icon.color: "#ffffff"
onClicked: walletFolderDialog.open()
background: Rectangle {
color: NeroshopComponents.Style.moneroGrayColor
radius: 5
border.color: walletPathChangeButton.hovered ? "#ffffff" : this.color//"#ffffff"//control.down ? "#17a81a" : "#21be2b"
}
contentItem: Text {
id: walletPathChangeButtonText
text: parent.text
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
}
ToolTip.delay: 1000
ToolTip.visible: hovered
ToolTip.text: qsTr("Change wallet path")
}
// generate key button
Button {
id: generateKeysButton
Layout.topMargin: 10//20
Layout.preferredWidth: (walletPathChangeButton.width * 3) - parent.spacing//150
Layout.preferredHeight: 50
text: qsTr("Generate")//("Generate Keys")
onClicked: generateWalletKeys()
contentItem: Text {
//font.family: "Consolas";
//font.pointSize: 10;
//id: generateKeysButtonText
font.bold: true
text: generate_key_button.text
text: generateKeysButton.text
color: "#ffffff" // white
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: '#ff6600' // #ff6600 is the monero orange color
radius: 0
background: Rectangle {
color: NeroshopComponents.Style.moneroOrangeColor
radius: 5
}
}
}
// Important message box
TextField {
id: walletMessageField
visible: false
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
background: Rectangle {
color: "firebrick"
}
}
// wallet seed display
ScrollView {
id: seedDisplayScrollView
//anchors.fill: parent
width: 800//500//300
height: 250//150
x: generate_key_button.x//20
y: (walletMessageField.visible) ? walletMessageField.y + walletMessageField.height + 20 : generate_key_button.y + generate_key_button.height + 20//registerPage.height - this.height - 20
clip: true
} // RowLayout containing both walletPathChangeButton and generateKeys button
// important wallet message box
TextArea {
id: seedDisplayEdit
id: walletMessageArea
visible: true////false
Layout.row: (!walletSeedDisplayRepeater.model) ? 7 : 0//QGridLayoutEngine::addItem: Cell (0, 0) already taken
Layout.column: (!walletSeedDisplayRepeater.model) ? 0 : 1//QGridLayoutEngine::addItem: Cell (0, 0) already taken
Layout.fillWidth: true // extends the TextArea's width to the width of the Layout
Layout.maximumWidth: walletPathField.width // keeps textarea from going past grid bounds when text is added
Layout.preferredHeight: contentHeight + 20
Layout.topMargin: 20//15
selectByMouse: true
readOnly: true
//text: qsTr("")
color: "#000000" // text color
//selectionColor: "transparent"
// Style
verticalAlignment: TextEdit.AlignVCenter // align the text within the center of TextArea item's height
wrapMode: TextEdit.Wrap // move text to newline if it reaches the width of the TextArea
text: qsTr("Please generate your wallet keys before registering your wallet.")
color: (messageCode == 1) ? "#b22222" : ((NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#404040")// text color
property int messageCode: 0 //0 = info; 1 = warning or error
background: Rectangle {
color: "#708090"
border.color:"#ffffff" // white (since dark mode is default)//border.width: 1//radius: 2
}
// on Left mouse clicked
MouseArea {
id: seed_display_mouse_area
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
//cursorShape: Qt.IBeamCursor
onClicked: (mouse)=> {
// left mouse = displayListOptions()
if ((mouse.button == Qt.LeftButton)) {
//console.log("Left mouse clicked on seedDisplayEdit");
}
// right mouse = selectAll()
if ((mouse.button == Qt.RightButton)) {
//console.log("Right mouse clicked on seedDisplayEdit");
}
}
/*onEntered: {
this.cursorShape = Qt.IBeamCursor
}*/
}
// text options for copy, paste, etc. (experimental)
/*ListView {
anchors.fill: parent
////model: ContactModel {}
delegate: contactDelegate
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
focus: true
x: seed_display_mouse_area.mouseX
y: seed_display_mouse_area.mouseY
}*/
// seedCopyButton (copies to the clipboard)
Button {
id: seedCopyButton
x: seedDisplayScrollView.width - seedDisplayScrollView.ScrollBar.horizontal.visualPosition//(seedDisplayScrollView.width - width)//anchors.left: parent.left//anchors.right: parent.right
//y: seedDisplayScrollView.ScrollBar.vertical.visualPosition//(seedDisplayScrollView.height - height)//anchors.leftMargin: (parent.width - this.width - 10)//anchors.rightMargin: 10
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
width: 32; height: this.width//50
text: qsTr("Copy")
display: AbstractButton.IconOnly
onClicked: copyToClipboard() // this only works on selected text
icon.source: "file:///" + neroshopResourcesDir + "/copy.png"
icon.color: "#ffffff"
//clip: false
//icon.height: 24; icon.width: 24
background: Rectangle {
color: "transparent"
radius: 0
border.color: this.parent.hovered ? "#ffffff" : this.color
border.color: (parent.messageCode == 1) ? "#b22222" : "#2196f3"////parent.color//(NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#404040"
radius: 3
}
leftPadding: 30 + circleInfo.contentWidth
Text {
id: circleInfo
anchors.left: parent.left
anchors.leftMargin: 15
anchors.verticalCenter: parent.verticalCenter
text: (parent.messageCode == 1) ? qsTr(FontAwesome.triangleExclamation) : qsTr(FontAwesome.circleInfo)
color: (parent.messageCode == 1) ? "#b22222" : "#2196f3"
font.bold: true
font.family: FontAwesome.fontFamily
}
ToolTip.delay: 500 // shows tooltip after hovering for 0.5 second
ToolTip.visible: hovered
ToolTip.text: qsTr("Copy to clipboard")
}
}
}
// testing listview for walletseed display
Flow {////RowLayout {
id: walletSeedDisplay
//Layout.preferredHeight: 200
Layout.rowSpan: 7////8 // fill the row 8 times?
Layout.row: 1//(!walletSeedDisplayRepeater.model) ? 0 : 1//8
Layout.column: 1//(!walletSeedDisplayRepeater.model) ? 1 : 1//0
////Layout.fillWidth: true // no reason to fill width since we set the maximum width
//Layout.preferredHeight: 40 * Layout.rowSpan // remove
Layout.maximumWidth: 550//walletMessageArea.width
Layout.topMargin: 20//15
/****orientation: ListView.Horizontal****/
spacing: 5
Repeater {
id: walletSeedDisplayRepeater
////model: null
delegate: Rectangle {
width: 130; height: 40
Text {
text: (index + 1) + ". " + modelData
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
anchors.verticalCenter: parent.verticalCenter//verticalAlignment: Text.AlignVCenter
anchors.left: parent.left
anchors.leftMargin: 15
}
color: "transparent"
border.color: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
radius: 3
//MouseArea {
// anchors.fill: parent
// onClicked: {}
//}
}
}
} // Flow?
// wallet seed copy button
} // GridLayout for registerPage
/*
// optional pseudonym edit
TextField {
id: optNameEdit
@ -442,7 +569,7 @@ Page {
color: "#6b5b95" // #ff6600 is the monero orange color
radius: 0
}
}
}*/
} // eof registerPage
// walletfile auth page
// Upload button with read-only textfield
@ -459,129 +586,285 @@ Page {
// add spacing from parent (padding - located inside the borders of an element)
//anchors.margins: 50//anchors.leftPadding: 20
///////////////////////////
Button {
id: pageRedirectButton1
anchors.verticalCenter: parent.verticalCenter//Layout.alignment: Qt.AlignVCenter | Qt::AlignLeft
anchors.left: parent.left
anchors.leftMargin: 20
implicitWidth: 60; height: implicitWidth
text: qsTr(FontAwesome.angleLeft)
Button {
id: pageRedirectButton1
anchors.verticalCenter: parent.verticalCenter//Layout.alignment: Qt.AlignVCenter | Qt::AlignLeft
anchors.left: parent.left
anchors.leftMargin: 20
implicitWidth: 60; height: implicitWidth
text: qsTr(FontAwesome.angleLeft)
background: Rectangle {
color: "#6b5b95"//"#121212"
radius: 100
border.color: parent.contentItem.color
border.width: (parent.hovered) ? 1 : 0
}
background: Rectangle {
color: "#6b5b95"//"#121212"
radius: 100
border.color: parent.contentItem.color
border.width: (parent.hovered) ? 1 : 0
}
contentItem: Text {
text: parent.text
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
font.family: FontAwesome.fontFamily
font.pixelSize: (parent.width / 2)
}
contentItem: Text {
text: parent.text
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
font.family: FontAwesome.fontFamily
font.pixelSize: (parent.width / 2)
}
onClicked: {
mainPageStack.currentIndex = mainPageStack.currentIndex - 1
onClicked: {
mainPageStack.currentIndex = mainPageStack.currentIndex - 1
}
}
GridLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 20
// wallet file text
Text {
id: walletFileText
Layout.row: 0
Layout.column: 0
text: qsTr("Wallet file")
//visible: false
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
font.bold: true
}
// wallet file field
TextField {
id: walletFileField
Layout.row: 1
Layout.column: 0
Layout.preferredWidth: 500; Layout.preferredHeight: 50
Layout.topMargin: (walletFileText.visible) ? 5 : 0
text: walletFileDialog.file
color: "#000000"////(NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000" // textColor
selectByMouse: true
readOnly: true
background: Rectangle {
color: "#708090"////(NeroshopComponents.Style.darkTheme) ? "#101010" : "#ffffff"
border.color: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969" // if path exists, make border.color green, if not then make red
radius: 3
}
}
}
// wallet_file name edit
// ...
/* ButtonGroup {
// wallet file upload or browse button
Button {
id: walletFileBrowseButton
Layout.row: 1
Layout.column: 1
Layout.preferredWidth: walletFileBrowseButtonText.contentWidth + 20
Layout.preferredHeight: walletFileField.height
text: qsTr("Browse")
//display: AbstractButton.IconOnly//AbstractButton.TextBesideIcon//AbstractButton.TextOnly//AbstractButton.TextUnderIcon
//icon.source: "file:///" + neroshopResourcesDir + "/ellipsis.png"//"/upload.png"
//icon.color: "#ffffff"
onClicked: walletFileDialog.open()
background: Rectangle {
color: "#808080"
radius: 5
border.color: walletFileBrowseButton.hovered ? "#ffffff" : this.color//"#ffffff"//control.down ? "#17a81a" : "#21be2b"
}
// this removes the icon unfortunately :( but it gives us more control over the text
contentItem: Text {
id: walletFileBrowseButtonText
text: parent.text
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
}
ToolTip.delay: 1000
ToolTip.visible: hovered
ToolTip.text: qsTr("Browse wallet file")
}
ButtonGroup {
id: walletRestoreMethodButtonGroup
exclusive: true // only one button selected at a time
onClicked: {
console.log("Selected", button.text, "button")
button.checked = true
//onClicked: walletRestoreStack.currentIndex = 0
/*if(button.text == restoreFromFileButton.text) {
walletRestoreStack.currentIndex = 0
}*/
/*if(button.text == restoreFromSeedButton.text) {
walletRestoreStack.currentIndex = 1
}*/
/*if(button.text == restoreFromKeysButton.text) {
walletRestoreStack.currentIndex = 2
}*/
/*if(button.text == restoreFromHWButton.text) {
walletRestoreStack.currentIndex = 3
}*/
}
}
// to add a button to the button group (within the Button object itself): ButtonGroup.group: walletRestoreMethodButtonGroup // attaches a button to a button group
*/
////StackLayout {
//// anchors.fill: loginPage
//// id: walletRestoreStack
//// Rectangle {
//// id: restoreFromWalletFile
//// }
RowLayout {
id: walletRestoreButtonsRow
//Layout.preferredWidth:
//Layout.preferredHeight:
Layout.row: 2
Layout.column: 0
Layout.topMargin: 15
// to add a button to the button group (within the Button object itself): ButtonGroup.group: walletRestoreMethodButtonGroup // attaches a button to a button group
Button {
id: restoreFromFileButton
ButtonGroup.group: walletRestoreMethodButtonGroup
checked: true
text: qsTr("Restore from file")//.arg("\uf8e9")
Layout.preferredHeight: 40
icon.source: "file:///" + neroshopResourcesDir + "/file.png" // keys (key.png), seed (sprout.png), file, hardware
//icon.color: "#ffffff"
display: AbstractButton.IconOnly//hovered ? AbstractButton.TextBesideIcon : AbstractButton.IconOnly//AbstractButton.TextUnderIcon
background: Rectangle {
color: (parent.checked) ? "#39304f" : "#6b5b95"
//border.color:
//border.width: 1
radius: 3
}
//contentItem: Text {
// text: parent.text
// color: "#ffffff"
// horizontalAlignment: Text.AlignHCenter
// verticalAlignment: Text.AlignVCenter
// font.bold: true
// font.family: FontAwesome.fontFamilySolid
//}
}
Button {
id: restoreFromSeedButton
ButtonGroup.group: walletRestoreMethodButtonGroup
text: qsTr("Restore from seed")//.arg("\uf8e9")
//width: contentWidth + 20;
Layout.preferredHeight: 40
icon.source: "file:///" + neroshopResourcesDir + "/sprout.png" // keys (key.png), seed (sprout.png), file, hardware
//icon.color: "#ffffff"
display: AbstractButton.IconOnly//hovered ? AbstractButton.TextBesideIcon : AbstractButton.IconOnly//AbstractButton.TextUnderIcon
background: Rectangle {
color: (parent.checked) ? "#39304f" : "#6b5b95"
//border.color:
//border.width: 1
radius: 3
}
}
Button {
id: restoreFromKeysButton
ButtonGroup.group: walletRestoreMethodButtonGroup
text: qsTr("Restore from keys")//.arg("\uf8e9")
//width: contentWidth + 20;
Layout.preferredHeight: 40
icon.source: "file:///" + neroshopResourcesDir + "/key.png" // keys (key.png), seed (sprout.png), file, hardware
//icon.color: "#ffffff"
display: AbstractButton.IconOnly//hovered ? AbstractButton.TextBesideIcon : AbstractButton.IconOnly//AbstractButton.TextUnderIcon
background: Rectangle {
color: (parent.checked) ? "#39304f" : "#6b5b95"
//border.color:
//border.width: 1
radius: 3
}
}
Button {
id: restoreFromHWButton
ButtonGroup.group: walletRestoreMethodButtonGroup
text: qsTr("Restore from hardware wallet")//.arg("\uf8e9")
//width: contentWidth + 20;
Layout.preferredHeight: 40
icon.source: "file:///" + neroshopResourcesDir + "/usb.png" // keys (key.png), seed (sprout.png), file, hardware
//icon.color: "#ffffff"
display: AbstractButton.IconOnly//hovered ? AbstractButton.TextBesideIcon : AbstractButton.IconOnly//AbstractButton.TextUnderIcon
background: Rectangle {
color: (parent.checked) ? "#39304f" : "#6b5b95"
//border.color:
//border.width: 1
radius: 3
}
}
} // RowLayout
StackLayout {
id: walletRestoreStack
Layout.row: 3
Layout.column: 0
currentIndex: 0
Rectangle {
id: restoreFromWalletFile
visible: restoreFromFileButton.checked
//Layout.minimumHeight:
Layout.preferredWidth: 500
Layout.preferredHeight: 300
Layout.topMargin: 5
//GridLayout {}
color: "transparent"
border.color: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
//radius: 3
}
//// Rectangle {
//// id: restoreFromMnemonicSeed
//// visible: restoreFrom?Button.checked
//// }
//// Rectangle {
//// id: restoreFromKeys
//// visible: restoreFrom?Button.checked
//// }
//// Rectangle {
//// id: restoreFromHardwareWallet
//// visible: restoreFrom?Button.checked
//// }
////}
}
//ScrollView {
// id: wallet_upload_scrollview
TextField {
id: wallet_upload_edit // for displaying wallet file name or path
x: (loginPage.width - wallet_upload_button.width - this.width) / 2//20
y: 20 // top_margin
width: 300; height: 30
readOnly: true
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 {
color: "#708090"
border.color:"#ffffff" // white (since dark mode is default)//border.width: 1//radius: 2
}
}
/*
//}
// upload button
Button {
id: wallet_upload_button
text: qsTr("Upload")
id: walletPathButton
text: restoreFromFileButton.checked ? qsTr("Browse") : qsTr("Change")//qsTr("Browse")//qsTr("...")//qsTr("Upload")
onClicked: walletFileDialog.open()
display: AbstractButton.IconOnly//AbstractButton.TextBesideIcon//AbstractButton.TextOnly
//hoverEnabled: true
x: wallet_upload_edit.x + wallet_upload_edit.width + 5
y: wallet_upload_edit.y
x: walletFileUploadField.x + walletFileUploadField.width + 5
y: walletFileUploadField.y
width: 50
height: wallet_upload_edit.height
height: walletFileUploadField.height
icon.source: "file:///" + neroshopResourcesDir + "/upload.png"//neroshopResourceDir + "/upload.png"
icon.color: "#ffffff"
// can only have 1 contentItem at a time (a contentItem is not needed for Button)
/*contentItem: Image {
source: neroshopResourceDir + "/upload.png"
height: 24; width: 24 // has no effect since image is scaled
fillMode:Image.PreserveAspectFit; // the image is scaled uniformly to fit button without cropping // https://doc.qt.io/qt-6/qml-qtquick-image.html#fillMode-prop
}
contentItem: Text {
text: wallet_upload_button.text
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}*/
//contentItem: Image {
// source: neroshopResourceDir + "/upload.png"
// height: 24; width: 24 // has no effect since image is scaled
// fillMode:Image.PreserveAspectFit; // the image is scaled uniformly to fit button without cropping // https://doc.qt.io/qt-6/qml-qtquick-image.html#fillMode-prop
//}
//contentItem: Text {
// text: walletPathButton.text
// color: "#ffffff"
// horizontalAlignment: Text.AlignHCenter
// verticalAlignment: Text.AlignVCenter
//}
background: Rectangle {
color: "#808080"/*parent.down ? "#bbbbbb" :
(parent.hovered ? "#d6d6d6" : "#f6f6f6")*/
color: "#808080"//parent.down ? "#bbbbbb" : (parent.hovered ? "#d6d6d6" : "#f6f6f6")
radius: 0
border.color: wallet_upload_button.hovered ? "#ffffff" : this.color//"#ffffff"//control.down ? "#17a81a" : "#21be2b"
border.color: walletPathButton.hovered ? "#ffffff" : this.color//"#ffffff"//control.down ? "#17a81a" : "#21be2b"
}
ToolTip.delay: 500 // shows tooltip after hovering for 0.5 second
ToolTip.visible: hovered
ToolTip.text: qsTr("Upload wallet file")
}
/*Label {
id: wallet_file_password_label
text: qsTr("Wallet file password")
}*/
//Label {
// id: wallet_file_password_label
// text: qsTr("Wallet file password")
//}
// wallet password textfield
TextField {//TextInput {
id: wallet_password_edit
x: wallet_upload_edit.x
y: wallet_upload_edit.y + wallet_upload_edit.height + 10
width: wallet_upload_edit.width//; height:
x: walletFileUploadField.x
y: walletFileUploadField.y + walletFileUploadField.height + 10
width: walletFileUploadField.width//; height:
placeholderText: qsTr("Wallet Password")
placeholderTextColor: "#696969" // dim gray
color: "#5f3dc4"//"#402ef7"//"orange" // textColor
@ -615,7 +898,8 @@ Page {
color: '#6b5b95'//#5f3dc4 = (95, 61, 196)//add to cart button colors =>//"#6b5b95"//#6b5b95 = (107, 91, 149)//"#483d8b"//#483d8b = (72, 61, 139)//"#ff6600"//#ff6600 is the monero orange color
radius: 0
}
}
}*/
} // GridLayout
} // eof wallet_file_authentication_page
}
}

File diff suppressed because it is too large Load Diff

@ -51,6 +51,12 @@ private:
static bool load_theme(); // names: "sun", moon, "bulb"
static bool load_settings(); // "cog", "tools"
static bool load_privacy();
static bool load_key();
static bool load_sprout();
static bool load_file();
static bool load_usb();
static bool load_ellipsis();
static bool load_change();
//static bool load_();
// non-icons8 icons
static bool load_speaker(); // volume_up, volume_down

@ -16,20 +16,25 @@ neroshop::gui::Wallet::~Wallet() {
#if defined(NEROSHOP_USE_QT)
////neroshop::gui::Wallet::Wallet(QObject* parent) : QObject(parent) {}
neroshop::Wallet * neroshop::gui::Wallet::get_wallet() const {
neroshop::Wallet * neroshop::gui::Wallet::getWallet() const {
return wallet.get();
}
int neroshop::gui::Wallet::create_random_wallet(const QString& password, const QString& confirm_pwd, const QString& path) const {
int neroshop::gui::Wallet::createRandomWallet(const QString& password, const QString& confirm_pwd, const QString& path) const {
auto error = wallet->create_random(password.toStdString(), confirm_pwd.toStdString(), path.toStdString());
return static_cast<int>(error);
}
QString neroshop::gui::Wallet::get_mnemonic() const {
QString neroshop::gui::Wallet::getMnemonic() const {
if(!wallet->get_monero_wallet()) return "";
return QString::fromStdString(wallet->get_monero_wallet()->get_mnemonic());
}
QStringList neroshop::gui::Wallet::getMnemonicModel() const {
QStringList seed_phrase = QString::fromStdString(wallet->get_monero_wallet()->get_mnemonic()).split(' ');
return seed_phrase;
}
void neroshop::gui::Wallet::daemonOpen(const QString& ip, const QString& port, bool confirm_external_bind, bool restricted_rpc, bool remote, QString data_dir, QString network_type, unsigned int restore_height) {//const {
wallet->daemon_open(ip.toStdString(), port.toStdString(), confirm_external_bind, restricted_rpc, remote, data_dir.toStdString(), network_type.toStdString(), restore_height);
}

@ -6,6 +6,7 @@
#if defined(NEROSHOP_USE_QT)
#include <QObject>
#include <QString>
#include <QStringList>
#include <QDebug>
#include <QThread>
#endif
@ -21,15 +22,16 @@ namespace gui { // or just remove the "gui" namespace and rename gui::Wallet to
class Wallet : public QObject, public neroshop::Wallet {
Q_OBJECT
// properties (for use in QML)
Q_PROPERTY(neroshop::Wallet* wallet READ get_wallet WRITE set_wallet);// NOTIFY wallet_changed);
Q_PROPERTY(neroshop::Wallet* wallet READ getWallet WRITE setWallet);// NOTIFY wallet_changed);
//Q_PROPERTY(<type> <variable_name> READ <get_function_name>)
public:
// functions (for use in QML)
////explicit Wallet(QObject* parent = 0);
Q_INVOKABLE int create_random_wallet(const QString& password, const QString& confirm_pwd, const QString& path) const;
Q_INVOKABLE QString get_mnemonic() const;
Q_INVOKABLE neroshop::Wallet * get_wallet() const;
Q_INVOKABLE void set_wallet(const neroshop::Wallet* wallet/*const neroshop::Wallet& wallet*/) {}//const { /*this->wallet = const_cast<neroshop::Wallet*>(wallet);*//*this->wallet = &const_cast<neroshop::Wallet&>(wallet);*//*emit wallet_changed(status);*/ }
Q_INVOKABLE int createRandomWallet(const QString& password, const QString& confirm_pwd, const QString& path) const;
Q_INVOKABLE QString getMnemonic() const;
Q_INVOKABLE QStringList getMnemonicModel() const;
Q_INVOKABLE neroshop::Wallet * getWallet() const;
Q_INVOKABLE void setWallet(const neroshop::Wallet* wallet/*const neroshop::Wallet& wallet*/) {}//const { /*this->wallet = const_cast<neroshop::Wallet*>(wallet);*//*this->wallet = &const_cast<neroshop::Wallet&>(wallet);*//*emit wallet_changed(status);*/ }
//Q_INVOKABLE <type> <function_name>() const {}
Q_INVOKABLE void daemonOpen/*Local*/(const QString& ip, const QString& port, bool confirm_external_bind, bool restricted_rpc, bool remote, QString data_dir, QString network_type, unsigned int restore_height);// const;
public slots:

@ -30,11 +30,11 @@
#include "core/encryptor.hpp"
#include "core/util.hpp"
#include "core/process.hpp"
// neroshop (daemon)
// neroshop-daemon
// ...
// neroshop (gui)
#if defined(NEROSHOP_BUILD_GUI)
// todo: remove icon.cpp and add icons to qml.qrc file
// todo: remove icon.hpp/icon.cpp and add icon files to qml.qrc file instead
#include "gui/icon.hpp"
#include "gui/script_proxy.hpp"
#include "gui/wallet_proxy.hpp"

Loading…
Cancel
Save