cleanup
This commit is contained in:
@@ -265,7 +265,7 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
|||||||
void ConnectionLoader::doManualConnect() {
|
void ConnectionLoader::doManualConnect() {
|
||||||
auto config = loadFromSettings();
|
auto config = loadFromSettings();
|
||||||
|
|
||||||
if (config.get() == nullptr) {
|
if (!config) {
|
||||||
// Nothing configured, show an error
|
// Nothing configured, show an error
|
||||||
QString explanation = QString()
|
QString explanation = QString()
|
||||||
% "A manual connection was requested, but the settings are not configured.\n\n"
|
% "A manual connection was requested, but the settings are not configured.\n\n"
|
||||||
|
|||||||
@@ -837,7 +837,7 @@ void RPC::refreshZECPrice() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const json& item : parsed.get<json::array_t>()) {
|
for (const json& item : parsed.get<json::array_t>()) {
|
||||||
if (item["symbol"].get<json::string_t>().compare("ZEC") == 0) {
|
if (item["symbol"].get<json::string_t>() == "ZEC") {
|
||||||
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());
|
||||||
@@ -881,8 +881,11 @@ void RPC::shutdownZcashd() {
|
|||||||
|
|
||||||
// We capture by reference all the local variables because of the d.exec()
|
// We capture by reference all the local variables because of the d.exec()
|
||||||
// below, which blocks this function until we exit.
|
// below, which blocks this function until we exit.
|
||||||
|
int waitCount = 0;
|
||||||
QObject::connect(&waiter, &QTimer::timeout, [&] () {
|
QObject::connect(&waiter, &QTimer::timeout, [&] () {
|
||||||
if (ezcashd->atEnd() && ezcashd->processId() == 0) {
|
waitCount++;
|
||||||
|
if ((ezcashd->atEnd() && ezcashd->processId() == 0) ||
|
||||||
|
waitCount > 30) {
|
||||||
qDebug() << "Ended";
|
qDebug() << "Ended";
|
||||||
waiter.stop();
|
waiter.stop();
|
||||||
QTimer::singleShot(1000, [&]() { d.accept(); });
|
QTimer::singleShot(1000, [&]() { d.accept(); });
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ QList<TransactionItem> SentTxStore::readSentTxFile() {
|
|||||||
QJsonDocument jsonDoc;
|
QJsonDocument jsonDoc;
|
||||||
|
|
||||||
data.open(QFile::ReadOnly);
|
data.open(QFile::ReadOnly);
|
||||||
jsonDoc = QJsonDocument().fromJson(data.readAll());
|
jsonDoc = QJsonDocument::fromJson(data.readAll());
|
||||||
data.close();
|
data.close();
|
||||||
|
|
||||||
QList<TransactionItem> items;
|
QList<TransactionItem> items;
|
||||||
@@ -87,7 +87,7 @@ void SentTxStore::addToSentTx(Tx tx, QString txid) {
|
|||||||
QJsonObject txItem;
|
QJsonObject txItem;
|
||||||
txItem["type"] = "sent";
|
txItem["type"] = "sent";
|
||||||
txItem["from"] = tx.fromAddr;
|
txItem["from"] = tx.fromAddr;
|
||||||
txItem["datetime"] = QDateTime().currentMSecsSinceEpoch() / (qint64)1000;
|
txItem["datetime"] = QDateTime::currentMSecsSinceEpoch() / (qint64)1000;
|
||||||
txItem["address"] = QString(); // The sent address is blank, to be consistent with t-Addr sent behaviour
|
txItem["address"] = QString(); // The sent address is blank, to be consistent with t-Addr sent behaviour
|
||||||
txItem["txid"] = txid;
|
txItem["txid"] = txid;
|
||||||
txItem["amount"] = -totalAmount;
|
txItem["amount"] = -totalAmount;
|
||||||
|
|||||||
@@ -5,9 +5,6 @@
|
|||||||
|
|
||||||
Settings* Settings::instance = nullptr;
|
Settings* Settings::instance = nullptr;
|
||||||
|
|
||||||
Settings::~Settings() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings::getSaveZtxs() {
|
bool Settings::getSaveZtxs() {
|
||||||
// Load from the QT Settings.
|
// Load from the QT Settings.
|
||||||
return QSettings().value("options/savesenttx", true).toBool();
|
return QSettings().value("options/savesenttx", true).toBool();
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ Turnstile::Turnstile(RPC* _rpc, MainWindow* mainwindow) {
|
|||||||
this->mainwindow = mainwindow;
|
this->mainwindow = mainwindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
Turnstile::~Turnstile() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void printPlan(QList<TurnstileMigrationItem> plan) {
|
void printPlan(QList<TurnstileMigrationItem> plan) {
|
||||||
for (auto item : plan) {
|
for (auto item : plan) {
|
||||||
@@ -118,7 +116,7 @@ void Turnstile::planMigration(QString zaddr, QString destAddr, int numsplits, in
|
|||||||
|
|
||||||
// The first migration is shifted to the current block, so the user sees something
|
// The first migration is shifted to the current block, so the user sees something
|
||||||
// happening immediately
|
// happening immediately
|
||||||
if (migItems.size() == 0) {
|
if (migItems.empty()) {
|
||||||
// Show error and abort
|
// Show error and abort
|
||||||
QMessageBox::warning(mainwindow,
|
QMessageBox::warning(mainwindow,
|
||||||
"Locked funds",
|
"Locked funds",
|
||||||
@@ -220,9 +218,7 @@ Turnstile::getNextStep(QList<TurnstileMigrationItem>& plan) {
|
|||||||
|
|
||||||
bool Turnstile::isMigrationPresent() {
|
bool Turnstile::isMigrationPresent() {
|
||||||
auto plan = readMigrationPlan();
|
auto plan = readMigrationPlan();
|
||||||
if (plan.isEmpty()) return false;
|
return !plan.isEmpty();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressReport Turnstile::getPlanProgress() {
|
ProgressReport Turnstile::getPlanProgress() {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class Turnstile
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Turnstile(RPC* _rpc, MainWindow* mainwindow);
|
Turnstile(RPC* _rpc, MainWindow* mainwindow);
|
||||||
~Turnstile();
|
|
||||||
|
|
||||||
void planMigration(QString zaddr, QString destAddr, int splits, int numBlocks);
|
void planMigration(QString zaddr, QString destAddr, int splits, int numBlocks);
|
||||||
QList<double> splitAmount(double amount, int parts);
|
QList<double> splitAmount(double amount, int parts);
|
||||||
|
|||||||
Reference in New Issue
Block a user