Skip to content

Commit

Permalink
[Qt] style police and small addition in rpcconsole
Browse files Browse the repository at this point in the history
- fix spaces, indentation and coding style glitches
  • Loading branch information
Philip Kaufmann committed Jun 3, 2014
1 parent 4c097f9 commit bbe1925
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 21 deletions.
4 changes: 3 additions & 1 deletion src/qt/clientmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
static const int64_t nClientStartupTime = GetTime();

ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
QObject(parent), optionsModel(optionsModel), peerTableModel(0),
QObject(parent),
optionsModel(optionsModel),
peerTableModel(0),
cachedNumBlocks(0),
cachedReindexing(0), cachedImporting(0),
numBlocksAtStartup(-1), pollTimer(0)
Expand Down
3 changes: 1 addition & 2 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ QString formatServicesStr(uint64_t mask)
QStringList strList;

// 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;
if (mask & check)
{
Expand All @@ -799,7 +799,6 @@ QString formatServicesStr(uint64_t mask)
return strList.join(" & ");
else
return QObject::tr("None");

}

} // namespace GUIUtil
1 change: 0 additions & 1 deletion src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ namespace GUIUtil

/* Format CNodeStats.nServices bitmask into a user-readable string */
QString formatServicesStr(uint64_t mask);

} // namespace GUIUtil

#endif // GUIUTIL_H
2 changes: 0 additions & 2 deletions src/qt/peertablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class PeerTablePriv
}
}


if (sortColumn >= 0)
// sort cacheNodeStats (use stable sort to prevent rows jumping around unneceesarily)
qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder));
Expand Down Expand Up @@ -110,7 +109,6 @@ class PeerTablePriv
return 0;
}
}

};

PeerTableModel::PeerTableModel(ClientModel *parent) :
Expand Down
7 changes: 4 additions & 3 deletions src/qt/peertablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#include <QAbstractTableModel>
#include <QStringList>

class PeerTablePriv;
class ClientModel;
class PeerTablePriv;

QT_BEGIN_NAMESPACE
class QTimer;
QT_END_NAMESPACE

struct CNodeCombinedStats {
CNodeStats nodestats;
Expand All @@ -24,7 +26,7 @@ struct CNodeCombinedStats {
class NodeLessThan
{
public:
NodeLessThan(int nColumn, Qt::SortOrder fOrder):
NodeLessThan(int nColumn, Qt::SortOrder fOrder) :
column(nColumn), order(fOrder) {}
bool operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const;

Expand Down Expand Up @@ -73,7 +75,6 @@ public slots:
QStringList columns;
PeerTablePriv *priv;
QTimer *timer;

};

#endif // PEERTABLEMODEL_H
2 changes: 1 addition & 1 deletion src/qt/receiverequestdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

#include <QClipboard>
#include <QDrag>
#include <QMenu>
#include <QMimeData>
#include <QMouseEvent>
#include <QPixmap>
#include <QMenu>
#if QT_VERSION < 0x050000
#include <QUrl>
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/qt/receiverequestdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#include <QImage>
#include <QLabel>

class OptionsModel;

namespace Ui {
class ReceiveRequestDialog;
}
class OptionsModel;

QT_BEGIN_NAMESPACE
class QMenu;
QT_END_NAMESPACE
Expand Down
15 changes: 8 additions & 7 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
#include "peertablemodel.h"

#include "main.h"
#include "util.h"

#include "rpcserver.h"
#include "rpcclient.h"
#include "util.h"

#include "json/json_spirit_value.h"
#include <openssl/crypto.h>
Expand Down Expand Up @@ -297,10 +296,8 @@ void RPCConsole::setClientModel(ClientModel *model)

// connect the peerWidget's selection model to our peerSelected() handler
QItemSelectionModel *peerSelectModel = ui->peerWidget->selectionModel();
connect(peerSelectModel,
SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this,
SLOT(peerSelected(const QItemSelection &, const QItemSelection &)));
connect(peerSelectModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
this, SLOT(peerSelected(const QItemSelection &, const QItemSelection &)));
connect(model->getPeerTableModel(), SIGNAL(layoutChanged()), this, SLOT(peerLayoutChanged()));

// Provide initial values
Expand Down Expand Up @@ -511,6 +508,8 @@ void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)

void RPCConsole::peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
{
Q_UNUSED(deselected);

if (selected.indexes().isEmpty())
return;

Expand Down Expand Up @@ -638,6 +637,8 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *combinedStats)
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)
{
QWidget::resizeEvent(event);
Expand All @@ -651,7 +652,7 @@ void RPCConsole::showEvent(QShowEvent *event)
// peerWidget needs a resize in case the dialog has non-default geometry
columnResizingFixer->stretchColumnWidth(PeerTableModel::Address);

// start the PeerTableModel refresh timer
// start PeerTableModel auto refresh
clientModel->getPeerTableModel()->startAutoRefresh(1000);
}

Expand Down
8 changes: 5 additions & 3 deletions src/qt/rpcconsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
#define RPCCONSOLE_H

#include "guiutil.h"
#include "net.h"

#include "peertablemodel.h"

#include "net.h"

#include <QDialog>

class ClientModel;
class CNodeCombinedStats;

QT_BEGIN_NAMESPACE
class QItemSelection;
class CNodeCombinedStats;
QT_END_NAMESPACE

namespace Ui {
class RPCConsole;
Expand Down
1 change: 1 addition & 0 deletions src/qt/transactiondesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <QString>

class TransactionRecord;

class CWallet;
class CWalletTx;

Expand Down

0 comments on commit bbe1925

Please sign in to comment.