Browse Source

Clean up

pull/81/head
Duke Leto 3 years ago
parent
commit
0d1c6048e4
  1. 14
      src/connection.cpp
  2. 6
      src/connection.h
  3. 2
      src/mainwindow.cpp
  4. 4
      src/mainwindow.ui
  5. 2
      src/requestdialog.cpp
  6. 2
      src/scripts/dounifiedbuild.ps1
  7. 16
      src/scripts/mkwininstaller.ps1
  8. 2
      src/senttxstore.cpp

14
src/connection.cpp

@ -47,7 +47,7 @@ void ConnectionLoader::loadConnection() {
d->exec(); d->exec();
} }
void ConnectionLoader::doAutoConnect(bool tryEzcashdStart) { void ConnectionLoader::doAutoConnect(bool tryEhushdStart) {
// Priority 1: Ensure all params are present. // Priority 1: Ensure all params are present.
if (!verifyParams()) { if (!verifyParams()) {
qDebug() << "Cannot find sapling params!"; qDebug() << "Cannot find sapling params!";
@ -64,7 +64,7 @@ void ConnectionLoader::doAutoConnect(bool tryEzcashdStart) {
refreshHushdState(connection, [=] () { refreshHushdState(connection, [=] () {
// Refused connection. So try and start embedded hushd // Refused connection. So try and start embedded hushd
if (Settings::getInstance()->useEmbedded()) { if (Settings::getInstance()->useEmbedded()) {
if (tryEzcashdStart) { if (tryEhushdStart) {
this->showInformation(QObject::tr("Starting embedded hushd")); this->showInformation(QObject::tr("Starting embedded hushd"));
if (this->startEmbeddedHushd()) { if (this->startEmbeddedHushd()) {
// Embedded hushd started up. Wait a second and then refresh the connection // Embedded hushd started up. Wait a second and then refresh the connection
@ -255,7 +255,7 @@ void ConnectionLoader::doNextDownload(std::function<void(void)> cb) {
int filesRemaining = downloadQueue->size(); int filesRemaining = downloadQueue->size();
QString filename = fnSaveFileName(url); QString filename = fnSaveFileName(url);
QString paramsDir = zcashParamsDir(); QString paramsDir = zkParamsDir();
if (QFile(QDir(paramsDir).filePath(filename)).exists()) { if (QFile(QDir(paramsDir).filePath(filename)).exists()) {
main->logger->write(filename + " already exists, skipping"); main->logger->write(filename + " already exists, skipping");
@ -593,7 +593,7 @@ QString ConnectionLoader::hushConfWritableLocation() {
return QDir::cleanPath(confLocation); return QDir::cleanPath(confLocation);
} }
QString ConnectionLoader::zcashParamsDir() { QString ConnectionLoader::zkParamsDir() {
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
//TODO: If /usr/share/hush exists, use that. It should not be assumed writeable //TODO: If /usr/share/hush exists, use that. It should not be assumed writeable
auto paramsLocation = QDir(QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".zcash-params")); auto paramsLocation = QDir(QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".zcash-params"));
@ -617,7 +617,7 @@ QString ConnectionLoader::zcashParamsDir() {
} }
bool ConnectionLoader::verifyParams() { bool ConnectionLoader::verifyParams() {
QDir paramsDir(zcashParamsDir()); QDir paramsDir(zkParamsDir());
// TODO: better error reporting if only 1 file exists or is missing // TODO: better error reporting if only 1 file exists or is missing
qDebug() << "Verifying sapling param files exist"; qDebug() << "Verifying sapling param files exist";
@ -734,9 +734,7 @@ std::shared_ptr<ConnectionConfig> ConnectionLoader::autoDetectHushConf() {
return std::shared_ptr<ConnectionConfig>(hushconf); return std::shared_ptr<ConnectionConfig>(hushconf);
} }
/** // Load connection settings from the UI, which indicates an unknown, external hushd
* Load connection settings from the UI, which indicates an unknown, external zcashd
*/
std::shared_ptr<ConnectionConfig> ConnectionLoader::loadFromSettings() { std::shared_ptr<ConnectionConfig> ConnectionLoader::loadFromSettings() {
// Load from the QT Settings. // Load from the QT Settings.
QSettings s; QSettings s;

6
src/connection.h

@ -47,13 +47,13 @@ private:
Connection* makeConnection(std::shared_ptr<ConnectionConfig> config); Connection* makeConnection(std::shared_ptr<ConnectionConfig> config);
void doAutoConnect(bool tryEzcashdStart = true); void doAutoConnect(bool tryEhushdStart = true);
void doManualConnect(); void doManualConnect();
void createHushConf(); void createHushConf();
QString locateHushConfFile(); QString locateHushConfFile();
QString hushConfWritableLocation(); QString hushConfWritableLocation();
QString zcashParamsDir(); QString zkParamsDir();
bool verifyParams(); bool verifyParams();
void downloadParams(std::function<void(void)> cb); void downloadParams(std::function<void(void)> cb);
@ -84,7 +84,7 @@ private:
}; };
/** /**
* Represents a connection to a zcashd. It may even start a new zcashd if needed. * Represents a connection to a hushd. It may even start a new hushd if needed.
* This is also a UI class, so it may show a dialog waiting for the connection. * This is also a UI class, so it may show a dialog waiting for the connection.
*/ */
class Connection { class Connection {

2
src/mainwindow.cpp

@ -61,7 +61,7 @@ MainWindow::MainWindow(QWidget *parent) :
}); });
// Request hush // Request hush
QObject::connect(ui->actionRequest_zcash, &QAction::triggered, [=]() { QObject::connect(ui->actionRequest_hush, &QAction::triggered, [=]() {
RequestDialog::showRequestZcash(this); RequestDialog::showRequestZcash(this);
}); });

4
src/mainwindow.ui

@ -1594,7 +1594,7 @@
<property name="title"> <property name="title">
<string>&amp;File</string> <string>&amp;File</string>
</property> </property>
<addaction name="actionRequest_zcash"/> <addaction name="actionRequest_hush"/>
<addaction name="actionPay_URI"/> <addaction name="actionPay_URI"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionImport_Private_Key"/> <addaction name="actionImport_Private_Key"/>
@ -1729,7 +1729,7 @@
<string>Ctrl+M</string> <string>Ctrl+M</string>
</property> </property>
</action> </action>
<action name="actionRequest_zcash"> <action name="actionRequest_hush">
<property name="text"> <property name="text">
<string>Request HUSH...</string> <string>Request HUSH...</string>
</property> </property>

2
src/requestdialog.cpp

@ -125,7 +125,7 @@ void RequestDialog::showRequestZcash(MainWindow* main) {
req.txtFrom->setFocus(); req.txtFrom->setFocus();
if (d.exec() == QDialog::Accepted) { if (d.exec() == QDialog::Accepted) {
// Construct a zcash Payment URI with the data and pay it immediately. // Construct a Hush Payment URI with the data and pay it immediately.
QString memoURI = "hush:" + req.cmbMyAddress->currentText() QString memoURI = "hush:" + req.cmbMyAddress->currentText()
+ "?amt=" + Settings::getDecimalString(req.txtAmount->text().toDouble()) + "?amt=" + Settings::getDecimalString(req.txtAmount->text().toDouble())
+ "&memo=" + QUrl::toPercentEncoding(req.txtMemo->toPlainText()); + "&memo=" + QUrl::toPercentEncoding(req.txtMemo->toPlainText());

2
src/scripts/dounifiedbuild.ps1

@ -28,7 +28,7 @@ Write-Host ""
Write-Host "[Building on Mac]" Write-Host "[Building on Mac]"
bash src/scripts/mkmacdmg.sh --qt_path ~/Qt/5.11.1/clang_64/ --version $version --zcash_path ~/gi/hush3 --certificate "$certificate" bash src/scripts/mkmacdmg.sh --qt_path ~/Qt/5.11.1/clang_64/ --version $version --hush_path ~/gi/hush3 --certificate "$certificate"
if (! $?) { if (! $?) {
Write-Output "[Error]" Write-Output "[Error]"
exit 1; exit 1;

16
src/scripts/mkwininstaller.ps1

@ -2,28 +2,28 @@ param (
[Parameter(Mandatory=$true)][string]$version [Parameter(Mandatory=$true)][string]$version
) )
$target="zecwallet-v$version" $target="silentdragon-v$version"
Remove-Item -Path release/wininstaller -Recurse -ErrorAction Ignore | Out-Null Remove-Item -Path release/wininstaller -Recurse -ErrorAction Ignore | Out-Null
New-Item release/wininstaller -itemtype directory | Out-Null New-Item release/wininstaller -itemtype directory | Out-Null
Copy-Item release/$target/zecwallet.exe release/wininstaller/ Copy-Item release/$target/silentdragon.exe release/wininstaller/
Copy-Item release/$target/LICENSE release/wininstaller/ Copy-Item release/$target/LICENSE release/wininstaller/
Copy-Item release/$target/README.md release/wininstaller/ Copy-Item release/$target/README.md release/wininstaller/
Copy-Item release/$target/zcashd.exe release/wininstaller/ Copy-Item release/$target/hushd.exe release/wininstaller/
Copy-Item release/$target/zcash-cli.exe release/wininstaller/ Copy-Item release/$target/hush-cli.exe release/wininstaller/
Get-Content src/scripts/zec-qt-wallet.wxs | ForEach-Object { $_ -replace "RELEASE_VERSION", "$version" } | Out-File -Encoding utf8 release/wininstaller/zec-qt-wallet.wxs Get-Content src/scripts/silentdragon.wxs | ForEach-Object { $_ -replace "RELEASE_VERSION", "$version" } | Out-File -Encoding utf8 release/wininstaller/silentdragon.wxs
candle.exe release/wininstaller/zec-qt-wallet.wxs -o release/wininstaller/zec-qt-wallet.wixobj candle.exe release/wininstaller/silentdragon.wxs -o release/wininstaller/silentdragon.wixobj
if (!$?) { if (!$?) {
exit 1; exit 1;
} }
light.exe -ext WixUIExtension -cultures:en-us release/wininstaller/zec-qt-wallet.wixobj -out release/wininstaller/zecwallet.msi light.exe -ext WixUIExtension -cultures:en-us release/wininstaller/silentdragon.wixobj -out release/wininstaller/silentdragon.msi
if (!$?) { if (!$?) {
exit 1; exit 1;
} }
New-Item artifacts -itemtype directory -Force | Out-Null New-Item artifacts -itemtype directory -Force | Out-Null
Copy-Item release/wininstaller/zecwallet.msi ./artifacts/Windows-installer-$target.msi Copy-Item release/wininstaller/silentdragon.msi ./artifacts/Windows-installer-$target.msi

2
src/senttxstore.cpp

@ -57,7 +57,7 @@ void SentTxStore::addToSentTx(Tx tx, QString txid) {
if (!Settings::getInstance()->getSaveZtxs()) if (!Settings::getInstance()->getSaveZtxs())
return; return;
// Also, only store outgoing txs where the from address is a z-Addr. Else, regular zcashd // Also, only store outgoing txs where the from address is a z-Addr. Else, regular hushd
// stores it just fine // stores it just fine
if (!tx.fromAddr.startsWith("z")) if (!tx.fromAddr.startsWith("z"))
return; return;

Loading…
Cancel
Save