Skip to content

Commit

Permalink
Add the batch of release v2.0.1 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
developer-at-bcn committed Apr 3, 2018
1 parent b95927f commit ed34fa8
Show file tree
Hide file tree
Showing 28 changed files with 753 additions and 111 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ set(SOURCES
src/createproofdialog.cpp
src/checkproofdialog.cpp
src/walletdparamsdialog.cpp
src/exportkeydialog.cpp

)

Expand Down
10 changes: 10 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## Release Notes

### v2.0.1

- Added possibility to try creating send proofs for transactions not found in history.
- Added support for view-only wallets.
- Fixed the changing password bug.
- Added export of view-only wallets.
- Added export of keys.
- Fixed crash on MacOS while working with address book.
- Fixed minor UI bugs.

### v2.0.0

- Added creating send proofs.
Expand Down
5 changes: 4 additions & 1 deletion src/addressbookmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ void AddressBookManager::removeAddress(AddressIndex _addressIndex)
const QString oldLabel = addressObject[ADDRESS_ITEM_LABEL_TAG_NAME].toString();
WalletLogger::debug(tr("[AddressBook] Remove address: label=\"%1\" address=\"%2\"").arg(oldLabel).arg(oldAddress));

emit beginRemoveAddressSignal(_addressIndex);

addressArray.removeAt(_addressIndex);
addressIndexes_.remove(oldAddress);
labelIndexes_.remove(oldLabel);
Expand All @@ -140,7 +142,8 @@ void AddressBookManager::removeAddress(AddressIndex _addressIndex)
}

addressBook_->setValue(ADDRESS_BOOK_TAG_NAME, addressArray);
emit addressRemovedSignal(_addressIndex);
// emit addressRemovedSignal(_addressIndex);
emit endRemoveAddressSignal();
}

void AddressBookManager::buildIndexes() {
Expand Down
4 changes: 3 additions & 1 deletion src/addressbookmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class AddressBookManager : public QObject
void addressBookClosedSignal();
void addressAddedSignal(AddressIndex _addressIndex);
void addressEditedSignal(AddressIndex _addressIndex);
void addressRemovedSignal(AddressIndex _addressIndex);
// void addressRemovedSignal(AddressIndex _addressIndex);
void beginRemoveAddressSignal(AddressIndex _addressIndex);
void endRemoveAddressSignal();
};

}
23 changes: 18 additions & 5 deletions src/addressbookmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ AddressBookModel::AddressBookModel(AddressBookManager* _addressBookManager, QObj
{
connect(m_addressBookManager, &AddressBookManager::addressAddedSignal, this, &AddressBookModel::addressAdded);
connect(m_addressBookManager, &AddressBookManager::addressEditedSignal, this, &AddressBookModel::addressEdited);
connect(m_addressBookManager, &AddressBookManager::addressRemovedSignal, this, &AddressBookModel::addressRemoved);
// connect(m_addressBookManager, &AddressBookManager::addressRemovedSignal, this, &AddressBookModel::addressRemoved);
connect(m_addressBookManager, &AddressBookManager::beginRemoveAddressSignal, this, &AddressBookModel::beginRemoveAddress);
connect(m_addressBookManager, &AddressBookManager::endRemoveAddressSignal, this, &AddressBookModel::endRemoveAddress);

addressBookOpened();
}
Expand Down Expand Up @@ -145,10 +147,21 @@ void AddressBookModel::addressEdited(quintptr _addressIndex) {
Q_EMIT dataChanged(index(_addressIndex, 0), index(_addressIndex, columnCount() - 1));
}

void AddressBookModel::addressRemoved(quintptr _addressIndex) {
beginRemoveRows(QModelIndex(), _addressIndex, _addressIndex);
m_rowCount = m_addressBookManager->getAddressCount();
endRemoveRows();
//void AddressBookModel::addressRemoved(quintptr _addressIndex) {
// beginRemoveRows(QModelIndex(), _addressIndex, _addressIndex);
// m_rowCount = m_addressBookManager->getAddressCount();
// endRemoveRows();
//}

void AddressBookModel::beginRemoveAddress(quintptr _addressIndex)
{
beginRemoveRows(QModelIndex(), _addressIndex, _addressIndex);
}

void AddressBookModel::endRemoveAddress()
{
m_rowCount = m_addressBookManager->getAddressCount();
endRemoveRows();
}

QVariant AddressBookModel::getDisplayRole(const QModelIndex& _index) const {
Expand Down
4 changes: 3 additions & 1 deletion src/addressbookmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class AddressBookModel : public QAbstractItemModel
Q_SLOT void addressBookClosed();
Q_SLOT void addressAdded(quintptr _addressIndex);
Q_SLOT void addressEdited(quintptr _addressIndex);
Q_SLOT void addressRemoved(quintptr _addressIndex);
// Q_SLOT void addressRemoved(quintptr _addressIndex);
Q_SLOT void beginRemoveAddress(quintptr _addressIndex);
Q_SLOT void endRemoveAddress();

private:
AddressBookManager* m_addressBookManager;
Expand Down
82 changes: 73 additions & 9 deletions src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "createproofdialog.h"
#include "checkproofdialog.h"
#include "walletdparamsdialog.h"
#include "questiondialog.h"

namespace WalletGUI {

Expand Down Expand Up @@ -90,7 +91,7 @@ bool WalletApplication::init()
if (!m_lockFile->tryLock())
{
WalletLogger::warning(tr("[Application] Bytecoin wallet GUI already running"));
QMessageBox::warning(nullptr, QObject::tr("Fail"), tr("Bytecoin wallet GUI already running"));
QMessageBox::warning(nullptr, QObject::tr("Error"), tr("Bytecoin wallet GUI already running"));
return false;
}

Expand Down Expand Up @@ -118,6 +119,8 @@ bool WalletApplication::init()
connect(m_mainWindow, &MainWindow::createProofSignal, this, &WalletApplication::createProof);
connect(m_mainWindow, &MainWindow::checkProofSignal, this, &WalletApplication::checkProof);
connect(m_mainWindow, &MainWindow::showWalletdParamsSignal, this, &WalletApplication::showWalletdParams);
connect(m_mainWindow, &MainWindow::exportViewOnlyKeysSignal, this, &WalletApplication::exportViewOnlyKeys);
connect(m_mainWindow, &MainWindow::exportKeysSignal, this, &WalletApplication::exportKeys);

connect(m_mainWindow, &MainWindow::createWalletSignal, this, &WalletApplication::createWallet);
connect(m_mainWindow, &MainWindow::importKeysSignal, this, &WalletApplication::importKeys);
Expand Down Expand Up @@ -226,9 +229,9 @@ void WalletApplication::sendTx(const RpcApi::SendTransaction::Request& req)
walletd_->sendTx(req);
}

void WalletApplication::sendCreateProof(const QString& txHash, const QString& message)
void WalletApplication::sendCreateProof(const QString& txHash, const QString& message, const QStringList& addresses)
{
const RpcApi::CreateSendProof::Request req{txHash, message, QStringList{}};
const RpcApi::CreateSendProof::Request req{txHash, message, addresses};
walletd_->createProof(req);
}

Expand Down Expand Up @@ -266,8 +269,10 @@ void WalletApplication::runBuiltinWalletd(const QString& walletFile, bool create
{
if (walletd_)
{
delete walletd_;
walletd_ = nullptr;
// delete walletd_;
// walletd_ = nullptr;

walletd_->deleteLater();
}

splashMsg(tr("Running walletd..."));
Expand All @@ -281,12 +286,15 @@ void WalletApplication::runBuiltinWalletd(const QString& walletFile, bool create
connect(walletd, &BuiltinWalletd::daemonFinishedSignal, this, &WalletApplication::detached);
connect(walletd, &BuiltinWalletd::requestPasswordSignal, this, &WalletApplication::requestPassword);
connect(walletd, &BuiltinWalletd::requestPasswordWithConfirmationSignal, this, &WalletApplication::requestPasswordWithConfirmation);
connect(walletd, &BuiltinWalletd::requestPasswordForExportSignal, this, &WalletApplication::requestPasswordForExport);

subscribeToWalletd();
Settings::instance().setConnectionMethod(ConnectionMethod::BUILTIN);
Settings::instance().setWalletFile(walletFile);

connect(walletd, &BuiltinWalletd::connectedSignal, this, &WalletApplication::builtinRunSignal);
connect(this, &WalletApplication::exportViewOnlyKeysSignal, walletd, &BuiltinWalletd::exportViewOnlyKeys);
connect(this, &WalletApplication::exportKeysSignal, walletd, &BuiltinWalletd::exportKeys);

walletd_->run();
}
Expand Down Expand Up @@ -341,7 +349,7 @@ void WalletApplication::daemonFinished(int exitCode, QProcess::ExitStatus /*exit
exitCode);
// const QString msg = metaEnum.valueToKey(static_cast<int>(exitCode));
bool showPasswordEdit = false;
QString msg;
/* QString msg;
switch(exitCode)
{
case static_cast<int>(BuiltinWalletd::ReturnCode::BYTECOIND_DATABASE_ERROR):
Expand Down Expand Up @@ -378,10 +386,18 @@ void WalletApplication::daemonFinished(int exitCode, QProcess::ExitStatus /*exit
case static_cast<int>(BuiltinWalletd::ReturnCode::WALLETD_WRONG_ARGS):
msg = tr("Wrong arguments passed to walletd.");
break;
case static_cast<int>(BuiltinWalletd::ReturnCode::WALLETD_EXPORTKEYS_MORETHANONE):
msg = tr("Walletd cannot export keys for more than one spend keypair");
break;
default:
msg = tr("Walletd just crashed. %1. Return code %2. ").arg(walletd->errorString()).arg(exitCode);
break;
}
}*/

const QString walletdMsg = BuiltinWalletd::errorMessage(static_cast<BuiltinWalletd::ReturnCode>(exitCode));
const QString msg = !walletdMsg.isEmpty() ?
walletdMsg :
tr("Walletd just crashed. %1. Return code %2. ").arg(walletd->errorString()).arg(exitCode);

if (crashDialog_->execWithReason(msg, showPasswordEdit) == QDialog::Accepted)
{
Expand Down Expand Up @@ -479,6 +495,7 @@ void WalletApplication::requestPassword()
AskPasswordDialog dlg(false, m_mainWindow);
BuiltinWalletd* walletd = static_cast<BuiltinWalletd*>(walletd_);
connect(walletd, &BuiltinWalletd::daemonErrorOccurredSignal, &dlg, &AskPasswordDialog::reject);
connect(crashDialog_.data(), &CrashDialog::rejected, &dlg, &AskPasswordDialog::reject);
if (dlg.exec() == QDialog::Accepted)
walletd->setPassword(dlg.getPassword());
else
Expand All @@ -496,6 +513,24 @@ void WalletApplication::requestPasswordWithConfirmation()
walletd_->stop();
}

void WalletApplication::requestPasswordForExport(QProcess* walletd, QString* pass)
{
AskPasswordDialog dlg(false, m_mainWindow);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
connect(
walletd, &QProcess::errorOccurred,
&dlg, &AskPasswordDialog::reject);
#else
connect(
walletd, static_cast<void(QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
&dlg, &AskPasswordDialog::reject);
#endif

if (dlg.exec() == QDialog::Accepted)
dlg.getPassword().swap(*pass);
}

void WalletApplication::requestWalletdAuth(QAuthenticator* authenticator)
{
AskPasswordDialog dlg(true, m_mainWindow);
Expand All @@ -511,16 +546,35 @@ void WalletApplication::requestWalletdAuth(QAuthenticator* authenticator)
}
}

void WalletApplication::createProof(const QString& txHash)
void WalletApplication::createProof(const QString& txHash, bool needToFind)
{
QStringList addresses;

if (needToFind)
{
QuestionDialog qdlg{tr("Question"), tr("Cannot find history for the selected transaction.\nDo you want to try to find appropriate addresses in your address book?"), m_mainWindow};
if (qdlg.exec() != QDialog::Accepted)
return;
for (auto i = addressBookManager_->getAddressCount() - 1; i >= 0; --i)
addresses.append(addressBookManager_->getAddress(i).address);
}

CreateProofDialog dlg{txHash, m_mainWindow};
connect(&dlg, &CreateProofDialog::generateProofSignal, this, &WalletApplication::sendCreateProof);

connect(&dlg, &CreateProofDialog::generateProofSignal,
this,
[this, &addresses](const QString& txHash, const QString& message)
{
sendCreateProof(txHash, message, addresses);
});

connect(walletd_, &RemoteWalletd::proofsReceivedSignal,
&dlg,
[&dlg](const RpcApi::Proofs& proofs)
{
dlg.addProofs(proofs.send_proofs);
});

dlg.exec();
}

Expand All @@ -546,4 +600,14 @@ void WalletApplication::showWalletdParams()
dlg.exec();
}

void WalletApplication::exportViewOnlyKeys()
{
emit exportViewOnlyKeysSignal(m_mainWindow, QPrivateSignal{});
}

void WalletApplication::exportKeys()
{
emit exportKeysSignal(m_mainWindow, QPrivateSignal{});
}

}
10 changes: 8 additions & 2 deletions src/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ class WalletApplication: public QApplication
void builtinRunSignal();
void remoteConnectedSignal();
void createWalletdSignal(QPrivateSignal);
void exportViewOnlyKeysSignal(QWidget* parent/*, const QString& exportPath*/, QPrivateSignal);
void exportKeysSignal(QWidget* parent, QPrivateSignal);

public slots:
void createTx(const RpcApi::CreateTransaction::Request& req);
void sendTx(const RpcApi::SendTransaction::Request& req);
void createProof(const QString& txHash);
void sendCreateProof(const QString& txHash, const QString& message);
void createProof(const QString& txHash, bool needToFind);
void sendCreateProof(const QString& txHash, const QString& message, const QStringList& addresses);
void checkProof();
void sendCheckProof(const QString& proof);
void restartDaemon();
Expand All @@ -88,6 +90,9 @@ public slots:

void splashMsg(const QString& msg);

void exportViewOnlyKeys();
void exportKeys();

private slots:
void connectedToWalletd();
void disconnectedFromWalletd();
Expand All @@ -96,6 +101,7 @@ private slots:
void daemonFinished(int exitCode, QProcess::ExitStatus exitStatus);
void requestPassword();
void requestPasswordWithConfirmation();
void requestPasswordForExport(QProcess* walletd, QString* pass);
void requestWalletdAuth(QAuthenticator* authenticator);

#ifdef Q_OS_MAC
Expand Down
2 changes: 2 additions & 0 deletions src/askpassworddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace WalletGUI
AskPasswordDialog::AskPasswordDialog(bool askUserName, QWidget *parent)
: QDialog(parent, Qt::Dialog)
, ui(new Ui::AskPasswordDialog)
, password_("")
, user_("")
{
ui->setupUi(this);

Expand Down
25 changes: 15 additions & 10 deletions src/bytecoin-gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ TEMPLATE = app
macx: QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
macx: ICON = images/bytecoin.icns
win32: RC_ICONS = images/bytecoin.ico
win32: VERSION = 2.18.3.20
win32: VERSION = 2.18.3.29

#QMAKE_CXXFLAGS += -fno-omit-frame-pointer -fsanitize=address,undefined
#LIBS += -lasan -lubsan

CONFIG += c++14 strict_c++ no-opengl

DESTDIR = $$PWD/../bin

# copy walletd adjacent to bytecoin-gui binary on all 3 platforms
win32 {
WALLETD_BY_SRC_PATH = $$shell_path($$clean_path("$$PWD/../../bytecoin/bin/walletd.exe"))
BYTECOIND_BY_SRC_PATH = $$shell_path($$clean_path("$$PWD/../../bytecoin/bin/bytecoind.exe"))
Debug:BY_DST_PATH = $$shell_path($$clean_path("$$OUT_PWD/debug"))
Release:BY_DST_PATH = $$shell_path($$clean_path("$$OUT_PWD/release"))
Debug:BY_DST_PATH = $$shell_path($$clean_path("$$DESTDIR"))
Release:BY_DST_PATH = $$shell_path($$clean_path("$$DESTDIR"))
copywalletd.commands = $(COPY_FILE) $${WALLETD_BY_SRC_PATH} $${BY_DST_PATH}
copybytecoind.commands = $(COPY_FILE) $${BYTECOIND_BY_SRC_PATH} $${BY_DST_PATH}
}else:macx {
copywalletd.commands += $(COPY_FILE) $$PWD/../../bytecoin/bin/walletd $$OUT_PWD/bytecoin-gui.app/Contents/MacOS
copybytecoind.commands += $(COPY_FILE) $$PWD/../../bytecoin/bin/bytecoind $$OUT_PWD/bytecoin-gui.app/Contents/MacOS
copywalletd.commands += $(COPY_FILE) $$PWD/../../bytecoin/bin/walletd $$DESTDIR/bytecoin-gui.app/Contents/MacOS
copybytecoind.commands += $(COPY_FILE) $$PWD/../../bytecoin/bin/bytecoind $$DESTDIR/bytecoin-gui.app/Contents/MacOS
}else {
copywalletd.commands += $(COPY_FILE) $$PWD/../../bytecoin/bin/walletd $$OUT_PWD
copybytecoind.commands += $(COPY_FILE) $$PWD/../../bytecoin/bin/bytecoind $$OUT_PWD
copywalletd.commands += $(COPY_FILE) $$PWD/../../bytecoin/bin/walletd $$DESTDIR
copybytecoind.commands += $(COPY_FILE) $$PWD/../../bytecoin/bin/bytecoind $$DESTDIR
}
first.depends = $(first) copywalletd copybytecoind
export(first.depends)
Expand Down Expand Up @@ -97,7 +99,8 @@ SOURCES += main.cpp\
PoolTreeView.cpp \
createproofdialog.cpp \
checkproofdialog.cpp \
walletdparamsdialog.cpp
walletdparamsdialog.cpp \
exportkeydialog.cpp

HEADERS += mainwindow.h \
signalhandler.h \
Expand Down Expand Up @@ -156,7 +159,8 @@ HEADERS += mainwindow.h \
PoolTreeView.h \
createproofdialog.h \
checkproofdialog.h \
walletdparamsdialog.h
walletdparamsdialog.h \
exportkeydialog.h

FORMS += mainwindow.ui \
overviewframe.ui \
Expand All @@ -180,7 +184,8 @@ FORMS += mainwindow.ui \
questiondialog.ui \
createproofdialog.ui \
checkproofdialog.ui \
walletdparamsdialog.ui
walletdparamsdialog.ui \
exportkeydialog.ui

RESOURCES += \
resources.qrc \
Expand Down
Loading

0 comments on commit ed34fa8

Please sign in to comment.