diff --git a/.gitignore b/.gitignore index 9ea395f15ee8cd2ff5fbb1c8f5aee55efd5636f6..71771c4cb0801ec75cf4b4a73e38480aed20676d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ cmake_install.cmake install_manifest.txt compile_commands.json CTestTestfile.cmake +*.user* diff --git a/DapUiQmlListModelWidgets.qml b/DapUiQmlListModelWidgets.qml new file mode 100644 index 0000000000000000000000000000000000000000..c97243ad31ec076f6d006354bdcb7e0f5e85eca5 --- /dev/null +++ b/DapUiQmlListModelWidgets.qml @@ -0,0 +1,30 @@ +import QtQuick 2.0 + +ListModel { + id: listModelMenu + + ListElement { + name: qsTr("Blockchain explorer") + page: "DapUiQmlWidgetChainBlockExplorer.ui.qml" + } + ListElement { + name: qsTr("Exchanges") + page: "DapUiQmlWidgetChainExchanges.ui.qml" + } + ListElement { + name: qsTr("Services client") + page: "DapUiQmlWidgetChainServicesClient.ui.qml" + } + ListElement { + name: qsTr("Services share control") + page: "DapUiQmlWidgetChainServicesShareControl.ui.qml" + } + ListElement { + name: qsTr("Settings") + page: "DapUiQmlWidgetChainSettings.ui.qml" + } + ListElement { + name: qsTr("Wallet") + page: "DapUiQmlWidgetChainWallet.ui.qml" + } +} diff --git a/DapUiQmlScreenDashboard.cpp b/DapUiQmlScreenDashboard.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ea06dd6231bea21f54cd8fcab6330af89513af25 --- /dev/null +++ b/DapUiQmlScreenDashboard.cpp @@ -0,0 +1,6 @@ +#include "DapUiQmlScreenDashboard.h" + +DapUiQmlScreenDashboard::DapUiQmlScreenDashboard() +{ + +} diff --git a/DapUiQmlScreenDashboard.h b/DapUiQmlScreenDashboard.h new file mode 100644 index 0000000000000000000000000000000000000000..1417dcb673466a1f62c6d5663d79f3bfdec3c939 --- /dev/null +++ b/DapUiQmlScreenDashboard.h @@ -0,0 +1,11 @@ +#ifndef DAPUIQMLSCREENDASHBOARD_H +#define DAPUIQMLSCREENDASHBOARD_H + + +class DapUiQmlScreenDashboard +{ +public: + DapUiQmlScreenDashboard(); +}; + +#endif // DAPUIQMLSCREENDASHBOARD_H \ No newline at end of file diff --git a/DapUiQmlScreenDashboard.qml b/DapUiQmlScreenDashboard.qml new file mode 100644 index 0000000000000000000000000000000000000000..e2461bbb00a7171e3855e9f702dfac200350d0da --- /dev/null +++ b/DapUiQmlScreenDashboard.qml @@ -0,0 +1,82 @@ +import QtQuick 2.9 +import QtQuick.Controls 1.4 +import QtQuick.Controls 2.2 +import QtQuick.Controls.Styles 1.4 + +Page { + id: dapUiQmlScreenDashboard + title: qsTr("General") + ListView { + id: listViewTabs + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + width: dapUiQmlScreenDashboard.width/5 + model: listModelTabs + + ListModel { + id: listModelTabs + + ListElement { + name: qsTr("Login") + page: "DapUiQmlScreenLogin.ui.qml" + } + ListElement { + name: qsTr("Dashboard") + page: "DapUiQmlScreenDialog.qml" + } + } + + + + delegate: + Component { + id: componentTab + Item { + width: listViewTabs.width + height: textTab.height + 10 + Rectangle { + id: canvas + border.color: "whitesmoke" + color: "Transparent" + anchors.fill: parent + Row { + anchors.margins: 5 + anchors.fill: parent + + Text + { + id: textTab + text: qsTr(name) + } + } + } + + MouseArea { + anchors.fill: parent + onClicked: + { + listViewTabs.currentIndex = index + stackViewScreenDashboard.setSource(Qt.resolvedUrl(page)) + } + } + } + } + + highlight: Rectangle { color: "aliceblue"; radius: 1 } + focus: true + } + Rectangle { + anchors.left: listViewTabs.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + border.color: "whitesmoke" + Loader { + id: stackViewScreenDashboard + anchors.fill: parent + anchors.margins: 1 + source: "DapUiQmlScreenLogin.ui.qml" + } + } +} diff --git a/DapUiQmlScreenDialog.cpp b/DapUiQmlScreenDialog.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c237cc216b8a746ed3427d163120b5aac94d4bdf --- /dev/null +++ b/DapUiQmlScreenDialog.cpp @@ -0,0 +1,6 @@ +#include "DapUiQmlScreenDialog.h" + +DapUiQmlScreenDialog::DapUiQmlScreenDialog() +{ + +} diff --git a/DapUiQmlScreenDialog.h b/DapUiQmlScreenDialog.h new file mode 100644 index 0000000000000000000000000000000000000000..c3a5028c8c1f0b82f82674fbbdfdcf1f77a0a0c3 --- /dev/null +++ b/DapUiQmlScreenDialog.h @@ -0,0 +1,11 @@ +#ifndef DAPUIQMLSCREENDIALOG_H +#define DAPUIQMLSCREENDIALOG_H + + +class DapUiQmlScreenDialog +{ +public: + DapUiQmlScreenDialog(); +}; + +#endif // DAPUIQMLSCREENDIALOG_H diff --git a/DapUiQmlScreenDialog.qml b/DapUiQmlScreenDialog.qml new file mode 100644 index 0000000000000000000000000000000000000000..a6d222603c18deecc4e0a3b567d185798c59ddb9 --- /dev/null +++ b/DapUiQmlScreenDialog.qml @@ -0,0 +1,63 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.4 + +Page { + id: dapUiQmlScreenDialog + title: qsTr("Dashboard") + anchors.fill: parent + + Rectangle { + color: "white" + anchors.fill: parent + + GridView { + id: gridViewDashboard + anchors.fill: parent + cellWidth: width/3; cellHeight: height/2 + focus: true + model: DapUiQmlListModelWidgets {} + + highlight: Rectangle { width: gridViewDashboard.cellWidth; height: gridViewDashboard.cellHeight; radius: width/50; color: "aliceblue" } + + delegate: Item { + width: gridViewDashboard.cellWidth + height: gridViewDashboard.cellHeight + Rectangle { + anchors.fill: parent + border.color: "grey" + color: "transparent" + radius: width/50 + anchors.margins: 5 + clip: true + + Column { + width: parent.width + anchors.centerIn: parent + spacing: width / 10 + anchors.margins: width / 10 + Image { + id: iconWidget + source: "qrc:/Resources/Icons/add.png" + width: parent.width * 2/3 + height: width + anchors.horizontalCenter: parent.horizontalCenter + } + Text { + text: name + color: "darkgrey" + anchors.horizontalCenter: parent.horizontalCenter + } + } + } + MouseArea { + anchors.fill: parent + onClicked: + { + parent.GridView.view.currentIndex = index; + stackView.push(Qt.resolvedUrl(page), StackView.Immediate); + } + } + } + } + } +} diff --git a/DapUiQmlScreenLogin.ui.qml b/DapUiQmlScreenLogin.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..2d51f82771685791be2359c3f879bf2381314aad --- /dev/null +++ b/DapUiQmlScreenLogin.ui.qml @@ -0,0 +1,27 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + id: dapUiQmlScreenLogin + + title: qsTr("Login") + + + Column { + anchors.centerIn: parent + spacing: 10 + + TextField { + id: textFieldPassword + placeholderText: "Password" + echoMode: TextInput.Password + } + + Button { + text: "Log in" + width: textFieldPassword.width + anchors.horizontalCenter: parent.horizontalCenter + } + } + +} diff --git a/DapUiQmlScreenMainWindow.ui.qml b/DapUiQmlScreenMainWindow.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..edc520024fe0c426c223257aabc8d72763a3dc28 --- /dev/null +++ b/DapUiQmlScreenMainWindow.ui.qml @@ -0,0 +1,8 @@ +import QtQuick 2.9 +import QtQuick.Controls 1.4 +import QtQuick.Controls 2.4 + +Page { + + title: qsTr("General") +} diff --git a/DapUiQmlWidgeChainOperations.cpp b/DapUiQmlWidgeChainOperations.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4703312d80e18f19902bea450ef54d881871785a --- /dev/null +++ b/DapUiQmlWidgeChainOperations.cpp @@ -0,0 +1,6 @@ +#include "DapUiQmlWidgeChainOperations.h" + +DapUiQmlWidgeChainOperations::DapUiQmlWidgeChainOperations() +{ + +} diff --git a/DapUiQmlWidgeChainOperations.h b/DapUiQmlWidgeChainOperations.h new file mode 100644 index 0000000000000000000000000000000000000000..458778325c376405de920d752b0470aa3148de9d --- /dev/null +++ b/DapUiQmlWidgeChainOperations.h @@ -0,0 +1,12 @@ +#ifndef DAPUIQMLWIDGECHAINOPERATIONS_H +#define DAPUIQMLWIDGECHAINOPERATIONS_H + +#include "DapUiQmlWidget.h" + +class DapUiQmlWidgeChainOperations : public DapUiQmlWidget +{ +public: + DapUiQmlWidgeChainOperations(); +}; + +#endif // DAPUIQMLWIDGECHAINOPERATIONS_H diff --git a/DapUiQmlWidget.cpp b/DapUiQmlWidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..59598aa4c5a19e72e3b861108185800ed5c57aa5 --- /dev/null +++ b/DapUiQmlWidget.cpp @@ -0,0 +1,6 @@ +#include "DapUiQmlWidget.h" + +DapUiQmlWidget::DapUiQmlWidget() +{ + +} diff --git a/DapUiQmlWidget.h b/DapUiQmlWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..06ebafdc6182a1d48bfc9c9b6202a5e281ed6de8 --- /dev/null +++ b/DapUiQmlWidget.h @@ -0,0 +1,11 @@ +#ifndef DAPUIQMLWIDGET_H +#define DAPUIQMLWIDGET_H + + +class DapUiQmlWidget +{ +public: + DapUiQmlWidget(); +}; + +#endif // DAPUIQMLWIDGET_H \ No newline at end of file diff --git a/DapUiQmlWidgetChainBallance.cpp b/DapUiQmlWidgetChainBallance.cpp new file mode 100644 index 0000000000000000000000000000000000000000..68da31745da72d965fa4cd3bce1b461968246a83 --- /dev/null +++ b/DapUiQmlWidgetChainBallance.cpp @@ -0,0 +1,6 @@ +#include "DapUiQmlWidgetChainBallance.h" + +DapUiQmlWidgetChainBallance::DapUiQmlWidgetChainBallance() +{ + +} diff --git a/DapUiQmlWidgetChainBallance.h b/DapUiQmlWidgetChainBallance.h new file mode 100644 index 0000000000000000000000000000000000000000..be7239552f011864e4c2ef5ecb6b74e9cc257da9 --- /dev/null +++ b/DapUiQmlWidgetChainBallance.h @@ -0,0 +1,12 @@ +#ifndef DAPUIQMLWIDGETCHAINBALLANCE_H +#define DAPUIQMLWIDGETCHAINBALLANCE_H + +#include "DapUiQmlWidget.h" + +class DapUiQmlWidgetChainBallance : public DapUiQmlWidget +{ +public: + DapUiQmlWidgetChainBallance(); +}; + +#endif // DAPUIQMLWIDGETCHAINBALLANCE_H diff --git a/DapUiQmlWidgetChainBlockExplorer.cpp b/DapUiQmlWidgetChainBlockExplorer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..28ce99bd360f5a368f4cbef43a65fa945b9b4c56 --- /dev/null +++ b/DapUiQmlWidgetChainBlockExplorer.cpp @@ -0,0 +1,6 @@ +#include "DapUiQmlWidgetChainBlockExplorer.h" + +DapUiQmlWidgetChainBlockExplorer::DapUiQmlWidgetChainBlockExplorer() +{ + +} diff --git a/DapUiQmlWidgetChainBlockExplorer.h b/DapUiQmlWidgetChainBlockExplorer.h new file mode 100644 index 0000000000000000000000000000000000000000..dfcb58894dc748f019d925f59d88b7e4b9a55286 --- /dev/null +++ b/DapUiQmlWidgetChainBlockExplorer.h @@ -0,0 +1,12 @@ +#ifndef DAPUIQMLWIDGETCHAINBLOCKEXPLORER_H +#define DAPUIQMLWIDGETCHAINBLOCKEXPLORER_H + +#include "DapUiQmlWidget.h" + +class DapUiQmlWidgetChainBlockExplorer : public DapUiQmlWidget +{ +public: + DapUiQmlWidgetChainBlockExplorer(); +}; + +#endif // DAPUIQMLWIDGETCHAINBLOCKEXPLORER_H diff --git a/DapUiQmlWidgetChainBlockExplorer.ui.qml b/DapUiQmlWidgetChainBlockExplorer.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..33225cc2eacc68742842b14aee75c6030ccf256b --- /dev/null +++ b/DapUiQmlWidgetChainBlockExplorer.ui.qml @@ -0,0 +1,15 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + id: dapUiQmlWidgetChainBlockExplorer + + title: qsTr("Blockchain explorer") + + Text { + id: name + anchors.centerIn: parent + text: qsTr("Blockchain explorer") + } + +} diff --git a/DapUiQmlWidgetChainExchanges.ui.qml b/DapUiQmlWidgetChainExchanges.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..fef680a80689e2c520e8aea2af322b9a714b1b71 --- /dev/null +++ b/DapUiQmlWidgetChainExchanges.ui.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + id: dapUiQmlWidgetChainExchanges + + title: qsTr("Exchanges") + + Text { + id: name + anchors.centerIn: parent + text: qsTr("Exchanges") + } +} diff --git a/DapUiQmlWidgetChainNodeLogs.cpp b/DapUiQmlWidgetChainNodeLogs.cpp new file mode 100644 index 0000000000000000000000000000000000000000..36ef984482f16eb614708b017e7c83d38d68a850 --- /dev/null +++ b/DapUiQmlWidgetChainNodeLogs.cpp @@ -0,0 +1,6 @@ +#include "DapUiQmlWidgetChainNodeLogs.h" + +DapUiQmlWidgetChainNodeLogs::DapUiQmlWidgetChainNodeLogs() +{ + +} diff --git a/DapUiQmlWidgetChainNodeLogs.h b/DapUiQmlWidgetChainNodeLogs.h new file mode 100644 index 0000000000000000000000000000000000000000..07123ebffdfde9cbfbad6995112402936ce5e188 --- /dev/null +++ b/DapUiQmlWidgetChainNodeLogs.h @@ -0,0 +1,12 @@ +#ifndef DAPUIQMLWIDGETCHAINNODELOGS_H +#define DAPUIQMLWIDGETCHAINNODELOGS_H + +#include "DapUiQmlWidget.h" + +class DapUiQmlWidgetChainNodeLogs : public DapUiQmlWidget +{ +public: + DapUiQmlWidgetChainNodeLogs(); +}; + +#endif // DAPUIQMLWIDGETCHAINNODELOGS_H diff --git a/DapUiQmlWidgetChainServicesClient.ui.qml b/DapUiQmlWidgetChainServicesClient.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..61065a0d44f5023cb061d719c59cf036cef79d23 --- /dev/null +++ b/DapUiQmlWidgetChainServicesClient.ui.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + id: dapUiQmlWidgetChainServicesClient + + title: qsTr("Services client") + + Text { + id: name + anchors.centerIn: parent + text: qsTr("Services client") + } +} diff --git a/DapUiQmlWidgetChainServicesShareControl.ui.qml b/DapUiQmlWidgetChainServicesShareControl.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..194f89e2ec45552e72ab39c7f89846a1c2e0e06b --- /dev/null +++ b/DapUiQmlWidgetChainServicesShareControl.ui.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + id: dapUiQmlWidgetChainServicesShareControl + + title: qsTr("Services share control") + + Text { + id: name + anchors.centerIn: parent + text: qsTr("Services share control") + } +} diff --git a/DapUiQmlWidgetChainSettings.ui.qml b/DapUiQmlWidgetChainSettings.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..54d6ac5b4a03c2ebe6d3a3e8fdba3347e4800bf7 --- /dev/null +++ b/DapUiQmlWidgetChainSettings.ui.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + id: dapUiQmlWidgetChainSettings + + title: qsTr("Settings") + + Text { + id: name + anchors.centerIn: parent + text: qsTr("Settings") + } +} diff --git a/DapUiQmlWidgetChainTransctions.cpp b/DapUiQmlWidgetChainTransctions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..654f78de1a143a15b28efcca5628566d6ede75b4 --- /dev/null +++ b/DapUiQmlWidgetChainTransctions.cpp @@ -0,0 +1,6 @@ +#include "DapUiQmlWidgetChainTransctions.h" + +DapUiQmlWidgetChainTransctions::DapUiQmlWidgetChainTransctions() +{ + +} diff --git a/DapUiQmlWidgetChainTransctions.h b/DapUiQmlWidgetChainTransctions.h new file mode 100644 index 0000000000000000000000000000000000000000..2595d04e62de3aba2535b29b6dfa330adb3fc637 --- /dev/null +++ b/DapUiQmlWidgetChainTransctions.h @@ -0,0 +1,12 @@ +#ifndef DAPUIQMLWIDGETCHAINTRANSCTIONS_H +#define DAPUIQMLWIDGETCHAINTRANSCTIONS_H + +#include "DapUiQmlWidget.h" + +class DapUiQmlWidgetChainTransctions : public DapUiQmlWidget +{ +public: + DapUiQmlWidgetChainTransctions(); +}; + +#endif // DAPUIQMLWIDGETCHAINTRANSCTIONS_H diff --git a/DapUiQmlWidgetChainWallet.ui.qml b/DapUiQmlWidgetChainWallet.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..465499b497235b5b058c80b1d46e28a589f29662 --- /dev/null +++ b/DapUiQmlWidgetChainWallet.ui.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 + +Page { + id: dapUiQmlWidgetChainWallet + + title: qsTr("Wallet") + + Text { + id: name + anchors.centerIn: parent + text: qsTr("Wallet") + } +} diff --git a/Resources/Icons/add.png b/Resources/Icons/add.png new file mode 100644 index 0000000000000000000000000000000000000000..f3c75ff7cc06fe9833492a80f6bd7ddcfefe3072 Binary files /dev/null and b/Resources/Icons/add.png differ diff --git a/Resources/Icons/icon.ico b/Resources/Icons/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..41230db92cb8101b8f24cf6f861082c6dfb827e1 Binary files /dev/null and b/Resources/Icons/icon.ico differ diff --git a/Resources/Icons/icon.png b/Resources/Icons/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..52525ef9e99b9d42242dcddc0f5f5a25eaeee901 Binary files /dev/null and b/Resources/Icons/icon.png differ diff --git a/kelvin.conf b/kelvin.conf new file mode 100644 index 0000000000000000000000000000000000000000..75b2cb8fffb69c8cb04c1192f9425a11789972d0 --- /dev/null +++ b/kelvin.conf @@ -0,0 +1,6 @@ +; This file can be edited to change the style of the application +; Read "Qt Quick Controls 2 Configuration File" for details: +; http://doc.qt.io/qt-5/qtquickcontrols2-configuration.html + +[Controls] +Style=Default diff --git a/kelvin.pro b/kelvin.pro new file mode 100644 index 0000000000000000000000000000000000000000..5356854e25566c28a8f263bbb5572ef3da1bb008 --- /dev/null +++ b/kelvin.pro @@ -0,0 +1,48 @@ +QT += quick quick widgets quickwidgets +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS +ICON = icon.ico +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp \ + DapUiQmlWidget.cpp \ + DapUiQmlWidgetChainBallance.cpp \ + DapUiQmlScreenDialog.cpp \ + DapUiQmlWidgeChainOperations.cpp \ + DapUiQmlWidgetChainBlockExplorer.cpp \ + DapUiQmlWidgetChainNodeLogs.cpp \ + DapUiQmlWidgetChainTransctions.cpp + +RESOURCES += qml.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +HEADERS += \ + DapUiQmlWidget.h \ + DapUiQmlWidgetChainBallance.h \ + DapUiQmlScreenDialog.h \ + DapUiQmlWidgeChainOperations.h \ + DapUiQmlWidgetChainBlockExplorer.h \ + DapUiQmlWidgetChainNodeLogs.h \ + DapUiQmlWidgetChainTransctions.h \ + DapUiQmlScreenDashboard.h + +DISTFILES += diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2a321fb37d896b8aa24c9e25cdd0180a101242c0 --- /dev/null +++ b/main.cpp @@ -0,0 +1,78 @@ +#include <QApplication> +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QQmlContext> +#include <QIcon> +#include <QSystemSemaphore> +#include <QSharedMemory> + +/// Check for the existence of a running instance of the program. +/// @param systemSemaphore Semaphore for blocking shared resource. +/// @param memmoryApp Shared memory. +/// @param memmoryAppBagFix Shared memory for Linux system features. +/// @return If the application is running, it returns three, otherwise false. +bool checkExistenceRunningInstanceApp(QSystemSemaphore& systemSemaphore, QSharedMemory &memmoryApp, QSharedMemory &memmoryAppBagFix); + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + // Creating a semaphore for locking external resources, as well as initializing an external resource-memory + QSystemSemaphore systemSemaphore(QString("systemSemaphore for %1").arg("Kelvin"), 1); +#ifndef Q_OS_WIN + QSharedMemory memmoryAppBagFix(QString("memmory for %1").arg("Kelvin")); +#endif + QSharedMemory memmoryApp(QString("memmory for %1").arg("Kelvin")); + // Check for the existence of a running instance of the program + bool isRunning = checkExistenceRunningInstanceApp(systemSemaphore, memmoryApp, memmoryAppBagFix); + + if(isRunning) + { + return 1; + } + + QApplication app(argc, argv); + app.setOrganizationName("DEMLABS"); + app.setOrganizationDomain("demlabs.com"); + app.setApplicationName("Kelvin"); + app.setWindowIcon(QIcon(":/Resources/Icons/icon.ico")); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} + +/// Check for the existence of a running instance of the program. +/// @param systemSemaphore Semaphore for blocking shared resource. +/// @param memmoryApp Shared memory. +/// @param memmoryAppBagFix Shared memory for Linux system features. +/// @return If the application is running, it returns three, otherwise false. +bool checkExistenceRunningInstanceApp(QSystemSemaphore& systemSemaphore, QSharedMemory &memmoryApp, QSharedMemory &memmoryAppBagFix) +{ + systemSemaphore.acquire(); + + if(memmoryAppBagFix.attach()) + { + memmoryAppBagFix.detach(); + } + + bool isRunning {false}; + + if (memmoryApp.attach()) + { + isRunning = true; + } + else + { + memmoryApp.create(1); + isRunning = false; + } + + systemSemaphore.release(); + + return isRunning; +} diff --git a/main.qml b/main.qml new file mode 100644 index 0000000000000000000000000000000000000000..759dae8c9c2fb69338337d2cd495c1144eab97f4 --- /dev/null +++ b/main.qml @@ -0,0 +1,121 @@ +import QtQuick 2.9 +import QtQuick.Controls 1.4 +import QtQuick.Controls 2.4 +import QtQuick.Window 2.0 +import QtQuick.Controls.Styles 1.4 +import Qt.labs.platform 1.0 + +ApplicationWindow { + id: window + visible: true + width: 640 + height: 480 + + SystemTrayIcon { + visible: true + iconName: "Kelvin" + iconSource: "qrc:/Resources/Icons/icon.ico" + tooltip: "Kelvin Dashboard" + + menu: Menu { + MenuItem { + text: qsTr("Quit") + onTriggered: Qt.quit() + } + } + + onActivated: { + if(reason === 1){ + menu.open() + } else { + if(window.visibility === Window.Hidden) { + window.show() + window.raise() + window.requestActivate() + } else { + window.hide() + } + } + } + } + + + header: ToolBar { + contentHeight: buttomMenu.implicitHeight + + ToolButton { + id: buttomMenu + text: stackView.depth > 1 ? "\u25C0" : "\u2630" + font.pixelSize: Qt.application.font.pixelSize * 1.6 + onClicked: { + if (stackView.depth > 1) { + stackView.pop() + } else { + drawerMenu.open() + } + } + } + + Label { + id: labelTitleWidget + text: stackView.currentItem.title + anchors.centerIn: parent + } + } + + Drawer { + id: drawerMenu + width: window.width * 0.25 + height: window.height + + ListView { + id: listViewMenu + anchors.fill: parent + model: listModelMenu + + DapUiQmlListModelWidgets { + id: listModelMenu + } + + delegate: + Component { + id: listViewItemMenu + Item { + id: itemMenu + + width: listViewMenu.width + height: textItemMenu.height + 10 + + Row { + anchors.margins: 5 + anchors.fill: parent + + Text + { + id: textItemMenu + text: qsTr(name) + } + } + + MouseArea { + anchors.fill: parent + onClicked: + { + listViewMenu.currentIndex = index + stackView.push(Qt.resolvedUrl(page), StackView.Immediate) + drawerMenu.close() + } + } + } + } + highlight: Rectangle { color: "aliceblue"; radius: 5 } + focus: true + } + } + + StackView { + id: stackView + initialItem: "DapUiQmlScreenDashboard.qml" + anchors.fill: parent + } +} diff --git a/qml.qrc b/qml.qrc new file mode 100644 index 0000000000000000000000000000000000000000..6c73571170e7d9677169a597e42f0e69a6373947 --- /dev/null +++ b/qml.qrc @@ -0,0 +1,20 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>DapUiQmlScreenDashboard.qml</file> + <file>DapUiQmlScreenMainWindow.ui.qml</file> + <file>kelvin.conf</file> + <file>DapUiQmlScreenLogin.ui.qml</file> + <file>DapUiQmlWidgetChainBlockExplorer.ui.qml</file> + <file>DapUiQmlWidgetChainExchanges.ui.qml</file> + <file>DapUiQmlWidgetChainServicesClient.ui.qml</file> + <file>DapUiQmlWidgetChainServicesShareControl.ui.qml</file> + <file>DapUiQmlWidgetChainSettings.ui.qml</file> + <file>DapUiQmlWidgetChainWallet.ui.qml</file> + <file>DapUiQmlScreenDialog.qml</file> + <file>Resources/Icons/icon.png</file> + <file>Resources/Icons/icon.ico</file> + <file>DapUiQmlListModelWidgets.qml</file> + <file>Resources/Icons/add.png</file> + </qresource> +</RCC>