|
|
@ -28,6 +28,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <iostream> |
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <QAction> |
|
|
|
#include <QApplication> |
|
|
|
#include <QApplication> |
|
|
|
#include <QDateTime> |
|
|
|
#include <QDateTime> |
|
|
|
#include <QDesktopWidget> |
|
|
|
#include <QDesktopWidget> |
|
|
@ -39,6 +40,7 @@ |
|
|
|
#include <QMenuBar> |
|
|
|
#include <QMenuBar> |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMimeData> |
|
|
|
#include <QMimeData> |
|
|
|
|
|
|
|
#include <QPoint> |
|
|
|
#include <QProgressBar> |
|
|
|
#include <QProgressBar> |
|
|
|
#include <QProgressDialog> |
|
|
|
#include <QProgressDialog> |
|
|
|
#include <QSettings> |
|
|
|
#include <QSettings> |
|
|
@ -49,6 +51,8 @@ |
|
|
|
#include <QToolBar> |
|
|
|
#include <QToolBar> |
|
|
|
#include <QVBoxLayout> |
|
|
|
#include <QVBoxLayout> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if QT_VERSION < 0x050000 |
|
|
|
#if QT_VERSION < 0x050000 |
|
|
|
#include <QUrl> |
|
|
|
#include <QUrl> |
|
|
|
#include <QTextDocument> |
|
|
|
#include <QTextDocument> |
|
|
@ -156,10 +160,13 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) : |
|
|
|
QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); |
|
|
|
QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); |
|
|
|
frameBlocksLayout->setContentsMargins(3,0,3,0); |
|
|
|
frameBlocksLayout->setContentsMargins(3,0,3,0); |
|
|
|
frameBlocksLayout->setSpacing(3); |
|
|
|
frameBlocksLayout->setSpacing(3); |
|
|
|
|
|
|
|
unitDisplayControl = new UnitDisplayStatusBarControl(); |
|
|
|
labelEncryptionIcon = new QLabel(); |
|
|
|
labelEncryptionIcon = new QLabel(); |
|
|
|
labelConnectionsIcon = new QLabel(); |
|
|
|
labelConnectionsIcon = new QLabel(); |
|
|
|
labelBlocksIcon = new QLabel(); |
|
|
|
labelBlocksIcon = new QLabel(); |
|
|
|
frameBlocksLayout->addStretch(); |
|
|
|
frameBlocksLayout->addStretch(); |
|
|
|
|
|
|
|
frameBlocksLayout->addWidget(unitDisplayControl); |
|
|
|
|
|
|
|
frameBlocksLayout->addStretch(); |
|
|
|
frameBlocksLayout->addWidget(labelEncryptionIcon); |
|
|
|
frameBlocksLayout->addWidget(labelEncryptionIcon); |
|
|
|
frameBlocksLayout->addStretch(); |
|
|
|
frameBlocksLayout->addStretch(); |
|
|
|
frameBlocksLayout->addWidget(labelConnectionsIcon); |
|
|
|
frameBlocksLayout->addWidget(labelConnectionsIcon); |
|
|
@ -420,6 +427,8 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) |
|
|
|
walletFrame->setClientModel(clientModel); |
|
|
|
walletFrame->setClientModel(clientModel); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this->unitDisplayControl->setOptionsModel(clientModel->getOptionsModel()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1000,3 +1009,72 @@ void BitcoinGUI::unsubscribeFromCoreSignals() |
|
|
|
// Disconnect signals from client
|
|
|
|
// Disconnect signals from client
|
|
|
|
uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); |
|
|
|
uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl():QLabel() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
optionsModel = 0; |
|
|
|
|
|
|
|
createContextMenu(); |
|
|
|
|
|
|
|
setStyleSheet("font:11pt; color: #333333"); |
|
|
|
|
|
|
|
setToolTip(tr("Unit to show amounts in. Click to select another unit.")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** So that it responds to left-button clicks */ |
|
|
|
|
|
|
|
void UnitDisplayStatusBarControl::mousePressEvent(QMouseEvent *event) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
onDisplayUnitsClicked(event->pos()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */ |
|
|
|
|
|
|
|
void UnitDisplayStatusBarControl::createContextMenu() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
menu = new QMenu(); |
|
|
|
|
|
|
|
foreach(BitcoinUnits::Unit u, BitcoinUnits::availableUnits()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QAction *menuAction = new QAction(QString(BitcoinUnits::name(u)), this); |
|
|
|
|
|
|
|
menuAction->setData(QVariant(u)); |
|
|
|
|
|
|
|
menu->addAction(menuAction); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
connect(menu,SIGNAL(triggered(QAction*)),this,SLOT(onMenuSelection(QAction*))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// what happens on right click.
|
|
|
|
|
|
|
|
setContextMenuPolicy(Qt::CustomContextMenu); |
|
|
|
|
|
|
|
connect(this,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(onDisplayUnitsClicked(const QPoint&))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Lets the control know about the Options Model (and its signals) */ |
|
|
|
|
|
|
|
void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *optionsModel) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (optionsModel) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this->optionsModel = optionsModel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// be aware of a display unit change reported by the OptionsModel object.
|
|
|
|
|
|
|
|
connect(optionsModel,SIGNAL(displayUnitChanged(int)),this,SLOT(updateDisplayUnit(int))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// initialize the display units label with the current value in the model.
|
|
|
|
|
|
|
|
updateDisplayUnit(optionsModel->getDisplayUnit()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ |
|
|
|
|
|
|
|
void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
setText(BitcoinUnits::name(newUnits)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Shows context menu with Display Unit options by the mouse coordinates */ |
|
|
|
|
|
|
|
void UnitDisplayStatusBarControl::onDisplayUnitsClicked(const QPoint& point) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QPoint globalPos = mapToGlobal(point); |
|
|
|
|
|
|
|
menu->exec(globalPos); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Tells underlying optionsModel to update its current display unit. */ |
|
|
|
|
|
|
|
void UnitDisplayStatusBarControl::onMenuSelection(QAction* action) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (action) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
optionsModel->setDisplayUnit(action->data()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|