Skip to content
Snippets Groups Projects
Commit aa897919 authored by dmitriy.gerasimov's avatar dmitriy.gerasimov
Browse files

Merge branch 'support-2288' into 'master'

Support 2288

See merge request !39
parents 84d8bd95 d8a01bf0
No related branches found
No related tags found
1 merge request!39Support 2288
Pipeline #1277 passed with stage
in 22 minutes and 22 seconds
...@@ -12,3 +12,4 @@ CTestTestfile.cmake ...@@ -12,3 +12,4 @@ CTestTestfile.cmake
*.o *.o
*.obj *.obj
moc_* moc_*
.DS_Store
...@@ -34,7 +34,13 @@ DEFINES += DAP_BRAND=\\\"$$BRAND\\\" ...@@ -34,7 +34,13 @@ DEFINES += DAP_BRAND=\\\"$$BRAND\\\"
DEFINES += DAP_SERVICE_NAME=\\\"CellFrameDashboardService\\\" DEFINES += DAP_SERVICE_NAME=\\\"CellFrameDashboardService\\\"
DEFINES += DAP_VERSION=\\\"$$VERSION\\\" DEFINES += DAP_VERSION=\\\"$$VERSION\\\"
DEFINES += DAP_SETTINGS_FILE=\\\"settings.json\\\" DEFINES += DAP_SETTINGS_FILE=\\\"settings.json\\\"
ICON = icon.ico macx {
ICON = Resources/Icons/dashboard.icns
}
else {
ICON = Resources/Icons/icon.ico
}
# You can also make your code fail to compile if you use deprecated APIs. # You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line. # 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. # You can also select to disable deprecated APIs only up to a certain version of Qt.
...@@ -66,6 +72,7 @@ SOURCES += \ ...@@ -66,6 +72,7 @@ SOURCES += \
DapServiceClientNativeAbstract.cpp \ DapServiceClientNativeAbstract.cpp \
DapServiceClientNativeLinux.cpp \ DapServiceClientNativeLinux.cpp \
DapServiceClientNativeWin.cpp \ DapServiceClientNativeWin.cpp \
DapServiceClientNativeMacOS.cpp \
DapChainWalletsModel.cpp DapChainWalletsModel.cpp
RESOURCES += qml.qrc RESOURCES += qml.qrc
......
...@@ -13,6 +13,9 @@ typedef class DapServiceClientNativeLinux DapServiceClientNative; ...@@ -13,6 +13,9 @@ typedef class DapServiceClientNativeLinux DapServiceClientNative;
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
#include "DapServiceClientNativeWin.h" #include "DapServiceClientNativeWin.h"
typedef class DapServiceClientNativeWin DapServiceClientNative; typedef class DapServiceClientNativeWin DapServiceClientNative;
#elif defined(Q_OS_MAC)
#include "DapServiceClientNativeMacOS.h"
typedef class DapServiceClientNativeMacOS DapServiceClientNative;
#endif #endif
typedef QLocalSocket DapUiSocket; typedef QLocalSocket DapUiSocket;
......
#include "DapServiceClientNativeMacOS.h"
#include <QtDebug>
#include <QMessageBox>
DapServiceClientNativeMacOS::DapServiceClientNativeMacOS()
{
QString dapServiceNameToLower = QString(DAP_SERVICE_NAME).toLower();
QString cmd = QString("ps -C %1 > /dev/null").arg(DAP_SERVICE_NAME);
m_checkIsServiceRunningCommand = strdup(cmd.toLatin1().data());
m_cmdTemplate = QString("service " + dapServiceNameToLower) + " %1";
qDebug() << "command for check is service running: " << m_checkIsServiceRunningCommand;
}
DapServiceClientNativeMacOS::~DapServiceClientNativeMacOS()
{
delete m_checkIsServiceRunningCommand;
}
bool DapServiceClientNativeMacOS::isServiceRunning()
{
m_isServiceRunning =true;// (::system(m_checkIsServiceRunningCommand) == 0);
return m_isServiceRunning;
}
DapServiceError DapServiceClientNativeMacOS::serviceRestart()
{
qDebug() << "Restart service name" << m_cmdTemplate.arg("restart").toLatin1().data();
int retCode = ::system(m_cmdTemplate.arg("restart").toLatin1().data());
qDebug() << "Restart result code:" << retCode;
if(retCode != 0) {
return DapServiceError::USER_COMMAND_ABORT;
}
return DapServiceError::NO_ERRORS;
}
/**
* @brief SapNetworkClientNativeMacOS::serviceStart
*/
DapServiceError DapServiceClientNativeMacOS::serviceStart()
{
// yes better use restart
int ret = ::system(m_cmdTemplate.arg("restart").toLatin1().data());
qDebug() << "serviceStart Result: " << ret;
if(ret != 0) {
return DapServiceError::USER_COMMAND_ABORT;
}
return DapServiceError::NO_ERRORS;
}
/**
* @brief SapServiceClientNativeMacOS::serviceStop
*/
DapServiceError DapServiceClientNativeMacOS::serviceStop()
{
int ret = ::system(m_cmdTemplate.arg("stop").toLatin1().data());
qDebug() << "serviceStop result:" << ret;
if(ret != 0) {
return DapServiceError::USER_COMMAND_ABORT;
}
return DapServiceError::NO_ERRORS;
}
/**
* @brief SapServiceClientNativeMacOS::serviceInstallAndRun
*/
DapServiceError DapServiceClientNativeMacOS::serviceInstallAndRun()
{
return serviceStart();
}
#ifndef DAPSERVICECLIENTNATIVEMACOS_H
#define DAPSERVICECLIENTNATIVEMACOS_H
#include "DapServiceClientNativeAbstract.h"
class DapServiceClientNativeMacOS : public DapServiceClientNativeAbstract
{
const char* m_checkIsServiceRunningCommand;
QString m_cmdTemplate;
public:
DapServiceClientNativeMacOS();
~DapServiceClientNativeMacOS() override;
bool isServiceRunning() override;
DapServiceError serviceStart() override;
DapServiceError serviceRestart() override;
DapServiceError serviceStop() override;
DapServiceError serviceInstallAndRun() override;
};
#endif // DAPSERVICECLIENTNATIVEMACOS_H
File added
CellFrameDashboardGUI/Resources/Icons/icon.ico

2.4 KiB | W: | H:

CellFrameDashboardGUI/Resources/Icons/icon.ico

20.4 KiB | W: | H:

CellFrameDashboardGUI/Resources/Icons/icon.ico
CellFrameDashboardGUI/Resources/Icons/icon.ico
CellFrameDashboardGUI/Resources/Icons/icon.ico
CellFrameDashboardGUI/Resources/Icons/icon.ico
  • 2-up
  • Swipe
  • Onion skin
CellFrameDashboardGUI/Resources/Icons/icon.png

2.61 KiB | W: | H:

CellFrameDashboardGUI/Resources/Icons/icon.png

20.4 KiB | W: | H:

CellFrameDashboardGUI/Resources/Icons/icon.png
CellFrameDashboardGUI/Resources/Icons/icon.png
CellFrameDashboardGUI/Resources/Icons/icon.png
CellFrameDashboardGUI/Resources/Icons/icon.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <QRegExp> #include <QRegExp>
#include <sys/stat.h>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
...@@ -46,12 +48,13 @@ int main(int argc, char *argv[]) ...@@ -46,12 +48,13 @@ int main(int argc, char *argv[])
DapLogger dapLogger; DapLogger dapLogger;
/// TODO: The code is commented out at the time of developing the logging strategy in the project /// TODO: The code is commented out at the time of developing the logging strategy in the project
//#ifndef QT_DEBUG //#ifndef QT_DEBUG
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
dapLogger.setLogFile(QString("/opt/cellframe-dashboard/log/%1Gui.log").arg(DAP_BRAND)); dapLogger.setLogFile(QString("/opt/cellframe-dashboard/log/%1Gui.log").arg(DAP_BRAND));
#elif defined Q_OS_WIN #elif defined Q_OS_MACOS
dapLogger.setLogFile(QString("%1Gui.log").arg(DAP_BRAND)); mkdir("/tmp/cellframe-dashboard_log",0777);
dapLogger.setLogLevel(L_DEBUG); dapLogger.setLogFile(QString("/tmp/cellframe-dashboard_log/%1Gui.log").arg(DAP_BRAND));
#endif #elif defined Q_OS_WIN
#endif
//#endif //#endif
/// Local client. /// Local client.
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "DapChainLogHandler.h" #include "DapChainLogHandler.h"
#include "DapSettings.h" #include "DapSettings.h"
#include <sys/stat.h>
void processArgs(); void processArgs();
int main(int argc, char *argv[]) int main(int argc, char *argv[])
...@@ -42,6 +44,9 @@ int main(int argc, char *argv[]) ...@@ -42,6 +44,9 @@ int main(int argc, char *argv[])
#elif defined Q_OS_WIN #elif defined Q_OS_WIN
dapLogger.setLogFile(QString("%1Service.log").arg(DAP_BRAND)); dapLogger.setLogFile(QString("%1Service.log").arg(DAP_BRAND));
dapLogger.setLogLevel(L_INFO); dapLogger.setLogLevel(L_INFO);
#elif defined Q_OS_MAC
mkdir("tmp/cellframe-dashboard_log",0777);
dapLogger.setLogFile(QString("/tmp/cellframe-dashboard_log/%1Service.log").arg(DAP_BRAND));
#endif #endif
//#endif //#endif
// Creating the main application object // Creating the main application object
...@@ -58,7 +63,7 @@ int main(int argc, char *argv[]) ...@@ -58,7 +63,7 @@ int main(int argc, char *argv[])
void processArgs() void processArgs()
{ {
#ifdef Q_OS_LINUX #if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
QCommandLineParser clParser; QCommandLineParser clParser;
clParser.parse(QCoreApplication::arguments()); clParser.parse(QCoreApplication::arguments());
auto options = clParser.unknownOptionNames(); auto options = clParser.unknownOptionNames();
......
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