Skip to content

Commit 7f3c4f0

Browse files
committed
Merge pull request #3923
cfe4cad [Qt] fix style, formating, comment and indentation problems (Philip Kaufmann)
2 parents 47ef190 + cfe4cad commit 7f3c4f0

File tree

7 files changed

+69
-67
lines changed

7 files changed

+69
-67
lines changed

src/qt/guiutil.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,15 @@ void TableViewLastColumnResizingFixer::connectViewHeadersSignals()
392392
connect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged()));
393393
}
394394

395-
//we need to disconnect these while handling the resize events, otherwise we can enter infinite loops
395+
// We need to disconnect these while handling the resize events, otherwise we can enter infinite loops.
396396
void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals()
397397
{
398398
disconnect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int)));
399399
disconnect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged()));
400400
}
401401

402-
//setup the resize mode, handles compatibility for QT5 and below as the method signatures changed. (refactored here for readability)
402+
// Setup the resize mode, handles compatibility for Qt5 and below as the method signatures changed.
403+
// Refactored here for readability.
403404
void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode)
404405
{
405406
#if QT_VERSION < 0x050000
@@ -409,7 +410,8 @@ void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex,
409410
#endif
410411
}
411412

412-
void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width) {
413+
void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width)
414+
{
413415
tableView->setColumnWidth(nColumnIndex, width);
414416
tableView->horizontalHeader()->resizeSection(nColumnIndex, width);
415417
}
@@ -438,7 +440,7 @@ int TableViewLastColumnResizingFixer::getAvailableWidthForColumn(int column)
438440
return nResult;
439441
}
440442

441-
//make sure we don't make the columns wider than the table's viewport's width.
443+
// Make sure we don't make the columns wider than the tables viewport width.
442444
void TableViewLastColumnResizingFixer::adjustTableColumnsWidth()
443445
{
444446
disconnectViewHeadersSignals();
@@ -453,14 +455,15 @@ void TableViewLastColumnResizingFixer::adjustTableColumnsWidth()
453455
}
454456
}
455457

456-
//make column use all the space available, useful during window resizing.
457-
void TableViewLastColumnResizingFixer::stretchColumnWidth(int column) {
458+
// Make column use all the space available, useful during window resizing.
459+
void TableViewLastColumnResizingFixer::stretchColumnWidth(int column)
460+
{
458461
disconnectViewHeadersSignals();
459462
resizeColumn(column, getAvailableWidthForColumn(column));
460463
connectViewHeadersSignals();
461464
}
462465

463-
//when a section is resized this is a slot-proxy for ajustAmountColumnWidth()
466+
// When a section is resized this is a slot-proxy for ajustAmountColumnWidth().
464467
void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int oldSize, int newSize)
465468
{
466469
adjustTableColumnsWidth();
@@ -471,8 +474,8 @@ void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int o
471474
}
472475
}
473476

474-
//when the table's geometry is ready, we manually perform the Stretch of the "Message" column
475-
//as the "Stretch" resize mode does not allow for interactive resizing.
477+
// When the tabless geometry is ready, we manually perform the stretch of the "Message" column,
478+
// as the "Stretch" resize mode does not allow for interactive resizing.
476479
void TableViewLastColumnResizingFixer::on_geometriesChanged()
477480
{
478481
if ((getColumnsWidth() - this->tableView->horizontalHeader()->width()) != 0)
@@ -488,9 +491,9 @@ void TableViewLastColumnResizingFixer::on_geometriesChanged()
488491
* the resize modes of the last 2 columns of the table and
489492
*/
490493
TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth) :
491-
tableView(table),
492-
lastColumnMinimumWidth(lastColMinimumWidth),
493-
allColumnsMinimumWidth(allColsMinimumWidth)
494+
tableView(table),
495+
lastColumnMinimumWidth(lastColMinimumWidth),
496+
allColumnsMinimumWidth(allColsMinimumWidth)
494497
{
495498
columnCount = tableView->horizontalHeader()->count();
496499
lastColumnIndex = columnCount - 1;
@@ -500,7 +503,6 @@ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* t
500503
setViewHeaderResizeMode(lastColumnIndex, QHeaderView::Interactive);
501504
}
502505

503-
504506
#ifdef WIN32
505507
boost::filesystem::path static StartupShortcutPath()
506508
{

src/qt/guiutil.h

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#ifndef GUIUTIL_H
66
#define GUIUTIL_H
77

8+
#include <QHeaderView>
89
#include <QMessageBox>
910
#include <QObject>
1011
#include <QString>
1112
#include <QTableView>
12-
#include <QHeaderView>
1313

1414
#include <boost/filesystem.hpp>
1515

@@ -132,30 +132,31 @@ namespace GUIUtil
132132
*/
133133
class TableViewLastColumnResizingFixer: public QObject
134134
{
135-
Q_OBJECT
136-
public:
137-
TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth);
138-
void stretchColumnWidth(int column);
135+
Q_OBJECT
139136

140-
private:
141-
QTableView* tableView;
142-
int lastColumnMinimumWidth;
143-
int allColumnsMinimumWidth;
144-
int lastColumnIndex;
145-
int columnCount;
146-
int secondToLastColumnIndex;
147-
148-
void adjustTableColumnsWidth();
149-
int getAvailableWidthForColumn(int column);
150-
int getColumnsWidth();
151-
void connectViewHeadersSignals();
152-
void disconnectViewHeadersSignals();
153-
void setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode);
154-
void resizeColumn(int nColumnIndex, int width);
155-
156-
private slots:
157-
void on_sectionResized(int logicalIndex, int oldSize, int newSize);
158-
void on_geometriesChanged();
137+
public:
138+
TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth);
139+
void stretchColumnWidth(int column);
140+
141+
private:
142+
QTableView* tableView;
143+
int lastColumnMinimumWidth;
144+
int allColumnsMinimumWidth;
145+
int lastColumnIndex;
146+
int columnCount;
147+
int secondToLastColumnIndex;
148+
149+
void adjustTableColumnsWidth();
150+
int getAvailableWidthForColumn(int column);
151+
int getColumnsWidth();
152+
void connectViewHeadersSignals();
153+
void disconnectViewHeadersSignals();
154+
void setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode);
155+
void resizeColumn(int nColumnIndex, int width);
156+
157+
private slots:
158+
void on_sectionResized(int logicalIndex, int oldSize, int newSize);
159+
void on_geometriesChanged();
159160
};
160161

161162
bool GetStartOnSystemStartup();

src/qt/receivecoinsdialog.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) :
5555
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
5656
}
5757

58-
59-
6058
void ReceiveCoinsDialog::setModel(WalletModel *model)
6159
{
6260
this->model = model;
@@ -79,11 +77,9 @@ void ReceiveCoinsDialog::setModel(WalletModel *model)
7977
tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
8078

8179
connect(tableView->selectionModel(),
82-
SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
83-
this,
80+
SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
8481
SLOT(on_recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
85-
86-
//(last 2 columns are set when the table geometry is ready) by the columnResizingFixer.
82+
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
8783
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH);
8884
}
8985
}
@@ -202,10 +198,12 @@ void ReceiveCoinsDialog::on_removeRequestButton_clicked()
202198
model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());
203199
}
204200

205-
//We override the virtual resizeEvent of the QWidget to adjust tablet's column sizes as the table's width is proportional to the dialog's.
206-
void ReceiveCoinsDialog::resizeEvent(QResizeEvent* event) {
207-
QWidget::resizeEvent(event);
208-
columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
201+
// We override the virtual resizeEvent of the QWidget to adjust tables column
202+
// sizes as the tables width is proportional to the dialogs width.
203+
void ReceiveCoinsDialog::resizeEvent(QResizeEvent* event)
204+
{
205+
QWidget::resizeEvent(event);
206+
columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
209207
}
210208

211209
void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event)

src/qt/receivecoinsdialog.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
#define RECEIVECOINSDIALOG_H
77

88
#include <QDialog>
9+
#include <QHeaderView>
10+
#include <QItemSelection>
911
#include <QKeyEvent>
1012
#include <QMenu>
1113
#include <QPoint>
1214
#include <QVariant>
13-
#include <QHeaderView>
14-
#include <QItemSelection>
15+
1516
#include "guiutil.h"
1617

1718
namespace Ui {
@@ -31,16 +32,16 @@ class ReceiveCoinsDialog : public QDialog
3132

3233
public:
3334
enum ColumnWidths {
34-
DATE_COLUMN_WIDTH = 130,
35-
LABEL_COLUMN_WIDTH = 120,
36-
AMOUNT_MINIMUM_COLUMN_WIDTH = 160,
37-
MINIMUM_COLUMN_WIDTH = 130
35+
DATE_COLUMN_WIDTH = 130,
36+
LABEL_COLUMN_WIDTH = 120,
37+
AMOUNT_MINIMUM_COLUMN_WIDTH = 160,
38+
MINIMUM_COLUMN_WIDTH = 130
3839
};
3940

4041
explicit ReceiveCoinsDialog(QWidget *parent = 0);
4142
~ReceiveCoinsDialog();
42-
void setModel(WalletModel *model);
4343

44+
void setModel(WalletModel *model);
4445

4546
public slots:
4647
void clear();

src/qt/transactionview.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,10 @@ void TransactionView::focusTransaction(const QModelIndex &idx)
438438
transactionView->setFocus();
439439
}
440440

441-
//We override the virtual resizeEvent of the QWidget to adjust tablet's column sizes as the table's width is proportional to the dialog's.
442-
void TransactionView::resizeEvent(QResizeEvent* event) {
443-
QWidget::resizeEvent(event);
444-
columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress);
441+
// We override the virtual resizeEvent of the QWidget to adjust tables column
442+
// sizes as the tables width is proportional to the dialogs width.
443+
void TransactionView::resizeEvent(QResizeEvent* event)
444+
{
445+
QWidget::resizeEvent(event);
446+
columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress);
445447
}

src/qt/transactionview.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
#ifndef TRANSACTIONVIEW_H
66
#define TRANSACTIONVIEW_H
77

8-
#include <QWidget>
98
#include "guiutil.h"
109

10+
#include <QWidget>
11+
1112
class TransactionFilterProxy;
1213
class WalletModel;
1314

@@ -46,11 +47,11 @@ class TransactionView : public QWidget
4647
};
4748

4849
enum ColumnWidths {
49-
STATUS_COLUMN_WIDTH = 23,
50-
DATE_COLUMN_WIDTH = 120,
51-
TYPE_COLUMN_WIDTH = 120,
52-
AMOUNT_MINIMUM_COLUMN_WIDTH = 120,
53-
MINIMUM_COLUMN_WIDTH = 23
50+
STATUS_COLUMN_WIDTH = 23,
51+
DATE_COLUMN_WIDTH = 120,
52+
TYPE_COLUMN_WIDTH = 120,
53+
AMOUNT_MINIMUM_COLUMN_WIDTH = 120,
54+
MINIMUM_COLUMN_WIDTH = 23
5455
};
5556

5657
private:

src/rpcwallet.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,3 @@ Value getwalletinfo(const Array& params, bool fHelp)
19181918
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
19191919
return obj;
19201920
}
1921-
1922-
1923-

0 commit comments

Comments
 (0)