diff options
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoin.cpp | 2 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 17 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 2 | ||||
-rw-r--r-- | src/qt/clientmodel.cpp | 14 | ||||
-rw-r--r-- | src/qt/clientmodel.h | 5 | ||||
-rw-r--r-- | src/qt/forms/rpcconsole.ui | 33 | ||||
-rw-r--r-- | src/qt/locale/bitcoin_en.ts | 2 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 2 | ||||
-rw-r--r-- | src/qt/receivecoinsdialog.cpp | 19 | ||||
-rw-r--r-- | src/qt/receivecoinsdialog.h | 8 | ||||
-rw-r--r-- | src/qt/receiverequestdialog.cpp | 25 | ||||
-rw-r--r-- | src/qt/receiverequestdialog.h | 7 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 8 | ||||
-rw-r--r-- | src/qt/rpcconsole.h | 2 |
14 files changed, 61 insertions, 85 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index c05692efa3..31716ab825 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -595,7 +595,7 @@ int main(int argc, char *argv[]) app.createWindow(isaTestNet); app.requestInitialize(); #if defined(Q_OS_WIN) && QT_VERSION >= 0x050000 - WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("Bitcoin Core did't yet exit safely..."), (HWND)app.getMainWinId()); + WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("Bitcoin Core didn't yet exit safely..."), (HWND)app.getMainWinId()); #endif app.exec(); app.requestShutdown(); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index da7762282a..e6190aec13 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -403,8 +403,8 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) setNumConnections(clientModel->getNumConnections()); connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); - setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers()); - connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); + setNumBlocks(clientModel->getNumBlocks()); + connect(clientModel, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int))); // Receive and report messages from client model connect(clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int))); @@ -617,7 +617,7 @@ void BitcoinGUI::setNumConnections(int count) labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Bitcoin network", "", count)); } -void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks) +void BitcoinGUI::setNumBlocks(int count) { // Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbelled text) statusBar()->clearMessage(); @@ -646,17 +646,10 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks) QDateTime currentDate = QDateTime::currentDateTime(); int secs = lastBlockDate.secsTo(currentDate); - if(count < nTotalBlocks) - { - tooltip = tr("Processed %1 of %2 (estimated) blocks of transaction history.").arg(count).arg(nTotalBlocks); - } - else - { - tooltip = tr("Processed %1 blocks of transaction history.").arg(count); - } + tooltip = tr("Processed %1 blocks of transaction history.").arg(count); // Set icon state: spinning if catching up, tick otherwise - if(secs < 90*60 && count >= nTotalBlocks) + if(secs < 90*60) { tooltip = tr("Up to date") + QString(".<br>") + tooltip; labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 0cc1ebc502..b4675b95ac 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -130,7 +130,7 @@ public slots: /** Set number of connections shown in the UI */ void setNumConnections(int count); /** Set number of blocks shown in the UI */ - void setNumBlocks(int count, int nTotalBlocks); + void setNumBlocks(int count); /** Notify the user of an event from the core network or transaction handling code. @param[in] title the message box / notification title diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 3c0564c208..d1f68ebd22 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -23,7 +23,7 @@ static const int64_t nClientStartupTime = GetTime(); ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) : QObject(parent), optionsModel(optionsModel), - cachedNumBlocks(0), cachedNumBlocksOfPeers(0), + cachedNumBlocks(0), cachedReindexing(0), cachedImporting(0), numBlocksAtStartup(-1), pollTimer(0) { @@ -101,19 +101,16 @@ void ClientModel::updateTimer() // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change. // Periodically check and update with a timer. int newNumBlocks = getNumBlocks(); - int newNumBlocksOfPeers = getNumBlocksOfPeers(); // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state - if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers || + if (cachedNumBlocks != newNumBlocks || cachedReindexing != fReindex || cachedImporting != fImporting) { cachedNumBlocks = newNumBlocks; - cachedNumBlocksOfPeers = newNumBlocksOfPeers; cachedReindexing = fReindex; cachedImporting = fImporting; - // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI - emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks)); + emit numBlocksChanged(newNumBlocks); } emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent()); @@ -166,11 +163,6 @@ enum BlockSource ClientModel::getBlockSource() const return BLOCK_SOURCE_NONE; } -int ClientModel::getNumBlocksOfPeers() const -{ - return GetNumBlocksOfPeers(); -} - QString ClientModel::getStatusBarWarnings() const { return QString::fromStdString(GetWarnings("statusbar")); diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index f29b695ea1..cab853d92d 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -60,8 +60,6 @@ public: bool inInitialBlockDownload() const; //! Return true if core is importing blocks enum BlockSource getBlockSource() const; - //! Return conservative estimate of total number of blocks, or 0 if unknown - int getNumBlocksOfPeers() const; //! Return warnings to be displayed in status bar QString getStatusBarWarnings() const; @@ -75,7 +73,6 @@ private: OptionsModel *optionsModel; int cachedNumBlocks; - int cachedNumBlocksOfPeers; bool cachedReindexing; bool cachedImporting; @@ -88,7 +85,7 @@ private: signals: void numConnectionsChanged(int count); - void numBlocksChanged(int count, int countOfPeers); + void numBlocksChanged(int count); void alertsChanged(const QString &warnings); void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut); diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index 31d61ec468..fcb6bb60bb 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -254,36 +254,13 @@ </widget> </item> <item row="11" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Estimated total blocks</string> - </property> - </widget> - </item> - <item row="11" column="1"> - <widget class="QLabel" name="totalBlocks"> - <property name="cursor"> - <cursorShape>IBeamCursor</cursorShape> - </property> - <property name="text"> - <string>N/A</string> - </property> - <property name="textFormat"> - <enum>Qt::PlainText</enum> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item row="12" column="0"> <widget class="QLabel" name="label_2"> <property name="text"> <string>Last block time</string> </property> </widget> </item> - <item row="12" column="1"> + <item row="11" column="1"> <widget class="QLabel" name="lastBlockTime"> <property name="cursor"> <cursorShape>IBeamCursor</cursorShape> @@ -299,7 +276,7 @@ </property> </widget> </item> - <item row="13" column="0"> + <item row="12" column="0"> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -312,7 +289,7 @@ </property> </spacer> </item> - <item row="14" column="0"> + <item row="13" column="0"> <widget class="QLabel" name="labelDebugLogfile"> <property name="font"> <font> @@ -325,7 +302,7 @@ </property> </widget> </item> - <item row="15" column="0"> + <item row="14" column="0"> <widget class="QPushButton" name="openDebugLogfileButton"> <property name="toolTip"> <string>Open the Bitcoin debug log file from the current data directory. This can take a few seconds for large log files.</string> @@ -338,7 +315,7 @@ </property> </widget> </item> - <item row="16" column="0"> + <item row="15" column="0"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index d857a1444f..4b541eabe9 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -1729,7 +1729,7 @@ Address: %4 </message> <message> <location line="+60"/> - <source>Bitcoin Core did't yet exit safely...</source> + <source>Bitcoin Core didn't yet exit safely...</source> <translation type="unfinished"></translation> </message> <message> diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 74c6b10ce2..e87a1d97e7 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -93,7 +93,7 @@ void OptionsModel::Init() // Wallet #ifdef ENABLE_WALLET if (!settings.contains("nTransactionFee")) - settings.setValue("nTransactionFee", 0); + settings.setValue("nTransactionFee", (qint64)DEFAULT_TRANSACTION_FEE); nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp if (mapArgs.count("-paytxfee")) addOverriddenOption("-paytxfee"); diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 3ccfb429a6..f2c76c8355 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -5,21 +5,21 @@ #include "receivecoinsdialog.h" #include "ui_receivecoinsdialog.h" -#include "walletmodel.h" -#include "bitcoinunits.h" #include "addressbookpage.h" -#include "optionsmodel.h" +#include "addresstablemodel.h" +#include "bitcoinunits.h" #include "guiutil.h" +#include "optionsmodel.h" #include "receiverequestdialog.h" -#include "addresstablemodel.h" #include "recentrequeststablemodel.h" +#include "walletmodel.h" #include <QAction> #include <QCursor> +#include <QItemSelection> #include <QMessageBox> -#include <QTextDocument> #include <QScrollBar> -#include <QItemSelection> +#include <QTextDocument> ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) : QDialog(parent), @@ -78,7 +78,7 @@ void ReceiveCoinsDialog::setModel(WalletModel *model) connect(tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, - SLOT(on_recentRequestsView_selectionChanged(QItemSelection, QItemSelection))); + SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection))); // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready. columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH); } @@ -165,8 +165,7 @@ void ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(const QModelIndex & dialog->show(); } -void ReceiveCoinsDialog::on_recentRequestsView_selectionChanged(const QItemSelection &selected, - const QItemSelection &deselected) +void ReceiveCoinsDialog::recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { // Enable Show/Remove buttons only if anything is selected. bool enable = !ui->recentRequestsView->selectionModel()->selectedRows().isEmpty(); @@ -200,7 +199,7 @@ void ReceiveCoinsDialog::on_removeRequestButton_clicked() // We override the virtual resizeEvent of the QWidget to adjust tables column // sizes as the tables width is proportional to the dialogs width. -void ReceiveCoinsDialog::resizeEvent(QResizeEvent* event) +void ReceiveCoinsDialog::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message); diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h index ab63331597..663cb157a4 100644 --- a/src/qt/receivecoinsdialog.h +++ b/src/qt/receivecoinsdialog.h @@ -18,8 +18,8 @@ namespace Ui { class ReceiveCoinsDialog; } -class WalletModel; class OptionsModel; +class WalletModel; QT_BEGIN_NAMESPACE class QModelIndex; @@ -57,16 +57,16 @@ private: WalletModel *model; QMenu *contextMenu; void copyColumnToClipboard(int column); - virtual void resizeEvent(QResizeEvent* event); + virtual void resizeEvent(QResizeEvent *event); private slots: void on_receiveButton_clicked(); void on_showRequestButton_clicked(); void on_removeRequestButton_clicked(); void on_recentRequestsView_doubleClicked(const QModelIndex &index); - void on_recentRequestsView_selectionChanged(const QItemSelection &, const QItemSelection &); + void recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); void updateDisplayUnit(); - void showMenu(const QPoint &); + void showMenu(const QPoint &point); void copyLabel(); void copyMessage(); void copyAmount(); diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index b5e45341d9..062638f2bc 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -16,6 +16,7 @@ #include <QMimeData> #include <QMouseEvent> #include <QPixmap> +#include <QMenu> #if QT_VERSION < 0x050000 #include <QUrl> #endif @@ -29,26 +30,27 @@ #endif QRImageWidget::QRImageWidget(QWidget *parent): - QLabel(parent) + QLabel(parent), contextMenu(0) { - setContextMenuPolicy(Qt::ActionsContextMenu); - + contextMenu = new QMenu(); QAction *saveImageAction = new QAction(tr("&Save Image..."), this); connect(saveImageAction, SIGNAL(triggered()), this, SLOT(saveImage())); - addAction(saveImageAction); + contextMenu->addAction(saveImageAction); QAction *copyImageAction = new QAction(tr("&Copy Image"), this); connect(copyImageAction, SIGNAL(triggered()), this, SLOT(copyImage())); - addAction(copyImageAction); + contextMenu->addAction(copyImageAction); } QImage QRImageWidget::exportImage() { + if(!pixmap()) + return QImage(); return pixmap()->toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE); } void QRImageWidget::mousePressEvent(QMouseEvent *event) { - if(event->button() == Qt::LeftButton) + if(event->button() == Qt::LeftButton && pixmap()) { event->accept(); QMimeData *mimeData = new QMimeData; @@ -64,6 +66,8 @@ void QRImageWidget::mousePressEvent(QMouseEvent *event) void QRImageWidget::saveImage() { + if(!pixmap()) + return; QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), NULL); if (!fn.isEmpty()) { @@ -73,9 +77,18 @@ void QRImageWidget::saveImage() void QRImageWidget::copyImage() { + if(!pixmap()) + return; QApplication::clipboard()->setImage(exportImage()); } +void QRImageWidget::contextMenuEvent(QContextMenuEvent *event) +{ + if(!pixmap()) + return; + contextMenu->exec(event->globalPos()); +} + ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ReceiveRequestDialog), diff --git a/src/qt/receiverequestdialog.h b/src/qt/receiverequestdialog.h index 295a73031d..5614ac635a 100644 --- a/src/qt/receiverequestdialog.h +++ b/src/qt/receiverequestdialog.h @@ -15,6 +15,9 @@ namespace Ui { class ReceiveRequestDialog; } class OptionsModel; +QT_BEGIN_NAMESPACE +class QMenu; +QT_END_NAMESPACE /* Label widget for QR code. This image can be dragged, dropped, copied and saved * to disk. @@ -33,6 +36,10 @@ public slots: protected: virtual void mousePressEvent(QMouseEvent *event); + virtual void contextMenuEvent(QContextMenuEvent *event); + +private: + QMenu *contextMenu; }; class ReceiveRequestDialog : public QDialog diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index ba5871ae2b..0a46a722e4 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -271,8 +271,8 @@ void RPCConsole::setClientModel(ClientModel *model) setNumConnections(model->getNumConnections()); connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); - setNumBlocks(model->getNumBlocks(), model->getNumBlocksOfPeers()); - connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int))); + setNumBlocks(model->getNumBlocks()); + connect(model, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int))); updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent()); connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64))); @@ -366,11 +366,9 @@ void RPCConsole::setNumConnections(int count) ui->numberOfConnections->setText(connections); } -void RPCConsole::setNumBlocks(int count, int countOfPeers) +void RPCConsole::setNumBlocks(int count) { ui->numberOfBlocks->setText(QString::number(count)); - // If there is no current countOfPeers available display N/A instead of 0, which can't ever be true - ui->totalBlocks->setText(countOfPeers == 0 ? tr("N/A") : QString::number(countOfPeers)); if(clientModel) ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString()); } diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index f7a7772050..091a6d294f 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -52,7 +52,7 @@ public slots: /** Set number of connections shown in the UI */ void setNumConnections(int count); /** Set number of blocks shown in the UI */ - void setNumBlocks(int count, int countOfPeers); + void setNumBlocks(int count); /** Go forward or back in history */ void browseHistory(int offset); /** Scroll console view to end */ |