consistent bracing style

This commit is contained in:
Wladimir J. van der Laan 2011-06-07 18:59:01 +02:00
parent 6717457390
commit 8e86dca256
8 changed files with 97 additions and 36 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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();
}
}

View File

@ -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));

View File

@ -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 */
}
}

View File

@ -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;
}
}

View File

@ -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,8 +302,10 @@ 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();
}
}