diff --git a/.gitignore b/.gitignore index 90f9b5e9..d8688d98 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,5 @@ safecoinwallet node_modules safe-qt-wallet.pro.user safecoinwallet_resource.rc -msvc_make.bat \ No newline at end of file +msvc_make.bat +safewallet_resource.rc diff --git a/README.md b/README.md index 2754afb5..cc83c0fd 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ make ./safewallet.app/Contents/MacOS/safewallet ``` +For a more indepth build guide please read our mac build guide [here](docs/build-mac.md) ### Emulating the embedded node In binary releases, safewallet will use node binaries in the current directory to sync a node from scratch. @@ -93,4 +94,3 @@ The above assumes safewallet and safecoin git repos are in the same directory. F ### Support For support or other questions, Join [Discord](https://discordapp.com/invite/vQgYGJz), or tweet at [@safecoins](https://twitter.com/safecoins) or [file an issue](https://github.com/Fair-Exchange/safewallet/issues). - diff --git a/application.qrc b/application.qrc index 70ec80de..692d46cf 100644 --- a/application.qrc +++ b/application.qrc @@ -31,7 +31,8 @@ res/css/dark.css res/css/default.css res/css/light.css - res/css/matrix.css + res/css/midnight.css + res/css/matrix.css res/images/blue/unchecked.png diff --git a/res/css/blue.css b/res/css/blue.css index 93dc0de7..2f4d3daa 100644 --- a/res/css/blue.css +++ b/res/css/blue.css @@ -11,7 +11,7 @@ QLabel { QGroupBox#groupBox { background-color: #014d67; - margin: 25px; + margin: -5px; margin-top: 10px; margin-bottom: 10px; padding: 15px; @@ -46,21 +46,6 @@ QGroupBox#horizontalGroupBox_3 { border-left: 7px solid #e6e6e6; } -/* send to */ -QGroupBox#groupBox_3 { - background-color: #014d67; - margin: 25px; - margin-top: 10px; - margin-bottom: 10px; - padding: 15px; - border-radius: 4px; - border-left: 7px solid #e6e6e6; -} - -QGroupBox#verticalGroupBox { - background-color: #014d67; - border-radius: 4px; -} QGroupBox#groupBox_3 QScrollArea { background-color: #014d67; @@ -99,16 +84,6 @@ QGroupBox#groupBox_3 QWidget#sendToWidgets QPushButton:pressed { border:1px solid #e6e6e6; } -/* send from */ -QGroupBox#groupBox_4 { - background-color: #014d67; - margin: 25px; - margin-top: 10px; - margin-bottom: 10px; - padding: 15px; - border-radius: 4px; - border-left: 7px solid #e6e6e6; -} /* Receive with section */ QGroupBox#groupBox_6 { @@ -406,3 +381,7 @@ QCheckBox::indicator:indeterminate:pressed { image:url(':/images/blue/res/images/blue/checked'); } +QComboBox { /* default values */ + min-height: 30px; + min-width: 100px; +} diff --git a/res/css/dark.css b/res/css/dark.css index 1791cedf..66e947f2 100644 --- a/res/css/dark.css +++ b/res/css/dark.css @@ -48,21 +48,6 @@ QGroupBox#horizontalGroupBox_3 { border-left: 7px solid #014d67; } -/* send to */ -QGroupBox#groupBox_3 { - background-color: #212121; - margin: 25px; - margin-top: 10px; - margin-bottom: 10px; - padding: 15px; - border-radius: 4px; - border-left: 7px solid #014d67; -} - -QGroupBox#verticalGroupBox { - background-color: #212121; - border-radius: 4px; -} QGroupBox#groupBox_3 QScrollArea { background-color: #212121; @@ -407,3 +392,7 @@ QCheckBox::indicator:indeterminate:pressed { image:url(':/images/blue/res/images/blue/checked'); } +QComboBox { /* default values */ + min-height: 30px; + min-width: 100px; +} diff --git a/res/css/default.css b/res/css/default.css index 424151f7..599ab934 100644 --- a/res/css/default.css +++ b/res/css/default.css @@ -1,5 +1,8 @@ QWidget, QMainWindow, QMenuBar, QMenu, QDialog, QTabWidget, QTableView, QTableView::item, QScrollArea, QGroupBox, QPlainTextEdit, QLineEdit, QLabel, MainWindow { /**/ - -} \ No newline at end of file +} +QComboBox { /* default values */ + min-height: 30px; + min-width: 100px; +} diff --git a/res/css/light.css b/res/css/light.css index da487434..dbbe8011 100644 --- a/res/css/light.css +++ b/res/css/light.css @@ -49,21 +49,6 @@ QGroupBox#horizontalGroupBox_3 { border-left: 7px solid #014d67; } -/* send to */ -QGroupBox#groupBox_3 { - background-color: #e6e6e6; - margin: 25px; - margin-top: 10px; - margin-bottom: 10px; - padding: 15px; - border-radius: 4px; - border-left: 7px solid #014d67; -} - -QGroupBox#verticalGroupBox { - background-color: #e6e6e6; - border-radius: 4px; -} QGroupBox#groupBox_3 QScrollArea { background-color: #e6e6e6; @@ -427,3 +412,7 @@ QCheckBox::indicator:indeterminate:pressed { image:url(':/images/blue/res/images/blue/checked'); } +QComboBox { /* default values */ + min-height: 30px; + min-width: 100px; +} \ No newline at end of file diff --git a/res/css/matrix.css b/res/css/matrix.css index 4eab9b40..2c30087d 100644 --- a/res/css/matrix.css +++ b/res/css/matrix.css @@ -133,7 +133,7 @@ QLineEdit:disabled, QPushButton:disabled, QPlainTextEdit:disabled { QComboBox { background-color: rgba(0, 16, 0, 128); - min-height: 28px; + min-height: 28px; min-width: 80px; border: 1px solid rgb(0, 64, 0); border-radius: 4px; @@ -194,4 +194,4 @@ QDialogButtonBox { QHeaderView::section { background-color: rgba(0, 0, 0, 0.6); border: 1px solid rgb(0, 128, 0); -} +} \ No newline at end of file diff --git a/res/css/midnight.css b/res/css/midnight.css new file mode 100644 index 00000000..a041d276 --- /dev/null +++ b/res/css/midnight.css @@ -0,0 +1,144 @@ +/* +Theme: Midnight Qt +Version: 1.0.2 +Reference: https://doc.qt.io/qt-5/stylesheet-reference.html + +Author: Charles Sharpe +Date: Apr. 23, 2020 +Website: https://www.csharpe.me +License: https://opensource.org/licenses/MIT +*/ + +QWidget, QMainWindow, QMenuBar, QMenu, QDialog, QTabWidget, QTableView, QTableView::item, QScrollArea, QGroupBox, QPlainTextEdit, QLineEdit, QLabel, MainWindow +{ +background-color: #111; +color: #fff; +} + +QPushButton { +padding: 10px 15px; +} + +QPushButton:hover { +background: #222; +} + +QLineEdit, QRadioButton::indicator::unchecked, QCheckBox::indicator::unchecked { +background: #222; +border: 1px solid #333; +border-radius: 3px; +} + +QLineEdit { +font-size: 12px; +} + +QLineEdit:focus { +border: 1px solid #9d8400; +} + +QWidget QLabel { +font-size: 11pt; +} + +QWidget QCheckBox { +font-weight: bold; +} + +QTabWidget QTabBar::tab { +min-height: 15px; +padding: 15px 25px; +border: 1px ridge #222; +left: 1px; /* Fix 1px alignment */ +background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111); +} + +QTabWidget QTabBar::tab:selected { +background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #555, stop: 1 #111); +color:#fff; +border: 1px ridge #222; +border-bottom: 0px; /* Overwrites border-bottom */ +} + +QTabWidget QTabBar::tab:hover { +background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #555, stop: 1 #111); +} + +QHeaderView { /* Table Header */ +background-color:#111; +} + +QHeaderView::section { /* Table Header Sections */ +qproperty-alignment:center; +background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111); +color:#fff; +min-height:25px; +font-weight:bold; +font-size:12px; +outline:0; +border:1px ridge #222; +padding: 2px 5px; +} + +QHeaderView::section:last { +border-right: 0px ridge #222; +} + +QScrollArea { +background:transparent; +border:0px; +} + +QTableView { /* Table - has to be selected as a class otherwise it throws off QCalendarWidget */ +background:#111; +} + +QTableView::item { /* Table Item */ +background-color:#111; +border:1px solid #222; +font-size:12px; +} + +QTableView::item:selected { /* Table Item Selected */ +background-color:#fff; +color:#000; +} + +QMenuBar { +background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #222, stop: 1 #111); +color: #fff; +} + +QMenuBar::item { +background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #222, stop: 1 #111); +color: #fff; +padding: 5px 7px; +margin: 0px; +} + +QMenuBar::item:selected { +background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111); +} + +QMenu { +border:1px solid #222; +} + +QMenu::item { +padding: 7px 15px; +} + +QMenu::item:selected { +background: #222; +} + +QMenu::separator { + height: 1px; + margin: 3px 7px 3px 7px; /* space at ends of separator */ + background: #222; +} + +QComboBox { /* default values */ + min-height: 30px; + min-width: 100px; +} diff --git a/res/safe_qt_wallet_uk.qm b/res/safe_qt_wallet_uk.qm index 6d62745d..d5f966c3 100644 Binary files a/res/safe_qt_wallet_uk.qm and b/res/safe_qt_wallet_uk.qm differ diff --git a/src/about.ui b/src/about.ui index d363ee95..12f8c590 100644 --- a/src/about.ui +++ b/src/about.ui @@ -52,12 +52,12 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Copyright (c) 2019 Martin, OleksandrBlack, miodrag, Duke Leto, David Mercer and Aditya Kulkarni. (MIT License)</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Copyright (c) 2020 Jeff Galloway, Martin, OleksandrBlack, miodrag, Duke Leto, David Mercer and Aditya Kulkarni. (MIT License)</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Special thanks to:</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">JSON for Modern C++ : </span><a href="https://nlohmann.github.io/json/"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">https://nlohmann.github.io/json/</span></a></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">QR Code generator library Nayuki : </span><a href="https://www.nayuki.io/page/qr-code-generator-library"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">https://www.nayuki.io/page/qr-code-ge…</span></a></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Made with QT : </span><a href="https://www.qt.io/"><span style=" font-family:'MS Shell Dlg 2'; text-decoration: underline; color:#0000ff;">https://www.qt.io/</span></a></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">JSON for Modern C++ : </span><a href="https://nlohmann.github.io/json/"><span style=" text-decoration: underline; color:#0000ff;">https://nlohmann.github.io/json/</span></a></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">QR Code generator library Nayuki : </span><a href="https://www.nayuki.io/page/qr-code-generator-library"><span style=" text-decoration: underline; color:#0000ff;">https://www.nayuki.io/page/qr-code-ge…</span></a></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Made with QT : </span><a href="https://www.qt.io/"><span style=" text-decoration: underline; color:#0000ff;">https://www.qt.io/</span></a></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">LICENSE:</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</span></p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Ubuntu'; font-size:11pt;" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</li> diff --git a/src/connection.cpp b/src/connection.cpp index e08b74ad..d42dfdb8 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -22,7 +22,7 @@ ConnectionLoader::ConnectionLoader(MainWindow* main, RPC* rpc) { QMovie *movie1 = new QMovie(":/img/res/safecoindlogo.gif");; QMovie *movie2 = new QMovie(":/img/res/safecoindlogo.gif");; auto theme = Settings::getInstance()->get_theme_name(); - if (theme == "dark") { + if (theme == "dark" || "midnight") { movie2->setScaledSize(QSize(256,256)); connD->topIcon->setMovie(movie2); movie2->start(); @@ -366,6 +366,7 @@ bool ConnectionLoader::startEmbeddedZcashd() { // Finally, start safecoind QDir appPath(QCoreApplication::applicationDirPath()); + #ifdef Q_OS_WIN64 auto safecoindProgram = appPath.absoluteFilePath("safecoind.exe"); @@ -436,18 +437,18 @@ bool ConnectionLoader::startEmbeddedZcashd() { #ifdef Q_OS_LINUX qDebug() << "Starting on Linux: "; - ezcashd->start(safecoindProgram); + ezcashd->QProcess::start(safecoindProgram, QStringList()); #elif defined(Q_OS_DARWIN) qDebug() << "Starting on Darwin: "; - ezcashd->start(safecoindProgram); + ezcashd->QProcess::start(safecoindProgram, QStringList()); #elif defined(Q_OS_WIN64) qDebug() << "Starting on Win64: "; ezcashd->setWorkingDirectory(appPath.absolutePath()); - ezcashd->start(safecoindProgram); + ezcashd->QProcess::start(safecoindProgram, QStringList()); #else qDebug() << "Starting on Unknown OS(!): "; ezcashd->setWorkingDirectory(appPath.absolutePath()); - ezcashd->start(safecoindProgram); + ezcashd->QProcess::start(safecoindProgram, QStringList()); #endif // Q_OS_LINUX main->logger->write("Started"); @@ -524,7 +525,7 @@ void ConnectionLoader::refreshZcashdState(Connection* connection, std::function< // Success main->logger->write("safecoind is online!"); // Delay 1 second to ensure loading (splash) is seen at least 1 second. - QTimer::singleShot(1000, [=]() { this->doRPCSetConnection(connection); }); + QTimer::singleShot(5000, [=]() { this->doRPCSetConnection(connection); }); }, [=] (QNetworkReply* reply, const QJsonValue &res) { // Failed, see what it is. @@ -554,7 +555,7 @@ void ConnectionLoader::refreshZcashdState(Connection* connection, std::function< this->showInformation(QObject::tr("Your safecoind is starting up. Please wait."), status); main->logger->write("Waiting for safecoind to come online."); // Refresh after one second - QTimer::singleShot(5000, [=]() { this->refreshZcashdState(connection, refused); }); + QTimer::singleShot(10000, [=]() { this->refreshZcashdState(connection, refused); }); } } ); @@ -619,10 +620,6 @@ QString ConnectionLoader::zcashParamsDir() { //TODO: If /usr/share/hush exists, use that. It should not be assumed writeable #ifdef Q_OS_LINUX auto paramsLocation = QDir(QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".zcash-params")); - // Debian packages do not install into per-user dirs - if (!paramsLocation.exists()) { - paramsLocation = QDir(QDir("/").filePath("usr/share/safecoin")); - } #elif defined(Q_OS_DARWIN) auto paramsLocation = QDir(QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath("Library/Application Support/ZcashParams")); #else diff --git a/src/connection.h b/src/connection.h index 5e6c29ef..fe31ae3d 100644 --- a/src/connection.h +++ b/src/connection.h @@ -122,10 +122,10 @@ class Connection { QString method = payloadGenerator(payloads[0])["method"].toString(); - //if (inProgress.value(method, false)) { - // qDebug() << "In progress batch, skipping"; - // return; - //} + // if (inProgress.value(method, false)) { + // qDebug() << "In progress batch, skipping"; + // return; + // } for (auto item: payloads) { QJsonValue payload = payloadGenerator(item); diff --git a/src/createzcashconfdialog.ui b/src/createzcashconfdialog.ui index ee233a1b..da17d884 100644 --- a/src/createzcashconfdialog.ui +++ b/src/createzcashconfdialog.ui @@ -14,24 +14,57 @@ Configure safecoin.conf - - + + - Your safecoin node will be configured for you automatically + <html><head/><body><p>Skips the most expensive checks during the initial block download. <a href="https://docs.zecwallet.co/using-zecwallet/#fastsync"><span style=" text-decoration: underline; color:#0000ff;">Learn More</span></a></p></body></html> - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + Qt::RichText + + + true + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - - + + + + + 0 + 0 + + + + + 128 + 128 + + + + + 128 + 128 + + + + + - Enable Fast Sync + - + true + + Qt::AlignCenter + @@ -61,28 +94,6 @@ - - - - - 0 - 0 - - - - background: #fff; - - - - - - true - - - Qt::AlignCenter - - - @@ -96,6 +107,13 @@ + + + + Qt::Horizontal + + + @@ -195,30 +213,24 @@ - - - - Qt::Horizontal + + + + Your safecoin node will be configured for you automatically + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - + + - <html><head/><body><p>Skips the most expensive checks during the initial block download. <a href="https://docs.zecwallet.co/using-zecwallet/#fastsync"><span style=" text-decoration: underline; color:#0000ff;">Learn More</span></a></p></body></html> - - - Qt::RichText - - - true + Enable Fast Sync - + true - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 303d8edc..e59b88bb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -396,7 +396,7 @@ void MainWindow::setupSettingsModal() { QDir zcashdir(rpc->getConnection()->config->zcashDir); QFile WalletSize(zcashdir.filePath("wallet.dat")); if (WalletSize.open(QIODevice::ReadOnly)){ - size = WalletSize.size() / 1000000; //when file does open. + size = WalletSize.size() / 1000; //when file does open. //QString size1 = QString::number(size) ; settings.WalletSize->setText(QString::number(size)); WalletSize.close(); @@ -1146,6 +1146,7 @@ void MainWindow::setupBalancesTab() { ui->unconfirmedWarning->setVisible(false); ui->lblSyncWarning->setVisible(false); ui->lblSyncWarningReceive->setVisible(false); + // Double click on balances table auto fnDoSendFrom = [=](const QString& addr, const QString& to = QString(), bool sendMax = false) { @@ -1259,11 +1260,11 @@ void MainWindow::SafeNodesTab() { QMovie *movie2 = new QMovie(":/img/res/safenodelogo.gif");; auto theme = Settings::getInstance()->get_theme_name(); if (theme == "dark") { - movie2->setScaledSize(QSize(256,256)); + movie2->setScaledSize(QSize(128,128)); ui->safenodelogo->setMovie(movie2); movie2->start(); } else { - movie1->setScaledSize(QSize(256,256)); + movie1->setScaledSize(QSize(128,128)); ui->safenodelogo->setMovie(movie1); movie1->start(); } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index ef581be7..98f7eebb 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -22,7 +22,7 @@ - 5 + 0 @@ -68,7 +68,7 @@ 0 - 0 + 5 0 @@ -319,6 +319,24 @@ + + + 0 + 0 + + + + + 1000 + 0 + + + + + 16777215 + 16777215 + + Recent Transactions @@ -330,7 +348,7 @@ 0 - 0 + 5 0 @@ -340,6 +358,24 @@ + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + QAbstractItemView::SingleSelection @@ -349,6 +385,9 @@ false + + false + true @@ -488,7 +527,7 @@ 0 0 1004 - 323 + 304 @@ -808,6 +847,25 @@ + + + + + 75 + true + + + + color: red; + + + Sending button are hidden until complete synchronization or transaction confirmation + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -1134,13 +1192,6 @@ - - - - safenodelogo - - - @@ -1175,6 +1226,16 @@ + + + + safenodelogo + + + Qt::AlignCenter + + + @@ -1411,7 +1472,7 @@ - + Qt::Horizontal @@ -1715,7 +1776,7 @@ - + @@ -2540,6 +2601,8 @@ minerFeeAmt sendToScrollArea - + + + diff --git a/src/rpc.cpp b/src/rpc.cpp index 961b8a08..70cdaf61 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -125,7 +125,7 @@ QJsonValue RPC::makePayload(QString method) { void RPC::getTAddresses(const std::function& cb) { QString method = "getaddressesbyaccount"; - QString params = ""; + // QString params = ""; // We're removing the params to get all addresses, similar to z_listaddresses for Z conn->doRPCWithDefaultErrorHandling(makePayload(method, ""), cb); } @@ -219,7 +219,7 @@ void RPC::importTPrivKey(QString privkey, bool rescan, const std::function> return; } + auto callnum = new int; // A special function that will call the callback when two lists have been added auto holder = new QPair>>(); holder->first = 0; // This is the number of times the callback has been called, initialized to 0 @@ -287,28 +288,35 @@ void RPC::getAllPrivKeys(const std::function> // Add all std::copy(list.begin(), list.end(), std::back_inserter(holder->second)); - + // And if the caller has been called twice, do the parent callback with the // collected list - if (holder->first == 2) { + if (holder->first == 3) { // Sort so z addresses are on top std::sort(holder->second.begin(), holder->second.end(), [=] (auto a, auto b) { return a.first > b.first; }); cb(holder->second); + delete holder; - } + } + }; // A utility fn to do the batch calling auto fnDoBatchGetPrivKeys = [=](QJsonValue getAddressPayload, QString privKeyDumpMethodName) { - conn->doRPCWithDefaultErrorHandling(getAddressPayload, [=] (QJsonValue resp) { + conn->doRPCIgnoreError(getAddressPayload, [=] (QJsonValue resp) { QList addrs; for (auto addr : resp.toArray()) { addrs.push_back(addr.toString()); } - // Then, do a batch request to get all the private keys + if (addrs.isEmpty()){ + holder->first++; + return; + } + + // Then, do a batch request to get all the private keys conn->doBatchRPC( addrs, [=] (auto addr) { @@ -318,17 +326,16 @@ void RPC::getAllPrivKeys(const std::function> {"method", privKeyDumpMethodName}, {"params", QJsonArray { addr }}, }; - return payload; + return payload; }, [=] (QMap* privkeys) { QList> allTKeys; - for (QString addr: privkeys->keys()) { + for (QString addr: privkeys->keys()) { allTKeys.push_back( QPair( addr, privkeys->value(addr).toString())); } - fnCombineTwoLists(allTKeys); delete privkeys; } @@ -340,10 +347,19 @@ void RPC::getAllPrivKeys(const std::function> QJsonObject payloadT = { {"jsonrpc", "1.0"}, {"id", "someid"}, - {"method", "getaddressesbyaccount"}, - {"params", QJsonArray {""} } + {"method", "getaddressesbyaccount"} + // {"params", QJsonArray {""} } // We're removing params here in order to get addressesin all accounts, similar to z_listaddresses + }; + + // Unspent addresses. Added because there are situations where the unspent address is not assigned to any account + QJsonObject payloadU = { + {"jsonrpc", "1.0"}, + {"id", "someid"}, + {"method", "listunspent"}, + {"params", QJsonArray {-2} } // Simplified listunspent to return addresses for unset accounts }; + QJsonObject payloadZ = { {"jsonrpc", "1.0"}, {"id", "someid"}, @@ -351,7 +367,10 @@ void RPC::getAllPrivKeys(const std::function> }; fnDoBatchGetPrivKeys(payloadT, "dumpprivkey"); + fnDoBatchGetPrivKeys(payloadU, "dumpprivkey"); fnDoBatchGetPrivKeys(payloadZ, "z_exportkey"); + + } @@ -745,7 +764,7 @@ void RPC::getInfoThenRefresh(bool force) { ui->tier->setText("addressindex not enabled"); } - is_valid = reply["is_valid"].toInt(); + is_valid = reply["is_valid"].toBool(); QString error_line; @@ -983,8 +1002,18 @@ void RPC::refreshAddresses() { // Function to create the data model and update the views, used below. void RPC::updateUI(bool anyUnconfirmed) { - ui->unconfirmedWarning->setVisible(anyUnconfirmed); + ui->unconfirmedWarning->setVisible(anyUnconfirmed); + + // Sending button are hidden until complete synchronization or transaction confirmation + if (anyUnconfirmed == true) { + ui->sendTransactionButton->setVisible(false); + ui->BlocksendingWarning->setVisible(true); + } else { + ui->sendTransactionButton->setVisible(true); + ui->BlocksendingWarning->setVisible(false); + } + // Update balances model data, which will update the table too balancesTableModel->setNewData(allBalances, utxos); diff --git a/src/settings.ui b/src/settings.ui index 80737dd8..a050cace 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -6,8 +6,8 @@ 0 0 - 600 - 610 + 540 + 500 @@ -151,47 +151,37 @@ Options - - - - Qt::Horizontal + + + + Connect via Tor - - + + - Remember shielded transactions + Normally, change from t-Addresses goes to another t-Address. Checking this option will send the change to your shielded sapling address instead. Check this option to increase your privacy. + + + true - - + + - Connect to github on startup to check for updates + Remember shielded transactions - - + + - Connect via Tor + Check github for updates at startup - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -220,26 +210,55 @@ - + Qt::Horizontal - - + + - Connect to the Tor network via SOCKS proxy running on 127.0.0.1:9050. Please note that you'll have to install and run the Tor service externally. + Connect to github on startup to check for updates - - true + + + + + + Clear History - - - + + + + + + 0 + 0 + + + + + 75 + true + + + + Qt::LeftToRight + + + Theme + + + Qt::AlignCenter + + + + + Qt::Horizontal @@ -251,295 +270,251 @@ - - - - - - - 0 - 0 - - - - Theme - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + + 75 + true + + + + Local Currency + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 100 + 30 + + + + + 100 + 30 + + + + + AED + - - - - 0 - 0 - - - - - default - - - - - blue - - - - - light - - - - - dark - - - + + ARS + - - - false - - - - 0 - 0 - - - - Local Currency - - - Qt::AlignCenter - - + + AUD + - - - - 0 - 0 - - - - - AED - - - - - ARS - - - - - AUD - - - - - BDT - - - - - BHD - - - - - BMD - - - - - BRL - - - - - BTC - - - - - CAD - - - - - CHF - - - - - CLP - - - - - CNY - - - - - CZK - - - - - DKK - - - - - EUR - - - - - GBP - - - - - HKD - - - - - HUF - - - - - IDR - - - - - ILS - - - - - INR - - - - - JPY - - - - - KRW - - - - - KWD - - - - - LKR - - - - - MXN - - - - - NZD - - - - - RUB - - - - - SAR - - - - - SEK - - - - - SGD - - - - - THB - - - - - TRY - - - - - TWD - - - - - UAH - - - - - USD - - - - - VEF - - - - - VND - - - - - XAG - - - - - XAU - - - - - ZAR - - - + + BDT + - - - - + + + BHD + + + + + BMD + + + + + BRL + + + + + BTC + + + + + CAD + + + + + CHF + + + + + CLP + + + + + CNY + + + + + CZK + + + + + DKK + + + + + EUR + + + + + GBP + + + + + HKD + + + + + HUF + + + + + IDR + + + + + ILS + + + + + INR + + + + + JPY + + + + + KRW + + + + + KWD + + + + + LKR + + + + + MXN + + + + + NZD + + + + + RUB + + + + + SAR + + + + + SEK + + + + + SGD + + + + + THB + + + + + TRY + + + + + TWD + + + + + UAH + + + + + USD + + + + + VEF + + + + + VND + + + + + XAG + + + + + XAU + + + + + ZAR + + + - - + + Qt::Horizontal @@ -551,19 +526,78 @@ + + + + + 0 + 0 + + + + + 100 + 30 + + + + + 100 + 30 + + + + + default + + + + + blue + + + + + light + + + + + dark + + + + + midnight + + + + + matrix + + + + - - + + + + Qt::Horizontal + + + + + - Check github for updates at startup + Allow custom fees - - + + - Normally, change from t-Addresses goes to another t-Address. Checking this option will send the change to your shielded sapling address instead. Check this option to increase your privacy. + Connect to the Tor network via SOCKS proxy running on 127.0.0.1:9050. Please note that you'll have to install and run the Tor service externally. true @@ -577,28 +611,54 @@ - - + + Clear History + + + + Qt::Horizontal + + + + 40 + 20 + + + + - + Qt::Horizontal - - - - Clear History + + + + Qt::Vertical - + + + 20 + 40 + + + - + + + + + Explorer + + + Qt::Vertical @@ -612,214 +672,174 @@ - + + + + 0 + 0 + + + + + https://explorer.safecoin.org/address/ + + + + + https://explorer.deepsky.space/address/ + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Wallet.dat Size : + + + Qt::AlignCenter + + + + + + + 100 + + + + + + + kb + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + + + https://explorer.safecoin.org/tx/ + + + + + https://explorer.deepsky.space/tx/ + + + + + + - Allow custom fees + Tx Explorer URL + + + + + + + Testnet Tx Explorer URL + + + + + + + https://explorer.testnet.z.cash/tx/ + + + + + + + Qt::Horizontal + + + + + + + + 75 + true + false + + + + Explorer Settings + + + Qt::AlignCenter + + + + + + + https://explorer.testnet.safecoin.org/address/ + + + + + + + Testnet Address Explorer URL + + + + + + + Address Explorer URL + + + + + + + Qt::Horizontal - - - Explorer - - - - - 330 - 550 - 51 - 17 - - - - 100 - - - - - - 210 - 550 - 111 - 17 - - - - Wallet.dat Size : - - - - - - 370 - 550 - 41 - 17 - - - - MB - - - - - - 10 - 6 - 551 - 521 - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 75 - true - false - - - - Explorer Settings - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - - - - Tx Explorer URL - - - - - - - - https://explorer.safecoin.org/tx/ - - - - - https://explorer.deepsky.space/tx/ - - - - - - - - Address Explorer URL - - - - - - - - https://explorer.safecoin.org/address/ - - - - - https://explorer.deepsky.space/address/ - - - - - - - - Qt::Horizontal - - - - - - - Testnet Tx Explorer URL - - - - - - - https://explorer.testnet.z.cash/tx/ - - - - - - - Testnet Address Explorer URL - - - - - - - https://explorer.testnet.safecoin.org/address/ - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Troubleshooting @@ -902,7 +922,7 @@ - + SafeNodes @@ -959,7 +979,7 @@ - + 60 diff --git a/src/txtablemodel.cpp b/src/txtablemodel.cpp index 0fc171f8..56bc6822 100644 --- a/src/txtablemodel.cpp +++ b/src/txtablemodel.cpp @@ -133,8 +133,9 @@ void TxTableModel::updateAllData() { else return addr; } - case 2: return QDateTime::fromMSecsSinceEpoch(modeldata->at(index.row()).datetime * (qint64)1000).toLocalTime().toString(); - case 3: return Settings::getDisplayFormat(modeldata->at(index.row()).amount); + case Column::Time: return QDateTime::fromMSecsSinceEpoch(dat.datetime * (qint64)1000).toLocalTime().toString(); + case Column::Confirmations: return QString::number(dat.confirmations); + case Column::Amount: return Settings::getDisplayFormat(dat.amount); } } @@ -144,6 +145,7 @@ void TxTableModel::updateAllData() { if (dat.memo.startsWith("safecoin:")) { return Settings::paymentURIPretty(Settings::parseURI(dat.memo)); } else { + // Don't render memo html in tooltip return modeldata->at(index.row()).type + (dat.memo.isEmpty() ? "" : " tx memo: \"" + dat.memo.toHtmlEscaped() + "\""); } @@ -175,8 +177,7 @@ void TxTableModel::updateAllData() { } else { // Empty pixmap to make it align QPixmap p(16, 16); - //p.fill(Qt::white); - p.fill(Qt::transparent); + p.fill(Qt::white); return QVariant(p); } } diff --git a/src/txtablemodel.h b/src/txtablemodel.h index f295bc57..c6e0bcfb 100644 --- a/src/txtablemodel.h +++ b/src/txtablemodel.h @@ -52,4 +52,4 @@ class TxTableModel: public QAbstractTableModel }; -#endif // STRINGSTABLEMODEL_H +#endif // STRINGSTABLEMODEL_H \ No newline at end of file diff --git a/src/version.h b/src/version.h index a4eda95a..0ad09d1c 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define APP_VERSION "0.36.2" +#define APP_VERSION "0.36.5"