Cryptocurrency with GOST R 34.11-2012 algo, GOST R 34.10-2012 signature
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

172 lines
3.8 KiB

// Qt bitcoin GUI.
//
// Copyright (c) 2011-2012 W.J. van der Laan
// Copyright (c) 2011-2012 The Bitcoin Developers
// Copyright (c) 2017-2018 The Gostcoin Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "walletframe.h"
#include "bitcoingui.h"
#include "walletstack.h"
#include "walletview.h"
#include <QHBoxLayout>
#include <QMessageBox>
#include <QLabel>
WalletFrame::WalletFrame(BitcoinGUI *_gui) :
QFrame(_gui),
gui(_gui),
clientModel(0)
{
// Leave HBox hook for adding a list view later
QHBoxLayout *walletFrameLayout = new QHBoxLayout(this);
setContentsMargins(0,0,0,0);
walletStack = new WalletStack(this);
walletStack->setBitcoinGUI(gui);
walletFrameLayout->setContentsMargins(0,0,0,0);
walletFrameLayout->addWidget(walletStack);
QLabel *noWallet = new QLabel(tr("No wallet has been loaded."));
noWallet->setAlignment(Qt::AlignCenter);
walletStack->addWidget(noWallet);
}
WalletFrame::~WalletFrame()
{
}
void WalletFrame::setClientModel(ClientModel *clientModel)
{
this->clientModel = clientModel;
walletStack->setClientModel(clientModel);
}
bool WalletFrame::addWallet(const QString& name, WalletModel *walletModel)
{
return walletStack->addWallet(name, walletModel);
}
bool WalletFrame::setCurrentWallet(const QString& name)
{
// TODO: Check if valid name
walletStack->setCurrentWallet(name);
return true;
}
void WalletFrame::removeAllWallets()
{
walletStack->removeAllWallets();
}
bool WalletFrame::handleURI(const QString &uri)
{
WalletView *walletView = currentWalletView();
if (!walletView)
return false;
return walletStack->handleURI(uri);
}
void WalletFrame::showOutOfSyncWarning(bool fShow)
{
if (!walletStack) {
QMessageBox box;
box.setText("walletStack is null");
box.exec();
return;
}
walletStack->showOutOfSyncWarning(fShow);
}
void WalletFrame::gotoOverviewPage()
{
walletStack->gotoOverviewPage();
}
void WalletFrame::gotoHistoryPage()
{
walletStack->gotoHistoryPage();
}
void WalletFrame::gotoAddressBookPage()
{
WalletView *walletView = currentWalletView();
if (walletView)
walletStack->gotoAddressBookPage();
}
void WalletFrame::gotoReceiveCoinsPage()
{
walletStack->gotoReceiveCoinsPage();
}
void WalletFrame::gotoSendCoinsPage(QString addr)
{
walletStack->gotoSendCoinsPage(addr);
}
void WalletFrame::gotoSignMessageTab(QString addr)
{
WalletView *walletView = currentWalletView();
if (walletView)
walletView->gotoSignMessageTab(addr);
}
void WalletFrame::gotoVerifyMessageTab(QString addr)
{
WalletView *walletView = currentWalletView();
if (walletView)
walletView->gotoVerifyMessageTab(addr);
}
void WalletFrame::encryptWallet(bool status)
{
WalletView *walletView = currentWalletView();
if (walletView)
walletView->encryptWallet(status);
}
void WalletFrame::backupWallet()
{
WalletView *walletView = currentWalletView();
if (walletView)
walletView->backupWallet();
}
void WalletFrame::changePassphrase()
{
WalletView *walletView = currentWalletView();
if (walletView)
walletView->changePassphrase();
}
void WalletFrame::unlockWallet()
{
WalletView *walletView = currentWalletView();
if (walletView)
walletView->unlockWallet();
}
#ifdef USE_QRCODE
void WalletFrame::printPaperWallet()
{
WalletView *walletView = currentWalletView();
if (walletView)
walletView->printPaperWallet();
}
#endif
void WalletFrame::setEncryptionStatus()
{
WalletView *walletView = currentWalletView();
if (walletView)
walletStack->setEncryptionStatus();
}
WalletView *WalletFrame::currentWalletView()
{
return qobject_cast<WalletView*>(walletStack->currentWidget());
}