diff --git a/KelvinDashboardGUI/DapScreenHistoryModel.cpp b/KelvinDashboardGUI/DapScreenHistoryModel.cpp index e5ed78fc402ac26ecd2e081b14eb3c094b2a05fa..91754fae220b5828e8b552efadac766768a0db9c 100644 --- a/KelvinDashboardGUI/DapScreenHistoryModel.cpp +++ b/KelvinDashboardGUI/DapScreenHistoryModel.cpp @@ -3,9 +3,7 @@ DapScreenHistoryModel::DapScreenHistoryModel(QObject *parent) : QAbstractListModel(parent) { - m_timeout = new QTimer(this); - QObject::connect(m_timeout, &QTimer::timeout, this, &DapScreenHistoryModel::sendRequestHistory); - m_timeout->start(1000); + } DapScreenHistoryModel& DapScreenHistoryModel::getInstance() @@ -52,8 +50,6 @@ void DapScreenHistoryModel::receiveNewData(const QVariant& aData) return; } - if(m_timeout->isActive()) m_timeout->stop(); - beginResetModel(); QList<QVariant> dataList = aData.toList(); m_elementList.clear(); @@ -77,16 +73,23 @@ void DapScreenHistoryModel::receiveNewData(const QVariant& aData) item.TokenName = dataItem.at(3); item.WalletNumber = dataItem.at(5); // TODO: Later we should convert currency - item.Currency = "$ 0 USD"; + item.Currency = QString::number(dataItem.at(2).toDouble() * 0.98); switch (item.Status) { - case DapTransactionStatus::stSent: item.Cryptocurrency.prepend("- "); break; - case DapTransactionStatus::stReceived: item.Cryptocurrency.prepend("+ "); break; + case DapTransactionStatus::stSent: + item.Cryptocurrency.prepend("- "); + item.Currency.prepend("- $ "); + break; + case DapTransactionStatus::stReceived: + item.Cryptocurrency.prepend("+ "); + item.Currency.prepend("+ $ "); + break; default: break; } item.Cryptocurrency = toConvertCurrency(item.Cryptocurrency); item.Cryptocurrency += " " + item.TokenName; + item.Currency.append(" USD"); m_elementList.append(item); } diff --git a/KelvinDashboardGUI/DapScreenHistoryModel.h b/KelvinDashboardGUI/DapScreenHistoryModel.h index 181b2ea55c23d944a586b55e69750c84d69eb229..0993e31181fa0844d71998d95b24ca952dbf4b89 100644 --- a/KelvinDashboardGUI/DapScreenHistoryModel.h +++ b/KelvinDashboardGUI/DapScreenHistoryModel.h @@ -31,7 +31,6 @@ public: private: QList<DapTransactionItem> m_elementList; - QTimer* m_timeout; public: explicit DapScreenHistoryModel(QObject *parent = nullptr); diff --git a/KelvinDashboardGUI/DapServiceController.cpp b/KelvinDashboardGUI/DapServiceController.cpp index 25f3b6efb77bdf93d4b0fc53e5ada695de826048..3b8f210afcb6fa1dfc3e9db0a74c6d9c234cd110 100755 --- a/KelvinDashboardGUI/DapServiceController.cpp +++ b/KelvinDashboardGUI/DapServiceController.cpp @@ -59,8 +59,6 @@ void DapServiceController::init(DapServiceClient *apDapServiceClient) connect(m_pDapCommandController, SIGNAL(sendHistory(QVariant)), this, SLOT(processGetHistory(QVariant))); connect(m_pDapCommandController, &DapCommandController::sendHistory, &DapScreenHistoryModel::getInstance(), &DapScreenHistoryModel::receiveNewData); - - connect(&DapScreenHistoryModel::getInstance(), &DapScreenHistoryModel::sendRequestHistory, this, &DapServiceController::getHistory); } QString DapServiceController::getBrand() const diff --git a/KelvinDashboardGUI/DapServiceController.h b/KelvinDashboardGUI/DapServiceController.h index 3dcc8a31d8882b81dc755694bb3e6cb6e8f83096..36f5ba190101a5a0edc4de81da60f3cc6a9d5081 100755 --- a/KelvinDashboardGUI/DapServiceController.h +++ b/KelvinDashboardGUI/DapServiceController.h @@ -124,7 +124,7 @@ public slots: /// Change status of node /// @param it is true if a node is online void setNodeStatus(const bool aIsOnline); - + /// void get(); /// Get node logs. diff --git a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContentForm.ui.qml b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContentForm.ui.qml index 3fc8fb2bbc03e42886f797da2c83e8e3f960c916..be2e895fc8157631d9e83a19ca3d80c9a27579ef 100644 --- a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContentForm.ui.qml +++ b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderContentForm.ui.qml @@ -61,7 +61,7 @@ Item { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignRight color: currencyTextInput.readOnly ? "#ACACAF" : "#737880" - font.family: fontExchange.name + font.family: contentFont font.pixelSize: 12 * pt text: index === 0 ? currencyName : qsTr("USD") } diff --git a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderForm.ui.qml b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderForm.ui.qml index 52ef1c08598c30086a323bae20531e9df866e5bb..0f23637175f6f3c6557015c9d25a9f9011f3ff07 100644 --- a/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderForm.ui.qml +++ b/KelvinDashboardGUI/DapUiQmlWidgetExchangeOrderForm.ui.qml @@ -11,22 +11,18 @@ Item { width: childrenRect.width height: childrenRect.height - FontLoader { - id: fontExchange - source: "qrc:/Resources/Fonts/roboto_regular.ttf" - } - ColumnLayout { DapUiQmlWidgetExchangeOrderTitleForm { id: orderTitle - orderFont: fontExchange.name + orderFont: "Roboto" + } Text { text: qsTr("Balance: ") + balance + " " + currencyName color: "#ACACAF" - font.family: fontExchange.name + font.family: "Roboto" font.pixelSize: 12 * pt } @@ -37,7 +33,7 @@ Item { } DapUiQmlWidgetExchangeOrderContentForm { - contentFont: fontExchange.name + contentFont: "Roboto" } Rectangle { @@ -46,7 +42,7 @@ Item { } DapUiQmlWidgetExchangeOrderButtonForm { - buttonFont: fontExchange.name + buttonFont: "Roboto" buttonText: titleOrder } } diff --git a/KelvinDashboardGUI/main.cpp b/KelvinDashboardGUI/main.cpp index 94b89492d0770394db2e67322c0ca258c64e8193..94d98456413039b87a180f4ea9c727a53f71f640 100755 --- a/KelvinDashboardGUI/main.cpp +++ b/KelvinDashboardGUI/main.cpp @@ -52,6 +52,7 @@ int main(int argc, char *argv[]) controller.init(&dapServiceClient); dapServiceClient.init(); controller.getWallets(); + controller.getHistory(); DapScreenHistoryFilterModel::getInstance() .setSourceModel(&DapScreenHistoryModel::getInstance()); diff --git a/KelvinDashboardService/DapChainHistoryHandler.cpp b/KelvinDashboardService/DapChainHistoryHandler.cpp index 7a06ea47fe37444dd76622e05198b8f800b8642f..2bb2dd5fa738fa85d28175000dce01d695fe562e 100644 --- a/KelvinDashboardService/DapChainHistoryHandler.cpp +++ b/KelvinDashboardService/DapChainHistoryHandler.cpp @@ -35,7 +35,6 @@ void DapChainHistoryHandler::onRequestNewHistory(const QMap<QString, QVariant>& while ((pos = rx.indexIn(result, pos)) != -1) { QStringList dataItem = QStringList() << rx.cap(1) << QString::number(DapTransactionStatusConvertor::getStatusByShort(rx.cap(4))) << rx.cap(5) << rx.cap(6) << rx.cap(7) << wallets.at(i).toString(); - qDebug() << "NEW MATCH" << pos << dataItem; data << dataItem; pos += rx.matchedLength(); } diff --git a/KelvinDashboardService/DapChainLogHandler.cpp b/KelvinDashboardService/DapChainLogHandler.cpp index 73c633b7e66ba1e464ac43c08bea1b412231d15b..809610d45a0a6ee894541db4ea0b857083f7c89d 100755 --- a/KelvinDashboardService/DapChainLogHandler.cpp +++ b/KelvinDashboardService/DapChainLogHandler.cpp @@ -13,29 +13,31 @@ DapChainLogHandler::DapChainLogHandler(QObject *parent) : QObject(parent) QStringList DapChainLogHandler::request() { - QStringList m_listLogs; - QFile file(LOG_FILE); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) - { - emit onUpdateModel(); - } - else - { - QTextStream in(&file); -// QRegExp rx("(\\[|\\]|\\s)([\\w*]{1,1}[\\w\\s\\W]+)([\\n]|\\])" ); !!! DO NOT DELETE!!! - QRegExp rx("(\\[|\\]|\\s)([\\w*]{1,1}[\\w\\s\\W]+)(\\]|$)" ); - rx.setMinimal(true); + /// TODO: The application doesn't work because of it. It needs to be changed +// QStringList m_listLogs; +// QFile file(LOG_FILE); +// if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) +// { +// emit onUpdateModel(); +// } +// else +// { +// QTextStream in(&file); +//// QRegExp rx("(\\[|\\]|\\s)([\\w*]{1,1}[\\w\\s\\W]+)([\\n]|\\])" ); !!! DO NOT DELETE!!! +// QRegExp rx("(\\[|\\]|\\s)([\\w*]{1,1}[\\w\\s\\W]+)(\\]|$)" ); +// rx.setMinimal(true); - while (!in.atEnd()) { - QString line = in.readLine(); - int pos{0}; - while((pos = rx.indexIn(line, pos)) != -1) - { - m_listLogs.append(rx.cap(2)); - pos += rx.matchedLength(); - } - } - } - return m_listLogs; +// while (!in.atEnd()) { +// QString line = in.readLine(); +// int pos{0}; +// while((pos = rx.indexIn(line, pos)) != -1) +// { +// m_listLogs.append(rx.cap(2)); +// pos += rx.matchedLength(); +// } +// } +// } +// return m_listLogs; + return QStringList(); } diff --git a/KelvinDashboardService/KelvinDashboardService.pro b/KelvinDashboardService/KelvinDashboardService.pro index 306f6d0753c6180aebf3a4dad02e0a3e11603a1c..1ada50d2262193adf059f2eed81d40df6b48fa5d 100755 --- a/KelvinDashboardService/KelvinDashboardService.pro +++ b/KelvinDashboardService/KelvinDashboardService.pro @@ -21,8 +21,7 @@ ICON = icon.ico win32 { VERSION = $${VER_MAJ}.$${VER_MIN}.$$VER_PAT DEFINES += CLI_PATH=\\\"./kelvin-node-cli.exe\\\" -# DEFINES += LOG_FILE=\\\"./opt/kelvin-node/var/log/kelvin-node_logs.txt\\\" - DEFINES += LOG_FILE=\\\"./kelvin-node_logs.txt\\\" + DEFINES += LOG_FILE=\\\"./opt/kelvin-node/var/log/kelvin-node_logs.txt\\\" } else { VERSION = $$VER_MAJ\.$$VER_MIN\-$$VER_PAT