/*
- * Qt4 bitcoin GUI.
+ * Qt4 ppcoin GUI.
*
* W.J. van der Laan 2011-2012
* The Bitcoin Developers 2011-2012
+ * The PPCoin Developers 2011-2012
*/
#include "bitcoingui.h"
#include "transactiontablemodel.h"
notificator(0)
{
resize(850, 550);
- setWindowTitle(tr("Bitcoin Wallet"));
+ setWindowTitle(tr("PPCoin Wallet"));
#ifndef Q_WS_MAC
setWindowIcon(QIcon(":icons/bitcoin"));
#else
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Number of transactions:</string>
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="5" column="1">
<widget class="QLabel" name="labelNumTransactions">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Unconfirmed:</string>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<widget class="QLabel" name="labelUnconfirmed">
<property name="text">
<string notr="true">0 BTC</string>
</property>
</widget>
</item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Stake:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="labelStake">
+ <property name="text">
+ <string notr="true">0 BTC</string>
+ </property>
+ </widget>
+ </item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
QWidget(parent),
ui(new Ui::OverviewPage),
currentBalance(-1),
+ currentStake(0),
currentUnconfirmedBalance(-1),
txdelegate(new TxViewDelegate())
{
ui->labelBalance->setToolTip(tr("Your current balance"));
ui->labelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
+ // ppcoin: stake: <stake>
+ ui->labelStake->setFont(QFont("Monospace", -1, QFont::Bold));
+ ui->labelStake->setToolTip(tr("Your current stake"));
+ ui->labelStake->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
+
// Unconfirmed balance: <balance>
ui->labelUnconfirmed->setFont(QFont("Monospace", -1, QFont::Bold));
ui->labelUnconfirmed->setToolTip(tr("Total of transactions that have yet to be confirmed, and do not yet count toward the current balance"));
delete ui;
}
-void OverviewPage::setBalance(qint64 balance, qint64 unconfirmedBalance)
+void OverviewPage::setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance)
{
int unit = model->getOptionsModel()->getDisplayUnit();
currentBalance = balance;
+ currentStake = stake;
currentUnconfirmedBalance = unconfirmedBalance;
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance));
+ ui->labelStake->setText(BitcoinUnits::formatWithUnit(unit, stake));
ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(unit, unconfirmedBalance));
}
filter->setLimit(NUM_ITEMS);
filter->setDynamicSortFilter(true);
filter->setSortRole(Qt::EditRole);
- filter->sort(TransactionTableModel::Status, Qt::DescendingOrder);
+ filter->sort(TransactionTableModel::Date, Qt::DescendingOrder);
ui->listTransactions->setModel(filter);
ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress);
// Keep up to date with wallet
- setBalance(model->getBalance(), model->getUnconfirmedBalance());
- connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64)));
+ setBalance(model->getBalance(), model->getStake(), model->getUnconfirmedBalance());
+ connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64)));
setNumTransactions(model->getNumTransactions());
connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
if(!model || !model->getOptionsModel())
return;
if(currentBalance != -1)
- setBalance(currentBalance, currentUnconfirmedBalance);
+ setBalance(currentBalance, currentStake, currentUnconfirmedBalance);
txdelegate->unit = model->getOptionsModel()->getDisplayUnit();
ui->listTransactions->update();
void setModel(WalletModel *model);
public slots:
- void setBalance(qint64 balance, qint64 unconfirmedBalance);
+ void setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance);
void setNumTransactions(int count);
signals:
Ui::OverviewPage *ui;
WalletModel *model;
qint64 currentBalance;
+ qint64 currentStake;
qint64 currentUnconfirmedBalance;
TxViewDelegate *txdelegate;
}
if(model)
{
- setBalance(model->getBalance(), model->getUnconfirmedBalance());
- connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64)));
+ setBalance(model->getBalance(), model->getStake(), model->getUnconfirmedBalance());
+ connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64)));
}
}
pasteEntry(rv);
}
-void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance)
+void SendCoinsDialog::setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance)
{
+ Q_UNUSED(stake);
Q_UNUSED(unconfirmedBalance);
if(!model || !model->getOptionsModel())
return;
void accept();
SendCoinsEntry *addEntry();
void updateRemoveEnabled();
- void setBalance(qint64 balance, qint64 unconfirmedBalance);
+ void setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance);
private:
Ui::SendCoinsDialog *ui;
strHTML += QString("<b>") + tr("Transaction ID:") + "</b> " + wtx.GetHash().ToString().c_str() + "<br>";
if (wtx.IsCoinBase())
- strHTML += QString("<br>") + tr("Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.") + "<br>";
+ strHTML += QString("<br>") + tr("Generated coins must wait 520 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.") + "<br>";
+ if (wtx.IsCoinStake())
+ strHTML += QString("<br>") + tr("Staked coins must wait 520 blocks before they can return to balance and be spent. When you generated this proof-of-stake block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to \"not accepted\" and not be a valid stake. This may occasionally happen if another node generates a proof-of-stake block within a few seconds of yours.") + "<br>";
//
// Debug view
if (showTransaction(wtx))
{
- if (nNet > 0 || wtx.IsCoinBase())
+ if (wtx.IsCoinStake()) // ppcoin: coinstake transaction
+ {
+ parts.append(TransactionRecord(hash, nTime, TransactionRecord::StakeMint, "", -nDebit, wtx.GetValueOut()));
+ }
+ else if (nNet > 0 || wtx.IsCoinBase())
{
//
// Credit
}
// For generated transactions, determine maturity
- if(type == TransactionRecord::Generated)
+ if(type == TransactionRecord::Generated || type == TransactionRecord::StakeMint)
{
int64 nCredit = wtx.GetCredit(true);
if (nCredit == 0)
SendToOther,
RecvWithAddress,
RecvFromOther,
- SendToSelf
+ SendToSelf,
+ StakeMint
};
/** Number of confirmation needed for transaction */
status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth);
break;
}
- if(wtx->type == TransactionRecord::Generated)
+ if(wtx->type == TransactionRecord::Generated || wtx->type == TransactionRecord::StakeMint)
{
switch(wtx->status.maturity)
{
return tr("Payment to yourself");
case TransactionRecord::Generated:
return tr("Mined");
+ case TransactionRecord::StakeMint:
+ return tr("Mint by stake");
default:
return QString();
}
TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
+ typeWidget->addItem(tr("Mint by stake"), TransactionFilterProxy::TYPE(TransactionRecord::StakeMint));
typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));
hlayout->addWidget(typeWidget);
return wallet->GetBalance();
}
+qint64 WalletModel::getStake() const
+{
+ return wallet->GetStake();
+}
+
qint64 WalletModel::getUnconfirmedBalance() const
{
return wallet->GetUnconfirmedBalance();
EncryptionStatus newEncryptionStatus = getEncryptionStatus();
if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance)
- emit balanceChanged(newBalance, newUnconfirmedBalance);
+ emit balanceChanged(newBalance, getStake(), newUnconfirmedBalance);
if(cachedNumTransactions != newNumTransactions)
emit numTransactionsChanged(newNumTransactions);
TransactionTableModel *getTransactionTableModel();
qint64 getBalance() const;
+ qint64 getStake() const;
qint64 getUnconfirmedBalance() const;
int getNumTransactions() const;
EncryptionStatus getEncryptionStatus() const;
signals:
// Signal that balance in wallet changed
- void balanceChanged(qint64 balance, qint64 unconfirmedBalance);
+ void balanceChanged(qint64 balance, qint64 stake, qint64 unconfirmedBalance);
// Number of transactions in wallet changed
void numTransactionsChanged(int count);