|
@ -68,7 +68,7 @@ MainWindow::MainWindow(QWidget *parent) : |
|
|
|
|
|
|
|
|
// Pay Hush URI
|
|
|
// Pay Hush URI
|
|
|
QObject::connect(ui->actionPay_URI, &QAction::triggered, [=] () { |
|
|
QObject::connect(ui->actionPay_URI, &QAction::triggered, [=] () { |
|
|
payZcashURI(); |
|
|
payHushURI(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// Import Private Key
|
|
|
// Import Private Key
|
|
@ -195,7 +195,7 @@ void MainWindow::closeEvent(QCloseEvent* event) { |
|
|
s.sync(); |
|
|
s.sync(); |
|
|
|
|
|
|
|
|
// Let the RPC know to shut down any running service.
|
|
|
// Let the RPC know to shut down any running service.
|
|
|
rpc->shutdownZcashd(); |
|
|
rpc->shutdownHushd(); |
|
|
|
|
|
|
|
|
// Bubble up
|
|
|
// Bubble up
|
|
|
if (event) |
|
|
if (event) |
|
@ -389,9 +389,9 @@ void MainWindow::setupSettingsModal() { |
|
|
settings.port->setValidator(&validator); |
|
|
settings.port->setValidator(&validator); |
|
|
|
|
|
|
|
|
// If values are coming from HUSH3.conf, then disable all the fields
|
|
|
// If values are coming from HUSH3.conf, then disable all the fields
|
|
|
auto zcashConfLocation = Settings::getInstance()->getZcashdConfLocation(); |
|
|
auto hushConfLocation = Settings::getInstance()->getHushdConfLocation(); |
|
|
if (!zcashConfLocation.isEmpty()) { |
|
|
if (!hushConfLocation.isEmpty()) { |
|
|
settings.confMsg->setText("Settings are being read from \n" + zcashConfLocation); |
|
|
settings.confMsg->setText("Settings are being read from \n" + hushConfLocation); |
|
|
settings.hostname->setEnabled(false); |
|
|
settings.hostname->setEnabled(false); |
|
|
settings.port->setEnabled(false); |
|
|
settings.port->setEnabled(false); |
|
|
settings.rpcuser->setEnabled(false); |
|
|
settings.rpcuser->setEnabled(false); |
|
@ -450,7 +450,7 @@ void MainWindow::setupSettingsModal() { |
|
|
|
|
|
|
|
|
if (!isUsingTor && settings.chkTor->isChecked()) { |
|
|
if (!isUsingTor && settings.chkTor->isChecked()) { |
|
|
// If "use tor" was previously unchecked and now checked
|
|
|
// If "use tor" was previously unchecked and now checked
|
|
|
Settings::addToZcashConf(zcashConfLocation, "proxy=127.0.0.1:9050"); |
|
|
Settings::addToHushConf(hushConfLocation, "proxy=127.0.0.1:9050"); |
|
|
rpc->getConnection()->config->proxy = "proxy=127.0.0.1:9050"; |
|
|
rpc->getConnection()->config->proxy = "proxy=127.0.0.1:9050"; |
|
|
|
|
|
|
|
|
QMessageBox::information(this, tr("Enable Tor"), |
|
|
QMessageBox::information(this, tr("Enable Tor"), |
|
@ -460,7 +460,7 @@ void MainWindow::setupSettingsModal() { |
|
|
|
|
|
|
|
|
if (isUsingTor && !settings.chkTor->isChecked()) { |
|
|
if (isUsingTor && !settings.chkTor->isChecked()) { |
|
|
// If "use tor" was previously checked and now is unchecked
|
|
|
// If "use tor" was previously checked and now is unchecked
|
|
|
Settings::removeFromZcashConf(zcashConfLocation, "proxy"); |
|
|
Settings::removeFromHushConf(hushConfLocation, "proxy"); |
|
|
rpc->getConnection()->config->proxy.clear(); |
|
|
rpc->getConnection()->config->proxy.clear(); |
|
|
|
|
|
|
|
|
QMessageBox::information(this, tr("Disable Tor"), |
|
|
QMessageBox::information(this, tr("Disable Tor"), |
|
@ -468,7 +468,7 @@ void MainWindow::setupSettingsModal() { |
|
|
QMessageBox::Ok); |
|
|
QMessageBox::Ok); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (zcashConfLocation.isEmpty()) { |
|
|
if (hushConfLocation.isEmpty()) { |
|
|
// Save settings
|
|
|
// Save settings
|
|
|
Settings::getInstance()->saveSettings( |
|
|
Settings::getInstance()->saveSettings( |
|
|
settings.hostname->text(), |
|
|
settings.hostname->text(), |
|
@ -491,55 +491,55 @@ void MainWindow::setupSettingsModal() { |
|
|
bool showRestartInfo = false; |
|
|
bool showRestartInfo = false; |
|
|
bool showReindexInfo = false; |
|
|
bool showReindexInfo = false; |
|
|
if (settings.chkRescan->isChecked()) { |
|
|
if (settings.chkRescan->isChecked()) { |
|
|
Settings::addToZcashConf(zcashConfLocation, "rescan=1"); |
|
|
Settings::addToHushConf(hushConfLocation, "rescan=1"); |
|
|
showRestartInfo = true; |
|
|
showRestartInfo = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (settings.chkReindex->isChecked()) { |
|
|
if (settings.chkReindex->isChecked()) { |
|
|
Settings::addToZcashConf(zcashConfLocation, "reindex=1"); |
|
|
Settings::addToHushConf(hushConfLocation, "reindex=1"); |
|
|
showRestartInfo = true; |
|
|
showRestartInfo = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!rpc->getConnection()->config->consolidation.isEmpty()==false) { |
|
|
if (!rpc->getConnection()->config->consolidation.isEmpty()==false) { |
|
|
if (settings.chkConso->isChecked()) { |
|
|
if (settings.chkConso->isChecked()) { |
|
|
Settings::addToZcashConf(zcashConfLocation, "consolidation=1"); |
|
|
Settings::addToHushConf(hushConfLocation, "consolidation=1"); |
|
|
showRestartInfo = true; |
|
|
showRestartInfo = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!rpc->getConnection()->config->consolidation.isEmpty()) { |
|
|
if (!rpc->getConnection()->config->consolidation.isEmpty()) { |
|
|
if (settings.chkConso->isChecked() == false) { |
|
|
if (settings.chkConso->isChecked() == false) { |
|
|
Settings::removeFromZcashConf(zcashConfLocation, "consolidation"); |
|
|
Settings::removeFromHushConf(hushConfLocation, "consolidation"); |
|
|
showRestartInfo = true; |
|
|
showRestartInfo = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!rpc->getConnection()->config->deletetx.isEmpty() == false) { |
|
|
if (!rpc->getConnection()->config->deletetx.isEmpty() == false) { |
|
|
if (settings.chkDeletetx->isChecked()) { |
|
|
if (settings.chkDeletetx->isChecked()) { |
|
|
Settings::addToZcashConf(zcashConfLocation, "deletetx=1"); |
|
|
Settings::addToHushConf(hushConfLocation, "deletetx=1"); |
|
|
showRestartInfo = true; |
|
|
showRestartInfo = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!rpc->getConnection()->config->deletetx.isEmpty()) { |
|
|
if (!rpc->getConnection()->config->deletetx.isEmpty()) { |
|
|
if (settings.chkDeletetx->isChecked() == false) { |
|
|
if (settings.chkDeletetx->isChecked() == false) { |
|
|
Settings::removeFromZcashConf(zcashConfLocation, "deletetx"); |
|
|
Settings::removeFromHushConf(hushConfLocation, "deletetx"); |
|
|
showRestartInfo = true; |
|
|
showRestartInfo = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!rpc->getConnection()->config->zindex.isEmpty() == false) { |
|
|
if (!rpc->getConnection()->config->zindex.isEmpty() == false) { |
|
|
if (settings.chkzindex->isChecked()) { |
|
|
if (settings.chkzindex->isChecked()) { |
|
|
Settings::addToZcashConf(zcashConfLocation, "zindex=1"); |
|
|
Settings::addToHushConf(hushConfLocation, "zindex=1"); |
|
|
Settings::addToZcashConf(zcashConfLocation, "reindex=1"); |
|
|
Settings::addToHushConf(hushConfLocation, "reindex=1"); |
|
|
showReindexInfo = true; |
|
|
showReindexInfo = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!rpc->getConnection()->config->zindex.isEmpty()) { |
|
|
if (!rpc->getConnection()->config->zindex.isEmpty()) { |
|
|
if (settings.chkzindex->isChecked() == false) { |
|
|
if (settings.chkzindex->isChecked() == false) { |
|
|
Settings::removeFromZcashConf(zcashConfLocation, "zindex"); |
|
|
Settings::removeFromHushConf(hushConfLocation, "zindex"); |
|
|
Settings::addToZcashConf(zcashConfLocation, "reindex=1"); |
|
|
Settings::addToHushConf(hushConfLocation, "reindex=1"); |
|
|
showReindexInfo = true; |
|
|
showReindexInfo = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -692,7 +692,7 @@ void MainWindow::balancesReady() { |
|
|
// process it.
|
|
|
// process it.
|
|
|
if (!pendingURIPayment.isEmpty()) { |
|
|
if (!pendingURIPayment.isEmpty()) { |
|
|
qDebug() << "Paying hush URI"; |
|
|
qDebug() << "Paying hush URI"; |
|
|
payZcashURI(pendingURIPayment); |
|
|
payHushURI(pendingURIPayment); |
|
|
pendingURIPayment = ""; |
|
|
pendingURIPayment = ""; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -703,7 +703,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) { |
|
|
if (event->type() == QEvent::FileOpen) { |
|
|
if (event->type() == QEvent::FileOpen) { |
|
|
QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event); |
|
|
QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event); |
|
|
if (!fileEvent->url().isEmpty()) |
|
|
if (!fileEvent->url().isEmpty()) |
|
|
payZcashURI(fileEvent->url().toString()); |
|
|
payHushURI(fileEvent->url().toString()); |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
@ -715,7 +715,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) { |
|
|
// Pay the Hush URI by showing a confirmation window. If the URI parameter is empty, the UI
|
|
|
// Pay the Hush URI by showing a confirmation window. If the URI parameter is empty, the UI
|
|
|
// will prompt for one. If the myAddr is empty, then the default from address is used to send
|
|
|
// will prompt for one. If the myAddr is empty, then the default from address is used to send
|
|
|
// the transaction.
|
|
|
// the transaction.
|
|
|
void MainWindow::payZcashURI(QString uri, QString myAddr) { |
|
|
void MainWindow::payHushURI(QString uri, QString myAddr) { |
|
|
// If the Payments UI is not ready (i.e, all balances have not loaded), defer the payment URI
|
|
|
// If the Payments UI is not ready (i.e, all balances have not loaded), defer the payment URI
|
|
|
if (!uiPaymentsReady) { |
|
|
if (!uiPaymentsReady) { |
|
|
qDebug() << "Payment UI not ready, waiting for UI to pay URI"; |
|
|
qDebug() << "Payment UI not ready, waiting for UI to pay URI"; |
|
|