refactor: remove appcontext, cleanup Wallet

This commit is contained in:
tobtoht
2023-03-01 03:05:56 +01:00
parent b057f750a5
commit 402bea3fd6
82 changed files with 1626 additions and 2340 deletions
+9 -7
View File
@@ -8,21 +8,23 @@
#include <QInputDialog>
#include <QMessageBox>
ViewOnlyDialog::ViewOnlyDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
#include "utils/Utils.h"
ViewOnlyDialog::ViewOnlyDialog(Wallet *wallet, QWidget *parent)
: WindowModalDialog(parent)
, ui(new Ui::ViewOnlyDialog)
, m_ctx(std::move(ctx))
, m_wallet(wallet)
{
ui->setupUi(this);
ui->label_restoreHeight->setText(QString::number(m_ctx->wallet->getWalletCreationHeight()));
ui->label_primaryAddress->setText(m_ctx->wallet->address(0, 0));
ui->label_secretViewKey->setText(m_ctx->wallet->getSecretViewKey());
ui->label_restoreHeight->setText(QString::number(m_wallet->getWalletCreationHeight()));
ui->label_primaryAddress->setText(m_wallet->address(0, 0));
ui->label_secretViewKey->setText(m_wallet->getSecretViewKey());
connect(ui->btn_Copy, &QPushButton::clicked, this, &ViewOnlyDialog::copyToClipboard);
connect(ui->btn_Save, &QPushButton::clicked, this, &ViewOnlyDialog::onWriteViewOnlyWallet);
if (m_ctx->wallet->viewOnly()) {
if (m_wallet->viewOnly()) {
ui->btn_Save->setEnabled(false);
ui->btn_Save->setToolTip("Wallet is already view-only");
}
@@ -45,7 +47,7 @@ void ViewOnlyDialog::onWriteViewOnlyWallet(){
if((bool)passwordDialog.exec())
passwd = passwordDialog.textValue();
m_ctx->wallet->createViewOnly(fn, passwd);
m_wallet->createViewOnly(fn, passwd);
QMessageBox::information(this, "Information", "View-only wallet successfully written to disk.");
}