Merge pull request #4280

bbe1925 [Qt] style police and small addition in rpcconsole (Philip Kaufmann)
This commit is contained in:
Wladimir J. van der Laan 2014-06-03 15:28:35 +02:00
commit 6a6d7892c4
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
10 changed files with 27 additions and 22 deletions

View File

@ -23,7 +23,9 @@
static const int64_t nClientStartupTime = GetTime(); static const int64_t nClientStartupTime = GetTime();
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) : ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
QObject(parent), optionsModel(optionsModel), peerTableModel(0), QObject(parent),
optionsModel(optionsModel),
peerTableModel(0),
cachedNumBlocks(0), cachedNumBlocks(0),
cachedReindexing(0), cachedImporting(0), cachedReindexing(0), cachedImporting(0),
numBlocksAtStartup(-1), pollTimer(0) numBlocksAtStartup(-1), pollTimer(0)

View File

@ -780,7 +780,7 @@ QString formatServicesStr(uint64_t mask)
QStringList strList; QStringList strList;
// Just scan the last 8 bits for now. // Just scan the last 8 bits for now.
for (int i=0; i < 8; i++) { for (int i = 0; i < 8; i++) {
uint64_t check = 1 << i; uint64_t check = 1 << i;
if (mask & check) if (mask & check)
{ {
@ -799,7 +799,6 @@ QString formatServicesStr(uint64_t mask)
return strList.join(" & "); return strList.join(" & ");
else else
return QObject::tr("None"); return QObject::tr("None");
} }
} // namespace GUIUtil } // namespace GUIUtil

View File

@ -178,7 +178,6 @@ namespace GUIUtil
/* Format CNodeStats.nServices bitmask into a user-readable string */ /* Format CNodeStats.nServices bitmask into a user-readable string */
QString formatServicesStr(uint64_t mask); QString formatServicesStr(uint64_t mask);
} // namespace GUIUtil } // namespace GUIUtil
#endif // GUIUTIL_H #endif // GUIUTIL_H

View File

@ -81,7 +81,6 @@ public:
} }
} }
if (sortColumn >= 0) if (sortColumn >= 0)
// sort cacheNodeStats (use stable sort to prevent rows jumping around unneceesarily) // sort cacheNodeStats (use stable sort to prevent rows jumping around unneceesarily)
qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder)); qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder));
@ -110,7 +109,6 @@ public:
return 0; return 0;
} }
} }
}; };
PeerTableModel::PeerTableModel(ClientModel *parent) : PeerTableModel::PeerTableModel(ClientModel *parent) :

View File

@ -11,10 +11,12 @@
#include <QAbstractTableModel> #include <QAbstractTableModel>
#include <QStringList> #include <QStringList>
class PeerTablePriv;
class ClientModel; class ClientModel;
class PeerTablePriv;
QT_BEGIN_NAMESPACE
class QTimer; class QTimer;
QT_END_NAMESPACE
struct CNodeCombinedStats { struct CNodeCombinedStats {
CNodeStats nodestats; CNodeStats nodestats;
@ -24,7 +26,7 @@ struct CNodeCombinedStats {
class NodeLessThan class NodeLessThan
{ {
public: public:
NodeLessThan(int nColumn, Qt::SortOrder fOrder): NodeLessThan(int nColumn, Qt::SortOrder fOrder) :
column(nColumn), order(fOrder) {} column(nColumn), order(fOrder) {}
bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const; bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const;
@ -73,7 +75,6 @@ private:
QStringList columns; QStringList columns;
PeerTablePriv *priv; PeerTablePriv *priv;
QTimer *timer; QTimer *timer;
}; };
#endif // PEERTABLEMODEL_H #endif // PEERTABLEMODEL_H

View File

@ -13,10 +13,10 @@
#include <QClipboard> #include <QClipboard>
#include <QDrag> #include <QDrag>
#include <QMenu>
#include <QMimeData> #include <QMimeData>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPixmap> #include <QPixmap>
#include <QMenu>
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
#include <QUrl> #include <QUrl>
#endif #endif

View File

@ -11,10 +11,12 @@
#include <QImage> #include <QImage>
#include <QLabel> #include <QLabel>
class OptionsModel;
namespace Ui { namespace Ui {
class ReceiveRequestDialog; class ReceiveRequestDialog;
} }
class OptionsModel;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QMenu; class QMenu;
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -10,10 +10,9 @@
#include "peertablemodel.h" #include "peertablemodel.h"
#include "main.h" #include "main.h"
#include "util.h"
#include "rpcserver.h" #include "rpcserver.h"
#include "rpcclient.h" #include "rpcclient.h"
#include "util.h"
#include "json/json_spirit_value.h" #include "json/json_spirit_value.h"
#include <openssl/crypto.h> #include <openssl/crypto.h>
@ -297,10 +296,8 @@ void RPCConsole::setClientModel(ClientModel *model)
// connect the peerWidget's selection model to our peerSelected() handler // connect the peerWidget's selection model to our peerSelected() handler
QItemSelectionModel *peerSelectModel = ui->peerWidget->selectionModel(); QItemSelectionModel *peerSelectModel = ui->peerWidget->selectionModel();
connect(peerSelectModel, connect(peerSelectModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(peerSelected(const QItemSelection &, const QItemSelection &)));
this,
SLOT(peerSelected(const QItemSelection &, const QItemSelection &)));
connect(model->getPeerTableModel(), SIGNAL(layoutChanged()), this, SLOT(peerLayoutChanged())); connect(model->getPeerTableModel(), SIGNAL(layoutChanged()), this, SLOT(peerLayoutChanged()));
// Provide initial values // Provide initial values
@ -511,6 +508,8 @@ void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelection &deselected) void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
{ {
Q_UNUSED(deselected);
if (selected.indexes().isEmpty()) if (selected.indexes().isEmpty())
return; return;
@ -638,6 +637,8 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *combinedStats)
ui->peerBanScore->setText(tr("Fetching...")); ui->peerBanScore->setText(tr("Fetching..."));
} }
// We override the virtual resizeEvent of the QWidget to adjust tables column
// sizes as the tables width is proportional to the dialogs width.
void RPCConsole::resizeEvent(QResizeEvent *event) void RPCConsole::resizeEvent(QResizeEvent *event)
{ {
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
@ -651,7 +652,7 @@ void RPCConsole::showEvent(QShowEvent *event)
// peerWidget needs a resize in case the dialog has non-default geometry // peerWidget needs a resize in case the dialog has non-default geometry
columnResizingFixer->stretchColumnWidth(PeerTableModel::Address); columnResizingFixer->stretchColumnWidth(PeerTableModel::Address);
// start the PeerTableModel refresh timer // start PeerTableModel auto refresh
clientModel->getPeerTableModel()->startAutoRefresh(1000); clientModel->getPeerTableModel()->startAutoRefresh(1000);
} }

View File

@ -6,17 +6,19 @@
#define RPCCONSOLE_H #define RPCCONSOLE_H
#include "guiutil.h" #include "guiutil.h"
#include "net.h"
#include "peertablemodel.h" #include "peertablemodel.h"
#include "net.h"
#include <QDialog> #include <QDialog>
class ClientModel; class ClientModel;
class QItemSelection;
class CNodeCombinedStats; class CNodeCombinedStats;
QT_BEGIN_NAMESPACE
class QItemSelection;
QT_END_NAMESPACE
namespace Ui { namespace Ui {
class RPCConsole; class RPCConsole;
} }

View File

@ -9,6 +9,7 @@
#include <QString> #include <QString>
class TransactionRecord; class TransactionRecord;
class CWallet; class CWallet;
class CWalletTx; class CWalletTx;