Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletframe.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 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 "walletframe.h" | #include "walletframe.h" | ||||
#include "bitcoingui.h" | #include "bitcoingui.h" | ||||
#include "walletview.h" | #include "walletview.h" | ||||
#include <cstdio> | #include <cstdio> | ||||
#include <QHBoxLayout> | #include <QHBoxLayout> | ||||
#include <QLabel> | #include <QLabel> | ||||
WalletFrame::WalletFrame(const PlatformStyle *_platformStyle, BitcoinGUI *_gui) | WalletFrame::WalletFrame(const PlatformStyle *_platformStyle, const Config *cfg, | ||||
: QFrame(_gui), gui(_gui), platformStyle(_platformStyle) { | BitcoinGUI *_gui) | ||||
: QFrame(_gui), gui(_gui), platformStyle(_platformStyle), cfg(cfg) { | |||||
// 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.")); | QLabel *noWallet = new QLabel(tr("No wallet has been loaded.")); | ||||
noWallet->setAlignment(Qt::AlignCenter); | noWallet->setAlignment(Qt::AlignCenter); | ||||
walletStack->addWidget(noWallet); | walletStack->addWidget(noWallet); | ||||
} | } | ||||
WalletFrame::~WalletFrame() {} | WalletFrame::~WalletFrame() {} | ||||
void WalletFrame::setClientModel(ClientModel *_clientModel) { | void WalletFrame::setClientModel(ClientModel *_clientModel) { | ||||
this->clientModel = _clientModel; | this->clientModel = _clientModel; | ||||
} | } | ||||
bool WalletFrame::addWallet(const QString &name, WalletModel *walletModel) { | bool WalletFrame::addWallet(const QString &name, WalletModel *walletModel) { | ||||
if (!gui || !clientModel || !walletModel || mapWalletViews.count(name) > 0) | if (!gui || !clientModel || !walletModel || mapWalletViews.count(name) > 0) | ||||
return false; | return false; | ||||
WalletView *walletView = new WalletView(platformStyle, this); | WalletView *walletView = new WalletView(platformStyle, cfg, this); | ||||
walletView->setBitcoinGUI(gui); | walletView->setBitcoinGUI(gui); | ||||
walletView->setClientModel(clientModel); | walletView->setClientModel(clientModel); | ||||
walletView->setWalletModel(walletModel); | walletView->setWalletModel(walletModel); | ||||
walletView->showOutOfSyncWarning(bOutOfSync); | walletView->showOutOfSyncWarning(bOutOfSync); | ||||
/* TODO we should goto the currently selected page once dynamically adding | /* TODO we should goto the currently selected page once dynamically adding | ||||
* wallets is supported */ | * wallets is supported */ | ||||
walletView->gotoOverviewPage(); | walletView->gotoOverviewPage(); | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |