small UI fixes
This commit is contained in:
31
src/rpc.cpp
31
src/rpc.cpp
@@ -25,6 +25,13 @@ RPC::RPC(QNetworkAccessManager* client, MainWindow* main) {
|
|||||||
|
|
||||||
reloadConnectionInfo();
|
reloadConnectionInfo();
|
||||||
|
|
||||||
|
// Set up timer to refresh Price
|
||||||
|
priceTimer = new QTimer(main);
|
||||||
|
QObject::connect(priceTimer, &QTimer::timeout, [=]() {
|
||||||
|
refreshZECPrice();
|
||||||
|
});
|
||||||
|
priceTimer->start(Utils::priceRefreshSpeed); // Every hour
|
||||||
|
|
||||||
// Set up a timer to refresh the UI every few seconds
|
// Set up a timer to refresh the UI every few seconds
|
||||||
timer = new QTimer(main);
|
timer = new QTimer(main);
|
||||||
QObject::connect(timer, &QTimer::timeout, [=]() {
|
QObject::connect(timer, &QTimer::timeout, [=]() {
|
||||||
@@ -39,13 +46,6 @@ RPC::RPC(QNetworkAccessManager* client, MainWindow* main) {
|
|||||||
});
|
});
|
||||||
// Start at every 10s. When an operation is pending, this will change to every second
|
// Start at every 10s. When an operation is pending, this will change to every second
|
||||||
txTimer->start(Utils::updateSpeed);
|
txTimer->start(Utils::updateSpeed);
|
||||||
|
|
||||||
// Set up timer to refresh Price
|
|
||||||
priceTimer = new QTimer(main);
|
|
||||||
QObject::connect(priceTimer, &QTimer::timeout, [=]() {
|
|
||||||
refreshZECPrice();
|
|
||||||
});
|
|
||||||
priceTimer->start(Utils::priceRefreshSpeed); // Every hour
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RPC::~RPC() {
|
RPC::~RPC() {
|
||||||
@@ -543,10 +543,18 @@ bool RPC::processUnspent(const json& reply) {
|
|||||||
|
|
||||||
void RPC::refreshBalances() {
|
void RPC::refreshBalances() {
|
||||||
// 1. Get the Balances
|
// 1. Get the Balances
|
||||||
getBalance([=] (json reply) {
|
getBalance([=] (json reply) {
|
||||||
ui->balSheilded ->setText(QString::fromStdString(reply["private"]) % " " % Utils::getTokenName());
|
auto balT = QString::fromStdString(reply["transparent"]).toDouble();
|
||||||
ui->balTransparent ->setText(QString::fromStdString(reply["transparent"]) % " " % Utils::getTokenName());
|
auto balZ = QString::fromStdString(reply["private"]).toDouble();
|
||||||
ui->balTotal ->setText(QString::fromStdString(reply["total"]) % " " % Utils::getTokenName());
|
auto tot = QString::fromStdString(reply["total"]).toDouble();
|
||||||
|
|
||||||
|
ui->balSheilded ->setText(Settings::getInstance()->getZECDisplayFormat(balZ));
|
||||||
|
ui->balTransparent->setText(Settings::getInstance()->getZECDisplayFormat(balT));
|
||||||
|
ui->balTotal ->setText(Settings::getInstance()->getZECDisplayFormat(tot));
|
||||||
|
|
||||||
|
ui->balSheilded ->setToolTip(Settings::getInstance()->getUSDFormat(balZ));
|
||||||
|
ui->balTransparent->setToolTip(Settings::getInstance()->getUSDFormat(balT));
|
||||||
|
ui->balTotal ->setToolTip(Settings::getInstance()->getUSDFormat(tot));
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2. Get the UTXOs
|
// 2. Get the UTXOs
|
||||||
@@ -744,6 +752,7 @@ void RPC::refreshZECPrice() {
|
|||||||
QString price = QString::fromStdString(item["price_usd"].get<json::string_t>());
|
QString price = QString::fromStdString(item["price_usd"].get<json::string_t>());
|
||||||
qDebug() << "ZEC Price=" << price;
|
qDebug() << "ZEC Price=" << price;
|
||||||
Settings::getInstance()->setZECPrice(price.toDouble());
|
Settings::getInstance()->setZECPrice(price.toDouble());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ double Settings::getZECPrice() {
|
|||||||
|
|
||||||
QString Settings::getUSDFormat(double bal) {
|
QString Settings::getUSDFormat(double bal) {
|
||||||
if (!isTestnet() && getZECPrice() > 0)
|
if (!isTestnet() && getZECPrice() > 0)
|
||||||
return "$" + QString::number(bal * getZECPrice(), 'f', 2);
|
return "$" + QLocale(QLocale::English).toString(bal * getZECPrice(), 'f', 2);
|
||||||
else
|
else
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ public:
|
|||||||
QAction *actionDonate;
|
QAction *actionDonate;
|
||||||
QAction *actionImport_Private_Keys;
|
QAction *actionImport_Private_Keys;
|
||||||
QAction *actionCheck_for_Updates;
|
QAction *actionCheck_for_Updates;
|
||||||
QAction *actionDelete_Sent_History;
|
|
||||||
QWidget *centralWidget;
|
QWidget *centralWidget;
|
||||||
QGridLayout *gridLayout_3;
|
QGridLayout *gridLayout_3;
|
||||||
QTabWidget *tabWidget;
|
QTabWidget *tabWidget;
|
||||||
@@ -160,8 +159,6 @@ public:
|
|||||||
actionImport_Private_Keys->setVisible(false);
|
actionImport_Private_Keys->setVisible(false);
|
||||||
actionCheck_for_Updates = new QAction(MainWindow);
|
actionCheck_for_Updates = new QAction(MainWindow);
|
||||||
actionCheck_for_Updates->setObjectName(QStringLiteral("actionCheck_for_Updates"));
|
actionCheck_for_Updates->setObjectName(QStringLiteral("actionCheck_for_Updates"));
|
||||||
actionDelete_Sent_History = new QAction(MainWindow);
|
|
||||||
actionDelete_Sent_History->setObjectName(QStringLiteral("actionDelete_Sent_History"));
|
|
||||||
centralWidget = new QWidget(MainWindow);
|
centralWidget = new QWidget(MainWindow);
|
||||||
centralWidget->setObjectName(QStringLiteral("centralWidget"));
|
centralWidget->setObjectName(QStringLiteral("centralWidget"));
|
||||||
gridLayout_3 = new QGridLayout(centralWidget);
|
gridLayout_3 = new QGridLayout(centralWidget);
|
||||||
@@ -368,7 +365,7 @@ public:
|
|||||||
sendToScrollArea->setWidgetResizable(true);
|
sendToScrollArea->setWidgetResizable(true);
|
||||||
sendToWidgets = new QWidget();
|
sendToWidgets = new QWidget();
|
||||||
sendToWidgets->setObjectName(QStringLiteral("sendToWidgets"));
|
sendToWidgets->setObjectName(QStringLiteral("sendToWidgets"));
|
||||||
sendToWidgets->setGeometry(QRect(0, 0, 849, 369));
|
sendToWidgets->setGeometry(QRect(0, 0, 841, 321));
|
||||||
sendToLayout = new QVBoxLayout(sendToWidgets);
|
sendToLayout = new QVBoxLayout(sendToWidgets);
|
||||||
sendToLayout->setSpacing(6);
|
sendToLayout->setSpacing(6);
|
||||||
sendToLayout->setContentsMargins(11, 11, 11, 11);
|
sendToLayout->setContentsMargins(11, 11, 11, 11);
|
||||||
@@ -640,7 +637,7 @@ public:
|
|||||||
MainWindow->setCentralWidget(centralWidget);
|
MainWindow->setCentralWidget(centralWidget);
|
||||||
menuBar = new QMenuBar(MainWindow);
|
menuBar = new QMenuBar(MainWindow);
|
||||||
menuBar->setObjectName(QStringLiteral("menuBar"));
|
menuBar->setObjectName(QStringLiteral("menuBar"));
|
||||||
menuBar->setGeometry(QRect(0, 0, 889, 19));
|
menuBar->setGeometry(QRect(0, 0, 889, 22));
|
||||||
menuBalance = new QMenu(menuBar);
|
menuBalance = new QMenu(menuBar);
|
||||||
menuBalance->setObjectName(QStringLiteral("menuBalance"));
|
menuBalance->setObjectName(QStringLiteral("menuBalance"));
|
||||||
menuHelp = new QMenu(menuBar);
|
menuHelp = new QMenu(menuBar);
|
||||||
@@ -693,7 +690,6 @@ public:
|
|||||||
actionDonate->setText(QApplication::translate("MainWindow", "Donate", nullptr));
|
actionDonate->setText(QApplication::translate("MainWindow", "Donate", nullptr));
|
||||||
actionImport_Private_Keys->setText(QApplication::translate("MainWindow", "Import Private Keys", nullptr));
|
actionImport_Private_Keys->setText(QApplication::translate("MainWindow", "Import Private Keys", nullptr));
|
||||||
actionCheck_for_Updates->setText(QApplication::translate("MainWindow", "Check github.com for Updates", nullptr));
|
actionCheck_for_Updates->setText(QApplication::translate("MainWindow", "Check github.com for Updates", nullptr));
|
||||||
actionDelete_Sent_History->setText(QApplication::translate("MainWindow", "Delete Sent History", nullptr));
|
|
||||||
groupBox->setTitle(QApplication::translate("MainWindow", "Summary", nullptr));
|
groupBox->setTitle(QApplication::translate("MainWindow", "Summary", nullptr));
|
||||||
label->setText(QApplication::translate("MainWindow", "Shielded", nullptr));
|
label->setText(QApplication::translate("MainWindow", "Shielded", nullptr));
|
||||||
balSheilded->setText(QString());
|
balSheilded->setText(QString());
|
||||||
|
|||||||
Reference in New Issue
Block a user