Browse Source

Merge branch 'master' into dev

Conflicts:
	src/connection.cpp
    src/connection.h
pull/7/head
Duke Leto 3 years ago
parent
commit
1c8f9e592b
  1. 2
      res/silentdragon_be.ts
  2. 2
      res/silentdragon_bg.ts
  3. BIN
      res/silentdragon_de.qm
  4. 4
      res/silentdragon_de.ts
  5. BIN
      res/silentdragon_es.qm
  6. 4
      res/silentdragon_es.ts
  7. BIN
      res/silentdragon_fi.qm
  8. 4
      res/silentdragon_fi.ts
  9. BIN
      res/silentdragon_fil.qm
  10. 2
      res/silentdragon_fil.ts
  11. BIN
      res/silentdragon_fr.qm
  12. 2
      res/silentdragon_fr.ts
  13. BIN
      res/silentdragon_hr.qm
  14. 2
      res/silentdragon_hr.ts
  15. BIN
      res/silentdragon_id.qm
  16. 2
      res/silentdragon_id.ts
  17. BIN
      res/silentdragon_it.qm
  18. 2
      res/silentdragon_it.ts
  19. BIN
      res/silentdragon_nl.qm
  20. 2
      res/silentdragon_nl.ts
  21. BIN
      res/silentdragon_pt.qm
  22. 4
      res/silentdragon_pt.ts
  23. BIN
      res/silentdragon_ro.qm
  24. 2
      res/silentdragon_ro.ts
  25. BIN
      res/silentdragon_ru.qm
  26. 2
      res/silentdragon_ru.ts
  27. BIN
      res/silentdragon_sr.qm
  28. 2
      res/silentdragon_sr.ts
  29. 2
      res/silentdragon_template.ts
  30. BIN
      res/silentdragon_tr.qm
  31. 2
      res/silentdragon_tr.ts
  32. BIN
      res/silentdragon_uk.qm
  33. 2
      res/silentdragon_uk.ts
  34. BIN
      res/silentdragon_zh.qm
  35. 2
      res/silentdragon_zh.ts
  36. 38
      src/connection.cpp
  37. 12
      src/connection.h
  38. 4
      src/main.cpp
  39. 42
      src/mainwindow.cpp
  40. 2
      src/mainwindow.h
  41. 4
      src/requestdialog.cpp
  42. 16
      src/rpc.cpp
  43. 4
      src/rpc.h
  44. 10
      src/settings.cpp
  45. 12
      src/settings.h

2
res/silentdragon_be.ts

@ -2692,7 +2692,7 @@ You either have unconfirmed funds or the balance is too low for an automatic mig
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="61"/>
<source>Show Advanced Configuration</source>

2
res/silentdragon_bg.ts

@ -2117,7 +2117,7 @@ Would you like to visit the releases page?</source>
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_de.qm

Binary file not shown.

4
res/silentdragon_de.ts

@ -672,7 +672,7 @@
<translation type="vanished">Die URI sollte folgendes Format haben: &apos;hush:&lt;Adresse&gt;?Betrag=x&amp;Nachricht=y</translation>
</message>
<message>
<source>Paste Zcash URI</source>
<source>Paste Hush URI</source>
<translation type="vanished">Füge HUSH URI ein</translation>
</message>
<message>
@ -2412,7 +2412,7 @@ You either have unconfirmed funds or the balance is too low for an automatic mig
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_es.qm

Binary file not shown.

4
res/silentdragon_es.ts

@ -2347,7 +2347,7 @@ El saldo es insuficiente para una migración automática.
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>
@ -2470,7 +2470,7 @@ El saldo es insuficiente para una migración automática.
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;ZBoard: Fully anonymous and untraceable chat messages based on the ZCash blockchain. &lt;a href=&quot;http://www.z-board.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.z-board.net/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="vanished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;ZBoard: Mensajes de chat totalmente anónimos e imposibles de rastrear basados en la cadena de bloques Zcash. &lt;a href=&quot;http://www.z-board.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.z-board.net/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
<translation type="vanished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;ZBoard: Mensajes de chat totalmente anónimos e imposibles de rastrear basados en la cadena de bloques Hush. &lt;a href=&quot;http://www.z-board.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.z-board.net/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>Warning</source>

BIN
res/silentdragon_fi.qm

Binary file not shown.

4
res/silentdragon_fi.ts

@ -1461,7 +1461,7 @@ Aseta isäntä/portti ja käyttäjänimi/salasana Muokkaa-&gt; Asetukset-valikos
<translation>Osoitteen Formaatti Virhe</translation>
</message>
<message>
<source> doesn&apos;t seem to be a valid Zcash address.</source>
<source> doesn&apos;t seem to be a valid Hush address.</source>
<translation type="obsolete">YOUR_TRANSLATION_HERE</translation>
</message>
<message>
@ -2367,7 +2367,7 @@ Sinulla on joko vahvistamattomia varoja tai saldo on liian pieni automaattiseen
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_fil.qm

Binary file not shown.

2
res/silentdragon_fil.ts

@ -2189,7 +2189,7 @@ Would you like to visit the releases page?</source>
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_fr.qm

Binary file not shown.

2
res/silentdragon_fr.ts

@ -2385,7 +2385,7 @@ Vous avez soit des fonds non confirmés soit le solde est trop petit pour une mi
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_hr.qm

Binary file not shown.

2
res/silentdragon_hr.ts

@ -2192,7 +2192,7 @@ Would you like to visit the releases page?</source>
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_id.qm

Binary file not shown.

2
res/silentdragon_id.ts

@ -2180,7 +2180,7 @@ Would you like to visit the releases page?</source>
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_it.qm

Binary file not shown.

2
res/silentdragon_it.ts

@ -2357,7 +2357,7 @@ Avete fondi non confermati o il saldo è troppo basso per una migrazione automat
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_nl.qm

Binary file not shown.

2
res/silentdragon_nl.ts

@ -2418,7 +2418,7 @@ Je hebt nog onbevestigde transacties of je saldo is te laag voor een automatisch
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_pt.qm

Binary file not shown.

4
res/silentdragon_pt.ts

@ -2341,7 +2341,7 @@ Você possui fundos não confirmados ou o saldo é muito baixo para uma migraç
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>
@ -2464,7 +2464,7 @@ Você possui fundos não confirmados ou o saldo é muito baixo para uma migraç
</message>
<message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;ZBoard: Fully anonymous and untraceable chat messages based on the ZCash blockchain. &lt;a href=&quot;http://www.z-board.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.z-board.net/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="vanished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;ZBoard: Chat de mensagens totalmente anônimas e irrastreáveis usando a blockchain da Zcash. &lt;a href=&quot;http://www.z-board.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.z-board.net/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
<translation type="vanished">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;ZBoard: Chat de mensagens totalmente anônimas e irrastreáveis usando a blockchain da Hush. &lt;a href=&quot;http://www.z-board.net/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.z-board.net/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message>
<message>
<source>Warning</source>

BIN
res/silentdragon_ro.qm

Binary file not shown.

2
res/silentdragon_ro.ts

@ -2190,7 +2190,7 @@ Doriti sa vizitati pagina veriunii?</translation>
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_ru.qm

Binary file not shown.

2
res/silentdragon_ru.ts

@ -2693,7 +2693,7 @@ You either have unconfirmed funds or the balance is too low for an automatic mig
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="61"/>
<source>Show Advanced Configuration</source>

BIN
res/silentdragon_sr.qm

Binary file not shown.

2
res/silentdragon_sr.ts

@ -2192,7 +2192,7 @@ Would you like to visit the releases page?</source>
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

2
res/silentdragon_template.ts

@ -1760,7 +1760,7 @@ Would you like to visit the releases page?</source>
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_tr.qm

Binary file not shown.

2
res/silentdragon_tr.ts

@ -2350,7 +2350,7 @@ Onaylanmamış fonunuz var veya otomatik geçiş için bakiye çok düşük.</tr
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="14"/>
<source>Configure HUSH3.conf</source>

BIN
res/silentdragon_uk.qm

Binary file not shown.

2
res/silentdragon_uk.ts

@ -2704,7 +2704,7 @@ You either have unconfirmed funds or the balance is too low for an automatic mig
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<location filename="../src/createzcashconfdialog.ui" line="61"/>
<source>Show Advanced Configuration</source>

BIN
res/silentdragon_zh.qm

Binary file not shown.

2
res/silentdragon_zh.ts

@ -2604,7 +2604,7 @@ You either have unconfirmed funds or the balance is too low for an automatic mig
</message>
</context>
<context>
<name>createZcashConf</name>
<name>createHushConf</name>
<message>
<source>Configure hush.conf</source>
<translation type="vanished"> hush.conf</translation>

38
src/connection.cpp

@ -55,23 +55,23 @@ void ConnectionLoader::doAutoConnect(bool tryEzcashdStart) {
}
// Priority 2: Try to connect to detect HUSH3.conf and connect to it.
auto config = autoDetectZcashConf();
auto config = autoDetectHushConf();
main->logger->write(QObject::tr("Attempting autoconnect"));
if (config.get() != nullptr) {
auto connection = makeConnection(config);
refreshZcashdState(connection, [=] () {
refreshHushdState(connection, [=] () {
// Refused connection. So try and start embedded zcashd
if (Settings::getInstance()->useEmbedded()) {
if (tryEzcashdStart) {
this->showInformation(QObject::tr("Starting embedded hushd"));
if (this->startEmbeddedZcashd()) {
if (this->startEmbeddedHushd()) {
// Embedded hushd started up. Wait a second and then refresh the connection
main->logger->write("Embedded hushd started up, trying autoconnect in 1 sec");
QTimer::singleShot(1000, [=]() { doAutoConnect(); } );
} else {
if (config->zcashDaemon) {
if (config->hushDaemon) {
// hushd is configured to run as a daemon, so we must wait for a few seconds
// to let it start up.
main->logger->write("hushd is daemon=1. Waiting for it to start up");
@ -89,7 +89,7 @@ void ConnectionLoader::doAutoConnect(bool tryEzcashdStart) {
// We tried to start ehushd previously, and it didn't work. So, show the error.
main->logger->write("Couldn't start embedded hushd for unknown reason");
QString explanation;
if (config->zcashDaemon) {
if (config->hushDaemon) {
explanation = QString() % QObject::tr("You have hushd set to start as a daemon, which can cause problems "
"with SilentDragon\n\n."
"Please remove the following line from your HUSH3.conf and restart SilentDragon\n"
@ -319,7 +319,7 @@ void ConnectionLoader::doNextDownload(std::function<void(void)> cb) {
});
}
bool ConnectionLoader::startEmbeddedZcashd() {
bool ConnectionLoader::startEmbeddedHushd() {
if (!Settings::getInstance()->useEmbedded())
return false;
@ -429,7 +429,7 @@ void ConnectionLoader::doManualConnect() {
}
auto connection = makeConnection(config);
refreshZcashdState(connection, [=] () {
refreshHushdState(connection, [=] () {
QString explanation = QString()
% QObject::tr("Could not connect to hushd configured in settings.\n\n"
"Please set the host/port and user/password in the Edit->Settings menu.");
@ -442,7 +442,7 @@ void ConnectionLoader::doManualConnect() {
}
void ConnectionLoader::doRPCSetConnection(Connection* conn) {
rpc->setEZcashd(ehushd);
rpc->setEHushd(ehushd);
rpc->setConnection(conn);
d->accept();
@ -469,7 +469,7 @@ Connection* ConnectionLoader::makeConnection(std::shared_ptr<ConnectionConfig> c
return new Connection(main, client, request, config);
}
void ConnectionLoader::refreshZcashdState(Connection* connection, std::function<void(void)> refused) {
void ConnectionLoader::refreshHushdState(Connection* connection, std::function<void(void)> refused) {
main->logger->write("refreshing state");
QJsonObject payload = {
@ -512,7 +512,7 @@ void ConnectionLoader::refreshZcashdState(Connection* connection, std::function<
this->showInformation(QObject::tr("Your hushd is starting up. Please wait."), status);
main->logger->write("Waiting for hushd to come online.");
// Refresh after one second
QTimer::singleShot(1000, [=]() { this->refreshZcashdState(connection, refused); });
QTimer::singleShot(1000, [=]() { this->refreshHushdState(connection, refused); });
}
}
);
@ -540,14 +540,14 @@ void ConnectionLoader::showInformation(QString info, QString detail) {
* Show error will close the loading dialog and show an error.
*/
void ConnectionLoader::showError(QString explanation) {
rpc->setEZcashd(nullptr);
rpc->setEHushd(nullptr);
rpc->noConnection();
QMessageBox::critical(main, QObject::tr("Connection Error"), explanation, QMessageBox::Ok);
d->close();
}
QString ConnectionLoader::locateZcashConfFile() {
QString ConnectionLoader::locateHushConfFile() {
#ifdef Q_OS_LINUX
auto confLocation = QStandardPaths::locate(QStandardPaths::HomeLocation, ".komodo/HUSH3/HUSH3.conf");
#elif defined(Q_OS_DARWIN)
@ -643,11 +643,11 @@ bool ConnectionLoader::verifyParams() {
/**
* Try to automatically detect a HUSH3/HUSH3.conf file in the correct location and load parameters
*/
std::shared_ptr<ConnectionConfig> ConnectionLoader::autoDetectZcashConf() {
auto confLocation = locateZcashConfFile();
std::shared_ptr<ConnectionConfig> ConnectionLoader::autoDetectHushConf() {
auto confLocation = locateHushConfFile();
if (confLocation.isNull()) {
// No Zcash file, just return with nothing
// No file, just return with nothing
return nullptr;
}
@ -662,11 +662,11 @@ std::shared_ptr<ConnectionConfig> ConnectionLoader::autoDetectZcashConf() {
auto zcashconf = new ConnectionConfig();
zcashconf->host = "127.0.0.1";
zcashconf->connType = ConnectionType::DetectedConfExternalHushD;
zcashconf->usingZcashConf = true;
zcashconf->usingHushConf = true;
zcashconf->zcashDir = QFileInfo(confLocation).absoluteDir().absolutePath();
zcashconf->zcashDaemon = false;
zcashconf->hushDaemon = false;
Settings::getInstance()->setUsingZcashConf(confLocation);
Settings::getInstance()->setUsingHushConf(confLocation);
while (!in.atEnd()) {
QString line = in.readLine();
@ -684,7 +684,7 @@ std::shared_ptr<ConnectionConfig> ConnectionLoader::autoDetectZcashConf() {
zcashconf->port = value;
}
if (name == "daemon" && value == "1") {
zcashconf->zcashDaemon = true;
zcashconf->hushDaemon = true;
}
if (name == "proxy") {
zcashconf->proxy = value;

12
src/connection.h

@ -20,8 +20,8 @@ struct ConnectionConfig {
QString port;
QString rpcuser;
QString rpcpassword;
bool usingZcashConf;
bool zcashDaemon;
bool usingHushConf;
bool hushDaemon;
QString zcashDir;
QString proxy;
QString consolidation;
@ -42,7 +42,7 @@ public:
void loadConnection();
private:
std::shared_ptr<ConnectionConfig> autoDetectZcashConf();
std::shared_ptr<ConnectionConfig> autoDetectHushConf();
std::shared_ptr<ConnectionConfig> loadFromSettings();
Connection* makeConnection(std::shared_ptr<ConnectionConfig> config);
@ -51,16 +51,16 @@ private:
void doManualConnect();
void createHushConf();
QString locateZcashConfFile();
QString locateHushConfFile();
QString zcashConfWritableLocation();
QString zcashParamsDir();
bool verifyParams();
void downloadParams(std::function<void(void)> cb);
void doNextDownload(std::function<void(void)> cb);
bool startEmbeddedZcashd();
bool startEmbeddedHushd();
void refreshZcashdState(Connection* connection, std::function<void(void)> refused);
void refreshHushdState(Connection* connection, std::function<void(void)> refused);
void showError(QString explanation);
void showInformation(QString info, QString detail = "");

4
src/main.cpp

@ -222,7 +222,7 @@ public:
// If there was a payment URI on the command line, pay it
if (parser.positionalArguments().length() > 0) {
w->payZcashURI(parser.positionalArguments()[0]);
w->payHushURI(parser.positionalArguments()[0]);
}
// Listen for any secondary instances telling us about a Hush payment URI
@ -230,7 +230,7 @@ public:
QString uri(msg);
// We need to execute this async, otherwise the app seems to crash for some reason.
QTimer::singleShot(1, [=]() { w->payZcashURI(uri); });
QTimer::singleShot(1, [=]() { w->payHushURI(uri); });
});
// For MacOS, we have an event filter

42
src/mainwindow.cpp

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

2
src/mainwindow.h

@ -55,7 +55,7 @@ public:
void stopWebsocket();
void balancesReady();
void payZcashURI(QString uri = "", QString myAddr = "");
void payHushURI(QString uri = "", QString myAddr = "");
void validateAddress();

4
src/requestdialog.cpp

@ -82,7 +82,7 @@ void RequestDialog::showPaymentConfirmation(MainWindow* main, QString paymentURI
req.lblHeader->setText(tr("You are paying a payment request. Your address will not be visible to the person requesting this payment."));
if (d.exec() == QDialog::Accepted) {
main->payZcashURI(paymentURI, req.cmbMyAddress->currentText());
main->payHushURI(paymentURI, req.cmbMyAddress->currentText());
}
}
@ -136,6 +136,6 @@ void RequestDialog::showRequestZcash(MainWindow* main) {
// If the disclosed address in the memo doesn't have a balance, it will automatically fallback to the default
// sapling address
main->payZcashURI(sendURI, req.cmbMyAddress->currentText());
main->payHushURI(sendURI, req.cmbMyAddress->currentText());
}
}

16
src/rpc.cpp

@ -68,7 +68,7 @@ RPC::~RPC() {
delete conn;
}
void RPC::setEZcashd(std::shared_ptr<QProcess> p) {
void RPC::setEHushd(std::shared_ptr<QProcess> p) {
ehushd = p;
if (ehushd && ui->tabWidget->widget(4) == nullptr) {
@ -86,9 +86,9 @@ void RPC::setConnection(Connection* c) {
ui->statusBar->showMessage("Ready! Thank you for helping secure the Hush network by running a full node.");
// See if we need to remove the reindex/rescan flags from the zcash.conf file
auto zcashConfLocation = Settings::getInstance()->getZcashdConfLocation();
Settings::removeFromZcashConf(zcashConfLocation, "rescan");
Settings::removeFromZcashConf(zcashConfLocation, "reindex");
auto hushConfLocation = Settings::getInstance()->getHushdConfLocation();
Settings::removeFromHushConf(hushConfLocation, "rescan");
Settings::removeFromHushConf(hushConfLocation, "reindex");
// Refresh the UI
refreshPrice();
@ -579,7 +579,7 @@ void RPC::getInfoThenRefresh(bool force) {
// Fuck The KYC Traitor named jl777
//QString kmdver = reply["KMDversion"].toString();
Settings::getInstance()->setZcashdVersion(version);
Settings::getInstance()->setHushdVersion(version);
ui->longestchain->setText(QString::number(longestchain));
ui->notarizedhashvalue->setText( ntzhash );
@ -708,7 +708,7 @@ void RPC::getInfoThenRefresh(bool force) {
else {
tooltip = QObject::tr("hushd has no peer connections! Network issues?");
}
tooltip = tooltip % "(v" % QString::number(Settings::getInstance()->getZcashdVersion()) % ")";
tooltip = tooltip % "(v" % QString::number(Settings::getInstance()->getHushdVersion()) % ")";
if (!hushPrice.isEmpty()) {
tooltip = "1 HUSH = " % hushPrice % "\n" % tooltip;
@ -1210,7 +1210,7 @@ void RPC::refreshPrice() {
});
}
void RPC::shutdownZcashd() {
void RPC::shutdownHushd() {
// Shutdown embedded hushd if it was started
if (ehushd == nullptr || ehushd->processId() == 0 || conn == nullptr) {
// No hushd running internally, just return
@ -1254,7 +1254,7 @@ void RPC::shutdownZcashd() {
if ((ehushd->atEnd() && ehushd->processId() == 0) ||
ehushd->state() == QProcess::NotRunning ||
waitCount > 30 ||
conn->config->zcashDaemon) { // If hushd is daemon, then we don't have to do anything else
conn->config->hushDaemon) { // If hushd is daemon, then we don't have to do anything else
qDebug() << "Ended";
waiter.stop();
QTimer::singleShot(1000, [&]() { d.accept(); });

4
src/rpc.h

@ -38,7 +38,7 @@ public:
~RPC();
void setConnection(Connection* c);
void setEZcashd(std::shared_ptr<QProcess> p);
void setEHushd(std::shared_ptr<QProcess> p);
const QProcess* getEHushD() { return ehushd.get(); }
void refresh(bool force = false);
@ -78,7 +78,7 @@ public:
void importTPrivKey(QString addr, bool rescan, const std::function<void(QJsonValue)>& cb);
void validateAddress(QString address, const std::function<void(QJsonValue)>& cb);
void shutdownZcashd();
void shutdownHushd();
void noConnection();
bool isEmbedded() { return ehushd != nullptr; }

10
src/settings.cpp

@ -89,7 +89,7 @@ void Settings::saveRestoreTableHeader(QTableView* table, QDialog* d, QString tab
});
}
void Settings::setUsingZcashConf(QString confLocation) {
void Settings::setUsingHushConf(QString confLocation) {
if (!confLocation.isEmpty())
_confLocation = confLocation;
}
@ -131,11 +131,11 @@ bool Settings::isTAddress(QString addr) {
return addr.startsWith("R");
}
int Settings::getZcashdVersion() {
int Settings::getHushdVersion() {
return _zcashdVersion;
}
void Settings::setZcashdVersion(int version) {
void Settings::setHushdVersion(int version) {
_zcashdVersion = version;
}
@ -329,7 +329,7 @@ QString Settings::getDonationAddr() {
return "zs1aq4xnrkjlnxx0zesqye7jz3dfrf3rjh7q5z6u8l6mwyqqaam3gx3j2fkqakp33v93yavq46j83q";
}
bool Settings::addToZcashConf(QString confLocation, QString line) {
bool Settings::addToHushConf(QString confLocation, QString line) {
QFile file(confLocation);
if (!file.open(QIODevice::ReadWrite | QIODevice::Append))
return false;
@ -352,7 +352,7 @@ void Settings::set_currency_name(QString currency_name) {
}
bool Settings::removeFromZcashConf(QString confLocation, QString option) {
bool Settings::removeFromHushConf(QString confLocation, QString option) {
if (confLocation.isEmpty())
return false;

12
src/settings.h

@ -54,8 +54,8 @@ public:
bool isSyncing();
void setSyncing(bool syncing);
int getZcashdVersion();
void setZcashdVersion(int version);
int getHushdVersion();
void setHushdVersion(int version);
void setUseEmbedded(bool r) { _useEmbedded = r; }
bool useEmbedded() { return _useEmbedded; }
@ -89,8 +89,8 @@ public:
QString get_currency_name();
void set_currency_name(QString currency_name);
void setUsingZcashConf(QString confLocation);
const QString& getZcashdConfLocation() { return _confLocation; }
void setUsingHushConf(QString confLocation);
const QString& getHushdConfLocation() { return _confLocation; }
void setHUSHPrice(double p) { hushPrice = p; }
void set_fiat_price(double p) { fiat_price = p; }
@ -136,8 +136,8 @@ public:
static bool isValidAddress(QString addr);
static bool addToZcashConf(QString confLocation, QString line);
static bool removeFromZcashConf(QString confLocation, QString option);
static bool addToHushConf(QString confLocation, QString line);
static bool removeFromHushConf(QString confLocation, QString option);
static const QString labelRegExp;

Loading…
Cancel
Save