Merge remote-tracking branch 'remotes/upstream/dev' into dev
This commit is contained in:
@@ -53,7 +53,7 @@ Compiling can take some time, so be patient and wait for it to finish. It will t
|
||||
|
||||
##### Ubuntu 18.04 and 20.04:
|
||||
```shell script
|
||||
sudo apt-get -y install qt5-default qt5-qmake libqt5websockets5-dev qtcreator qttools5-dev-tools
|
||||
sudo apt-get -y install build-essential qt5-default qt5-qmake libqt5websockets5-dev qtcreator qttools5-dev-tools
|
||||
git clone https://git.hush.is/hush/SilentDragonLite
|
||||
cd SilentDragonLite
|
||||
./build.sh linguist
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=SilentDragonLite
|
||||
Exec=/home/user/SilentDragonLite/SilentDragonLite
|
||||
Icon=/home/user/SilentDragonLite/res/SDLogo.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
@@ -71,3 +71,10 @@ echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
|
||||
./win-static-build.sh
|
||||
|
||||
```
|
||||
|
||||
# Adding a new SDL lite server backend to the code
|
||||
|
||||
* Add the new server name to the array in getRandomServer() in settings.cpp
|
||||
* Add the new server to dropdown in mainwindow.cpp
|
||||
|
||||
TODO: Make both of these places use a single list of servers.
|
||||
|
||||
10
install.sh
10
install.sh
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2019-2021 The Hush Developers
|
||||
|
||||
./build.sh linguist && ./build.sh
|
||||
|
||||
username=$(id -un)
|
||||
|
||||
sed -i "s|\/home\/.*\/SilentDragonLite\/|\/home\/$username\/SilentDragonLite\/|g" SilentDragonLite.desktop
|
||||
|
||||
mv SilentDragonLite.desktop ~/.local/share/applications
|
||||
@@ -1,2 +0,0 @@
|
||||
break FileSystem::readContactsOldFormat
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
# Project created by QtCreator 2018-10-05T09:54:45
|
||||
#
|
||||
#-------------------------------------------------
|
||||
# Copyright 2019-2021 The Hush Developers
|
||||
# Copyright 2019-2022 The Hush Developers
|
||||
# Released under the GPLv3
|
||||
|
||||
QT += core gui network
|
||||
|
||||
@@ -125,7 +126,6 @@ FORMS += \
|
||||
src/encryption.ui \
|
||||
src/hushrequest.ui \
|
||||
src/mainwindow.ui \
|
||||
src/migration.ui \
|
||||
src/newseed.ui \
|
||||
src/newwallet.ui \
|
||||
src/recurringpayments.ui \
|
||||
|
||||
2
src/3rdparty/sodium.h
vendored
2
src/3rdparty/sodium.h
vendored
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#ifndef sodium_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#include "Chat.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CHAT_H
|
||||
#define CHAT_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// GPLv3
|
||||
|
||||
#ifndef CHATDELEGATOR_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "FileEncryption.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef FILEENCRYPTION_H
|
||||
#define FILEENCRYPTION_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "passwd.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef PASSWD_H
|
||||
#define PASSWD_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#include "ChatDataStore.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CHATDATASTORE_H
|
||||
#define CHATDATASTORE_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// GPLv3
|
||||
|
||||
#include "ContactDataStore.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CONTACTDATASTORE_H
|
||||
#define CONTACTDATASTORE_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef DATASTORE_H
|
||||
#define DATASTORE_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "DataStore.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef DATASTORE_H
|
||||
#define DATASTORE_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "SietchDataStore.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef SIETCHDATASTORE_H
|
||||
#define SIETCHDATASTORE_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "FileSystem.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// GPLv3
|
||||
#ifndef FILESYSTEM_H
|
||||
#define FILESYSTEM_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGCONTEXT_H
|
||||
#define LOGCONTEXT_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGCRITICAL_H
|
||||
#define LOGCRITICAL_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGDEBUG_H
|
||||
#define LOGDEBUG_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGERROR_H
|
||||
#define LOGERROR_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGFATAL_H
|
||||
#define LOGFATAL_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGINFO_H
|
||||
#define LOGINFO_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGSTRATEGY_H
|
||||
#define LOGSTRATEGY_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGSUCCESS_H
|
||||
#define LOGSUCCESS_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGTYPE_H
|
||||
#define LOGTYPE_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGWARNING_H
|
||||
#define LOGWARNING_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "LogWriter.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGWRITER_H
|
||||
#define LOGWRITER_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef SIMPLELOGGER_H
|
||||
#define SIMPLELOGGER_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "SimpleLogger.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#include "ChatItem.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#ifndef CHATITEM_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// GPLv3
|
||||
#include "ContactItem.h"
|
||||
#include "chatmodel.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CONTACTITEM_H
|
||||
#define CONTACTITEM_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// GPLv3
|
||||
|
||||
#include "ContactRequest.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CONTACTREQUEST_H
|
||||
#define CONTACTREQUEST_H
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "ContactRequestChatItem.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifdef CONTACTREQUESTCHATITEM_H
|
||||
#define CONTACTREQUESTCHATITEM_H
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; 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;">Copyright (c) 2019-2021 The Hush developers GNU Public License V3</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright (c) 2019-2022 The Hush developers GNU Public License V3</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;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright (c) 2018-2019 Aditya Kulkarni, Duke Leto, Jane Mercer </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;"><br /></p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#include "addressbook.h"
|
||||
@@ -304,6 +304,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
||||
});
|
||||
|
||||
auto fnSetTargetLabelAddr = [=] (QLineEdit* target, QString label, QString addr, QString myAddr, QString cid, QString avatar) {
|
||||
qDebug() << __func__ << ": label=" << label << " cid=" << cid << " avatar=" << avatar;
|
||||
target->setText(label % "/" % addr % myAddr);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef ADDRESSBOOK_H
|
||||
#define ADDRESSBOOK_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "addresscombo.h"
|
||||
#include "addressbook.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef ADDRESSCOMBO_H
|
||||
#define ADDRESSCOMBO_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "balancestablemodel.h"
|
||||
#include "addressbook.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef BALANCESTABLEMODEL_H
|
||||
#define BALANCESTABLEMODEL_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "camount.h"
|
||||
#include "settings.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CAMOUNT_H
|
||||
#define CAMOUNT_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "chatbubbleme.h"
|
||||
#include "ui_chatbubbleme.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CHATBUBBLEME_H
|
||||
#define CHATBUBBLEME_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "chatbubblepartner.h"
|
||||
#include "ui_chatbubblepartner.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CHATBUBBLEPARTNER_H
|
||||
#define CHATBUBBLEPARTNER_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "chatmodel.h"
|
||||
#include "settings.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#ifndef CHATMODEL_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "connection.h"
|
||||
#include "mainwindow.h"
|
||||
@@ -76,14 +76,14 @@ void ConnectionLoader::loadProgress()
|
||||
|
||||
void ConnectionLoader::ShowProgress()
|
||||
{
|
||||
qDebug() << __func__;
|
||||
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
|
||||
config->dangerous = false;
|
||||
config->server = Settings::getInstance()->getSettings().server;
|
||||
|
||||
auto connection = makeConnection(config);
|
||||
auto me = this;
|
||||
qDebug() << __func__ << ": server=" << config->server
|
||||
<< " connection=" << connection << " me=" << me;
|
||||
qDebug() << __func__ << ": server=" << config->server << " connection=" << connection << " me=" << me;
|
||||
|
||||
isSyncing = new QAtomicInteger<bool>();
|
||||
isSyncing->store(true);
|
||||
@@ -147,6 +147,7 @@ void ConnectionLoader::doAutoConnect()
|
||||
|
||||
// Check to see if there's an existing wallet
|
||||
if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str())) {
|
||||
qDebug() << __func__ << ": using existing wallet";
|
||||
main->logger->write(QObject::tr("Using existing wallet."));
|
||||
char* resp = litelib_initialize_existing(
|
||||
config->dangerous,
|
||||
@@ -175,6 +176,7 @@ void ConnectionLoader::doAutoConnect()
|
||||
}
|
||||
|
||||
} else {
|
||||
qDebug() << __func__ << ": no existing wallet";
|
||||
main->logger->write(QObject::tr("Create/restore wallet."));
|
||||
createOrRestore(config->dangerous, config->server);
|
||||
d->show();
|
||||
@@ -248,6 +250,7 @@ void ConnectionLoader::doAutoConnect()
|
||||
|
||||
void ConnectionLoader::createOrRestore(bool dangerous, QString server)
|
||||
{
|
||||
qDebug() << __func__ << ": server=" << server;
|
||||
// Close the startup dialog, since we'll be showing the wizard
|
||||
d->hide();
|
||||
// Create a wizard
|
||||
@@ -264,13 +267,14 @@ void ConnectionLoader::doRPCSetConnection(Connection* conn)
|
||||
d->accept();
|
||||
QTimer::singleShot(1, [=]() { delete this; });
|
||||
|
||||
QFile plaintextWallet(dirwalletconnection);
|
||||
try {
|
||||
QFile plaintextWallet(dirwalletconnection);
|
||||
main->logger->write("Path to Wallet.dat : " );
|
||||
qDebug() << __func__ << ": wallet path =" << plaintextWallet;
|
||||
plaintextWallet.remove();
|
||||
|
||||
} catch (...) {
|
||||
qDebug() << "No plaintext wallet found! file=" << plaintextWallet;
|
||||
main->logger->write("no Plaintext wallet.dat");
|
||||
}
|
||||
|
||||
@@ -284,13 +288,14 @@ void ConnectionLoader::doRPCSetConnectionShield(Connection* conn)
|
||||
main->getRPC()->shield([=] (auto) {});
|
||||
QTimer::singleShot(1, [=]() { delete this; });
|
||||
|
||||
QFile plaintextWallet(dirwalletconnection);
|
||||
try {
|
||||
QFile plaintextWallet(dirwalletconnection);
|
||||
main->logger->write("Path to Wallet.dat : " );
|
||||
qDebug() << __func__ << ": wallet path =" << plaintextWallet;
|
||||
plaintextWallet.remove();
|
||||
} catch (...) {
|
||||
main->logger->write("no Plaintext wallet.dat");
|
||||
qDebug() << "No plaintext wallet found! file=" << plaintextWallet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CONNECTION_H
|
||||
#define CONNECTION_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// GPLv3
|
||||
|
||||
#include "contactmodel.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef CONTACTMODEL_H
|
||||
#define CONTACTMODEL_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#include "controller.h"
|
||||
@@ -44,7 +44,6 @@ Controller::Controller(MainWindow* main)
|
||||
transactionsTableModel = new TxTableModel(ui->transactionsTable);
|
||||
main->ui->transactionsTable->setModel(transactionsTableModel);
|
||||
|
||||
|
||||
// Set up timer to refresh Price
|
||||
priceTimer = new QTimer(main);
|
||||
QObject::connect(priceTimer, &QTimer::timeout, [=]() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "datamodel.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef DATAMODEL_H
|
||||
#define DATAMODEL_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "fillediconlabel.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef FILLEDICONLABEL_H
|
||||
#define FILLEDICONLABEL_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "firsttimewizard.h"
|
||||
#include "ui_newseed.h"
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "ui_newwallet.h"
|
||||
#include "mainwindow.h"
|
||||
#include "DataStore/DataStore.h"
|
||||
|
||||
#include "../lib/silentdragonlitelib.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -52,6 +51,7 @@ void FirstTimeWizard::slot_change_theme(const QString& theme_name) {
|
||||
|
||||
FirstTimeWizard::FirstTimeWizard(bool dangerous, QString server)
|
||||
{
|
||||
qDebug() << __func__ << ": dangerous=" << dangerous << " server=" << server;
|
||||
// Include css
|
||||
QString theme_name;
|
||||
try
|
||||
@@ -64,21 +64,19 @@ FirstTimeWizard::FirstTimeWizard(bool dangerous, QString server)
|
||||
}
|
||||
this->slot_change_theme(theme_name);
|
||||
|
||||
setWindowTitle("New wallet wizard");
|
||||
setWindowTitle(tr("New wallet wizard"));
|
||||
this->dangerous = dangerous;
|
||||
this->server = server;
|
||||
|
||||
|
||||
////backup addresslabels.dat if there is one, to restore it later
|
||||
//backup addresslabels.dat if there is one, to restore it later
|
||||
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
QString addressbook = dir.filePath("addresslabels.dat.enc");
|
||||
QFile file(addressbook);
|
||||
|
||||
if (file.exists())
|
||||
{
|
||||
file.rename(dir.filePath("addresslabels.dat.enc-backup"));
|
||||
|
||||
if (file.exists()) {
|
||||
file.rename(dir.filePath("addresslabels.dat.enc-backup"));
|
||||
qDebug() << __func__ << ": backed up old addresslabels";
|
||||
}
|
||||
|
||||
// Create the pages
|
||||
@@ -104,88 +102,89 @@ int FirstTimeWizard::nextId() const {
|
||||
|
||||
QString FirstTimeWizard::getSeed()
|
||||
{
|
||||
|
||||
return _seed;
|
||||
}
|
||||
|
||||
void FirstTimeWizard::setSeed(QString seed)
|
||||
{
|
||||
|
||||
_seed = seed;
|
||||
}
|
||||
|
||||
QString FirstTimeWizard::getBirthday()
|
||||
{
|
||||
|
||||
return _birthday;
|
||||
}
|
||||
|
||||
void FirstTimeWizard::setBirthday(QString birthday)
|
||||
{
|
||||
|
||||
_birthday = birthday;
|
||||
}
|
||||
|
||||
void FirstTimeWizard::initializePage() {
|
||||
qDebug() << "FirstTimeWizard:" <<__func__;
|
||||
|
||||
}
|
||||
|
||||
void NewOrRestorePage::initializePage() {
|
||||
qDebug() << "NewOrRestorePage:" <<__func__;
|
||||
|
||||
}
|
||||
|
||||
NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent) {
|
||||
setTitle("Create or Restore wallet.");
|
||||
qDebug() << __func__;
|
||||
setTitle(tr("Create or Restore wallet."));
|
||||
|
||||
QWidget* pageWidget = new QWidget();
|
||||
Ui_CreateWalletForm form;
|
||||
form.setupUi(pageWidget);
|
||||
|
||||
QGraphicsScene* scene = new QGraphicsScene();
|
||||
QGraphicsView* view = new QGraphicsView(scene);
|
||||
form.Logo->setScene(scene);
|
||||
QPixmap pixmap(":/icons/res/dark-01.png");
|
||||
scene->addPixmap(pixmap);
|
||||
form.Logo->show();
|
||||
|
||||
setButtonText(QWizard::CommitButton, tr("Next"));
|
||||
|
||||
parent->setOption(QWizard::NoBackButtonOnStartPage);
|
||||
|
||||
parent->button(QWizard::CommitButton)->setEnabled(false);
|
||||
setButtonText(QWizard::CommitButton, "Next");
|
||||
form.txtPassword->setEnabled(false);
|
||||
form.txtConfirmPassword->setEnabled(false);
|
||||
|
||||
QObject::connect(form.TOS, &QRadioButton::clicked, [=](bool checked) {
|
||||
QObject::connect(form.TOS, &QRadioButton::clicked, [=](bool checked) {
|
||||
qDebug() << __func__ << ": TOS radio button clicked";
|
||||
if (checked) {
|
||||
|
||||
form.txtPassword->setEnabled(true);
|
||||
form.txtConfirmPassword->setEnabled(true);
|
||||
|
||||
}else{
|
||||
qDebug() << __func__ << ": disabling next/commit buttons";
|
||||
parent->button(QWizard::CommitButton)->setEnabled(false);
|
||||
parent->button(QWizard::NextButton)->setEnabled(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
auto fnPasswordEdited = [=](const QString&) {
|
||||
auto fnPasswordEdited = [=](const QString&) {
|
||||
// Enable the Finish button if the passwords match.
|
||||
QString passphraseBlank = form.txtPassword->text();
|
||||
|
||||
QString passphrase = QString("HUSH3") + passphraseBlank + QString("SDL");
|
||||
|
||||
|
||||
if (!form.txtPassword->text().isEmpty() &&
|
||||
form.txtPassword->text() == form.txtConfirmPassword->text() && passphraseBlank.size() >= 16 ){
|
||||
|
||||
form.lblPasswordMatch->setText("");
|
||||
|
||||
|
||||
form.radioRestoreWallet->setEnabled(true);
|
||||
form.radioNewWallet->setEnabled(true);
|
||||
form.radioNewWallet->setChecked(true);
|
||||
parent->button(QWizard::NextButton)->setEnabled(false);
|
||||
|
||||
|
||||
int length = passphrase.length();
|
||||
form.lblPasswordMatch->setText("");
|
||||
|
||||
form.radioRestoreWallet->setEnabled(true);
|
||||
form.radioNewWallet->setEnabled(true);
|
||||
parent->button(QWizard::NextButton)->setEnabled(false);
|
||||
|
||||
int length = passphrase.length();
|
||||
qDebug() << __func__ << ": passphrase length=" << length;
|
||||
|
||||
char *sequence = NULL;
|
||||
sequence = new char[length+1];
|
||||
strncpy(sequence, passphrase.toUtf8(), length +1);
|
||||
|
||||
QString passphraseHash = blake3_PW(sequence);
|
||||
|
||||
|
||||
char *sequence1 = NULL;
|
||||
sequence1 = new char[length+1];
|
||||
@@ -200,18 +199,20 @@ NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent
|
||||
|
||||
unsigned char key[KEY_LEN];
|
||||
|
||||
if (crypto_pwhash
|
||||
(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
if (crypto_pwhash(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
|
||||
crypto_pwhash_ALG_DEFAULT) != 0) {
|
||||
/* out of memory */
|
||||
}
|
||||
qDebug() << __func__ << ": crypto_pwhash failed! Possibly out of memory";
|
||||
exit(1);
|
||||
}
|
||||
QString passphraseHash1 = QByteArray(reinterpret_cast<const char*>(key), KEY_LEN).toHex();
|
||||
DataStore::getChatDataStore()->setPassword(passphraseHash1);
|
||||
|
||||
// Exclusive buttons
|
||||
QObject::connect(form.radioNewWallet, &QRadioButton::clicked, [=](bool checked) {
|
||||
if (checked) {
|
||||
qDebug() << __func__ << ": new wallet radio button clicked";
|
||||
form.radioRestoreWallet->setChecked(false);
|
||||
parent->button(QWizard::CommitButton)->setEnabled(true);
|
||||
|
||||
@@ -220,18 +221,16 @@ NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent
|
||||
|
||||
QObject::connect(form.radioRestoreWallet, &QRadioButton::clicked, [=](bool checked) {
|
||||
if (checked) {
|
||||
qDebug() << __func__ << ": restore wallet radio button clicked";
|
||||
form.radioNewWallet->setChecked(false);
|
||||
parent->button(QWizard::CommitButton)->setEnabled(true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
form.lblPasswordMatch->setText(tr("Passphrase don't match or You have entered too few letters (16 minimum)"));
|
||||
qDebug() << __func__ << ": passphrases do not match";
|
||||
form.lblPasswordMatch->setText(tr("Passphrase don't match or You have entered too few letters (16 minimum)"));
|
||||
|
||||
parent->button(QWizard::CommitButton)->setEnabled(false);
|
||||
form.radioRestoreWallet->setEnabled(false);
|
||||
@@ -243,24 +242,34 @@ NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->addWidget(pageWidget);
|
||||
setLayout(layout);
|
||||
|
||||
|
||||
QObject::connect(form.txtConfirmPassword, &QLineEdit::textChanged, fnPasswordEdited);
|
||||
QObject::connect(form.txtPassword, &QLineEdit::textChanged, fnPasswordEdited);
|
||||
|
||||
registerField("intro.new", form.radioNewWallet);
|
||||
registerField("intro.restore", form.radioRestoreWallet);
|
||||
|
||||
// A trailing * means these are REQUIRED fields and "Next" button will be disabled
|
||||
// until they are filled
|
||||
registerField("TOS*", form.TOS);
|
||||
registerField("txtPassword*", form.txtPassword);
|
||||
registerField("txtConfirmPassword*", form.txtPassword);
|
||||
|
||||
form.radioRestoreWallet->setEnabled(false);
|
||||
form.radioNewWallet->setEnabled(false);
|
||||
|
||||
qDebug() << __func__ << ": disabling next/commit buttons";
|
||||
setCommitPage(true);
|
||||
|
||||
|
||||
|
||||
|
||||
parent->button(QWizard::CommitButton)->setEnabled(false);
|
||||
parent->button(QWizard::NextButton)->setEnabled(false);
|
||||
}
|
||||
|
||||
NewSeedPage::NewSeedPage(FirstTimeWizard *parent) : QWizardPage(parent) {
|
||||
qDebug() << __func__;
|
||||
this->parent = parent;
|
||||
|
||||
setTitle("Your new wallet");
|
||||
setTitle(tr("Your new wallet"));
|
||||
|
||||
QWidget* pageWidget = new QWidget();
|
||||
form.setupUi(pageWidget);
|
||||
@@ -273,9 +282,11 @@ NewSeedPage::NewSeedPage(FirstTimeWizard *parent) : QWizardPage(parent) {
|
||||
|
||||
void NewSeedPage::initializePage() {
|
||||
// Call the library to create a new wallet.
|
||||
qDebug() << __func__;
|
||||
|
||||
char* resp = litelib_initialize_new(parent->dangerous,parent->server.toStdString().c_str());
|
||||
QString reply = litelib_process_response(resp);
|
||||
qDebug() << __func__ << ": reply=" << reply;
|
||||
|
||||
auto parsed = json::parse(reply.toStdString().c_str(), nullptr, false);
|
||||
if (parsed.is_discarded() || parsed.is_null() || parsed.find("seed") == parsed.end()) {
|
||||
@@ -290,23 +301,24 @@ void NewSeedPage::initializePage() {
|
||||
parent->button(QWizard::CancelButton)->setEnabled(false);
|
||||
disconnect(parent->button(QWizard::CancelButton ), SIGNAL( clicked() ), parent, SLOT( reject() ) );
|
||||
connect(parent->button(QWizard::CancelButton ), SIGNAL( clicked() ), parent, SLOT( cancelEvent() ) );
|
||||
|
||||
qDebug() << __func__ << ": page initialized with birthday=" << birthday;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void FirstTimeWizard::cancelEvent()
|
||||
{
|
||||
if( QMessageBox::question( this, ( "Quit Setup" ), ( "Setup is not complete yet. Are you sure you want to quit setup?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
|
||||
// allow cancel
|
||||
reject();
|
||||
}
|
||||
void FirstTimeWizard::cancelEvent() {
|
||||
qDebug() << __func__;
|
||||
if( QMessageBox::question( this, ( "Quit Setup" ), ( "Setup is not complete yet. Are you sure you want to quit setup?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
|
||||
qDebug() << __func__ << ": wizard canceled";
|
||||
// allow cancel
|
||||
reject();
|
||||
}
|
||||
}
|
||||
|
||||
// Will be called just before closing. Make sure we can save the seed in the wallet
|
||||
// before we allow the page to be closed
|
||||
bool NewSeedPage::validatePage() {
|
||||
qDebug() << __func__;
|
||||
|
||||
Ui_verifyseed verifyseed;
|
||||
QDialog dialog(this);
|
||||
@@ -315,7 +327,6 @@ bool NewSeedPage::validatePage() {
|
||||
|
||||
form.birthday->setVisible(false);
|
||||
form.txtSeed->setVisible(false);
|
||||
|
||||
|
||||
QString seed = parent->getSeed();
|
||||
QString birthday = parent->getBirthday();
|
||||
@@ -603,8 +614,7 @@ bool NewSeedPage::validatePage() {
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
|
||||
qDebug()<<"Falscher Seed";
|
||||
qDebug()<<"Wrong Seed";
|
||||
QFile file(dirwalletencfirst);
|
||||
QFile file1(dirwalletfirst);
|
||||
|
||||
@@ -618,13 +628,15 @@ bool NewSeedPage::validatePage() {
|
||||
return false;
|
||||
this->validatePage();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
RestoreSeedPage::RestoreSeedPage(FirstTimeWizard *parent) : QWizardPage(parent) {
|
||||
this->parent = parent;
|
||||
|
||||
setTitle("Restore wallet from seed");
|
||||
setTitle(tr("Restore wallet from seed"));
|
||||
|
||||
QWidget* pageWidget = new QWidget();
|
||||
form.setupUi(pageWidget);
|
||||
@@ -638,7 +650,9 @@ RestoreSeedPage::RestoreSeedPage(FirstTimeWizard *parent) : QWizardPage(parent)
|
||||
bool RestoreSeedPage::validatePage() {
|
||||
// 1. Validate that we do have 24 words
|
||||
QString seed = form.txtSeed->toPlainText().replace(QRegExp("[ \n\r\t]+"), " ");
|
||||
if (seed.trimmed().split(" ").length() != 24) {
|
||||
auto seedLength = seed.trimmed().split(" ").length();
|
||||
qDebug() << __func__ << ": seed length=" << seedLength;
|
||||
if (seedLength != 24) {
|
||||
QMessageBox::warning(this, tr("Failed to restore wallet"),
|
||||
tr("SilentDragonLite needs 24 words to restore wallet"),
|
||||
QMessageBox::Ok);
|
||||
@@ -650,16 +664,16 @@ bool RestoreSeedPage::validatePage() {
|
||||
bool ok;
|
||||
qint64 birthday = birthday_str.toUInt(&ok);
|
||||
if (!ok) {
|
||||
qDebug() << __func__ << ": Failed to parse wallet birthday=" << birthday_str;
|
||||
QMessageBox::warning(this, tr("Failed to parse wallet birthday"),
|
||||
tr("Couldn't understand wallet birthday. This should be a block height from where to rescan the wallet. You can leave it as '0' if you don't know what it should be."),
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
|
||||
///Number
|
||||
|
||||
QString number_str = form.number->text();
|
||||
qint64 number = number_str.toUInt();
|
||||
///Number
|
||||
QString number_str = form.number->text();
|
||||
qint64 number = number_str.toUInt();
|
||||
// 3. Attempt to restore wallet with the seed phrase
|
||||
{
|
||||
char* resp = litelib_initialize_new_from_phrase(parent->dangerous, parent->server.toStdString().c_str(),
|
||||
@@ -681,6 +695,7 @@ qint64 number = number_str.toUInt();
|
||||
|
||||
auto parsed = json::parse(reply.toStdString().c_str(), nullptr, false);
|
||||
if (parsed.is_discarded() || parsed.is_null() || parsed.find("result") == parsed.end()) {
|
||||
qDebug() << __func__ << ": Failed to save wallet, reply=" << reply;
|
||||
QMessageBox::warning(this, tr("Failed to save wallet"),
|
||||
tr("Couldn't save the wallet") + "\n" + reply,
|
||||
QMessageBox::Ok);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2020 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef FIRSTTIMEWIZARD_H
|
||||
#define FIRSTTIMEWIZARD_H
|
||||
@@ -12,7 +12,7 @@
|
||||
class FirstTimeWizard: public QWizard
|
||||
{
|
||||
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FirstTimeWizard(bool dangerous, QString server);
|
||||
@@ -31,8 +31,10 @@ public slots:
|
||||
|
||||
protected:
|
||||
int nextId() const;
|
||||
virtual void initializePage();
|
||||
|
||||
private:
|
||||
FirstTimeWizard* parent;
|
||||
enum {
|
||||
Page_NewOrRestore,
|
||||
Page_New,
|
||||
@@ -46,15 +48,20 @@ private:
|
||||
friend class NewSeedPage;
|
||||
friend class RestoreSeedPage;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
class NewOrRestorePage: public QWizardPage {
|
||||
|
||||
public:
|
||||
|
||||
NewOrRestorePage(FirstTimeWizard* parent);
|
||||
|
||||
protected:
|
||||
virtual void initializePage();
|
||||
|
||||
private:
|
||||
FirstTimeWizard* parent;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -85,6 +92,4 @@ private:
|
||||
Ui_RestoreSeedForm form;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // FIRSTTIMEWIZARD_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "liteinterface.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef hushDRPC_H
|
||||
#define hushDRPC_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include <singleapplication.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "mainwindow.h"
|
||||
#include "addressbook.h"
|
||||
@@ -76,12 +76,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
}
|
||||
|
||||
this->slot_change_theme(theme_name);
|
||||
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
if (!dir.exists()){
|
||||
qDebug() << __func__ << ": creating dir=" << dir.absolutePath();
|
||||
QDir().mkpath(dir.absolutePath());
|
||||
}else{}
|
||||
|
||||
@@ -175,7 +175,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
restoreSeed.setupUi(&dialog);
|
||||
Settings::saveRestore(&dialog);
|
||||
|
||||
|
||||
rpc->fetchSeed([=](json reply) {
|
||||
if (isJsonError(reply)) {
|
||||
return;
|
||||
@@ -246,26 +245,29 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
tr("Couldn't save the wallet") + "\n" + reply,
|
||||
QMessageBox::Ok);
|
||||
|
||||
} else {}
|
||||
} else {
|
||||
qDebug() << __func__ << ": saved wallet correctly";
|
||||
}
|
||||
|
||||
dialog.close();
|
||||
// To rescan, we clear the wallet state, and then reload the connection
|
||||
dialog.close();
|
||||
// To rescan, we clear the wallet state, and then reload the connection
|
||||
// This will start a sync, and show the scanning status.
|
||||
this->getRPC()->clearWallet([=] (auto) {
|
||||
qDebug() << "Clearing wallet...";
|
||||
// Save the wallet
|
||||
this->getRPC()->saveWallet([=] (auto) {
|
||||
qDebug() << "Saving wallet...";
|
||||
// Then reload the connection. The ConnectionLoader deletes itself.
|
||||
auto cl = new ConnectionLoader(this, rpc);
|
||||
cl->loadConnection();
|
||||
});
|
||||
});
|
||||
|
||||
cl->loadConnection();
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
dialog.exec();
|
||||
});
|
||||
|
||||
dialog.exec();
|
||||
});
|
||||
|
||||
// Import Privkey
|
||||
@@ -432,6 +434,7 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
||||
|
||||
void MainWindow::closeEventpw(QCloseEvent* event) {
|
||||
// Let the RPC know to shut down any running service.
|
||||
qDebug() << __func__ << ": event=" << event;
|
||||
rpc->shutdownhushd();
|
||||
}
|
||||
|
||||
@@ -489,12 +492,16 @@ void MainWindow::encryptWallet() {
|
||||
|
||||
unsigned char key[KEY_LEN];
|
||||
|
||||
if (crypto_pwhash
|
||||
(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
if (crypto_pwhash(key, sizeof key, PASSWORD, strlen(PASSWORD), hash,
|
||||
crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE,
|
||||
crypto_pwhash_ALG_DEFAULT) != 0) {
|
||||
/* out of memory */
|
||||
}
|
||||
QMessageBox::information(this, tr("Out of memory!"),
|
||||
QString("Please close some other programs to free up memory and try again"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
QString passphraseHash1 = QByteArray(reinterpret_cast<const char*>(key), KEY_LEN).toHex();
|
||||
DataStore::getChatDataStore()->setPassword(passphraseHash1);
|
||||
|
||||
@@ -835,6 +842,8 @@ void MainWindow::setupSettingsModal() {
|
||||
settings.cmbServer->addItem("https://devo.crabdance.com");
|
||||
settings.cmbServer->addItem("https://lite.nyami.org");
|
||||
settings.cmbServer->addItem("https://poop.granitefone.me:9067");
|
||||
settings.cmbServer->addItem("https://lite.hushpool.is");
|
||||
|
||||
//settings.cmbServer->addItem("https://hush.leto.net:5420");
|
||||
//TODO: seperate lists of https/Tor servers, only show user or attempt
|
||||
// connection to .onion if user has it enabled
|
||||
@@ -995,6 +1004,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event) {
|
||||
// will prompt for one. If the myAddr is empty, then the default from address is used to send
|
||||
// the transaction.
|
||||
void MainWindow::payhushURI(QString uri, QString myAddr) {
|
||||
qDebug() << __func__ << ": uri=" << uri << " myAddr=" << myAddr;
|
||||
// If the Payments UI is not ready (i.e, all balances have not loaded), defer the payment URI
|
||||
if (!isPaymentsReady()) {
|
||||
qDebug() << "Payment UI not ready, waiting for UI to pay URI";
|
||||
@@ -1441,8 +1451,7 @@ void MainWindow::setupTransactionsTab() {
|
||||
int lastPost = memo.trimmed().lastIndexOf(QRegExp("[\r\n]+"));
|
||||
QString lastWord = memo.right(memo.length() - lastPost - 1);
|
||||
|
||||
if (Settings::getInstance()->isSaplingAddress(lastWord) ||
|
||||
Settings::getInstance()->isSproutAddress(lastWord)) {
|
||||
if (Settings::getInstance()->isSaplingAddress(lastWord)) {
|
||||
menu.addAction(tr("Reply to ") + lastWord.left(25) + "...", [=]() {
|
||||
// First, cancel any pending stuff in the send tab by pretending to click
|
||||
// the cancel button
|
||||
@@ -2429,7 +2438,7 @@ void MainWindow::addNewZaddr(bool sapling) {
|
||||
}
|
||||
|
||||
|
||||
// Adds sapling or sprout z-addresses to the combo box. Technically, returns a
|
||||
// Adds sapling z-addresses to the combo box. Technically, returns a
|
||||
// lambda, which can be connected to the appropriate signal
|
||||
std::function<void(bool)> MainWindow::addZAddrsToComboList(bool sapling) {
|
||||
return [=] (bool checked) {
|
||||
@@ -2770,9 +2779,7 @@ void MainWindow::updateLabels() {
|
||||
updateLabelsAutoComplete();
|
||||
}
|
||||
|
||||
void MainWindow::slot_change_currency(const QString& currency_name)
|
||||
|
||||
{
|
||||
void MainWindow::slot_change_currency(const QString& currency_name) {
|
||||
|
||||
Settings::getInstance()->set_currency_name(currency_name);
|
||||
|
||||
@@ -2788,9 +2795,7 @@ void MainWindow::slot_change_currency(const QString& currency_name)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slot_change_theme(const QString& theme_name)
|
||||
|
||||
{
|
||||
void MainWindow::slot_change_theme(const QString& theme_name) {
|
||||
Settings::getInstance()->set_theme_name(theme_name);
|
||||
|
||||
|
||||
@@ -2842,8 +2847,9 @@ void MainWindow::on_givemeZaddr_clicked()
|
||||
QMessageBox::information(this, "Your new HushChat address was copied to your clipboard!",hushchataddr);
|
||||
ui->listReceiveAddresses->insertItem(0, hushchataddr);
|
||||
ui->listReceiveAddresses->setCurrentIndex(0);
|
||||
qDebug() << __func__ << ": hushchat zaddr=" << hushchataddr << " created";
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "memoedit.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef MEMOEDIT_H
|
||||
#define MEMOEDIT_H
|
||||
|
||||
139
src/migration.ui
139
src/migration.ui
@@ -1,139 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MigrationDialog</class>
|
||||
<widget class="QDialog" name="MigrationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>511</width>
|
||||
<height>498</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Migration Turnstile</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Migration History</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Migrated Amount</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QTableView" name="tblTxids">
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Unmigrated Amount</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="lblUnMigrated">
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="lblMigrated">
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkEnabled">
|
||||
<property name="text">
|
||||
<string>Sprout -> Sapling migration enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>If enabled, hushd will slowly migrate your Sprout shielded funds to your Sapling address. </string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="lblSaplingAddress">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>MigrationDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>MigrationDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "mobileappconnector.h"
|
||||
#include "ui_mobileappconnector.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef MOBILEAPPCONNECTOR_H
|
||||
#define MOBILEAPPCONNECTOR_H
|
||||
|
||||
@@ -110,6 +110,9 @@ p, li { white-space: pre-wrap; }
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>I accept the Terms of Service</string>
|
||||
</property>
|
||||
@@ -146,7 +149,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string notr="true">color: red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-style:italic;">Passphrase don't match</span></p></body></html></string>
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#if defined __cplusplus
|
||||
/* Add C++ includes here */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "qrcodelabel.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef QRCODELABEL_H
|
||||
#define QRCODELABEL_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "recurring.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef RECURRING_H
|
||||
#define RECURRING_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "requestdialog.h"
|
||||
#include "ui_requestdialog.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef REQUESTDIALOG_H
|
||||
#define REQUESTDIALOG_H
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "mainwindow.h"
|
||||
#include "settings.h"
|
||||
@@ -95,13 +95,6 @@ bool Settings::isSaplingAddress(QString addr) {
|
||||
(!isTestnet() && addr.startsWith("zs1"));
|
||||
}
|
||||
|
||||
bool Settings::isSproutAddress(QString addr) {
|
||||
if (!isValidAddress(addr))
|
||||
return false;
|
||||
|
||||
return isZAddress(addr) && !isSaplingAddress(addr);
|
||||
}
|
||||
|
||||
bool Settings::isZAddress(QString addr) {
|
||||
if (!isValidAddress(addr))
|
||||
return false;
|
||||
@@ -305,12 +298,14 @@ QString Settings::getRandomServer() {
|
||||
"https://devo.crabdance.com",
|
||||
"https://lite.nyami.org",
|
||||
"https://poop.granitefone.me:9067",
|
||||
// These can be un-commented to test out how code deals with down servers
|
||||
//"https://thisisdown1.example.com",
|
||||
//"https://thisisdown2.example.com",
|
||||
//"https://thisisdown3.example.com",
|
||||
//"https://thisisdown4.example.com",
|
||||
//"https://thisisdown5.example.com",
|
||||
"https://lite.hush.land"
|
||||
"https://lite.hush.land",
|
||||
"https://lite.hushpool.is"
|
||||
};
|
||||
|
||||
// we don't need cryptographic random-ness, but we want
|
||||
@@ -324,7 +319,14 @@ QString Settings::getRandomServer() {
|
||||
while (tries < servers.size() ) {
|
||||
qDebug() << "Checking if lite server " << server << " is a alive, try=" << tries;
|
||||
char* resp = litelib_initialize_existing(false, server.toStdString().c_str());
|
||||
QString response = litelib_process_response(resp);
|
||||
|
||||
QString response = "";
|
||||
|
||||
try {
|
||||
response = litelib_process_response(resp);
|
||||
} catch (const std::exception& e) {
|
||||
qDebug() << __func__ << ": litelib_process_response threw an exception, ignoring: " << e.what();
|
||||
}
|
||||
|
||||
// if we see a valid connection, return this server
|
||||
if (response.toUpper().trimmed() == "OK") {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
@@ -42,7 +42,6 @@ public:
|
||||
void setTestnet(bool isTestnet);
|
||||
|
||||
bool isSaplingAddress(QString addr);
|
||||
bool isSproutAddress(QString addr);
|
||||
|
||||
bool isValidSaplingPrivateKey(QString pk);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#include "txtablemodel.h"
|
||||
#include "settings.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019-2021 The Hush developers
|
||||
// Copyright 2019-2022 The Hush developers
|
||||
// Released under the GPLv3
|
||||
#ifndef STRINGSTABLEMODEL_H
|
||||
#define STRINGSTABLEMODEL_H
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user