Skip to content
Snippets Groups Projects
Commit fee437d5 authored by konstantin.papizh's avatar konstantin.papizh
Browse files

Build Dashboard under Windows OS

parent 00e420c4
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,9 @@
#if defined(Q_OS_LINUX)
#include "DapServiceClientNativeLinux.h"
typedef class DapServiceClientNativeLinux DapServiceClientNative;
#elif defined(Q_OS_WIN)
#include "DapServiceClientNativeWin.h"
typedef class DapServiceClientNativeWin DapServiceClientNative;
#endif
typedef QLocalSocket DapUiSocket;
......
#include "DapServiceClientNativeWin.h"
DapServiceClientNativeWin::DapServiceClientNativeWin()
{
}
bool DapServiceClientNativeWin::isServiceRunning()
{
return true;
}
DapServiceError DapServiceClientNativeWin::serviceInstallAndRun() {
return DapServiceError::NO_ERRORS;
}
DapServiceError DapServiceClientNativeWin::serviceStart() {
return DapServiceError::NO_ERRORS;
}
DapServiceError DapServiceClientNativeWin::serviceRestart() {
return DapServiceError::NO_ERRORS;
}
DapServiceError DapServiceClientNativeWin::serviceStop() {
return DapServiceError::NO_ERRORS;
}
DapServiceClientNativeWin::~DapServiceClientNativeWin() {
}
#ifndef DAPSERVICECLIENTNATIVEWIN_H
#define DAPSERVICECLIENTNATIVEWIN_H
#include "DapServiceClientNativeAbstract.h"
class DapServiceClientNativeWin : public DapServiceClientNativeAbstract
{
public:
DapServiceClientNativeWin();
~DapServiceClientNativeWin() override;
bool isServiceRunning() override;
DapServiceError serviceStart() override;
DapServiceError serviceRestart() override;
DapServiceError serviceStop() override;
DapServiceError serviceInstallAndRun() override;
};
#endif // DAPSERVICECLIENTNATIVEWIN_H
......@@ -18,9 +18,11 @@ VER_PAT = 0
win32 {
VERSION = $${VER_MAJ}.$${VER_MIN}.$$VER_PAT
DEFINES += CLI_PATH=\\\"./kelvin-node-cli.exe\\\"
}
else {
VERSION = $$VER_MAJ\.$$VER_MIN\-$$VER_PAT
DEFINES += CLI_PATH=\\\"/opt/kelvin-node/bin/kelvin-node-cli\\\"
}
# The following define makes your compiler emit warnings if you use
......@@ -53,6 +55,7 @@ SOURCES += \
DapCommandController.cpp \
DapServiceClientNativeAbstract.cpp \
DapServiceClientNativeLinux.cpp \
DapServiceClientNativeWin.cpp \
DapChainWalletsModel.cpp
RESOURCES += qml.qrc
......@@ -84,6 +87,7 @@ HEADERS += \
DapCommandController.h \
DapServiceClientNativeAbstract.h \
DapServiceClientNativeLinux.h \
DapServiceClientNativeWin.h \
DapChainWalletsModel.h
include (../libdap/libdap.pri)
......
......@@ -26,7 +26,7 @@ QStringList DapChainLogHandler::request(int aiTimeStamp, int aiRowCount)
{
QByteArray result;
QProcess process;
process.start(QString("%1 print_log ts_after %2 limit %3").arg("/opt/kelvin-node/bin/kelvin-node-cli").arg(aiTimeStamp).arg(aiRowCount));
process.start(QString("%1 print_log ts_after %2 limit %3").arg(CLI_PATH).arg(aiTimeStamp).arg(aiRowCount));
process.waitForFinished(-1);
result = process.readAll();
......
......@@ -17,7 +17,7 @@ QStringList DapChainWalletHandler::createWallet(const QString &asNameWallet)
{
QByteArray result;
QProcess process;
process.start(QString("%1 wallet new -w %2").arg("/opt/kelvin-node/bin/kelvin-node-cli").arg(asNameWallet));
process.start(QString("%1 wallet new -w %2").arg(CLI_PATH).arg(asNameWallet));
process.waitForFinished(-1);
result = process.readAll();
QStringList list;
......@@ -40,7 +40,7 @@ QMap<QString, QVariant> DapChainWalletHandler::getWallets()
{
QMap<QString, QVariant> map;
QProcess process;
process.start(QString("%1 wallet list").arg("/opt/kelvin-node/bin/kelvin-node-cli"));
process.start(QString("%1 wallet list").arg(CLI_PATH));
process.waitForFinished(-1);
QString str = QString::fromLatin1(process.readAll());
qDebug() << "ZDES`" << str;
......@@ -70,9 +70,40 @@ QMap<QString, QVariant> DapChainWalletHandler::getWallets()
QStringList DapChainWalletHandler::getWalletInfo(const QString &asNameWallet)
{
QProcess process;
process.start(QString("%1 wallet info -w %2 -net private").arg("/opt/kelvin-node/bin/kelvin-node-cli").arg(asNameWallet));
process.start(QString("%1 wallet info -w %2 -net kelvin-testnet").arg(CLI_PATH).arg(asNameWallet));
process.waitForFinished(-1);
char* response = process.readAll().data();
//qDebug() << response;
QStringList list;
#ifdef Q_OS_WIN32
char *context = nullptr;
char *data = nullptr;
data = strtok_r(response, ":", &context);
if (strcmp(data, "wallet") != 0) {
data = strtok_r(response, ":", &context);
}
data = strtok_r(context+1, "\r", &context);
list.append(QString(data));
data = strtok_r(context+1, ":", &context);
data = strtok_r(context+1, "\r", &context);
list.append(QString(data));
data = strtok_r(context+1, ":", &context);
list.append(QString(data));
data = strtok_r(context+4, "\r", &context);
char *subctx;
char *subdata;
if (strlen(data) > 2) {
subdata = strtok_r(data+1, " ", &subctx);
} else {
subdata = strtok_r(data, " ", &subctx);
}
list.append(QString(subdata));
subdata = strtok_r(subctx, " ", &subctx);
list.append(QString(subdata));
subdata = strtok_r(subctx, "\r", &subctx);
list.append(QString(subdata));
#else
QString str = QString::fromLatin1(process.readAll()).replace("\\", "\\\\");
QRegExp rx("[(:\\)\\t]{1,1}([^\\\\\\n\\t]+)[\\\\(|\\n|\\r]{1,1}");
......@@ -84,6 +115,7 @@ QStringList DapChainWalletHandler::getWalletInfo(const QString &asNameWallet)
list.append(rx.cap(1));
pos += rx.matchedLength();
}
#endif
qDebug() << list;
return list;
}
......@@ -93,8 +125,8 @@ QString DapChainWalletHandler::sendToken(const QString &asSendWallet, const QStr
QString answer;
qInfo() << QString("sendTokenTest(%1, %2, %3, %4)").arg(asSendWallet).arg(asAddressReceiver).arg(asToken).arg(aAmount);
QProcess processCreate;
processCreate.start(QString("%1 tx_create -net private -chain gdb -from_wallet %2 -to_addr %3 -token %4 -value %5")
.arg("/opt/kelvin-node/bin/kelvin-node-cli")
processCreate.start(QString("%1 tx_create -net kelvin-testnet -chain gdb -from_wallet %2 -to_addr %3 -token %4 -value %5")
.arg(CLI_PATH)
.arg(asSendWallet)
.arg(asAddressReceiver)
.arg(asToken)
......@@ -105,7 +137,7 @@ QString DapChainWalletHandler::sendToken(const QString &asSendWallet, const QStr
if(!(resultCreate.isEmpty() || resultCreate.isNull()))
{
QProcess processMempool;
processMempool.start(QString("%1 mempool_proc -net private -chain gdb").arg("/opt/kelvin-node/bin/kelvin-node-cli"));
processMempool.start(QString("%1 mempool_proc -net kelvin-testnet -chain gdb").arg(CLI_PATH));
processMempool.waitForFinished(-1);
answer = QString::fromLatin1(processMempool.readAll());
qDebug() << answer;
......
......@@ -20,9 +20,11 @@ ICON = icon.ico
win32 {
VERSION = $${VER_MAJ}.$${VER_MIN}.$$VER_PAT
DEFINES += CLI_PATH=\\\"./kelvin-node-cli.exe\\\"
}
else {
VERSION = $$VER_MAJ\.$$VER_MIN\-$$VER_PAT
DEFINES += CLI_PATH=\\\"/opt/kelvin-node/bin/kelvin-node-cli\\\"
}
# The following define makes your compiler emit warnings if you use
......
......@@ -16,9 +16,9 @@ int main(int argc, char *argv[])
{
// Creating a semaphore for locking external resources, as well as initializing an external resource-memory
QSystemSemaphore systemSemaphore(QString("systemSemaphore for %1").arg("KelvinDashboardService"), 1);
#ifndef Q_OS_WIN
QSharedMemory memmoryAppBagFix(QString("memmory for %1").arg("KelvinDashboardService"));
#endif
QSharedMemory memmoryApp(QString("memmory for %1").arg("KelvinDashboardService"));
// Check for the existence of a running instance of the program
bool isRunning = DapHalper::getInstance().checkExistenceRunningInstanceApp(systemSemaphore, memmoryApp, memmoryAppBagFix);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment