Add NodeList.qml and CONTRIBUTING.md; Edit CatalogList.qml

pull/64/head
larteyoh 1 year ago
parent da179ea3aa
commit 5d40c23cc2

@ -0,0 +1,6 @@
There are many ways that you can contribute.
- Creating pull requests that solve issues found on the (Issues page)[https://github.com/larteyoh/testshop/issues]
- Making a (donation)[#donations] to fund the development of the project
- Reporting any bugs or vulnerabilities found in the code as a GitHub (issue)[https://github.com/larteyoh/testshop/issues]

@ -10,7 +10,8 @@ A distributed P2P (peer-to-peer) marketplace for [**Monero**](https://getmonero.
- [Demo](#demo) <!-- - [Features](#features)--> <!-- - [Documentation](#documentation)-->
- [Building neroshop](#building-neroshop)
- [Dependencies](#dependencies)
- [Compiling neroshop from source](#compiling-neroshop-from-source) <!-- - [Contributing](#contributing) --> <!-- - [Bug Bounty Program]-->
- [Compiling neroshop from source](#compiling-neroshop-from-source)
- [Contributing](#contributing) <!-- - [Bug Bounty Program]-->
- [Donations](#donations)
- [Resources](#resources)
- [Credits](#credits)
@ -195,9 +196,8 @@ make
```
To build for [**Android**](https://www.android.com/) (requires [**Android NDK**](https://developer.android.com/ndk)):<!-- and [CMake](https://cmake.org/)):-->
```bash
```
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## Donations
@ -228,7 +228,7 @@ Official neroshop logo design — [u/EchoingCat](https://www.reddit.com/u/Echoin
[//]: # (./clean.sh)
[//]: # (git checkout -b main)
[//]: # (git add .gitignore .gitmodules cmake/ CMakeLists.txt external/ fonts/ images/ qml/ qml.qrc README.md shaders/ src/ test/)
[//]: # (git add .gitignore .gitmodules cmake/ CMakeLists.txt CONTRIBUTING.md external/ fonts/ images/ LICENSE qml/ qml.qrc README.md shaders/ src/ test/)
[//]: # (git commit -m"...")
[//]: # (git push -u origin main --force)
[//]: # (https://git.slipfox.xyz/larteyoh/testshop/settings => Mirror Settings => Synchronize Now)

@ -11,9 +11,11 @@
<file>qml/components/Hint.qml</file>
<file>qml/components/MessageBox.qml</file>
<file>qml/components/NavigationalBar.qml</file>
<file>qml/components/NodeList.qml</file>
<file>qml/components/PaginationBar.qml</file>
<file>qml/components/ProgressBar.qml</file>
<file>qml/components/qmldir</file>
<file>qml/components/RadioButton.qml</file>
<file>qml/components/SearchBar.qml</file>
<file>qml/components/SettingsDialog.qml</file>
<file>qml/components/Style.qml</file>

@ -12,7 +12,7 @@ import "." as NeroshopComponents
// catalog view (Grid)
Grid {
id: catalogGrid
rows: 20//2
rows: 10//20
columns: 3
spacing: 5//rowSpacing: 5; columnSpacing: 5
//flow: Grid.TopToBottom
@ -23,15 +23,20 @@ import "." as NeroshopComponents
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
property real boxWidth: (hideProductDetails) ? 250 : 300//220 : 250//300
property real boxHeight: (hideProductDetails) ? 300 : 400//220 : 250//220
property real fullWidth: (this.boxWidth * columns) + (spacing * (columns - 1)) // Full width of the entire grid
property alias count: catalogGridRepeater.count
Repeater { // owns all items it instantiates
id: catalogGridRepeater
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
id: productBox
visible: true
width: (hideProductDetails) ? 250 : 300//220 : 250//300
height: (hideProductDetails) ? 300 : 400//220 : 250//220
width: catalogGrid.boxWidth
height: catalogGrid.boxHeight
color: (NeroshopComponents.Style.darkTheme) ? "#2e2e2e"/*"#121212"*/ : "#a0a0a0"//"#ffffff"// #a0a0a0 = 160,160,160
border.color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
border.width: 0

@ -6,4 +6,31 @@ import QtQuick.Layouts 1.12
import FontAwesome 1.0
import "." as NeroshopComponents
Column {
id: catalogList
width: parent.width; height: (boxHeight * catalogListRepeater.count) // The height is the height of all the models in the listview combined
spacing: 5
property bool hideProductDetails: true//false // hides product name, price, and star ratings if set to true
property real boxWidth: this.width
property real boxHeight: 300//NeroshopComponents.CatalogGrid.boxWidth
property alias count: catalogListRepeater.count
Repeater {
id: catalogListRepeater
model: 10
delegate: Rectangle {
id: productBox
width: catalogList.boxWidth; height: catalogList.boxHeight // The height of each individual model item/ list element
color: (NeroshopComponents.Style.darkTheme) ? "#2e2e2e" : "#a0a0a0"
border.color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
border.width: 0
radius: 5
//clip: true
Text {
text: "I'm item " + index + ", model count: " + catalogListRepeater.count//text: //name + ": " + number
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
}
}
}
}

@ -0,0 +1,109 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
//import FontAwesome 1.0
import "." as NeroshopComponents
Item {
id: root
ColumnLayout {
anchors.fill: parent
spacing: 2
RowLayout {
Layout.fillWidth: true
spacing: 2
property real titleBoxRadius: 3
Rectangle {
Layout.fillWidth: true
Layout.minimumHeight: 25
color: "#6c6c6f"
radius: parent.titleBoxRadius
Label {
text: qsTr("Node")
color: "white"
anchors {
horizontalCenter: parent.horizontalCenter//left: parent.left;leftMargin: 4
verticalCenter: parent.verticalCenter
}
}
}
Rectangle {
id: heightTitle
Layout.minimumWidth: 100//50
Layout.minimumHeight: 25
color: "#6c6c6f"
radius: parent.titleBoxRadius
Label {
text: qsTr("Height")
color: "white"
anchors {
horizontalCenter: parent.horizontalCenter//left: parent.left; leftMargin: 4
verticalCenter: parent.verticalCenter
}
}
}
}
ListView {
id: listView
clip: true
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.vertical: ScrollBar { }
model: 50
delegate: Item {
width: listView.width
height: 25
Rectangle {
anchors.fill: parent
color: parent.ListView.isCurrentItem ? NeroshopComponents.Style.moneroOrangeColor : "transparent"
}
MouseArea {
anchors.fill: parent
onClicked: {
listView.currentIndex = index
listView.positionViewAtIndex(index, ListView.Contain)
}
}
RowLayout {
id: delegateRow
anchors.fill: parent
Label {
id: nodeStatusLabel
text: index % 3 === 0 ? "✅" : "❌" // TODO create normal model
Layout.maximumWidth: 25
property bool status: index % 3 === 0//false // todo: use data from model to determine the status
}
Label {
id: nodeAddressLabel
Layout.fillWidth: true
text: "node.neroshop.org:38081"//:18081" // TODO create normal model
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
elide: Label.ElideRight
}
Label {
id: nodeHeightLabel
Layout.minimumWidth: heightTitle.width//50
Layout.maximumWidth: heightTitle.width//50
text: "100500" // TODO create normal model
color: nodeAddressLabel.color
elide: Label.ElideRight
}
}
}
}
}
}

@ -0,0 +1,43 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
RadioButton {
id: control
text: qsTr("RadioButton")
checked: true
property string color: control.down ? "#39304f" : "#6b5b95"
property string innerColor: borderColor//"white"
property string borderColor: control.down ? "#39304f" : "#6b5b95"
property string textColor: control.down ? "#39304f" : "#6b5b95"
property alias textObject: radioButtonText
indicator: Rectangle {
implicitWidth: 16//26
implicitHeight: 16//26
x: control.leftPadding
y: parent.height / 2 - height / 2
radius: 13
color: innerColor
border.color: control.borderColor
Rectangle {
width: 10//14
height: 10//14
anchors.horizontalCenter: parent.horizontalCenter////x: 5//6
anchors.verticalCenter: parent.verticalCenter////y: 5//6
radius: 7
color: control.color
visible: control.checked
}
}
contentItem: Text {
id: radioButtonText
text: control.text
font: control.font
opacity: enabled ? 1.0 : 0.3
color: control.textColor
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}
}

@ -30,6 +30,14 @@ Popup {
height: 40
width: parent.width
Label {
text: "Settings"
color: "#ffffff"
font.bold: true
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
Button {
id: closeButton
width: 25//20
@ -57,19 +65,6 @@ Popup {
}
}
}
FileDialog {
id: moneroDaemonFileDialog
fileMode: FileDialog.OpenFile
currentFile: monerodLocationField.text // currentFile is deprecated since Qt 6.3. Use selectedFile instead
folder: (isWindows) ? StandardPaths.writableLocation(StandardPaths.DocumentsLocation) + "/neroshop" : StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/neroshop"
nameFilters: ["Executable files (*.exe *.AppImage *)"]
}
FolderDialog {
id: moneroDataDirFolderDialog
currentFolder: moneroDataDirField.text
}
TabBar {
id: settingsBar
@ -78,6 +73,7 @@ Popup {
anchors.horizontalCenter: parent.horizontalCenter
property string buttonColor: "#030380"
background: Rectangle { color: "transparent" } // hide white corners when tabButton radius is set
property real buttonRadius: 5
TabButton {
id: generalSettingsButton
@ -90,7 +86,7 @@ Popup {
checked: (settingsStack.currentIndex == 0)
background: Rectangle {
color: (parent.checked) ? settingsBar.buttonColor : "#ffffff"
radius: 3
radius: settingsBar.buttonRadius
}
// This will remove the icon :(
contentItem: Text {
@ -104,7 +100,7 @@ Popup {
}
TabButton {
text: (hideTabText) ? qsTr(FontAwesome.monero) : qsTr("%1 Monero Settings").arg(FontAwesome.monero)//
text: (hideTabText) ? qsTr(FontAwesome.monero) : qsTr("%1 monerod").arg(FontAwesome.monero)//
width: implicitWidth + 20
onClicked: settingsStack.currentIndex = 1
display: AbstractButton.TextOnly
@ -112,7 +108,7 @@ Popup {
checked: (settingsStack.currentIndex == 1)
background: Rectangle {
color: (parent.checked) ? settingsBar.buttonColor : "#ffffff"
radius: 3
radius: settingsBar.buttonRadius
}
contentItem: Text {
text: parent.text
@ -281,7 +277,7 @@ Popup {
Layout.row: 2
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500
title: qsTr("Language")
title: qsTr("Localization")
background: Rectangle {
y: parent.topPadding - parent.bottomPadding
@ -298,6 +294,21 @@ Popup {
color: parent.background.border.color//"#030380"
elide: Text.ElideRight
}
RowLayout {
anchors.fill: parent
Label {
text: qsTr("Language:")
color: NeroshopComponents.Style.darkTheme ? "#ffffff" : "#000000"
}
ComboBox {
id: languageComboBox
Layout.alignment: Qt.AlignRight
Layout.rightMargin: 0
currentIndex: model.indexOf("English"/*Script.getString("neroshop.generalsettings.currency").toUpperCase()*/)
model: ["English"] // TODO logic from controller
}
}
} // GroupBox3
} // ColumnLayout (positions items vertically (up-and-down) I think, while RowLayout items are side-by-side)
@ -307,79 +318,186 @@ Popup {
id: moneroSettings
Layout.minimumWidth: parent.width - 10 // 10 is the scrollView's right margin
//rowSpacing: // The default value is 5 but we'll set this later
////Layout.minimumHeight: 500 // Increase this value whenever more items are added inside the scrollview
Frame { //GroupBox {
/*Frame { //GroupBox {
//title: qsTr("Select a node type")
Layout.row: 0
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500//250////Layout.fillWidth: true
Layout.preferredHeight: contentHeight + (contentHeight / 2)//implicitContentHeight
Layout.preferredHeight: contentHeight + (contentHeight / 2)//implicitContentHeight*/
/*label: Label {
text: parent.title
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
font.bold: true
}*/
background: Rectangle {
/*background: Rectangle {
radius: 3
color: "transparent"
border.color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
}
}*/
RowLayout {
spacing: (contentWidth + remoteNodeLabel.contentWidth)//20//100
Layout.row: 0
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500
/*spacing: (contentWidth + remoteNodeLabel.contentWidth)//20//100
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.fill: parent
anchors.fill: parent*/
property string checkedColor: NeroshopComponents.Style.moneroOrangeColor////"#0069d9"
ButtonGroup {
id: nodeTypeGroup
onClicked: { console.log("Selected condition:", button.text) }
onClicked: { nodeTypeStackLayout.currentIndex = button.stackLayoutIndex }
}
Rectangle {
color: (remoteNodeButton.checked) ? parent.checkedColor : "#ffffff"//"transparent"
border.color: (remoteNodeButton.checked) ? parent.checkedColor : "#989999"
border.width: (remoteNodeButton.checked) ? 0 : 2
radius: 3
Layout.preferredWidth: 250
Layout.preferredHeight: 50//Layout.fillHeight: true
MouseArea {
anchors.fill: parent
////cursorShape: Qt.PointingHandCursor
onClicked: { remoteNodeButton.checked = true
nodeTypeStackLayout.currentIndex = remoteNodeButton.stackLayoutIndex
}
}
RadioButton {
NeroshopComponents.RadioButton {
id: remoteNodeButton
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
checked: true
ButtonGroup.group: nodeTypeGroup
Label {
id: remoteNodeLabel
anchors.left: parent.right
anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter
text: FontAwesome.cloud//"Remote node"
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
font.bold: true
//font.family: FontAwesome.fontFamily
font.pointSize: 15
}
text: qsTr("Remote node")//FontAwesome.cloud
color: checked ? parent.parent.checkedColor : "#d9dada"
borderColor: checked ? "#ffffff" : "#d9dada"
textColor: checked ? "#ffffff" : "#989999"
textObject.font.bold: true
////innercolor: borderColor
property int stackLayoutIndex: 0
//font.family: FontAwesome.fontFamily
//font.pointSize: 15
}
}
RadioButton {
Rectangle {
color: (localNodeButton.checked) ? parent.checkedColor : "#ffffff"//"transparent"
border.color: (localNodeButton.checked) ? parent.checkedColor : "#989999"
border.width: (localNodeButton.checked) ? 0 : 2
radius: 3
Layout.preferredWidth: 250 - parent.spacing
Layout.preferredHeight: 50//Layout.fillHeight: true
MouseArea {
anchors.fill: parent
////cursorShape: Qt.PointingHandCursor
onClicked: { localNodeButton.checked = true
nodeTypeStackLayout.currentIndex = localNodeButton.stackLayoutIndex
}
}
NeroshopComponents.RadioButton {
id: localNodeButton
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
checked: false
ButtonGroup.group: nodeTypeGroup
Label {
anchors.left: parent.right
anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter
text: FontAwesome.house//"Local node"
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
font.bold: true
font.family: FontAwesome.fontFamily
font.pointSize: 15
}
}
text: qsTr("Local node")//FontAwesome.house
color: checked ? parent.parent.checkedColor : "#d9dada"
borderColor: checked ? "#ffffff" : "#d9dada"
textColor: checked ? "#ffffff" : "#989999"
textObject.font.bold: true
////innercolor: borderColor
property int stackLayoutIndex: 1
}
}
}
} // GroupBox or Frame
//} // GroupBox or Frame
StackLayout {
id: nodeTypeStackLayout
Layout.row: 1
Layout.fillWidth: true
Layout.fillHeight: true
Item {
ColumnLayout {
anchors.fill: parent
Frame {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500
Layout.preferredHeight: 200//300////Layout.fillHeight: true
background: Rectangle {
radius: 3
color: "transparent"
border.color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
//border.width: 1
}
NeroshopComponents.NodeList {
anchors.fill: parent
// Use the below code if not using a frame
/*Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500
Layout.preferredHeight: 500*/
}
}
RowLayout {
Layout.alignment: Qt.AlignHCenter
TextField {
id: customMoneroNodeIPField
Layout.preferredWidth: (moneroDaemonPortField.width * 3) - parent.spacing // Default row spacing is 5 so the width is reduced by 5
Layout.preferredHeight: 50
placeholderText: qsTr("Custom node IP address"); placeholderTextColor: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
selectByMouse: true
background: Rectangle {
color: (NeroshopComponents.Style.darkTheme) ? "#101010" : "#ffffff"
border.color: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
radius: 3
}
}
TextField {
id: customMoneroNodePortField
Layout.preferredWidth: (500 / 4)
Layout.preferredHeight: 50
placeholderText: qsTr("Custom node port number"); placeholderTextColor: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
selectByMouse: true
background: Rectangle {
color: (NeroshopComponents.Style.darkTheme) ? "#101010" : "#ffffff"
border.color: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
radius: 3
}
}
}
}
} // Item 0
Item {
ColumnLayout {
anchors.fill: parent//Layout.fillWidth: true
//Layout.fillHeight: true
TextField {
id: monerodLocationField
Layout.row: 1//(localNodeButton.checked) ? 1 : 2
Layout.alignment: Qt.AlignHCenter
//Layout.fillWidth: true
Layout.preferredWidth: 500
Layout.preferredWidth: 500//Layout.fillWidth: true
Layout.preferredHeight: 50
////visible: (localNodeButton.checked) // error: Qt Quick Layouts: Polish loop detected. Aborting after two iterations.
placeholderText: qsTr((isWindows) ? "monerod.exe" : "monerod"); placeholderTextColor: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
selectByMouse: true
@ -418,11 +536,9 @@ Popup {
TextField {
id: moneroDataDirField
Layout.row: 2//(localNodeButton.checked) ? 2 : 3
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500
Layout.preferredHeight: 50
////visible: (localNodeButton.checked)
property string defaultMoneroDataDirFolder: (isWindows) ? StandardPaths.writableLocation(StandardPaths.AppDataLocation) + "/bitmonero" : StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/.bitmonero" // C:/ProgramData/bitmonero (Windows) or ~/.bitmonero (Linux and Mac OS X)
placeholderText: qsTr(defaultMoneroDataDirFolder); placeholderTextColor: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
@ -459,9 +575,7 @@ Popup {
}
RowLayout {
Layout.row: 3//(localNodeButton.checked) ? 3 : 1
Layout.alignment: Qt.AlignHCenter
////visible: (localNodeButton.checked)
TextField {
id: moneroDaemonIPField
@ -497,10 +611,8 @@ Popup {
}
RowLayout {
Layout.row: 4//(localNodeButton.checked) ? 4 : 2
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500
////visible: (localNodeButton.checked)
Label {
Layout.alignment: Qt.AlignLeft
@ -521,10 +633,8 @@ Popup {
}
RowLayout {
Layout.row: 5//(localNodeButton.checked) ? 5 : 3
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500
////visible: (localNodeButton.checked)
Label {
Layout.alignment: Qt.AlignLeft
@ -545,9 +655,7 @@ Popup {
}
// todo: add rpc-login option so full node mainainers can require a login in order for others to connect to their daemon
/*RowLayout {
Layout.row: 6//(localNodeButton.checked) ? 6 : 4
Layout.alignment: Qt.AlignHCenter
////visible: (localNodeButton.checked)
TextField {
id: moneroDaemonRpcLoginUser
@ -578,18 +686,44 @@ Popup {
radius: 3
}
}
}*/
/*//ScrollView { // NO need for this. TableView provides a scrollbar
//ListView { // NO need for this. TableView provides a listview
// id: remoteNodeList
//}
//}
// manage daemon buttons: stop daemon, start daemon, etc.
}*/
/*TextField {
id: moneroDaemonOptFlags
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 500 // Default row spacing is 5 so the width is reduced by 5
Layout.preferredHeight: 50
placeholderText: qsTr("Daemon flags (optional)"); placeholderTextColor: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
color: (NeroshopComponents.Style.darkTheme) ? "#ffffff" : "#000000"
selectByMouse: true
background: Rectangle {
color: (NeroshopComponents.Style.darkTheme) ? "#101010" : "#ffffff"
border.color: (NeroshopComponents.Style.darkTheme) ? "#a9a9a9" : "#696969"
radius: 3
}
}*/
/*// manage daemon buttons: stop daemon, start daemon, etc.
//Button {
//id:saveSettingsButton
//}
*/
*/
} // ColumnLayout
FileDialog {
id: moneroDaemonFileDialog
fileMode: FileDialog.OpenFile
currentFile: monerodLocationField.text // currentFile is deprecated since Qt 6.3. Use selectedFile instead
folder: (isWindows) ? StandardPaths.writableLocation(StandardPaths.DocumentsLocation) + "/neroshop" : StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/neroshop"
nameFilters: ["Executable files (*.exe *.AppImage *)"]
}
FolderDialog {
id: moneroDataDirFolderDialog
currentFolder: moneroDataDirField.text
}
} // Item 1
} // StackLayout (node)
} // moneroSettings
} // StackLayout
} // StackLayout (settings)
} // ScrollView
}

@ -52,10 +52,10 @@ ApplicationWindow {
Loader {
id: pageLoader
anchors.fill: parent
source: "qrc:/qml/pages/MainPage.qml"
//source: "qrc:/qml/pages/MainPage.qml"
//source: "qrc:/qml/pages/HomePage.qml"
//source: "qrc:/qml/pages/CartPage.qml"
//source: "qrc:/qml/pages/CatalogPage.qml"
source: "qrc:/qml/pages/CatalogPage.qml"
//source: "qrc:/qml/pages/ProductPage.qml"
//source: "qrc:/qml/pages/OrderCheckoutPage.qml"
////source: "qrc:/qml/pages/ProfilePage.qml"

@ -99,25 +99,26 @@ ScrollView {//Flickable {
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
Repeater {
id: pages
model: 10 // Number of page results from search
// todo: use a Loader to switch between grid view and list view // https://forum.qt.io/topic/80826/dynamic-delegate-in-repeater/4 //// (viewToggle.checkedButton.text.match("List view")) ?
delegate: NeroshopComponents.CatalogGrid {
// To access each grid: pages.itemAt(index)
// To access each box inside the grid: pages.itemAt(gridIndex).children[gridBoxIndex] //or: pages.itemAt(gridIndex).getBox(gridBoxIndex)
//id: catalog
// Items in a StackLayout support these attached properties (anchors cannot be used when managed by StackLayout or any other Layout type):
//Layout.minimumWidth
//Layout.minimumHeight
//Layout.preferredWidth
//Layout.preferredHeight
//Layout.maximumWidth
//Layout.maximumHeight
//Layout.fillWidth: true
//Layout.fillHeight: true
delegate: Loader {////NeroshopComponents.CatalogGrid {
id: catalogViewLoader
source: (viewToggle.checkedButton.text == "Grid view") ? "qrc:/qml/components/CatalogGrid.qml" : "qrc:/qml/components/CatalogList.qml"
// displaying the catalog grid's properties
//onLoaded: {
/*console.log("Full width of Grid (actual):", catalogViewLoader.item.width)
console.log("catalogGrid.fullWidth:", catalogViewLoader.item.fullWidth)*/
//console.log(catalogViewLoader.item.rows)
//console.log("model count:", catalogViewLoader.item.count)
//}
// Changing the catalog grid's properties
/*Component.onCompleted: {
catalogViewLoader.setSource(catalogViewLoader.source,
{ "rows": "2" });
}*/
}
}
} // StackLayout

@ -5,13 +5,10 @@ lua_State * neroshop::lua_state(luaL_newstate());
bool neroshop::load_config() {
std::string user = neroshop::device::get_user();
// "/home/<user>/.config/neroshop"
#if defined(NEROSHOP_USE_QT)
std::string neroshop_config_path = NEROSHOP_DEFAULT_CONFIGURATION_PATH.toStdString();
#else
std::string neroshop_config_path = NEROSHOP_DEFAULT_CONFIGURATION_PATH;
#endif
std::string configuration_path = NEROSHOP_DEFAULT_CONFIGURATION_PATH;
std::string configuration_file = "settings.lua";
// "/home/<user>/.config/neroshop/settings.lua"
std::string neroshop_config_name = neroshop_config_path + "/" + NEROSHOP_CONFIGURATION_FILE;
std::string neroshop_config_name = configuration_path + "/" + configuration_file;
Script script;
if(!script.load(lua_state, neroshop_config_name)) {
return false;
@ -87,13 +84,10 @@ neroshop = {
text = neroshop::string::swap_first_of(text, "/home/<user>/.bitmonero", ("/home/" + user + "/.bitmonero"));
#endif
// "/home/<user>/.config/neroshop"
#if defined(NEROSHOP_USE_QT)
std::string neroshop_config_path = NEROSHOP_DEFAULT_CONFIGURATION_PATH.toStdString();
#else
std::string neroshop_config_path = NEROSHOP_DEFAULT_CONFIGURATION_PATH;//"/home/" + user + "/.config/neroshop"; // neroshop::device::get_user()
#endif
std::string configuration_path = NEROSHOP_DEFAULT_CONFIGURATION_PATH;//"/home/" + user + "/.config/neroshop";
std::string configuration_file = "settings.lua";
// "/home/<user>/.config/neroshop/config.lua"
std::string neroshop_config_name = neroshop_config_path + "/" + NEROSHOP_CONFIGURATION_FILE;
std::string neroshop_config_name = configuration_path + "/" + configuration_file;
// if file already exists, no need to create it again
if(std::filesystem::is_regular_file(neroshop_config_name)) return false; // false because it will not be created // if true then it will cause "PANIC: unprotected error in call to Lua API (attempt to index a nil value)" error
// check if script works before saving
@ -103,11 +97,11 @@ neroshop = {
return false; // exit function so it does not save text
}
// if path does not exist
if(!std::filesystem::is_directory(neroshop_config_path))
if(!std::filesystem::is_directory(configuration_path))
{ // create the path
neroshop::print("directory \"" + neroshop_config_path + "\" does not exist, but I will create it for you (^_^)", 2);
if(!std::filesystem::create_directories(neroshop_config_path)) { neroshop::print("create_config error: failed to make the path. Sorry (ᵕ人ᵕ)! ...", 1); return false; }
neroshop::print("\033[1;97;49mcreated path \"" + neroshop_config_path + "\"");
neroshop::print("directory \"" + configuration_path + "\" does not exist, but I will create it for you (^_^)", 2);
if(!std::filesystem::create_directories(configuration_path)) { neroshop::print("create_config error: failed to make the path. Sorry (ᵕ人ᵕ)! ...", 1); return false; }
neroshop::print("\033[1;97;49mcreated path \"" + configuration_path + "\"");
}
// if path exists, but the file is missing or deleted
if(!std::filesystem::is_regular_file(neroshop_config_name)) {

@ -5,7 +5,7 @@
#if defined(NEROSHOP_USE_QT)
#include <QStandardPaths>
#define NEROSHOP_DEFAULT_CONFIGURATION_PATH QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)
#define NEROSHOP_DEFAULT_CONFIGURATION_PATH QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toStdString()
#endif
#if !defined(NEROSHOP_USE_QT)
@ -31,10 +31,6 @@
#endif
#endif // endif !defined(NEROSHOP_USE_QT)
#define NEROSHOP_CONFIGURATION_NAME "settings"
#define NEROSHOP_CONFIGURATION_EXTENSION "lua"
#define NEROSHOP_CONFIGURATION_FILE NEROSHOP_CONFIGURATION_NAME "." NEROSHOP_CONFIGURATION_EXTENSION
#define LUA_TAG "\033[1;34m[lua]:\033[0m "
#include "script.hpp"//<script.hpp>

@ -49,6 +49,9 @@ int main(int argc, char *argv[]) {
#else
QGuiApplication app(argc, argv);
#endif
//app.setOrganizationName("Some Company");
app.setOrganizationDomain("neroshop.org");
app.setApplicationName("neroshop");
QQmlApplicationEngine engine;
//--------------------------

Loading…
Cancel
Save