|
|
@ -267,7 +267,8 @@ void BitcoinGUI::createToolBars() |
|
|
|
void BitcoinGUI::setClientModel(ClientModel *clientModel) |
|
|
|
void BitcoinGUI::setClientModel(ClientModel *clientModel) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this->clientModel = clientModel; |
|
|
|
this->clientModel = clientModel; |
|
|
|
|
|
|
|
if(clientModel) |
|
|
|
|
|
|
|
{ |
|
|
|
if(clientModel->isTestNet()) |
|
|
|
if(clientModel->isTestNet()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString title_testnet = windowTitle() + QString(" ") + tr("[testnet]"); |
|
|
|
QString title_testnet = windowTitle() + QString(" ") + tr("[testnet]"); |
|
|
@ -293,12 +294,14 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) |
|
|
|
|
|
|
|
|
|
|
|
// Report errors from network/worker thread
|
|
|
|
// Report errors from network/worker thread
|
|
|
|
connect(clientModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString))); |
|
|
|
connect(clientModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString))); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::setWalletModel(WalletModel *walletModel) |
|
|
|
void BitcoinGUI::setWalletModel(WalletModel *walletModel) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this->walletModel = walletModel; |
|
|
|
this->walletModel = walletModel; |
|
|
|
|
|
|
|
if(walletModel) |
|
|
|
|
|
|
|
{ |
|
|
|
// Report errors from wallet thread
|
|
|
|
// Report errors from wallet thread
|
|
|
|
connect(walletModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString))); |
|
|
|
connect(walletModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString))); |
|
|
|
|
|
|
|
|
|
|
@ -319,6 +322,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel) |
|
|
|
|
|
|
|
|
|
|
|
// Ask for passphrase if needed
|
|
|
|
// Ask for passphrase if needed
|
|
|
|
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet())); |
|
|
|
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::createTrayIcon() |
|
|
|
void BitcoinGUI::createTrayIcon() |
|
|
@ -369,6 +373,8 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::optionsClicked() |
|
|
|
void BitcoinGUI::optionsClicked() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!clientModel || !clientModel->getOptionsModel()) |
|
|
|
|
|
|
|
return; |
|
|
|
OptionsDialog dlg; |
|
|
|
OptionsDialog dlg; |
|
|
|
dlg.setModel(clientModel->getOptionsModel()); |
|
|
|
dlg.setModel(clientModel->getOptionsModel()); |
|
|
|
dlg.exec(); |
|
|
|
dlg.exec(); |
|
|
@ -398,6 +404,8 @@ void BitcoinGUI::setNumConnections(int count) |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::setNumBlocks(int count) |
|
|
|
void BitcoinGUI::setNumBlocks(int count) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!clientModel) |
|
|
|
|
|
|
|
return; |
|
|
|
int initTotal = clientModel->getNumBlocksAtStartup(); |
|
|
|
int initTotal = clientModel->getNumBlocksAtStartup(); |
|
|
|
int total = clientModel->getNumBlocksOfPeers(); |
|
|
|
int total = clientModel->getNumBlocksOfPeers(); |
|
|
|
QString tooltip; |
|
|
|
QString tooltip; |
|
|
@ -492,6 +500,8 @@ void BitcoinGUI::changeEvent(QEvent *e) |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::closeEvent(QCloseEvent *event) |
|
|
|
void BitcoinGUI::closeEvent(QCloseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(clientModel) |
|
|
|
|
|
|
|
{ |
|
|
|
#ifndef Q_WS_MAC // Ignored on Mac
|
|
|
|
#ifndef Q_WS_MAC // Ignored on Mac
|
|
|
|
if(!clientModel->getOptionsModel()->getMinimizeToTray() && |
|
|
|
if(!clientModel->getOptionsModel()->getMinimizeToTray() && |
|
|
|
!clientModel->getOptionsModel()->getMinimizeOnClose()) |
|
|
|
!clientModel->getOptionsModel()->getMinimizeOnClose()) |
|
|
@ -499,6 +509,7 @@ void BitcoinGUI::closeEvent(QCloseEvent *event) |
|
|
|
qApp->quit(); |
|
|
|
qApp->quit(); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
QMainWindow::closeEvent(event); |
|
|
|
QMainWindow::closeEvent(event); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -517,6 +528,8 @@ void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee) |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end) |
|
|
|
void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!walletModel || !clientModel) |
|
|
|
|
|
|
|
return; |
|
|
|
TransactionTableModel *ttm = walletModel->getTransactionTableModel(); |
|
|
|
TransactionTableModel *ttm = walletModel->getTransactionTableModel(); |
|
|
|
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent) |
|
|
|
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent) |
|
|
|
.data(Qt::EditRole).toULongLong(); |
|
|
|
.data(Qt::EditRole).toULongLong(); |
|
|
@ -654,6 +667,8 @@ void BitcoinGUI::setEncryptionStatus(int status) |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::encryptWallet(bool status) |
|
|
|
void BitcoinGUI::encryptWallet(bool status) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!walletModel) |
|
|
|
|
|
|
|
return; |
|
|
|
AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt: |
|
|
|
AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt: |
|
|
|
AskPassphraseDialog::Decrypt, this); |
|
|
|
AskPassphraseDialog::Decrypt, this); |
|
|
|
dlg.setModel(walletModel); |
|
|
|
dlg.setModel(walletModel); |
|
|
@ -671,6 +686,8 @@ void BitcoinGUI::changePassphrase() |
|
|
|
|
|
|
|
|
|
|
|
void BitcoinGUI::unlockWallet() |
|
|
|
void BitcoinGUI::unlockWallet() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(!walletModel) |
|
|
|
|
|
|
|
return; |
|
|
|
// Unlock wallet when requested by wallet model
|
|
|
|
// Unlock wallet when requested by wallet model
|
|
|
|
if(walletModel->getEncryptionStatus() == WalletModel::Locked) |
|
|
|
if(walletModel->getEncryptionStatus() == WalletModel::Locked) |
|
|
|
{ |
|
|
|
{ |
|
|
|