diff --git a/chain/wallet/DapConfigManager/DapConfigToolController.cpp b/chain/wallet/DapConfigManager/DapConfigToolController.cpp index 625dcbb7c133066a885f3bbddf247385d5bdae23..1606a66542b29617d61e73af8b1409271f9cde84 100644 --- a/chain/wallet/DapConfigManager/DapConfigToolController.cpp +++ b/chain/wallet/DapConfigManager/DapConfigToolController.cpp @@ -10,7 +10,7 @@ DapConfigToolController::DapConfigToolController(QObject *parent) else { m_initTimer->start(1000); - connect(m_initTimer, &QTimer::timeout, [=] { + connect(m_initTimer, &QTimer::timeout, this, [this] { qDebug()<<"Reinit timer tick"; if(initConfTool()) m_initTimer->stop(); @@ -170,14 +170,14 @@ QString DapConfigToolController::getConfigParam(const QString &configName, const QStringList DapConfigToolController::parseArrayConfigParam(QString str) { - auto isValidInput = [&](const QString& input) -> bool + auto isValidInput = [](const QString& input) -> bool { QRegularExpression regex(R"(^\[\s*([^,\[\]]+\s*(,\s*[^,\[\]]+\s*)*)?\]$)"); return regex.match(input).hasMatch(); }; if (!isValidInput(str)) { - qDebug() << "Error: Unknown input text format ."; + qDebug() << "Error: Unknown input text format. " << str; return QStringList()<<str; } diff --git a/chain/wallet/DapConfigManager/DapNodePathManager.cpp b/chain/wallet/DapConfigManager/DapNodePathManager.cpp index 8b81cfb87353fe5bd76d602bd45fbe627c16ad2e..ba0cd739b03540cdbbe29e98db0e572fc2057547 100644 --- a/chain/wallet/DapConfigManager/DapNodePathManager.cpp +++ b/chain/wallet/DapConfigManager/DapNodePathManager.cpp @@ -8,12 +8,12 @@ DapNodePathManager::DapNodePathManager( QObject *parent) { m_target = QString(PROG_TYPE); - connect(m_instMngr, &DapNodeInstallManager::singnalReadyUpdateToNode, [this] (bool isReady) + connect(m_instMngr, &DapNodeInstallManager::singnalReadyUpdateToNode, this, [this] (bool isReady) { emit checkedUrlSignal(isReady); }); - connect(m_cfgToolCtrl, &DapConfigToolController::changeStatusConftoolInit, [this] (bool isReady) + connect(m_cfgToolCtrl, &DapConfigToolController::changeStatusConftoolInit, this, [this] (bool isReady) { if(isReady) init(); diff --git a/chain/wallet/DapConfigManager/DapNodePathManager.h b/chain/wallet/DapConfigManager/DapNodePathManager.h index f9cb121f5690b55a64486611d8ee1a666ac6cdb5..02e6e6871690d534ac1d95dd8b2771638be0e7b3 100644 --- a/chain/wallet/DapConfigManager/DapNodePathManager.h +++ b/chain/wallet/DapConfigManager/DapNodePathManager.h @@ -25,9 +25,6 @@ class DapNodePathManager: public QObject explicit DapNodePathManager(QObject *parent = nullptr); - QString m_keyName = "NodePathInit"; - QString m_target{""}; - public: static DapNodePathManager &getInstance(); @@ -60,23 +57,18 @@ public: }nodePaths; - - DapNodeInstallManager *m_instMngr; - DapConfigToolController *m_cfgToolCtrl; - QString getNodeUrl(const QString& ver = ""); void tryCheckUrl(const QString& url); -private: - QSharedMemory m_sharedMemory; - bool m_initMemFlag{false}; +public slots: + void slotCheckUpdateNode(QString currentNodeVersion); + // void slotBreakInstallNode(); +signals: + Q_INVOKABLE void signalIsNeedInstallNode(bool isNeed, QString url); - enum NodeInstallTypes{ - Unknown = -1, - NoInstall = 0, - OldInstall, - NewInstall - }; + void installNodeChanged(); + + void checkedUrlSignal(bool check); private: @@ -85,17 +77,23 @@ private: bool writeMem(); void fillNodePath(); +private: + DapNodeInstallManager *m_instMngr; + DapConfigToolController *m_cfgToolCtrl; + QString m_keyName = "NodePathInit"; + QString m_target{""}; + QSharedMemory m_sharedMemory; + bool m_initMemFlag{false}; + enum NodeInstallTypes{ + Unknown = -1, + NoInstall = 0, + OldInstall, + NewInstall + }; -signals: - Q_INVOKABLE void signalIsNeedInstallNode(bool isNeed, QString url); - void installNodeChanged(); - void checkedUrlSignal(bool check); -public slots: - void slotCheckUpdateNode(QString currentNodeVersion); -// void slotBreakInstallNode(); }; #endif // DAPNODEPATHMANAGER_H diff --git a/chain/wallet/handlers/DapAbstractCommand.cpp b/chain/wallet/handlers/DapAbstractCommand.cpp index b293ac3f99962a0961c883dc51fe152f3b399a97..6fdba8a1847810cf4f72d76c0c57ef7c34d08497 100644 --- a/chain/wallet/handlers/DapAbstractCommand.cpp +++ b/chain/wallet/handlers/DapAbstractCommand.cpp @@ -13,7 +13,7 @@ DapAbstractCommand::DapAbstractCommand(const QString &asServiceName, QObject *pa m_sCliPath = &DapNodePathManager::getInstance().nodePaths.nodePath_cli; m_sToolPath = &DapNodePathManager::getInstance().nodePaths.nodePath_tool; - qDebug()<<"INIT: CMD LIST" << "CLI PATH = " << &m_sCliPath << "TOOL PATH = " << &m_sToolPath; + qDebug()<<"INIT: CMD LIST" << "CLI PATH = " << *m_sCliPath << "TOOL PATH = " << *m_sToolPath; connect(this, &DapAbstractCommand::toDataSignal, this, &DapAbstractCommand::replyToClient); } diff --git a/chain/wallet/handlers/DapAbstractCommand.h b/chain/wallet/handlers/DapAbstractCommand.h index 03ebbaedf35c40469f78f9d6127c3c2010c92c2e..d16eb641a48e9d08c3f96636fbbcc1c6998ead6f 100644 --- a/chain/wallet/handlers/DapAbstractCommand.h +++ b/chain/wallet/handlers/DapAbstractCommand.h @@ -29,15 +29,7 @@ class DapAbstractCommand : public DapCommand public: void setRegularController(DapRegularRequestsController *controller); -protected: - /// Overloaded constructor. - /// @param asServiceName Service name. - /// @param parent Parent. - /// @details The parent must be either DapRPCSocket or DapRPCLocalServer. - /// @param asCliPath The path to cli nodes. - explicit DapAbstractCommand(const QString &asServiceName, QObject *parent = nullptr, const QString &asCliPath = QString(), const QString &asToolPath = QString()); - void addWeb3Result(QJsonObject& result, const QVariant& args); signals: /// The signal is emitted in case of successful notification of the client by the service. /// @param aNotify Notification. @@ -113,6 +105,15 @@ public slots: QString requestToNode(QString cmd); protected: + /// Overloaded constructor. + /// @param asServiceName Service name. + /// @param parent Parent. + /// @details The parent must be either DapRPCSocket or DapRPCLocalServer. + /// @param asCliPath The path to cli nodes. + explicit DapAbstractCommand(const QString &asServiceName, QObject *parent = nullptr, const QString &asCliPath = QString(), const QString &asToolPath = QString()); + + void addWeb3Result(QJsonObject& result, const QVariant& args); + const QStringList& getListNetworks() const; QMap<QString,QString> getListWallets() const; QMap<QString, NetworkSpace::FeeInfoStruct> getFee() const; diff --git a/chain/wallet/handlers/DapCommandList.cpp b/chain/wallet/handlers/DapCommandList.cpp index 924ac5ea36b8dfd566193f0d95beb73299609b35..c5505e1fc3e8003273ad001a283b891718d43699 100644 --- a/chain/wallet/handlers/DapCommandList.cpp +++ b/chain/wallet/handlers/DapCommandList.cpp @@ -1515,10 +1515,18 @@ void DapCommandList::updateConfigParams() listenAddrCfg = DapConfigToolController::getInstance().parseArrayConfigParam(listenAddrCfg).first(); - m_socketPath = nodePath + DapConfigToolController::getInstance().parseArrayConfigParam(listenPathCfg).first(); - m_socketPort = (listenAddrCfg.isEmpty() || !listenAddrCfg.contains(":")) ? 0 : listenAddrCfg.split(":").last().toUInt(); +#ifdef Q_OS_UNIX + if(!nodePath.isEmpty()) +#else + if(!listenAddrCfg.isEmpty() || listenAddrCfg.contains(":")) +#endif + { + m_socketPath = nodePath + DapConfigToolController::getInstance().parseArrayConfigParam(listenPathCfg).first(); + m_socketPort = (listenAddrCfg.isEmpty() || !listenAddrCfg.contains(":")) ? 0 : listenAddrCfg.split(":").last().toUInt(); + + qDebug()<<"[DapCommandList::updateConfigParams] Connect params: path = " << m_socketPath << " port = " << m_socketPort; + } - qDebug()<<"[DapCommandList::updateConfigParams] Connect params: path = " << m_socketPath << " port = " << m_socketPort; } bool DapCommandList::getParamForPairList(const QStringList& list, const QString& paramName, QString& param) diff --git a/chain/wallet/handlers/DapCommandList.h b/chain/wallet/handlers/DapCommandList.h index ee16aabc1aab11407a6ad86c00adf611ead7bd39..394e60493575ad268d591c41cd3ed7ccbe71bfb1 100644 --- a/chain/wallet/handlers/DapCommandList.h +++ b/chain/wallet/handlers/DapCommandList.h @@ -220,12 +220,9 @@ private: bool checkContentLenght(QString body); void updateConfigParams(); - private: QString m_socketPath = ""; uint16_t m_socketPort = 0; - - }; #endif // DAPCOMMANDLIST_H