small UI fixes
This commit is contained in:
parent
a0128c8136
commit
fed17ba0ee
31
src/rpc.cpp
31
src/rpc.cpp
|
@ -25,6 +25,13 @@ RPC::RPC(QNetworkAccessManager* client, MainWindow* main) {
|
|||
|
||||
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
|
||||
timer = new QTimer(main);
|
||||
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
|
||||
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() {
|
||||
|
@ -543,10 +543,18 @@ bool RPC::processUnspent(const json& reply) {
|
|||
|
||||
void RPC::refreshBalances() {
|
||||
// 1. Get the Balances
|
||||
getBalance([=] (json reply) {
|
||||
ui->balSheilded ->setText(QString::fromStdString(reply["private"]) % " " % Utils::getTokenName());
|
||||
ui->balTransparent ->setText(QString::fromStdString(reply["transparent"]) % " " % Utils::getTokenName());
|
||||
ui->balTotal ->setText(QString::fromStdString(reply["total"]) % " " % Utils::getTokenName());
|
||||
getBalance([=] (json reply) {
|
||||
auto balT = QString::fromStdString(reply["transparent"]).toDouble();
|
||||
auto balZ = QString::fromStdString(reply["private"]).toDouble();
|
||||
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
|
||||
|
@ -744,6 +752,7 @@ void RPC::refreshZECPrice() {
|
|||
QString price = QString::fromStdString(item["price_usd"].get<json::string_t>());
|
||||
qDebug() << "ZEC Price=" << price;
|
||||
Settings::getInstance()->setZECPrice(price.toDouble());
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ double Settings::getZECPrice() {
|
|||
|
||||
QString Settings::getUSDFormat(double bal) {
|
||||
if (!isTestnet() && getZECPrice() > 0)
|
||||
return "$" + QString::number(bal * getZECPrice(), 'f', 2);
|
||||
return "$" + QLocale(QLocale::English).toString(bal * getZECPrice(), 'f', 2);
|
||||
else
|
||||
return QString();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ public:
|
|||
QAction *actionDonate;
|
||||
QAction *actionImport_Private_Keys;
|
||||
QAction *actionCheck_for_Updates;
|
||||
QAction *actionDelete_Sent_History;
|
||||
QWidget *centralWidget;
|
||||
QGridLayout *gridLayout_3;
|
||||
QTabWidget *tabWidget;
|
||||
|
@ -160,8 +159,6 @@ public:
|
|||
actionImport_Private_Keys->setVisible(false);
|
||||
actionCheck_for_Updates = new QAction(MainWindow);
|
||||
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->setObjectName(QStringLiteral("centralWidget"));
|
||||
gridLayout_3 = new QGridLayout(centralWidget);
|
||||
|
@ -368,7 +365,7 @@ public:
|
|||
sendToScrollArea->setWidgetResizable(true);
|
||||
sendToWidgets = new QWidget();
|
||||
sendToWidgets->setObjectName(QStringLiteral("sendToWidgets"));
|
||||
sendToWidgets->setGeometry(QRect(0, 0, 849, 369));
|
||||
sendToWidgets->setGeometry(QRect(0, 0, 841, 321));
|
||||
sendToLayout = new QVBoxLayout(sendToWidgets);
|
||||
sendToLayout->setSpacing(6);
|
||||
sendToLayout->setContentsMargins(11, 11, 11, 11);
|
||||
|
@ -640,7 +637,7 @@ public:
|
|||
MainWindow->setCentralWidget(centralWidget);
|
||||
menuBar = new QMenuBar(MainWindow);
|
||||
menuBar->setObjectName(QStringLiteral("menuBar"));
|
||||
menuBar->setGeometry(QRect(0, 0, 889, 19));
|
||||
menuBar->setGeometry(QRect(0, 0, 889, 22));
|
||||
menuBalance = new QMenu(menuBar);
|
||||
menuBalance->setObjectName(QStringLiteral("menuBalance"));
|
||||
menuHelp = new QMenu(menuBar);
|
||||
|
@ -693,7 +690,6 @@ public:
|
|||
actionDonate->setText(QApplication::translate("MainWindow", "Donate", 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));
|
||||
actionDelete_Sent_History->setText(QApplication::translate("MainWindow", "Delete Sent History", nullptr));
|
||||
groupBox->setTitle(QApplication::translate("MainWindow", "Summary", nullptr));
|
||||
label->setText(QApplication::translate("MainWindow", "Shielded", nullptr));
|
||||
balSheilded->setText(QString());
|
||||
|
|
Loading…
Reference in New Issue