Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoingui.cpp
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | #endif // ENABLE_WALLET | ||||
frameBlocks->setContentsMargins(0, 0, 0, 0); | frameBlocks->setContentsMargins(0, 0, 0, 0); | ||||
frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); | frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); | ||||
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(platformStyle); | unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle); | ||||
labelWalletEncryptionIcon = new QLabel(); | labelWalletEncryptionIcon = new QLabel(); | ||||
labelWalletHDStatusIcon = new QLabel(); | labelWalletHDStatusIcon = new QLabel(); | ||||
labelProxyIcon = new QLabel(); | labelProxyIcon = new GUIUtil::ClickableLabel(); | ||||
connectionsControl = new GUIUtil::ClickableLabel(); | connectionsControl = new GUIUtil::ClickableLabel(); | ||||
labelBlocksIcon = new GUIUtil::ClickableLabel(); | labelBlocksIcon = new GUIUtil::ClickableLabel(); | ||||
if (enableWallet) { | if (enableWallet) { | ||||
frameBlocksLayout->addStretch(); | frameBlocksLayout->addStretch(); | ||||
frameBlocksLayout->addWidget(unitDisplayControl); | frameBlocksLayout->addWidget(unitDisplayControl); | ||||
frameBlocksLayout->addStretch(); | frameBlocksLayout->addStretch(); | ||||
frameBlocksLayout->addWidget(labelWalletEncryptionIcon); | frameBlocksLayout->addWidget(labelWalletEncryptionIcon); | ||||
frameBlocksLayout->addWidget(labelWalletHDStatusIcon); | frameBlocksLayout->addWidget(labelWalletHDStatusIcon); | ||||
Show All 35 Lines | #endif // ENABLE_WALLET | ||||
this->installEventFilter(this); | this->installEventFilter(this); | ||||
// Initially wallet actions should be disabled | // Initially wallet actions should be disabled | ||||
setWalletActionsEnabled(false); | setWalletActionsEnabled(false); | ||||
// Subscribe to notifications from core | // Subscribe to notifications from core | ||||
subscribeToCoreSignals(); | subscribeToCoreSignals(); | ||||
connect(connectionsControl, SIGNAL(clicked(QPoint)), this, | connect(connectionsControl, &GUIUtil::ClickableLabel::clicked, | ||||
SLOT(toggleNetworkActive())); | [this] { m_node.setNetworkActive(!m_node.getNetworkActive()); }); | ||||
connect(labelProxyIcon, &GUIUtil::ClickableLabel::clicked, | |||||
[this] { openOptionsDialogWithTab(OptionsDialog::TAB_NETWORK); }); | |||||
modalOverlay = new ModalOverlay(this->centralWidget()); | modalOverlay = new ModalOverlay(this->centralWidget()); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
if (enableWallet) { | if (enableWallet) { | ||||
connect(walletFrame, SIGNAL(requestedSyncWarningInfo()), this, | connect(walletFrame, SIGNAL(requestedSyncWarningInfo()), this, | ||||
SLOT(showModalOverlay())); | SLOT(showModalOverlay())); | ||||
connect(labelBlocksIcon, SIGNAL(clicked(QPoint)), this, | connect(labelBlocksIcon, SIGNAL(clicked(QPoint)), this, | ||||
SLOT(showModalOverlay())); | SLOT(showModalOverlay())); | ||||
▲ Show 20 Lines • Show All 501 Lines • ▼ Show 20 Lines | void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) { | ||||
if (reason == QSystemTrayIcon::Trigger) { | if (reason == QSystemTrayIcon::Trigger) { | ||||
// Click on system tray icon triggers show/hide of the main window | // Click on system tray icon triggers show/hide of the main window | ||||
toggleHidden(); | toggleHidden(); | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
void BitcoinGUI::optionsClicked() { | void BitcoinGUI::optionsClicked() { | ||||
if (!clientModel || !clientModel->getOptionsModel()) return; | openOptionsDialogWithTab(OptionsDialog::TAB_MAIN); | ||||
OptionsDialog dlg(this, enableWallet); | |||||
dlg.setModel(clientModel->getOptionsModel()); | |||||
dlg.exec(); | |||||
} | } | ||||
void BitcoinGUI::aboutClicked() { | void BitcoinGUI::aboutClicked() { | ||||
if (!clientModel) return; | if (!clientModel) return; | ||||
HelpMessageDialog dlg(m_node, this, true); | HelpMessageDialog dlg(m_node, this, true); | ||||
dlg.exec(); | dlg.exec(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC) { | ||||
tr("Syncing Headers (%1%)...") | tr("Syncing Headers (%1%)...") | ||||
.arg(QString::number(100.0 / | .arg(QString::number(100.0 / | ||||
(headersTipHeight + estHeadersLeft) * | (headersTipHeight + estHeadersLeft) * | ||||
headersTipHeight, | headersTipHeight, | ||||
'f', 1))); | 'f', 1))); | ||||
} | } | ||||
} | } | ||||
void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab) { | |||||
if (!clientModel || !clientModel->getOptionsModel()) return; | |||||
Fabien: Braces | |||||
OptionsDialog dlg(this, enableWallet); | |||||
dlg.setCurrentTab(tab); | |||||
dlg.setModel(clientModel->getOptionsModel()); | |||||
dlg.exec(); | |||||
} | |||||
void BitcoinGUI::setNumBlocks(int count, const QDateTime &blockDate, | void BitcoinGUI::setNumBlocks(int count, const QDateTime &blockDate, | ||||
double nVerificationProgress, bool header) { | double nVerificationProgress, bool header) { | ||||
if (modalOverlay) { | if (modalOverlay) { | ||||
if (header) { | if (header) { | ||||
modalOverlay->setKnownBestHeight(count, blockDate); | modalOverlay->setKnownBestHeight(count, blockDate); | ||||
} else { | } else { | ||||
modalOverlay->tipUpdate(count, blockDate, nVerificationProgress); | modalOverlay->tipUpdate(count, blockDate, nVerificationProgress); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 450 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void BitcoinGUI::unsubscribeFromCoreSignals() { | void BitcoinGUI::unsubscribeFromCoreSignals() { | ||||
// Disconnect signals from client | // Disconnect signals from client | ||||
m_handler_message_box->disconnect(); | m_handler_message_box->disconnect(); | ||||
m_handler_question->disconnect(); | m_handler_question->disconnect(); | ||||
} | } | ||||
void BitcoinGUI::toggleNetworkActive() { | |||||
m_node.setNetworkActive(!m_node.getNetworkActive()); | |||||
} | |||||
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl( | UnitDisplayStatusBarControl::UnitDisplayStatusBarControl( | ||||
const PlatformStyle *platformStyle) | const PlatformStyle *platformStyle) | ||||
: optionsModel(0), menu(0) { | : optionsModel(0), menu(0) { | ||||
createContextMenu(); | createContextMenu(); | ||||
setToolTip(tr("Unit to show amounts in. Click to select another unit.")); | setToolTip(tr("Unit to show amounts in. Click to select another unit.")); | ||||
QList<BitcoinUnits::Unit> units = BitcoinUnits::availableUnits(); | QList<BitcoinUnits::Unit> units = BitcoinUnits::availableUnits(); | ||||
int max_width = 0; | int max_width = 0; | ||||
const QFontMetrics fm(font()); | const QFontMetrics fm(font()); | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |
Braces