don't count or spend payments until they have 1 confirmation,
misc cleanup, changed internal version number from 312 to 31300 -- version 0.3.13 git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@158 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
53
ui.cpp
53
ui.cpp
@@ -103,6 +103,16 @@ int InsertLine(wxListCtrl* listCtrl, void* pdata, const wxString& str0, const wx
|
||||
return nIndex;
|
||||
}
|
||||
|
||||
void SetItemTextColour(wxListCtrl* listCtrl, int nIndex, const wxColour& colour)
|
||||
{
|
||||
// Repaint on Windows is more flickery if the colour has ever been set,
|
||||
// so don't want to set it unless it's different. Default colour has
|
||||
// alpha 0 transparent, so our colours don't match using operator==.
|
||||
wxColour c1 = listCtrl->GetItemTextColour(nIndex);
|
||||
if (colour.Red() != c1.Red() || colour.Green() != c1.Green() || colour.Blue() != c1.Blue())
|
||||
listCtrl->SetItemTextColour(nIndex, colour);
|
||||
}
|
||||
|
||||
void SetSelection(wxListCtrl* listCtrl, int nIndex)
|
||||
{
|
||||
int nSize = listCtrl->GetItemCount();
|
||||
@@ -434,7 +444,7 @@ int CMainFrame::GetSortIndex(const string& strSort)
|
||||
#endif
|
||||
}
|
||||
|
||||
void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5, const wxString& str6)
|
||||
void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxColour& colour, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5, const wxString& str6)
|
||||
{
|
||||
strSort = " " + strSort; // leading space to workaround wx2.9.0 ubuntu 9.10 bug
|
||||
long nData = *(long*)&hashKey; // where first char of hidden column is displayed
|
||||
@@ -470,6 +480,7 @@ void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSo
|
||||
m_listCtrl->SetItem(nIndex, 5, str5);
|
||||
m_listCtrl->SetItem(nIndex, 6, str6);
|
||||
m_listCtrl->SetItemData(nIndex, nData);
|
||||
SetItemTextColour(m_listCtrl, nIndex, colour);
|
||||
}
|
||||
|
||||
bool CMainFrame::DeleteLine(uint256 hashKey)
|
||||
@@ -489,9 +500,10 @@ bool CMainFrame::DeleteLine(uint256 hashKey)
|
||||
return nIndex != -1;
|
||||
}
|
||||
|
||||
string FormatTxStatus(const CWalletTx& wtx)
|
||||
string FormatTxStatus(const CWalletTx& wtx, bool& fConfirmed)
|
||||
{
|
||||
// Status
|
||||
fConfirmed = false;
|
||||
if (!wtx.IsFinal())
|
||||
{
|
||||
if (wtx.nLockTime < 500000000)
|
||||
@@ -502,6 +514,8 @@ string FormatTxStatus(const CWalletTx& wtx)
|
||||
else
|
||||
{
|
||||
int nDepth = wtx.GetDepthInMainChain();
|
||||
if (nDepth >= 1 || wtx.GetDebit() > 0)
|
||||
fConfirmed = true;
|
||||
if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
|
||||
return strprintf(_("%d/offline?"), nDepth);
|
||||
else if (nDepth < 6)
|
||||
@@ -511,6 +525,12 @@ string FormatTxStatus(const CWalletTx& wtx)
|
||||
}
|
||||
}
|
||||
|
||||
string FormatTxStatus(const CWalletTx& wtx)
|
||||
{
|
||||
bool fConfirmed;
|
||||
return FormatTxStatus(wtx, fConfirmed);
|
||||
}
|
||||
|
||||
string SingleLine(const string& strIn)
|
||||
{
|
||||
string strOut;
|
||||
@@ -539,7 +559,10 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
int64 nDebit = wtx.GetDebit();
|
||||
int64 nNet = nCredit - nDebit;
|
||||
uint256 hash = wtx.GetHash();
|
||||
string strStatus = FormatTxStatus(wtx);
|
||||
bool fConfirmed;
|
||||
string strStatus = FormatTxStatus(wtx, fConfirmed);
|
||||
wtx.fConfirmedDisplayed = fConfirmed;
|
||||
wxColour colour = (fConfirmed ? wxColour(0,0,0) : wxColour(128,128,128));
|
||||
map<string, string> mapValue = wtx.mapValue;
|
||||
wtx.nLinesDisplayed = 1;
|
||||
nListViewUpdated++;
|
||||
@@ -658,12 +681,16 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
}
|
||||
}
|
||||
|
||||
InsertLine(fNew, nIndex, hash, strSort,
|
||||
string strCredit = FormatMoney(nNet, true);
|
||||
if (!fConfirmed)
|
||||
strCredit = "[" + strCredit + "]";
|
||||
|
||||
InsertLine(fNew, nIndex, hash, strSort, colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
SingleLine(strDescription),
|
||||
"",
|
||||
FormatMoney(nNet, true));
|
||||
strCredit);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -679,7 +706,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
{
|
||||
// Payment to self
|
||||
int64 nValue = wtx.vout[0].nValue;
|
||||
InsertLine(fNew, nIndex, hash, strSort,
|
||||
InsertLine(fNew, nIndex, hash, strSort, colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
_("Payment to yourself"),
|
||||
@@ -738,7 +765,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
nTxFee = 0;
|
||||
}
|
||||
|
||||
InsertLine(fNew, nIndex, hash, strprintf("%s-%d", strSort.c_str(), nOut),
|
||||
InsertLine(fNew, nIndex, hash, strprintf("%s-%d", strSort.c_str(), nOut), colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
SingleLine(strDescription),
|
||||
@@ -758,7 +785,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
|
||||
foreach(const CTxIn& txin, wtx.vin)
|
||||
fAllMine = fAllMine && txin.IsMine();
|
||||
|
||||
InsertLine(fNew, nIndex, hash, strSort,
|
||||
InsertLine(fNew, nIndex, hash, strSort, colour,
|
||||
strStatus,
|
||||
nTime ? DateTimeStr(nTime) : "",
|
||||
"",
|
||||
@@ -885,13 +912,17 @@ void CMainFrame::RefreshStatusColumn()
|
||||
continue;
|
||||
}
|
||||
CWalletTx& wtx = (*mi).second;
|
||||
if (wtx.IsCoinBase() || wtx.GetTxTime() != wtx.nTimeDisplayed)
|
||||
bool fConfirmed;
|
||||
string strStatus = FormatTxStatus(wtx, fConfirmed);
|
||||
if (wtx.IsCoinBase() || wtx.GetTxTime() != wtx.nTimeDisplayed || fConfirmed != wtx.fConfirmedDisplayed)
|
||||
{
|
||||
if (!InsertTransaction(wtx, false, nIndex))
|
||||
m_listCtrl->DeleteItem(nIndex--);
|
||||
}
|
||||
else
|
||||
m_listCtrl->SetItem(nIndex, 2, FormatTxStatus(wtx));
|
||||
{
|
||||
m_listCtrl->SetItem(nIndex, 2, strStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1772,7 +1803,7 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event)
|
||||
|
||||
CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)
|
||||
{
|
||||
m_staticTextVersion->SetLabel(strprintf(_("version %d.%d.%d%s beta"), VERSION/10000, (VERSION/100)%100, VERSION%100, pszSubVer));
|
||||
m_staticTextVersion->SetLabel(strprintf(_("version %s%s beta"), FormatVersion(VERSION).c_str(), pszSubVer));
|
||||
|
||||
// Change (c) into UTF-8 or ANSI copyright symbol
|
||||
wxString str = m_staticTextMain->GetLabel();
|
||||
|
||||
Reference in New Issue
Block a user