mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-23 12:09:50 +00:00
Merge pull request 'Wizard: autoselect open if wallets available & refresh wallets when wizard opened' (#253) from tobtoht/feather:wizard_open_refresh into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/253
This commit is contained in:
commit
7092116efd
7 changed files with 57 additions and 27 deletions
|
@ -11,13 +11,22 @@
|
|||
|
||||
#include "libwalletqt/WalletManager.h"
|
||||
|
||||
MenuPage::MenuPage(AppContext *ctx, QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
ui(new Ui::MenuPage),
|
||||
m_ctx(ctx) {
|
||||
MenuPage::MenuPage(AppContext *ctx, WalletKeysFilesModel *wallets, QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
, ui(new Ui::MenuPage)
|
||||
, m_ctx(ctx)
|
||||
, m_walletKeysFilesModel(wallets)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setButtonText(QWizard::FinishButton, "Open recent wallet");
|
||||
ui->radioCreate->setChecked(true);
|
||||
}
|
||||
|
||||
void MenuPage::initializePage() {
|
||||
if (m_walletKeysFilesModel->rowCount() > 0) {
|
||||
ui->radioOpen->setChecked(true);
|
||||
} else {
|
||||
ui->radioCreate->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
int MenuPage::nextId() const {
|
||||
|
|
|
@ -19,13 +19,14 @@ class MenuPage : public QWizardPage
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MenuPage(AppContext *ctx, QWidget *parent = nullptr);
|
||||
explicit MenuPage(AppContext *ctx, WalletKeysFilesModel *wallets, QWidget *parent = nullptr);
|
||||
void initializePage() override;
|
||||
bool validatePage() override;
|
||||
int nextId() const override;
|
||||
|
||||
private:
|
||||
AppContext *m_ctx;
|
||||
QLabel *topLabel;
|
||||
WalletKeysFilesModel *m_walletKeysFilesModel;
|
||||
Ui::MenuPage *ui;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>424</width>
|
||||
<height>245</height>
|
||||
<width>617</width>
|
||||
<height>463</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -29,6 +29,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioCreate">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create new wallet</string>
|
||||
</property>
|
||||
|
@ -36,6 +39,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioOpen">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open wallet file</string>
|
||||
</property>
|
||||
|
@ -43,6 +49,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioSeed">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Restore wallet from seed</string>
|
||||
</property>
|
||||
|
@ -50,6 +59,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioViewOnly">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Import from keys</string>
|
||||
</property>
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
// @TODO: rescan wallet dir on wizard open
|
||||
|
||||
OpenWalletPage::OpenWalletPage(AppContext *ctx, QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
ui(new Ui::OpenWalletPage),
|
||||
m_ctx(ctx) {
|
||||
OpenWalletPage::OpenWalletPage(AppContext *ctx, WalletKeysFilesModel *wallets, QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
, ui(new Ui::OpenWalletPage)
|
||||
, m_ctx(ctx)
|
||||
, m_walletKeysFilesModel(wallets)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->btnBrowse, &QPushButton::clicked, [=]{
|
||||
|
@ -46,11 +46,8 @@ OpenWalletPage::OpenWalletPage(AppContext *ctx, QWidget *parent) :
|
|||
ui->walletTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui->walletTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
this->walletKeysFilesModel = new WalletKeysFilesModel(m_ctx);
|
||||
this->walletKeysFilesModel->refresh();
|
||||
|
||||
m_keysProxy = new WalletKeysFilesProxyModel(this, m_ctx->networkType);
|
||||
m_keysProxy->setSourceModel(this->walletKeysFilesModel);
|
||||
m_keysProxy->setSourceModel(m_walletKeysFilesModel);
|
||||
m_keysProxy->setSortRole(Qt::UserRole);
|
||||
|
||||
ui->walletTable->setModel(m_keysProxy);
|
||||
|
@ -67,6 +64,10 @@ OpenWalletPage::OpenWalletPage(AppContext *ctx, QWidget *parent) :
|
|||
});
|
||||
}
|
||||
|
||||
void OpenWalletPage::initializePage() {
|
||||
m_walletKeysFilesModel->refresh();
|
||||
}
|
||||
|
||||
void OpenWalletPage::updatePath() {
|
||||
QModelIndex index = ui->walletTable->currentIndex();
|
||||
if (!index.isValid()) {
|
||||
|
|
|
@ -20,7 +20,8 @@ class OpenWalletPage : public QWizardPage
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenWalletPage(AppContext *ctx, QWidget *parent = nullptr);
|
||||
explicit OpenWalletPage(AppContext *ctx, WalletKeysFilesModel *wallets, QWidget *parent = nullptr);
|
||||
void initializePage() override;
|
||||
bool validatePage() override;
|
||||
int nextId() const override;
|
||||
|
||||
|
@ -31,10 +32,8 @@ private:
|
|||
void updatePath();
|
||||
|
||||
AppContext *m_ctx;
|
||||
WalletKeysFilesModel *walletKeysFilesModel;
|
||||
WalletKeysFilesModel *m_walletKeysFilesModel;
|
||||
WalletKeysFilesProxyModel *m_keysProxy;
|
||||
QSortFilterProxyModel *ll;
|
||||
QLabel *topLabel;
|
||||
Ui::OpenWalletPage *ui;
|
||||
QStandardItemModel *m_model;
|
||||
};
|
||||
|
|
|
@ -18,14 +18,20 @@
|
|||
#include <QScreen>
|
||||
#include <QApplication>
|
||||
|
||||
WalletWizard::WalletWizard(AppContext *ctx, WalletWizard::Page startPage, QWidget *parent) : QWizard(parent),
|
||||
m_ctx(ctx) {
|
||||
WalletWizard::WalletWizard(AppContext *ctx, WalletWizard::Page startPage, QWidget *parent)
|
||||
: QWizard(parent)
|
||||
, m_ctx(ctx)
|
||||
{
|
||||
this->setWindowTitle("Welcome to Feather Wallet");
|
||||
this->setWindowIcon(QIcon(":/assets/images/appicons/64x64.png"));
|
||||
auto openWalletPage = new OpenWalletPage(m_ctx, this);
|
||||
|
||||
m_walletKeysFilesModel = new WalletKeysFilesModel(m_ctx, this);
|
||||
m_walletKeysFilesModel->refresh();
|
||||
|
||||
auto openWalletPage = new OpenWalletPage(m_ctx, m_walletKeysFilesModel, this);
|
||||
auto createWallet = new CreateWalletPage(m_ctx, this);
|
||||
auto createWalletSeed = new CreateWalletSeedPage(m_ctx, this);
|
||||
setPage(Page_Menu, new MenuPage(m_ctx, this));
|
||||
setPage(Page_Menu, new MenuPage(m_ctx, m_walletKeysFilesModel, this));
|
||||
setPage(Page_CreateWallet, createWallet);
|
||||
setPage(Page_OpenWallet, openWalletPage);
|
||||
setPage(Page_CreateWalletSeed, createWalletSeed);
|
||||
|
|
|
@ -25,6 +25,8 @@ signals:
|
|||
|
||||
private:
|
||||
AppContext *m_ctx;
|
||||
WalletKeysFilesModel *m_walletKeysFilesModel;
|
||||
|
||||
void createWallet();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue