Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletframe.cpp
// Copyright (c) 2011-2019 The Bitcoin Core developers | // Copyright (c) 2011-2019 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <qt/createwalletdialog.h> | |||||
#include <qt/walletcontroller.h> | |||||
#include <qt/walletframe.h> | #include <qt/walletframe.h> | ||||
#include <qt/bitcoingui.h> | #include <qt/bitcoingui.h> | ||||
#include <qt/walletmodel.h> | #include <qt/walletmodel.h> | ||||
#include <qt/walletview.h> | #include <qt/walletview.h> | ||||
#include <QGroupBox> | |||||
#include <QHBoxLayout> | #include <QHBoxLayout> | ||||
#include <QLabel> | #include <QLabel> | ||||
#include <QPushButton> | |||||
#include <QVBoxLayout> | |||||
#include <cassert> | #include <cassert> | ||||
WalletFrame::WalletFrame(const PlatformStyle *_platformStyle, BitcoinGUI *_gui) | WalletFrame::WalletFrame(const PlatformStyle *_platformStyle, BitcoinGUI *_gui) | ||||
: QFrame(_gui), gui(_gui), platformStyle(_platformStyle) { | : QFrame(_gui), gui(_gui), platformStyle(_platformStyle) { | ||||
// Leave HBox hook for adding a list view later | // Leave HBox hook for adding a list view later | ||||
QHBoxLayout *walletFrameLayout = new QHBoxLayout(this); | QHBoxLayout *walletFrameLayout = new QHBoxLayout(this); | ||||
setContentsMargins(0, 0, 0, 0); | setContentsMargins(0, 0, 0, 0); | ||||
walletStack = new QStackedWidget(this); | walletStack = new QStackedWidget(this); | ||||
walletFrameLayout->setContentsMargins(0, 0, 0, 0); | walletFrameLayout->setContentsMargins(0, 0, 0, 0); | ||||
walletFrameLayout->addWidget(walletStack); | walletFrameLayout->addWidget(walletStack); | ||||
QLabel *noWallet = new QLabel(tr("No wallet has been loaded.")); | // hbox for no wallet | ||||
QGroupBox *no_wallet_group = new QGroupBox(walletStack); | |||||
QVBoxLayout *no_wallet_layout = new QVBoxLayout(no_wallet_group); | |||||
QLabel *noWallet = new QLabel(tr("No wallet has been loaded.\nGo to File > " | |||||
"Open Wallet to load a wallet.\n- OR -")); | |||||
noWallet->setAlignment(Qt::AlignCenter); | noWallet->setAlignment(Qt::AlignCenter); | ||||
walletStack->addWidget(noWallet); | no_wallet_layout->addWidget(noWallet, 0, | ||||
Qt::AlignHCenter | Qt::AlignBottom); | |||||
// A button for create wallet dialog | |||||
QPushButton *create_wallet_button = | |||||
new QPushButton(tr("Create a new wallet"), walletStack); | |||||
connect(create_wallet_button, &QPushButton::clicked, [this] { | |||||
auto activity = | |||||
new CreateWalletActivity(gui->getWalletController(), this); | |||||
connect(activity, &CreateWalletActivity::finished, activity, | |||||
&QObject::deleteLater); | |||||
activity->create(); | |||||
}); | |||||
no_wallet_layout->addWidget(create_wallet_button, 0, | |||||
Qt::AlignHCenter | Qt::AlignTop); | |||||
no_wallet_group->setLayout(no_wallet_layout); | |||||
walletStack->addWidget(no_wallet_group); | |||||
} | } | ||||
WalletFrame::~WalletFrame() {} | WalletFrame::~WalletFrame() {} | ||||
void WalletFrame::setClientModel(ClientModel *_clientModel) { | void WalletFrame::setClientModel(ClientModel *_clientModel) { | ||||
this->clientModel = _clientModel; | this->clientModel = _clientModel; | ||||
for (auto i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); | for (auto i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); | ||||
▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines |