Browse Source

consistent bracing style

miguelfreitas
Wladimir J. van der Laan 14 years ago
parent
commit
8e86dca256
  1. 6
      gui/src/addressbookdialog.cpp
  2. 20
      gui/src/addresstablemodel.cpp
  3. 3
      gui/src/bitcoin.cpp
  4. 8
      gui/src/bitcoingui.cpp
  5. 8
      gui/src/clientmodel.cpp
  6. 12
      gui/src/optionsmodel.cpp
  7. 29
      gui/src/transactionrecord.cpp
  8. 47
      gui/src/transactiontablemodel.cpp

6
gui/src/addressbookdialog.cpp

@ -80,7 +80,8 @@ void AddressBookDialog::on_copyToClipboard_clicked() @@ -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() @@ -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();
}

20
gui/src/addresstablemodel.cpp

@ -58,7 +58,9 @@ struct AddressTablePriv @@ -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 @@ -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 @@ -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 @@ -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();
}

3
gui/src/bitcoin.cpp

@ -92,7 +92,8 @@ int main(int argc, char *argv[]) @@ -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;

8
gui/src/bitcoingui.cpp

@ -345,7 +345,9 @@ void BitcoinGUI::error(const QString &title, const QString &message) @@ -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) @@ -363,7 +365,9 @@ void BitcoinGUI::changeEvent(QEvent *e)
{
hide();
e->ignore();
} else {
}
else
{
e->accept();
}
}

8
gui/src/clientmodel.cpp

@ -34,7 +34,9 @@ QString ClientModel::getAddress() @@ -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 @@ -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));

12
gui/src/optionsmodel.cpp

@ -81,7 +81,9 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in @@ -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 @@ -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 @@ -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 */
}
}

29
gui/src/transactionrecord.cpp

@ -124,12 +124,15 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWalletTx @@ -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 @@ -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) @@ -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) @@ -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) @@ -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;
}
}

47
gui/src/transactiontablemodel.cpp

@ -121,13 +121,15 @@ struct TransactionTablePriv @@ -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 @@ -167,7 +169,9 @@ struct TransactionTablePriv
}
}
return rec;
} else {
}
else
{
return 0;
}
}
@ -274,7 +278,9 @@ QVariant TransactionTableModel::formatTxDate(const TransactionRecord *wtx) const @@ -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) @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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();
}
}

Loading…
Cancel
Save