Browse Source

[Qt] fix style, formating, comment and indentation problems

- introduced by #3920
0.10
Philip Kaufmann 11 years ago
parent
commit
cfe4cad9e5
  1. 20
      src/qt/guiutil.cpp
  2. 3
      src/qt/guiutil.h
  3. 14
      src/qt/receivecoinsdialog.cpp
  4. 7
      src/qt/receivecoinsdialog.h
  5. 6
      src/qt/transactionview.cpp
  6. 3
      src/qt/transactionview.h
  7. 3
      src/rpcwallet.cpp

20
src/qt/guiutil.cpp

@ -392,14 +392,15 @@ void TableViewLastColumnResizingFixer::connectViewHeadersSignals()
connect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); connect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged()));
} }
//we need to disconnect these while handling the resize events, otherwise we can enter infinite loops // We need to disconnect these while handling the resize events, otherwise we can enter infinite loops.
void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals() void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals()
{ {
disconnect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int))); disconnect(tableView->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(on_sectionResized(int,int,int)));
disconnect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged())); disconnect(tableView->horizontalHeader(), SIGNAL(geometriesChanged()), this, SLOT(on_geometriesChanged()));
} }
//setup the resize mode, handles compatibility for QT5 and below as the method signatures changed. (refactored here for readability) // Setup the resize mode, handles compatibility for Qt5 and below as the method signatures changed.
// Refactored here for readability.
void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode) void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode)
{ {
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
@ -409,7 +410,8 @@ void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex,
#endif #endif
} }
void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width) { void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width)
{
tableView->setColumnWidth(nColumnIndex, width); tableView->setColumnWidth(nColumnIndex, width);
tableView->horizontalHeader()->resizeSection(nColumnIndex, width); tableView->horizontalHeader()->resizeSection(nColumnIndex, width);
} }
@ -438,7 +440,7 @@ int TableViewLastColumnResizingFixer::getAvailableWidthForColumn(int column)
return nResult; return nResult;
} }
//make sure we don't make the columns wider than the table's viewport's width. // Make sure we don't make the columns wider than the tables viewport width.
void TableViewLastColumnResizingFixer::adjustTableColumnsWidth() void TableViewLastColumnResizingFixer::adjustTableColumnsWidth()
{ {
disconnectViewHeadersSignals(); disconnectViewHeadersSignals();
@ -453,14 +455,15 @@ void TableViewLastColumnResizingFixer::adjustTableColumnsWidth()
} }
} }
//make column use all the space available, useful during window resizing. // Make column use all the space available, useful during window resizing.
void TableViewLastColumnResizingFixer::stretchColumnWidth(int column) { void TableViewLastColumnResizingFixer::stretchColumnWidth(int column)
{
disconnectViewHeadersSignals(); disconnectViewHeadersSignals();
resizeColumn(column, getAvailableWidthForColumn(column)); resizeColumn(column, getAvailableWidthForColumn(column));
connectViewHeadersSignals(); connectViewHeadersSignals();
} }
//when a section is resized this is a slot-proxy for ajustAmountColumnWidth() // When a section is resized this is a slot-proxy for ajustAmountColumnWidth().
void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int oldSize, int newSize) void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int oldSize, int newSize)
{ {
adjustTableColumnsWidth(); adjustTableColumnsWidth();
@ -471,7 +474,7 @@ void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int o
} }
} }
//when the table's geometry is ready, we manually perform the Stretch of the "Message" column // When the tabless geometry is ready, we manually perform the stretch of the "Message" column,
// as the "Stretch" resize mode does not allow for interactive resizing. // as the "Stretch" resize mode does not allow for interactive resizing.
void TableViewLastColumnResizingFixer::on_geometriesChanged() void TableViewLastColumnResizingFixer::on_geometriesChanged()
{ {
@ -500,7 +503,6 @@ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* t
setViewHeaderResizeMode(lastColumnIndex, QHeaderView::Interactive); setViewHeaderResizeMode(lastColumnIndex, QHeaderView::Interactive);
} }
#ifdef WIN32 #ifdef WIN32
boost::filesystem::path static StartupShortcutPath() boost::filesystem::path static StartupShortcutPath()
{ {

3
src/qt/guiutil.h

@ -5,11 +5,11 @@
#ifndef GUIUTIL_H #ifndef GUIUTIL_H
#define GUIUTIL_H #define GUIUTIL_H
#include <QHeaderView>
#include <QMessageBox> #include <QMessageBox>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QTableView> #include <QTableView>
#include <QHeaderView>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@ -133,6 +133,7 @@ namespace GUIUtil
class TableViewLastColumnResizingFixer: public QObject class TableViewLastColumnResizingFixer: public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth); TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth);
void stretchColumnWidth(int column); void stretchColumnWidth(int column);

14
src/qt/receivecoinsdialog.cpp

@ -55,8 +55,6 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) :
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
} }
void ReceiveCoinsDialog::setModel(WalletModel *model) void ReceiveCoinsDialog::setModel(WalletModel *model)
{ {
this->model = model; this->model = model;
@ -79,11 +77,9 @@ void ReceiveCoinsDialog::setModel(WalletModel *model)
tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH); tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
connect(tableView->selectionModel(), connect(tableView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
this,
SLOT(on_recentRequestsView_selectionChanged(QItemSelection, QItemSelection))); SLOT(on_recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
//(last 2 columns are set when the table geometry is ready) by the columnResizingFixer.
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH); columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH);
} }
} }
@ -202,8 +198,10 @@ void ReceiveCoinsDialog::on_removeRequestButton_clicked()
model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent()); model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());
} }
//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. // We override the virtual resizeEvent of the QWidget to adjust tables column
void ReceiveCoinsDialog::resizeEvent(QResizeEvent* event) { // sizes as the tables width is proportional to the dialogs width.
void ReceiveCoinsDialog::resizeEvent(QResizeEvent* event)
{
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message); columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
} }

7
src/qt/receivecoinsdialog.h

@ -6,12 +6,13 @@
#define RECEIVECOINSDIALOG_H #define RECEIVECOINSDIALOG_H
#include <QDialog> #include <QDialog>
#include <QHeaderView>
#include <QItemSelection>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMenu> #include <QMenu>
#include <QPoint> #include <QPoint>
#include <QVariant> #include <QVariant>
#include <QHeaderView>
#include <QItemSelection>
#include "guiutil.h" #include "guiutil.h"
namespace Ui { namespace Ui {
@ -39,8 +40,8 @@ public:
explicit ReceiveCoinsDialog(QWidget *parent = 0); explicit ReceiveCoinsDialog(QWidget *parent = 0);
~ReceiveCoinsDialog(); ~ReceiveCoinsDialog();
void setModel(WalletModel *model);
void setModel(WalletModel *model);
public slots: public slots:
void clear(); void clear();

6
src/qt/transactionview.cpp

@ -438,8 +438,10 @@ void TransactionView::focusTransaction(const QModelIndex &idx)
transactionView->setFocus(); transactionView->setFocus();
} }
//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. // We override the virtual resizeEvent of the QWidget to adjust tables column
void TransactionView::resizeEvent(QResizeEvent* event) { // sizes as the tables width is proportional to the dialogs width.
void TransactionView::resizeEvent(QResizeEvent* event)
{
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress); columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress);
} }

3
src/qt/transactionview.h

@ -5,9 +5,10 @@
#ifndef TRANSACTIONVIEW_H #ifndef TRANSACTIONVIEW_H
#define TRANSACTIONVIEW_H #define TRANSACTIONVIEW_H
#include <QWidget>
#include "guiutil.h" #include "guiutil.h"
#include <QWidget>
class TransactionFilterProxy; class TransactionFilterProxy;
class WalletModel; class WalletModel;

3
src/rpcwallet.cpp

@ -1918,6 +1918,3 @@ Value getwalletinfo(const Array& params, bool fHelp)
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
return obj; return obj;
} }

Loading…
Cancel
Save