cleanup
This commit is contained in:
@@ -265,7 +265,7 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
||||
void ConnectionLoader::doManualConnect() {
|
||||
auto config = loadFromSettings();
|
||||
|
||||
if (config.get() == nullptr) {
|
||||
if (!config) {
|
||||
// Nothing configured, show an error
|
||||
QString explanation = QString()
|
||||
% "A manual connection was requested, but the settings are not configured.\n\n"
|
||||
@@ -569,4 +569,4 @@ void Connection::showTxError(const QString& error) {
|
||||
*/
|
||||
void Connection::shutdown() {
|
||||
shutdownInProgress = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,7 +837,7 @@ void RPC::refreshZECPrice() {
|
||||
}
|
||||
|
||||
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>());
|
||||
qDebug() << "ZEC Price=" << price;
|
||||
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()
|
||||
// below, which blocks this function until we exit.
|
||||
int waitCount = 0;
|
||||
QObject::connect(&waiter, &QTimer::timeout, [&] () {
|
||||
if (ezcashd->atEnd() && ezcashd->processId() == 0) {
|
||||
waitCount++;
|
||||
if ((ezcashd->atEnd() && ezcashd->processId() == 0) ||
|
||||
waitCount > 30) {
|
||||
qDebug() << "Ended";
|
||||
waiter.stop();
|
||||
QTimer::singleShot(1000, [&]() { d.accept(); });
|
||||
|
||||
@@ -31,7 +31,7 @@ QList<TransactionItem> SentTxStore::readSentTxFile() {
|
||||
QJsonDocument jsonDoc;
|
||||
|
||||
data.open(QFile::ReadOnly);
|
||||
jsonDoc = QJsonDocument().fromJson(data.readAll());
|
||||
jsonDoc = QJsonDocument::fromJson(data.readAll());
|
||||
data.close();
|
||||
|
||||
QList<TransactionItem> items;
|
||||
@@ -87,7 +87,7 @@ void SentTxStore::addToSentTx(Tx tx, QString txid) {
|
||||
QJsonObject txItem;
|
||||
txItem["type"] = "sent";
|
||||
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["txid"] = txid;
|
||||
txItem["amount"] = -totalAmount;
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
|
||||
Settings* Settings::instance = nullptr;
|
||||
|
||||
Settings::~Settings() {
|
||||
}
|
||||
|
||||
bool Settings::getSaveZtxs() {
|
||||
// Load from the QT Settings.
|
||||
return QSettings().value("options/savesenttx", true).toBool();
|
||||
@@ -122,4 +119,4 @@ QString Settings::getZECUSDDisplayFormat(double bal) {
|
||||
return getZECDisplayFormat(bal) % " (" % getUSDFormat(bal) % ")";
|
||||
else
|
||||
return getZECDisplayFormat(bal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@ Turnstile::Turnstile(RPC* _rpc, MainWindow* mainwindow) {
|
||||
this->mainwindow = mainwindow;
|
||||
}
|
||||
|
||||
Turnstile::~Turnstile() {
|
||||
}
|
||||
|
||||
void printPlan(QList<TurnstileMigrationItem> 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
|
||||
// happening immediately
|
||||
if (migItems.size() == 0) {
|
||||
if (migItems.empty()) {
|
||||
// Show error and abort
|
||||
QMessageBox::warning(mainwindow,
|
||||
"Locked funds",
|
||||
@@ -220,9 +218,7 @@ Turnstile::getNextStep(QList<TurnstileMigrationItem>& plan) {
|
||||
|
||||
bool Turnstile::isMigrationPresent() {
|
||||
auto plan = readMigrationPlan();
|
||||
if (plan.isEmpty()) return false;
|
||||
|
||||
return true;
|
||||
return !plan.isEmpty();
|
||||
}
|
||||
|
||||
ProgressReport Turnstile::getPlanProgress() {
|
||||
|
||||
@@ -39,7 +39,6 @@ class Turnstile
|
||||
{
|
||||
public:
|
||||
Turnstile(RPC* _rpc, MainWindow* mainwindow);
|
||||
~Turnstile();
|
||||
|
||||
void planMigration(QString zaddr, QString destAddr, int splits, int numBlocks);
|
||||
QList<double> splitAmount(double amount, int parts);
|
||||
|
||||
Reference in New Issue
Block a user