aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-06-07 18:59:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-06-07 18:59:01 +0200
commit8e86dca256624d76022be3b461b736dfc1f87625 (patch)
tree96bc89eaca145fff87bbda6a9c4fd4984cb61c51
parent6717457390d6197410f7264af6c4182a7767bc99 (diff)
consistent bracing style
-rw-r--r--gui/src/addressbookdialog.cpp6
-rw-r--r--gui/src/addresstablemodel.cpp20
-rw-r--r--gui/src/bitcoin.cpp3
-rw-r--r--gui/src/bitcoingui.cpp8
-rw-r--r--gui/src/clientmodel.cpp8
-rw-r--r--gui/src/optionsmodel.cpp12
-rw-r--r--gui/src/transactionrecord.cpp29
-rw-r--r--gui/src/transactiontablemodel.cpp47
8 files changed, 97 insertions, 36 deletions
diff --git a/gui/src/addressbookdialog.cpp b/gui/src/addressbookdialog.cpp
index 0228eff461..eaab66a202 100644
--- a/gui/src/addressbookdialog.cpp
+++ b/gui/src/addressbookdialog.cpp
@@ -80,7 +80,8 @@ void AddressBookDialog::on_copyToClipboard_clicked()
QTableView *table = getCurrentTable();
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
- foreach (QModelIndex index, indexes) {
+ foreach (QModelIndex index, indexes)
+ {
QVariant address = table->model()->data(index);
QApplication::clipboard()->setText(address.toString());
}
@@ -148,7 +149,8 @@ void AddressBookDialog::on_buttonBox_accepted()
QTableView *table = getCurrentTable();
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
- foreach (QModelIndex index, indexes) {
+ foreach (QModelIndex index, indexes)
+ {
QVariant address = table->model()->data(index);
returnValue = address.toString();
}
diff --git a/gui/src/addresstablemodel.cpp b/gui/src/addresstablemodel.cpp
index 1cbc1b5d1d..91b87fb7f1 100644
--- a/gui/src/addresstablemodel.cpp
+++ b/gui/src/addresstablemodel.cpp
@@ -58,7 +58,9 @@ struct AddressTablePriv
if(idx >= 0 && idx < cachedAddressTable.size())
{
return &cachedAddressTable[idx];
- } else {
+ }
+ else
+ {
return 0;
}
}
@@ -105,13 +107,15 @@ QVariant AddressTableModel::data(const QModelIndex &index, int role) const
case Address:
return rec->address;
}
- } else if (role == Qt::FontRole)
+ }
+ else if (role == Qt::FontRole)
{
if(index.column() == Address)
{
return GUIUtil::bitcoinAddressFont();
}
- } else if (role == TypeRole)
+ }
+ else if (role == TypeRole)
{
switch(rec->type)
{
@@ -178,7 +182,9 @@ QModelIndex AddressTableModel::index(int row, int column, const QModelIndex & pa
if(data)
{
return createIndex(row, column, priv->index(row));
- } else {
+ }
+ else
+ {
return QModelIndex();
}
}
@@ -206,11 +212,13 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
return QString();
}
}
- } else if(type == Receive)
+ }
+ else if(type == Receive)
{
/* Generate a new address to associate with given label */
strAddress = PubKeyToAddress(GetKeyFromKeyPool());
- } else
+ }
+ else
{
return QString();
}
diff --git a/gui/src/bitcoin.cpp b/gui/src/bitcoin.cpp
index 6dbcb6c299..e003267426 100644
--- a/gui/src/bitcoin.cpp
+++ b/gui/src/bitcoin.cpp
@@ -92,7 +92,8 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
app.setQuitOnLastWindowClosed(false);
- try {
+ try
+ {
if(AppInit2(argc, argv))
{
BitcoinGUI window;
diff --git a/gui/src/bitcoingui.cpp b/gui/src/bitcoingui.cpp
index 70da0b2393..ed7d133a39 100644
--- a/gui/src/bitcoingui.cpp
+++ b/gui/src/bitcoingui.cpp
@@ -345,7 +345,9 @@ void BitcoinGUI::error(const QString &title, const QString &message)
{
// Show as "balloon" message if possible
trayIcon->showMessage(title, message, QSystemTrayIcon::Critical);
- } else {
+ }
+ else
+ {
// Fall back to old fashioned popup dialog if not
QMessageBox::critical(this, title,
message,
@@ -363,7 +365,9 @@ void BitcoinGUI::changeEvent(QEvent *e)
{
hide();
e->ignore();
- } else {
+ }
+ else
+ {
e->accept();
}
}
diff --git a/gui/src/clientmodel.cpp b/gui/src/clientmodel.cpp
index 8fd3599e97..97391e0938 100644
--- a/gui/src/clientmodel.cpp
+++ b/gui/src/clientmodel.cpp
@@ -34,7 +34,9 @@ QString ClientModel::getAddress()
if (CWalletDB("r").ReadDefaultKey(vchPubKey))
{
return QString::fromStdString(PubKeyToAddress(vchPubKey));
- } else {
+ }
+ else
+ {
return QString();
}
}
@@ -116,9 +118,13 @@ ClientModel::StatusCode ClientModel::sendCoins(const QString &payTo, qint64 payA
std::string strError = SendMoney(scriptPubKey, payAmount, wtx, true);
if (strError == "")
+ {
return OK;
+ }
else if (strError == "ABORTED")
+ {
return Aborted;
+ }
else
{
emit error(tr("Sending..."), QString::fromStdString(strError));
diff --git a/gui/src/optionsmodel.cpp b/gui/src/optionsmodel.cpp
index 37d5cb1580..1528fdf697 100644
--- a/gui/src/optionsmodel.cpp
+++ b/gui/src/optionsmodel.cpp
@@ -81,7 +81,9 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
{
addrProxy.ip = addr.ip;
walletdb.WriteSetting("addrProxy", addrProxy);
- } else {
+ }
+ else
+ {
successful = false;
}
}
@@ -93,7 +95,9 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
{
addrProxy.port = htons(nPort);
walletdb.WriteSetting("addrProxy", addrProxy);
- } else {
+ }
+ else
+ {
successful = false;
}
}
@@ -104,7 +108,9 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
{
nTransactionFee = retval;
walletdb.WriteSetting("nTransactionFee", nTransactionFee);
- } else {
+ }
+ else
+ {
successful = false; /* parse error */
}
}
diff --git a/gui/src/transactionrecord.cpp b/gui/src/transactionrecord.cpp
index 83c7d63515..6c1f3a5e58 100644
--- a/gui/src/transactionrecord.cpp
+++ b/gui/src/transactionrecord.cpp
@@ -124,12 +124,15 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWalletTx
// Ignore parts sent to self, as this is usually the change
// from a transaction sent back to our own address.
continue;
- } else if (!mapValue["to"].empty())
+ }
+ else if (!mapValue["to"].empty())
{
// Sent to IP
sub.type = TransactionRecord::SendToIP;
sub.address = mapValue["to"];
- } else {
+ }
+ else
+ {
// Sent to Bitcoin Address
sub.type = TransactionRecord::SendToAddress;
uint160 hash160;
@@ -148,7 +151,9 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWalletTx
parts.append(sub);
}
- } else {
+ }
+ else
+ {
//
// Mixed debit transaction, can't break down payees
//
@@ -192,7 +197,9 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
{
status.status = TransactionStatus::OpenUntilBlock;
status.open_for = nBestHeight - wtx.nLockTime;
- } else {
+ }
+ else
+ {
status.status = TransactionStatus::OpenUntilDate;
status.open_for = wtx.nLockTime;
}
@@ -202,10 +209,12 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
{
status.status = TransactionStatus::Offline;
- } else if (status.depth < 6)
+ }
+ else if (status.depth < 6)
{
status.status = TransactionStatus::Unconfirmed;
- } else
+ }
+ else
{
status.status = TransactionStatus::HaveConfirmations;
}
@@ -226,10 +235,14 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
// Check if the block was requested by anyone
if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
status.maturity = TransactionStatus::MaturesWarning;
- } else {
+ }
+ else
+ {
status.maturity = TransactionStatus::NotAccepted;
}
- } else {
+ }
+ else
+ {
status.maturity = TransactionStatus::Mature;
}
}
diff --git a/gui/src/transactiontablemodel.cpp b/gui/src/transactiontablemodel.cpp
index 0d50e6e2df..f99784794c 100644
--- a/gui/src/transactiontablemodel.cpp
+++ b/gui/src/transactiontablemodel.cpp
@@ -121,13 +121,15 @@ struct TransactionTablePriv
}
parent->endInsertRows();
}
- } else if(!inWallet && inModel)
+ }
+ else if(!inWallet && inModel)
{
/* Removed */
parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
cachedWallet.erase(lower, upper);
parent->endRemoveRows();
- } else if(inWallet && inModel)
+ }
+ else if(inWallet && inModel)
{
/* Updated */
@@ -167,7 +169,9 @@ struct TransactionTablePriv
}
}
return rec;
- } else {
+ }
+ else
+ {
return 0;
}
}
@@ -274,7 +278,9 @@ QVariant TransactionTableModel::formatTxDate(const TransactionRecord *wtx) const
if(wtx->time)
{
return QVariant(GUIUtil::DateTimeStr(wtx->time));
- } else {
+ }
+ else
+ {
return QVariant();
}
}
@@ -296,7 +302,9 @@ std::string lookupAddress(const std::string &address)
description += "(" + label + ")";
}
else
+ {
description += address;
+ }
}
return description;
}
@@ -354,7 +362,9 @@ QVariant TransactionTableModel::formatTxDebit(const TransactionRecord *wtx) cons
str = QString("[") + str + QString("]");
}
return QVariant(str);
- } else {
+ }
+ else
+ {
return QVariant();
}
}
@@ -369,7 +379,9 @@ QVariant TransactionTableModel::formatTxCredit(const TransactionRecord *wtx) con
str = QString("[") + str + QString("]");
}
return QVariant(str);
- } else {
+ }
+ else
+ {
return QVariant();
}
}
@@ -396,7 +408,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case Credit:
return formatTxCredit(rec);
}
- } else if(role == Qt::EditRole)
+ }
+ else if(role == Qt::EditRole)
{
/* Edit role is used for sorting so return the real values */
switch(index.column())
@@ -412,19 +425,24 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case Credit:
return rec->credit;
}
- } else if (role == Qt::TextAlignmentRole)
+ }
+ else if (role == Qt::TextAlignmentRole)
{
return column_alignments[index.column()];
- } else if (role == Qt::ForegroundRole)
+ }
+ else if (role == Qt::ForegroundRole)
{
/* Non-confirmed transactions are grey */
if(rec->status.confirmed)
{
return QColor(0, 0, 0);
- } else {
+ }
+ else
+ {
return QColor(128, 128, 128);
}
- } else if (role == TypeRole)
+ }
+ else if (role == TypeRole)
{
/* Role for filtering tabs by type */
switch(rec->type)
@@ -450,7 +468,8 @@ QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientat
if(role == Qt::DisplayRole)
{
return columns[section];
- } else if (role == Qt::TextAlignmentRole)
+ }
+ else if (role == Qt::TextAlignmentRole)
{
return column_alignments[section];
}
@@ -470,7 +489,9 @@ QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex
if(data)
{
return createIndex(row, column, priv->index(row));
- } else {
+ }
+ else
+ {
return QModelIndex();
}
}