strip out unfinished product, review and market stuff,

enable _() instead of wxT() in uiproject.fbp so it uses wxGetTranslation for the wxFormBuilder generated part of the UI

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@64 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
s_nakamoto 2010-02-15 04:03:07 +00:00
parent 64a474a49b
commit 5253d1ab77
18 changed files with 128 additions and 8465 deletions

21
db.cpp
View file

@ -507,27 +507,6 @@ bool LoadAddresses()
//
// CReviewDB
//
bool CReviewDB::ReadReviews(uint256 hash, vector<CReview>& vReviews)
{
vReviews.size(); // msvc workaround, just need to do anything with vReviews
return Read(make_pair(string("reviews"), hash), vReviews);
}
bool CReviewDB::WriteReviews(uint256 hash, const vector<CReview>& vReviews)
{
return Write(make_pair(string("reviews"), hash), vReviews);
}
// //
// CWalletDB // CWalletDB
// //

39
db.h
View file

@ -285,45 +285,6 @@ public:
class CReviewDB : public CDB
{
public:
CReviewDB(const char* pszMode="r+") : CDB("reviews.dat", pszMode) { }
private:
CReviewDB(const CReviewDB&);
void operator=(const CReviewDB&);
public:
bool ReadUser(uint256 hash, CUser& user)
{
return Read(make_pair(string("user"), hash), user);
}
bool WriteUser(uint256 hash, const CUser& user)
{
return Write(make_pair(string("user"), hash), user);
}
bool ReadReviews(uint256 hash, vector<CReview>& vReviews);
bool WriteReviews(uint256 hash, const vector<CReview>& vReviews);
};
class CMarketDB : public CDB
{
public:
CMarketDB(const char* pszMode="r+") : CDB("market.dat", pszMode) { }
private:
CMarketDB(const CMarketDB&);
void operator=(const CMarketDB&);
};
class CAddrDB : public CDB class CAddrDB : public CDB
{ {
public: public:

View file

@ -99,7 +99,6 @@ using namespace boost;
#include "net.h" #include "net.h"
#include "irc.h" #include "irc.h"
#include "main.h" #include "main.h"
#include "market.h"
#include "rpc.h" #include "rpc.h"
#include "uibase.h" #include "uibase.h"
#include "ui.h" #include "ui.h"

View file

@ -1706,10 +1706,8 @@ bool AlreadyHave(CTxDB& txdb, const CInv& inv)
{ {
switch (inv.type) switch (inv.type)
{ {
case MSG_TX: return mapTransactions.count(inv.hash) || txdb.ContainsTx(inv.hash); case MSG_TX: return mapTransactions.count(inv.hash) || txdb.ContainsTx(inv.hash);
case MSG_BLOCK: return mapBlockIndex.count(inv.hash) || mapOrphanBlocks.count(inv.hash); case MSG_BLOCK: return mapBlockIndex.count(inv.hash) || mapOrphanBlocks.count(inv.hash);
case MSG_REVIEW: return true;
case MSG_PRODUCT: return mapProducts.count(inv.hash);
} }
// Don't know what it is, just say we already got one // Don't know what it is, just say we already got one
return true; return true;
@ -2108,24 +2106,6 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
} }
else if (strCommand == "review")
{
CDataStream vMsg(vRecv);
CReview review;
vRecv >> review;
CInv inv(MSG_REVIEW, review.GetHash());
pfrom->AddInventoryKnown(inv);
if (review.AcceptReview())
{
// Relay the original message as-is in case it's a higher version than we know how to parse
RelayMessage(inv, vMsg);
mapAlreadyAskedFor.erase(inv);
}
}
else if (strCommand == "block") else if (strCommand == "block")
{ {
auto_ptr<CBlock> pblock(new CBlock); auto_ptr<CBlock> pblock(new CBlock);

View file

@ -25,7 +25,7 @@ LIBS= \
-l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
WXDEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH WXDEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
CFLAGS=-mthreads -O0 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) CFLAGS=-mthreads -O0 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h market.h rpc.h uibase.h ui.h HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h
@ -50,9 +50,6 @@ obj/net.o: net.cpp $(HEADERS)
obj/main.o: main.cpp $(HEADERS) sha.h obj/main.o: main.cpp $(HEADERS) sha.h
g++ -c $(CFLAGS) -o $@ $< g++ -c $(CFLAGS) -o $@ $<
obj/market.o: market.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/ui.o: ui.cpp $(HEADERS) obj/ui.o: ui.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $< g++ -c $(CFLAGS) -o $@ $<
@ -73,7 +70,7 @@ obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \ OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o \ obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o \
obj/ui_res.o obj/ui_res.o

View file

@ -35,7 +35,7 @@ LIBS= \
WXDEFS=-D__WXGTK__ -DNOPCH WXDEFS=-D__WXGTK__ -DNOPCH
CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h market.h rpc.h uibase.h ui.h HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h
@ -60,9 +60,6 @@ obj/net.o: net.cpp $(HEADERS)
obj/main.o: main.cpp $(HEADERS) sha.h obj/main.o: main.cpp $(HEADERS) sha.h
g++ -c $(CFLAGS) -o $@ $< g++ -c $(CFLAGS) -o $@ $<
obj/market.o: market.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/ui.o: ui.cpp $(HEADERS) obj/ui.o: ui.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $< g++ -c $(CFLAGS) -o $@ $<
@ -80,7 +77,7 @@ obj/rpc.o: rpc.cpp $(HEADERS)
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \ OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o
bitcoin: headers.h.gch $(OBJS) bitcoin: headers.h.gch $(OBJS)

View file

@ -35,7 +35,7 @@ LIBS= \
WXDEFS=-D__WXGTK__ -DNOPCH WXDEFS=-D__WXGTK__ -DNOPCH
CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h market.h rpc.h uibase.h ui.h HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h
@ -60,9 +60,6 @@ obj/net.o: net.cpp $(HEADERS)
obj/main.o: main.cpp $(HEADERS) sha.h obj/main.o: main.cpp $(HEADERS) sha.h
g++ -c $(CFLAGS) -o $@ $< g++ -c $(CFLAGS) -o $@ $<
obj/market.o: market.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<
obj/ui.o: ui.cpp $(HEADERS) obj/ui.o: ui.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $< g++ -c $(CFLAGS) -o $@ $<
@ -80,7 +77,7 @@ obj/rpc.o: rpc.cpp $(HEADERS)
OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \ OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o \
obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/rpc.o
bitcoin: headers.h.gch $(OBJS) bitcoin: headers.h.gch $(OBJS)

View file

@ -23,7 +23,7 @@ LIBS= \
kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib
WXDEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH WXDEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH
CFLAGS=/c /nologo /Ob0 /MD$(D) /EHsc /GR /Zm300 $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS) CFLAGS=/c /nologo /Ob0 /MD$(D) /EHsc /GR /Zm300 $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h market.h rpc.h uibase.h ui.h HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h
@ -45,9 +45,6 @@ obj\net.obj: net.cpp $(HEADERS)
obj\main.obj: main.cpp $(HEADERS) sha.h obj\main.obj: main.cpp $(HEADERS) sha.h
cl $(CFLAGS) /Fo$@ %s cl $(CFLAGS) /Fo$@ %s
obj\market.obj: market.cpp $(HEADERS)
cl $(CFLAGS) /Fo$@ %s
obj\ui.obj: ui.cpp $(HEADERS) obj\ui.obj: ui.cpp $(HEADERS)
cl $(CFLAGS) /Fo$@ %s cl $(CFLAGS) /Fo$@ %s
@ -68,7 +65,7 @@ obj\ui.res: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp r
OBJS=obj\util.obj obj\script.obj obj\db.obj obj\net.obj obj\main.obj obj\market.obj \ OBJS=obj\util.obj obj\script.obj obj\db.obj obj\net.obj obj\main.obj \
obj\ui.obj obj\uibase.obj obj\sha.obj obj\irc.obj obj\rpc.obj \ obj\ui.obj obj\uibase.obj obj\sha.obj obj\irc.obj obj\rpc.obj \
obj\ui.res obj\ui.res

View file

@ -1,264 +0,0 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include "headers.h"
//
// Global state variables
//
//// later figure out how these are persisted
map<uint256, CProduct> mapMyProducts;
map<uint256, CProduct> mapProducts;
CCriticalSection cs_mapProducts;
bool AdvertInsert(const CProduct& product)
{
uint256 hash = product.GetHash();
bool fNew = false;
bool fUpdated = false;
CRITICAL_BLOCK(cs_mapProducts)
{
// Insert or find existing product
pair<map<uint256, CProduct>::iterator, bool> item = mapProducts.insert(make_pair(hash, product));
CProduct* pproduct = &(*(item.first)).second;
fNew = item.second;
// Update if newer
if (product.nSequence > pproduct->nSequence)
{
*pproduct = product;
fUpdated = true;
}
}
//if (fNew)
// NotifyProductAdded(hash);
//else if (fUpdated)
// NotifyProductUpdated(hash);
return (fNew || fUpdated);
}
void AdvertErase(const CProduct& product)
{
uint256 hash = product.GetHash();
CRITICAL_BLOCK(cs_mapProducts)
mapProducts.erase(hash);
//NotifyProductDeleted(hash);
}
template<typename T>
unsigned int Union(T& v1, T& v2)
{
// v1 = v1 union v2
// v1 and v2 must be sorted
// returns the number of elements added to v1
///// need to check that this is equivalent, then delete this comment
//vector<unsigned short> vUnion(v1.size() + v2.size());
//vUnion.erase(set_union(v1.begin(), v1.end(),
// v2.begin(), v2.end(),
// vUnion.begin()),
// vUnion.end());
T vUnion;
vUnion.reserve(v1.size() + v2.size());
set_union(v1.begin(), v1.end(),
v2.begin(), v2.end(),
back_inserter(vUnion));
unsigned int nAdded = vUnion.size() - v1.size();
if (nAdded > 0)
v1 = vUnion;
return nAdded;
}
void CUser::AddAtom(unsigned short nAtom, bool fOrigin)
{
// Ignore duplicates
if (binary_search(vAtomsIn.begin(), vAtomsIn.end(), nAtom) ||
find(vAtomsNew.begin(), vAtomsNew.end(), nAtom) != vAtomsNew.end())
return;
//// instead of zero atom, should change to free atom that propagates,
//// limited to lower than a certain value like 5 so conflicts quickly
// The zero atom never propagates,
// new atoms always propagate through the user that created them
if (nAtom == 0 || fOrigin)
{
vector<unsigned short> vTmp(1, nAtom);
Union(vAtomsIn, vTmp);
if (fOrigin)
vAtomsOut.push_back(nAtom);
return;
}
vAtomsNew.push_back(nAtom);
if (vAtomsNew.size() >= nFlowthroughRate || vAtomsOut.empty())
{
// Select atom to flow through to vAtomsOut
vAtomsOut.push_back(vAtomsNew[GetRand(vAtomsNew.size())]);
// Merge vAtomsNew into vAtomsIn
sort(vAtomsNew.begin(), vAtomsNew.end());
Union(vAtomsIn, vAtomsNew);
vAtomsNew.clear();
}
}
bool AddAtomsAndPropagate(uint256 hashUserStart, const vector<unsigned short>& vAtoms, bool fOrigin)
{
CReviewDB reviewdb;
map<uint256, vector<unsigned short> > pmapPropagate[2];
pmapPropagate[0][hashUserStart] = vAtoms;
for (int side = 0; !pmapPropagate[side].empty(); side = 1 - side)
{
map<uint256, vector<unsigned short> >& mapFrom = pmapPropagate[side];
map<uint256, vector<unsigned short> >& mapTo = pmapPropagate[1 - side];
for (map<uint256, vector<unsigned short> >::iterator mi = mapFrom.begin(); mi != mapFrom.end(); ++mi)
{
const uint256& hashUser = (*mi).first;
const vector<unsigned short>& vReceived = (*mi).second;
///// this would be a lot easier on the database if it put the new atom at the beginning of the list,
///// so the change would be right next to the vector size.
// Read user
CUser user;
reviewdb.ReadUser(hashUser, user);
unsigned int nIn = user.vAtomsIn.size();
unsigned int nNew = user.vAtomsNew.size();
unsigned int nOut = user.vAtomsOut.size();
// Add atoms received
foreach(unsigned short nAtom, vReceived)
user.AddAtom(nAtom, fOrigin);
fOrigin = false;
// Don't bother writing to disk if no changes
if (user.vAtomsIn.size() == nIn && user.vAtomsNew.size() == nNew)
continue;
// Propagate
if (user.vAtomsOut.size() > nOut)
foreach(const uint256& hash, user.vLinksOut)
mapTo[hash].insert(mapTo[hash].end(), user.vAtomsOut.begin() + nOut, user.vAtomsOut.end());
// Write back
if (!reviewdb.WriteUser(hashUser, user))
return false;
}
mapFrom.clear();
}
return true;
}
bool CReview::AcceptReview()
{
// Timestamp
nTime = GetTime();
// Check signature
if (!CKey::Verify(vchPubKeyFrom, GetSigHash(), vchSig))
return false;
CReviewDB reviewdb;
// Add review text to recipient
vector<CReview> vReviews;
reviewdb.ReadReviews(hashTo, vReviews);
vReviews.push_back(*this);
if (!reviewdb.WriteReviews(hashTo, vReviews))
return false;
// Add link from sender
CUser user;
uint256 hashFrom = Hash(vchPubKeyFrom.begin(), vchPubKeyFrom.end());
reviewdb.ReadUser(hashFrom, user);
user.vLinksOut.push_back(hashTo);
if (!reviewdb.WriteUser(hashFrom, user))
return false;
reviewdb.Close();
// Propagate atoms to recipient
vector<unsigned short> vZeroAtom(1, 0);
if (!AddAtomsAndPropagate(hashTo, user.vAtomsOut.size() ? user.vAtomsOut : vZeroAtom, false))
return false;
return true;
}
bool CProduct::CheckSignature()
{
return (CKey::Verify(vchPubKeyFrom, GetSigHash(), vchSig));
}
bool CProduct::CheckProduct()
{
if (!CheckSignature())
return false;
// Make sure it's a summary product
if (!mapDetails.empty() || !vOrderForm.empty())
return false;
// Look up seller's atom count
CReviewDB reviewdb("r");
CUser user;
reviewdb.ReadUser(GetUserHash(), user);
nAtoms = user.GetAtomCount();
reviewdb.Close();
////// delme, this is now done by AdvertInsert
//// Store to memory
//CRITICAL_BLOCK(cs_mapProducts)
// mapProducts[GetHash()] = *this;
return true;
}

182
market.h
View file

@ -1,182 +0,0 @@
// Copyright (c) 2009 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
class CUser;
class CReview;
class CProduct;
static const unsigned int nFlowthroughRate = 2;
bool AdvertInsert(const CProduct& product);
void AdvertErase(const CProduct& product);
bool AddAtomsAndPropagate(uint256 hashUserStart, const vector<unsigned short>& vAtoms, bool fOrigin);
class CUser
{
public:
vector<unsigned short> vAtomsIn;
vector<unsigned short> vAtomsNew;
vector<unsigned short> vAtomsOut;
vector<uint256> vLinksOut;
CUser()
{
}
IMPLEMENT_SERIALIZE
(
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vAtomsIn);
READWRITE(vAtomsNew);
READWRITE(vAtomsOut);
READWRITE(vLinksOut);
)
void SetNull()
{
vAtomsIn.clear();
vAtomsNew.clear();
vAtomsOut.clear();
vLinksOut.clear();
}
uint256 GetHash() const { return SerializeHash(*this); }
int GetAtomCount() const
{
return (vAtomsIn.size() + vAtomsNew.size());
}
void AddAtom(unsigned short nAtom, bool fOrigin);
};
class CReview
{
public:
int nVersion;
uint256 hashTo;
map<string, string> mapValue;
vector<unsigned char> vchPubKeyFrom;
vector<unsigned char> vchSig;
// memory only
unsigned int nTime;
int nAtoms;
CReview()
{
nVersion = 1;
hashTo = 0;
nTime = 0;
nAtoms = 0;
}
IMPLEMENT_SERIALIZE
(
READWRITE(this->nVersion);
nVersion = this->nVersion;
if (!(nType & SER_DISK))
READWRITE(hashTo);
READWRITE(mapValue);
READWRITE(vchPubKeyFrom);
if (!(nType & SER_GETHASH))
READWRITE(vchSig);
)
uint256 GetHash() const { return SerializeHash(*this); }
uint256 GetSigHash() const { return SerializeHash(*this, SER_GETHASH|SER_SKIPSIG); }
uint256 GetUserHash() const { return Hash(vchPubKeyFrom.begin(), vchPubKeyFrom.end()); }
bool AcceptReview();
};
class CProduct
{
public:
int nVersion;
CAddress addr;
map<string, string> mapValue;
map<string, string> mapDetails;
vector<pair<string, string> > vOrderForm;
unsigned int nSequence;
vector<unsigned char> vchPubKeyFrom;
vector<unsigned char> vchSig;
// disk only
int nAtoms;
// memory only
set<unsigned int> setSources;
CProduct()
{
nVersion = 1;
nAtoms = 0;
nSequence = 0;
}
IMPLEMENT_SERIALIZE
(
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(addr);
READWRITE(mapValue);
if (!(nType & SER_GETHASH))
{
READWRITE(mapDetails);
READWRITE(vOrderForm);
READWRITE(nSequence);
}
READWRITE(vchPubKeyFrom);
if (!(nType & SER_GETHASH))
READWRITE(vchSig);
if (nType & SER_DISK)
READWRITE(nAtoms);
)
uint256 GetHash() const { return SerializeHash(*this); }
uint256 GetSigHash() const { return SerializeHash(*this, SER_GETHASH|SER_SKIPSIG); }
uint256 GetUserHash() const { return Hash(vchPubKeyFrom.begin(), vchPubKeyFrom.end()); }
bool CheckSignature();
bool CheckProduct();
};
extern map<uint256, CProduct> mapProducts;
extern CCriticalSection cs_mapProducts;
extern map<uint256, CProduct> mapMyProducts;

View file

@ -381,11 +381,6 @@ void CNode::CancelSubscribe(unsigned int nChannel)
foreach(CNode* pnode, vNodes) foreach(CNode* pnode, vNodes)
if (pnode != this) if (pnode != this)
pnode->PushMessage("sub-cancel", nChannel); pnode->PushMessage("sub-cancel", nChannel);
// Clear memory, no longer subscribed
if (nChannel == MSG_PRODUCT)
CRITICAL_BLOCK(cs_mapProducts)
mapProducts.clear();
} }
} }
@ -497,10 +492,6 @@ void CNode::Cleanup()
// All of a nodes broadcasts and subscriptions are automatically torn down // All of a nodes broadcasts and subscriptions are automatically torn down
// when it goes down, so a node has to stay up to keep its broadcast going. // when it goes down, so a node has to stay up to keep its broadcast going.
CRITICAL_BLOCK(cs_mapProducts)
for (map<uint256, CProduct>::iterator mi = mapProducts.begin(); mi != mapProducts.end();)
AdvertRemoveSource(this, MSG_PRODUCT, 0, (*(mi++)).second);
// Cancel subscriptions // Cancel subscriptions
for (unsigned int nChannel = 0; nChannel < vfSubscribe.size(); nChannel++) for (unsigned int nChannel = 0; nChannel < vfSubscribe.size(); nChannel++)
if (vfSubscribe[nChannel]) if (vfSubscribe[nChannel])

6
net.h
View file

@ -341,9 +341,6 @@ enum
{ {
MSG_TX = 1, MSG_TX = 1,
MSG_BLOCK, MSG_BLOCK,
MSG_REVIEW,
MSG_PRODUCT,
MSG_TABLE,
}; };
static const char* ppszTypeName[] = static const char* ppszTypeName[] =
@ -351,9 +348,6 @@ static const char* ppszTypeName[] =
"ERROR", "ERROR",
"tx", "tx",
"block", "block",
"review",
"product",
"table",
}; };
class CInv class CInv

View file

@ -20,7 +20,7 @@ class CDataStream;
class CAutoFile; class CAutoFile;
static const int VERSION = 201; static const int VERSION = 201;
static const char* pszSubVer = ".1"; static const char* pszSubVer = ".2";

930
ui.cpp
View file

@ -7,22 +7,15 @@
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif
void ThreadRequestProductDetails(void* parg);
void ThreadRandSendTest(void* parg);
bool GetStartOnSystemStartup(); bool GetStartOnSystemStartup();
void SetStartOnSystemStartup(bool fAutoStart); void SetStartOnSystemStartup(bool fAutoStart);
DEFINE_EVENT_TYPE(wxEVT_UITHREADCALL) DEFINE_EVENT_TYPE(wxEVT_UITHREADCALL)
DEFINE_EVENT_TYPE(wxEVT_REPLY1)
DEFINE_EVENT_TYPE(wxEVT_REPLY2)
DEFINE_EVENT_TYPE(wxEVT_REPLY3)
CMainFrame* pframeMain = NULL; CMainFrame* pframeMain = NULL;
CMyTaskBarIcon* ptaskbaricon = NULL; CMyTaskBarIcon* ptaskbaricon = NULL;
bool fRandSendTest = false;
void RandSend();
extern int g_isPainting; extern int g_isPainting;
bool fClosedToTray = false; bool fClosedToTray = false;
@ -210,93 +203,6 @@ int ThreadSafeMessageBox(const string& message, const string& caption, int style
//////////////////////////////////////////////////////////////////////////////
//
// Custom events
//
// If this code gets used again, it should be replaced with something like UIThreadCall
set<void*> setCallbackAvailable;
CCriticalSection cs_setCallbackAvailable;
void AddCallbackAvailable(void* p)
{
CRITICAL_BLOCK(cs_setCallbackAvailable)
setCallbackAvailable.insert(p);
}
void RemoveCallbackAvailable(void* p)
{
CRITICAL_BLOCK(cs_setCallbackAvailable)
setCallbackAvailable.erase(p);
}
bool IsCallbackAvailable(void* p)
{
CRITICAL_BLOCK(cs_setCallbackAvailable)
return setCallbackAvailable.count(p);
return false;
}
template<typename T>
void AddPendingCustomEvent(wxEvtHandler* pevthandler, int nEventID, const T pbeginIn, const T pendIn)
{
// Need to rewrite with something like UIThreadCall
// I'm tired of maintaining this hack that's only called by unfinished unused code.
assert(("Unimplemented", 0));
//if (!pevthandler)
// return;
//
//const char* pbegin = (pendIn != pbeginIn) ? &pbeginIn[0] : NULL;
//const char* pend = pbegin + (pendIn - pbeginIn) * sizeof(pbeginIn[0]);
//wxCommandEvent event(nEventID);
//wxString strData(wxChar(0), (pend - pbegin) / sizeof(wxChar) + 1);
//memcpy(&strData[0], pbegin, pend - pbegin);
//event.SetString(strData);
//event.SetInt(pend - pbegin);
//
//pevthandler->AddPendingEvent(event);
}
template<class T>
void AddPendingCustomEvent(wxEvtHandler* pevthandler, int nEventID, const T& obj)
{
CDataStream ss;
ss << obj;
AddPendingCustomEvent(pevthandler, nEventID, ss.begin(), ss.end());
}
void AddPendingReplyEvent1(void* pevthandler, CDataStream& vRecv)
{
if (IsCallbackAvailable(pevthandler))
AddPendingCustomEvent((wxEvtHandler*)pevthandler, wxEVT_REPLY1, vRecv.begin(), vRecv.end());
}
void AddPendingReplyEvent2(void* pevthandler, CDataStream& vRecv)
{
if (IsCallbackAvailable(pevthandler))
AddPendingCustomEvent((wxEvtHandler*)pevthandler, wxEVT_REPLY2, vRecv.begin(), vRecv.end());
}
void AddPendingReplyEvent3(void* pevthandler, CDataStream& vRecv)
{
if (IsCallbackAvailable(pevthandler))
AddPendingCustomEvent((wxEvtHandler*)pevthandler, wxEVT_REPLY3, vRecv.begin(), vRecv.end());
}
CDataStream GetStreamFromEvent(const wxCommandEvent& event)
{
wxString strData = event.GetString();
const char* pszBegin = strData.c_str();
return CDataStream(pszBegin, pszBegin + event.GetInt(), SER_NETWORK);
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// CMainFrame // CMainFrame
@ -1180,16 +1086,6 @@ void CMainFrame::OnMouseEventsAddress(wxMouseEvent& event)
event.Skip(); event.Skip();
} }
void CMainFrame::OnButtonCopy(wxCommandEvent& event)
{
// Copy address box to clipboard
if (wxTheClipboard->Open())
{
wxTheClipboard->SetData(new wxTextDataObject(m_textCtrlAddress->GetValue()));
wxTheClipboard->Close();
}
}
void CMainFrame::OnButtonChange(wxCommandEvent& event) void CMainFrame::OnButtonChange(wxCommandEvent& event)
{ {
CYourAddressDialog dialog(this, string(m_textCtrlAddress->GetValue())); CYourAddressDialog dialog(this, string(m_textCtrlAddress->GetValue()));
@ -1208,6 +1104,16 @@ void CMainFrame::OnButtonChange(wxCommandEvent& event)
} }
} }
void CMainFrame::OnButtonCopy(wxCommandEvent& event)
{
// Copy address box to clipboard
if (wxTheClipboard->Open())
{
wxTheClipboard->SetData(new wxTextDataObject(m_textCtrlAddress->GetValue()));
wxTheClipboard->Close();
}
}
void CMainFrame::OnListItemActivated(wxListEvent& event) void CMainFrame::OnListItemActivated(wxListEvent& event)
{ {
uint256 hash((string)GetItemText(m_listCtrl, event.GetIndex(), 1)); uint256 hash((string)GetItemText(m_listCtrl, event.GetIndex(), 1));
@ -1228,28 +1134,6 @@ void CMainFrame::OnListItemActivated(wxListEvent& event)
//pdialog->Show(); //pdialog->Show();
} }
void CMainFrame::OnListItemActivatedProductsSent(wxListEvent& event)
{
CProduct& product = *(CProduct*)event.GetItem().GetData();
CEditProductDialog* pdialog = new CEditProductDialog(this);
pdialog->SetProduct(product);
pdialog->Show();
}
void CMainFrame::OnListItemActivatedOrdersSent(wxListEvent& event)
{
CWalletTx& order = *(CWalletTx*)event.GetItem().GetData();
CViewOrderDialog* pdialog = new CViewOrderDialog(this, order, false);
pdialog->Show();
}
void CMainFrame::OnListItemActivatedOrdersReceived(wxListEvent& event)
{
CWalletTx& order = *(CWalletTx*)event.GetItem().GetData();
CViewOrderDialog* pdialog = new CViewOrderDialog(this, order, true);
pdialog->Show();
}
@ -2525,800 +2409,6 @@ void CAddressBookDialog::OnClose(wxCloseEvent& event)
//////////////////////////////////////////////////////////////////////////////
//
// CProductsDialog
//
bool CompareIntStringPairBestFirst(const pair<int, string>& item1, const pair<int, string>& item2)
{
return (item1.first > item2.first);
}
CProductsDialog::CProductsDialog(wxWindow* parent) : CProductsDialogBase(parent)
{
// Init column headers
m_listCtrl->InsertColumn(0, "Title", wxLIST_FORMAT_LEFT, 200);
m_listCtrl->InsertColumn(1, "Price", wxLIST_FORMAT_LEFT, 80);
m_listCtrl->InsertColumn(2, "Seller", wxLIST_FORMAT_LEFT, 80);
m_listCtrl->InsertColumn(3, "Stars", wxLIST_FORMAT_LEFT, 50);
m_listCtrl->InsertColumn(4, "Power", wxLIST_FORMAT_LEFT, 50);
// Tally top categories
map<string, int> mapTopCategories;
CRITICAL_BLOCK(cs_mapProducts)
for (map<uint256, CProduct>::iterator mi = mapProducts.begin(); mi != mapProducts.end(); ++mi)
mapTopCategories[(*mi).second.mapValue["category"]]++;
// Sort top categories
vector<pair<int, string> > vTopCategories;
for (map<string, int>::iterator mi = mapTopCategories.begin(); mi != mapTopCategories.end(); ++mi)
vTopCategories.push_back(make_pair((*mi).second, (*mi).first));
sort(vTopCategories.begin(), vTopCategories.end(), CompareIntStringPairBestFirst);
// Fill categories combo box
int nLimit = 250;
for (vector<pair<int, string> >::iterator it = vTopCategories.begin(); it != vTopCategories.end() && nLimit-- > 0; ++it)
m_comboBoxCategory->Append((*it).second);
// Fill window with initial search
//wxCommandEvent event;
//OnButtonSearch(event);
}
void CProductsDialog::OnCombobox(wxCommandEvent& event)
{
OnButtonSearch(event);
}
bool CompareProductsBestFirst(const CProduct* p1, const CProduct* p2)
{
return (p1->nAtoms > p2->nAtoms);
}
void CProductsDialog::OnButtonSearch(wxCommandEvent& event)
{
string strCategory = (string)m_comboBoxCategory->GetValue();
string strSearch = (string)m_textCtrlSearch->GetValue();
// Search products
vector<CProduct*> vProductsFound;
CRITICAL_BLOCK(cs_mapProducts)
{
for (map<uint256, CProduct>::iterator mi = mapProducts.begin(); mi != mapProducts.end(); ++mi)
{
CProduct& product = (*mi).second;
if (product.mapValue["category"].find(strCategory) != -1)
{
if (product.mapValue["title"].find(strSearch) != -1 ||
product.mapValue["description"].find(strSearch) != -1 ||
product.mapValue["seller"].find(strSearch) != -1)
{
vProductsFound.push_back(&product);
}
}
}
}
// Sort
sort(vProductsFound.begin(), vProductsFound.end(), CompareProductsBestFirst);
// Display
foreach(CProduct* pproduct, vProductsFound)
{
InsertLine(m_listCtrl,
pproduct->mapValue["title"],
pproduct->mapValue["price"],
pproduct->mapValue["seller"],
pproduct->mapValue["stars"],
itostr(pproduct->nAtoms));
}
}
void CProductsDialog::OnListItemActivated(wxListEvent& event)
{
// Doubleclick opens product
CViewProductDialog* pdialog = new CViewProductDialog(this, m_vProduct[event.GetIndex()]);
pdialog->Show();
}
//////////////////////////////////////////////////////////////////////////////
//
// CEditProductDialog
//
CEditProductDialog::CEditProductDialog(wxWindow* parent) : CEditProductDialogBase(parent)
{
m_textCtrlLabel[0 ] = m_textCtrlLabel0;
m_textCtrlLabel[1 ] = m_textCtrlLabel1;
m_textCtrlLabel[2 ] = m_textCtrlLabel2;
m_textCtrlLabel[3 ] = m_textCtrlLabel3;
m_textCtrlLabel[4 ] = m_textCtrlLabel4;
m_textCtrlLabel[5 ] = m_textCtrlLabel5;
m_textCtrlLabel[6 ] = m_textCtrlLabel6;
m_textCtrlLabel[7 ] = m_textCtrlLabel7;
m_textCtrlLabel[8 ] = m_textCtrlLabel8;
m_textCtrlLabel[9 ] = m_textCtrlLabel9;
m_textCtrlLabel[10] = m_textCtrlLabel10;
m_textCtrlLabel[11] = m_textCtrlLabel11;
m_textCtrlLabel[12] = m_textCtrlLabel12;
m_textCtrlLabel[13] = m_textCtrlLabel13;
m_textCtrlLabel[14] = m_textCtrlLabel14;
m_textCtrlLabel[15] = m_textCtrlLabel15;
m_textCtrlLabel[16] = m_textCtrlLabel16;
m_textCtrlLabel[17] = m_textCtrlLabel17;
m_textCtrlLabel[18] = m_textCtrlLabel18;
m_textCtrlLabel[19] = m_textCtrlLabel19;
m_textCtrlField[0 ] = m_textCtrlField0;
m_textCtrlField[1 ] = m_textCtrlField1;
m_textCtrlField[2 ] = m_textCtrlField2;
m_textCtrlField[3 ] = m_textCtrlField3;
m_textCtrlField[4 ] = m_textCtrlField4;
m_textCtrlField[5 ] = m_textCtrlField5;
m_textCtrlField[6 ] = m_textCtrlField6;
m_textCtrlField[7 ] = m_textCtrlField7;
m_textCtrlField[8 ] = m_textCtrlField8;
m_textCtrlField[9 ] = m_textCtrlField9;
m_textCtrlField[10] = m_textCtrlField10;
m_textCtrlField[11] = m_textCtrlField11;
m_textCtrlField[12] = m_textCtrlField12;
m_textCtrlField[13] = m_textCtrlField13;
m_textCtrlField[14] = m_textCtrlField14;
m_textCtrlField[15] = m_textCtrlField15;
m_textCtrlField[16] = m_textCtrlField16;
m_textCtrlField[17] = m_textCtrlField17;
m_textCtrlField[18] = m_textCtrlField18;
m_textCtrlField[19] = m_textCtrlField19;
m_buttonDel[0 ] = m_buttonDel0;
m_buttonDel[1 ] = m_buttonDel1;
m_buttonDel[2 ] = m_buttonDel2;
m_buttonDel[3 ] = m_buttonDel3;
m_buttonDel[4 ] = m_buttonDel4;
m_buttonDel[5 ] = m_buttonDel5;
m_buttonDel[6 ] = m_buttonDel6;
m_buttonDel[7 ] = m_buttonDel7;
m_buttonDel[8 ] = m_buttonDel8;
m_buttonDel[9 ] = m_buttonDel9;
m_buttonDel[10] = m_buttonDel10;
m_buttonDel[11] = m_buttonDel11;
m_buttonDel[12] = m_buttonDel12;
m_buttonDel[13] = m_buttonDel13;
m_buttonDel[14] = m_buttonDel14;
m_buttonDel[15] = m_buttonDel15;
m_buttonDel[16] = m_buttonDel16;
m_buttonDel[17] = m_buttonDel17;
m_buttonDel[18] = m_buttonDel18;
m_buttonDel[19] = m_buttonDel19;
for (int i = 1; i < FIELDS_MAX; i++)
ShowLine(i, false);
LayoutAll();
}
void CEditProductDialog::LayoutAll()
{
m_scrolledWindow->Layout();
m_scrolledWindow->GetSizer()->Fit(m_scrolledWindow);
this->Layout();
}
void CEditProductDialog::ShowLine(int i, bool fShow)
{
m_textCtrlLabel[i]->Show(fShow);
m_textCtrlField[i]->Show(fShow);
m_buttonDel[i]->Show(fShow);
}
void CEditProductDialog::OnButtonDel0(wxCommandEvent& event) { OnButtonDel(event, 0); }
void CEditProductDialog::OnButtonDel1(wxCommandEvent& event) { OnButtonDel(event, 1); }
void CEditProductDialog::OnButtonDel2(wxCommandEvent& event) { OnButtonDel(event, 2); }
void CEditProductDialog::OnButtonDel3(wxCommandEvent& event) { OnButtonDel(event, 3); }
void CEditProductDialog::OnButtonDel4(wxCommandEvent& event) { OnButtonDel(event, 4); }
void CEditProductDialog::OnButtonDel5(wxCommandEvent& event) { OnButtonDel(event, 5); }
void CEditProductDialog::OnButtonDel6(wxCommandEvent& event) { OnButtonDel(event, 6); }
void CEditProductDialog::OnButtonDel7(wxCommandEvent& event) { OnButtonDel(event, 7); }
void CEditProductDialog::OnButtonDel8(wxCommandEvent& event) { OnButtonDel(event, 8); }
void CEditProductDialog::OnButtonDel9(wxCommandEvent& event) { OnButtonDel(event, 9); }
void CEditProductDialog::OnButtonDel10(wxCommandEvent& event) { OnButtonDel(event, 10); }
void CEditProductDialog::OnButtonDel11(wxCommandEvent& event) { OnButtonDel(event, 11); }
void CEditProductDialog::OnButtonDel12(wxCommandEvent& event) { OnButtonDel(event, 12); }
void CEditProductDialog::OnButtonDel13(wxCommandEvent& event) { OnButtonDel(event, 13); }
void CEditProductDialog::OnButtonDel14(wxCommandEvent& event) { OnButtonDel(event, 14); }
void CEditProductDialog::OnButtonDel15(wxCommandEvent& event) { OnButtonDel(event, 15); }
void CEditProductDialog::OnButtonDel16(wxCommandEvent& event) { OnButtonDel(event, 16); }
void CEditProductDialog::OnButtonDel17(wxCommandEvent& event) { OnButtonDel(event, 17); }
void CEditProductDialog::OnButtonDel18(wxCommandEvent& event) { OnButtonDel(event, 18); }
void CEditProductDialog::OnButtonDel19(wxCommandEvent& event) { OnButtonDel(event, 19); }
void CEditProductDialog::OnButtonDel(wxCommandEvent& event, int n)
{
Freeze();
int x, y;
m_scrolledWindow->GetViewStart(&x, &y);
int i;
for (i = n; i < FIELDS_MAX-1; i++)
{
m_textCtrlLabel[i]->SetValue(m_textCtrlLabel[i+1]->GetValue());
m_textCtrlField[i]->SetValue(m_textCtrlField[i+1]->GetValue());
if (!m_buttonDel[i+1]->IsShown())
break;
}
m_textCtrlLabel[i]->SetValue("");
m_textCtrlField[i]->SetValue("");
ShowLine(i, false);
m_buttonAddField->Enable(true);
LayoutAll();
m_scrolledWindow->Scroll(0, y);
Thaw();
}
void CEditProductDialog::OnButtonAddField(wxCommandEvent& event)
{
for (int i = 0; i < FIELDS_MAX; i++)
{
if (!m_buttonDel[i]->IsShown())
{
Freeze();
ShowLine(i, true);
if (i == FIELDS_MAX-1)
m_buttonAddField->Enable(false);
LayoutAll();
m_scrolledWindow->Scroll(0, 99999);
Thaw();
break;
}
}
}
void AddToMyProducts(CProduct product)
{
CProduct& productInsert = mapMyProducts[product.GetHash()];
productInsert = product;
//InsertLine(pframeMain->m_listCtrlProductsSent, &productInsert,
// product.mapValue["category"],
// product.mapValue["title"].substr(0, 100),
// product.mapValue["description"].substr(0, 100),
// product.mapValue["price"],
// "");
}
void CEditProductDialog::OnButtonSend(wxCommandEvent& event)
{
CProduct product;
GetProduct(product);
// Sign the detailed product
product.vchPubKeyFrom = keyUser.GetPubKey();
if (!keyUser.Sign(product.GetSigHash(), product.vchSig))
{
wxMessageBox("Error digitally signing the product ");
return;
}
// Save detailed product
AddToMyProducts(product);
// Strip down to summary product
product.mapDetails.clear();
product.vOrderForm.clear();
// Sign the summary product
if (!keyUser.Sign(product.GetSigHash(), product.vchSig))
{
wxMessageBox("Error digitally signing the product ");
return;
}
// Verify
if (!product.CheckProduct())
{
wxMessageBox("Errors found in product ");
return;
}
// Broadcast
AdvertStartPublish(pnodeLocalHost, MSG_PRODUCT, 0, product);
Destroy();
}
void CEditProductDialog::OnButtonPreview(wxCommandEvent& event)
{
CProduct product;
GetProduct(product);
CViewProductDialog* pdialog = new CViewProductDialog(this, product);
pdialog->Show();
}
void CEditProductDialog::OnButtonCancel(wxCommandEvent& event)
{
Destroy();
}
void CEditProductDialog::SetProduct(const CProduct& productIn)
{
CProduct product = productIn;
m_comboBoxCategory->SetValue(product.mapValue["category"]);
m_textCtrlTitle->SetValue(product.mapValue["title"]);
m_textCtrlPrice->SetValue(product.mapValue["price"]);
m_textCtrlDescription->SetValue(product.mapValue["description"]);
m_textCtrlInstructions->SetValue(product.mapValue["instructions"]);
for (int i = 0; i < FIELDS_MAX; i++)
{
bool fUsed = i < product.vOrderForm.size();
m_buttonDel[i]->Show(fUsed);
m_textCtrlLabel[i]->Show(fUsed);
m_textCtrlField[i]->Show(fUsed);
if (!fUsed)
continue;
m_textCtrlLabel[i]->SetValue(product.vOrderForm[i].first);
string strControl = product.vOrderForm[i].second;
if (strControl.substr(0, 5) == "text=")
m_textCtrlField[i]->SetValue("");
else if (strControl.substr(0, 7) == "choice=")
m_textCtrlField[i]->SetValue(strControl.substr(7));
else
m_textCtrlField[i]->SetValue(strControl);
}
}
void CEditProductDialog::GetProduct(CProduct& product)
{
// map<string, string> mapValue;
// vector<pair<string, string> > vOrderForm;
product.mapValue["category"] = m_comboBoxCategory->GetValue().Trim();
product.mapValue["title"] = m_textCtrlTitle->GetValue().Trim();
product.mapValue["price"] = m_textCtrlPrice->GetValue().Trim();
product.mapValue["description"] = m_textCtrlDescription->GetValue().Trim();
product.mapValue["instructions"] = m_textCtrlInstructions->GetValue().Trim();
for (int i = 0; i < FIELDS_MAX; i++)
{
if (m_buttonDel[i]->IsShown())
{
string strLabel = (string)m_textCtrlLabel[i]->GetValue().Trim();
string strControl = (string)m_textCtrlField[i]->GetValue();
if (strControl.empty())
strControl = "text=";
else
strControl = "choice=" + strControl;
product.vOrderForm.push_back(make_pair(strLabel, strControl));
}
}
}
//////////////////////////////////////////////////////////////////////////////
//
// CViewProductDialog
//
CViewProductDialog::CViewProductDialog(wxWindow* parent, const CProduct& productIn) : CViewProductDialogBase(parent)
{
Connect(wxEVT_REPLY1, wxCommandEventHandler(CViewProductDialog::OnReply1), NULL, this);
AddCallbackAvailable(GetEventHandler());
// Fill display with product summary while waiting for details
product = productIn;
UpdateProductDisplay(false);
m_buttonBack->Enable(false);
m_buttonNext->Enable(!product.vOrderForm.empty());
m_htmlWinReviews->Show(true);
m_scrolledWindow->Show(false);
this->Layout();
// Request details from seller
CreateThread(ThreadRequestProductDetails, new pair<CProduct, wxEvtHandler*>(product, GetEventHandler()));
}
CViewProductDialog::~CViewProductDialog()
{
RemoveCallbackAvailable(GetEventHandler());
}
void ThreadRequestProductDetails(void* parg)
{
// Extract parameters
pair<CProduct, wxEvtHandler*>* pitem = (pair<CProduct, wxEvtHandler*>*)parg;
CProduct product = pitem->first;
wxEvtHandler* pevthandler = pitem->second;
delete pitem;
// Connect to seller
CNode* pnode = ConnectNode(product.addr, 5 * 60);
if (!pnode)
{
CDataStream ssEmpty;
AddPendingReplyEvent1(pevthandler, ssEmpty);
return;
}
// Request detailed product, with response going to OnReply1 via dialog's event handler
pnode->PushRequest("getdetails", product.GetHash(), AddPendingReplyEvent1, (void*)pevthandler);
}
void CViewProductDialog::OnReply1(wxCommandEvent& event)
{
CDataStream ss = GetStreamFromEvent(event);
if (ss.empty())
{
product.mapValue["description"] = "-- CAN'T CONNECT TO SELLER --\n";
UpdateProductDisplay(true);
return;
}
int nRet;
CProduct product2;
try
{
ss >> nRet;
if (nRet > 0)
throw false;
ss >> product2;
if (product2.GetHash() != product.GetHash())
throw false;
if (!product2.CheckSignature())
throw false;
}
catch (...)
{
product.mapValue["description"] = "-- INVALID RESPONSE --\n";
UpdateProductDisplay(true);
return;
}
product = product2;
UpdateProductDisplay(true);
}
bool CompareReviewsBestFirst(const CReview* p1, const CReview* p2)
{
return (p1->nAtoms > p2->nAtoms);
}
void CViewProductDialog::UpdateProductDisplay(bool fDetails)
{
// Product and reviews
string strHTML;
strHTML.reserve(4000);
strHTML += "<html>\n"
"<head>\n"
"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"
"</head>\n"
"<body>\n";
strHTML += "<b>Category:</b> " + HtmlEscape(product.mapValue["category"]) + "<br>\n";
strHTML += "<b>Title:</b> " + HtmlEscape(product.mapValue["title"]) + "<br>\n";
strHTML += "<b>Price:</b> " + HtmlEscape(product.mapValue["price"]) + "<br>\n";
if (!fDetails)
strHTML += "<b>Loading details...</b><br>\n<br>\n";
else
strHTML += HtmlEscape(product.mapValue["description"], true) + "<br>\n<br>\n";
strHTML += "<b>Reviews:</b><br>\n<br>\n";
if (!product.vchPubKeyFrom.empty())
{
CReviewDB reviewdb("r");
// Get reviews
vector<CReview> vReviews;
reviewdb.ReadReviews(product.GetUserHash(), vReviews);
// Get reviewer's number of atoms
vector<CReview*> vSortedReviews;
vSortedReviews.reserve(vReviews.size());
for (vector<CReview>::reverse_iterator it = vReviews.rbegin(); it != vReviews.rend(); ++it)
{
CReview& review = *it;
CUser user;
reviewdb.ReadUser(review.GetUserHash(), user);
review.nAtoms = user.GetAtomCount();
vSortedReviews.push_back(&review);
}
reviewdb.Close();
// Sort
stable_sort(vSortedReviews.begin(), vSortedReviews.end(), CompareReviewsBestFirst);
// Format reviews
foreach(CReview* preview, vSortedReviews)
{
CReview& review = *preview;
int nStars = atoi(review.mapValue["stars"].c_str());
if (nStars < 1 || nStars > 5)
continue;
strHTML += "<b>" + itostr(nStars) + (nStars == 1 ? " star" : " stars") + "</b>";
strHTML += " &nbsp;&nbsp;&nbsp; ";
strHTML += DateStr(atoi64(review.mapValue["date"])) + "<br>\n";
strHTML += HtmlEscape(review.mapValue["review"], true);
strHTML += "<br>\n<br>\n";
}
}
strHTML += "</body>\n</html>\n";
// Shrink capacity to fit
string(strHTML.begin(), strHTML.end()).swap(strHTML);
m_htmlWinReviews->SetPage(strHTML);
///// need to find some other indicator to use so can allow empty order form
if (product.vOrderForm.empty())
return;
// Order form
m_staticTextInstructions->SetLabel(product.mapValue["instructions"]);
for (int i = 0; i < FIELDS_MAX; i++)
{
m_staticTextLabel[i] = NULL;
m_textCtrlField[i] = NULL;
m_choiceField[i] = NULL;
}
// Construct flexgridsizer
wxBoxSizer* bSizer21 = (wxBoxSizer*)m_scrolledWindow->GetSizer();
wxFlexGridSizer* fgSizer;
fgSizer = new wxFlexGridSizer(0, 2, 0, 0);
fgSizer->AddGrowableCol(1);
fgSizer->SetFlexibleDirection(wxBOTH);
fgSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
// Construct order form fields
wxWindow* windowLast = NULL;
for (int i = 0; i < product.vOrderForm.size(); i++)
{
string strLabel = product.vOrderForm[i].first;
string strControl = product.vOrderForm[i].second;
if (strLabel.size() < 20)
strLabel.insert(strLabel.begin(), 20 - strLabel.size(), ' ');
m_staticTextLabel[i] = new wxStaticText(m_scrolledWindow, wxID_ANY, strLabel, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
m_staticTextLabel[i]->Wrap(-1);
fgSizer->Add(m_staticTextLabel[i], 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5);
if (strControl.substr(0, 5) == "text=")
{
m_textCtrlField[i] = new wxTextCtrl(m_scrolledWindow, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
fgSizer->Add(m_textCtrlField[i], 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);
windowLast = m_textCtrlField[i];
}
else if (strControl.substr(0, 7) == "choice=")
{
vector<string> vChoices;
ParseString(strControl.substr(7), ',', vChoices);
wxArrayString arraystring;
foreach(const string& str, vChoices)
arraystring.Add(str);
m_choiceField[i] = new wxChoice(m_scrolledWindow, wxID_ANY, wxDefaultPosition, wxDefaultSize, arraystring, 0);
fgSizer->Add(m_choiceField[i], 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
windowLast = m_choiceField[i];
}
else
{
m_textCtrlField[i] = new wxTextCtrl(m_scrolledWindow, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
fgSizer->Add(m_textCtrlField[i], 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);
m_staticTextLabel[i]->Show(false);
m_textCtrlField[i]->Show(false);
}
}
// Insert after instructions and before submit/cancel buttons
bSizer21->Insert(2, fgSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5);
m_scrolledWindow->Layout();
bSizer21->Fit(m_scrolledWindow);
this->Layout();
// Fixup the tab order
m_buttonSubmitForm->MoveAfterInTabOrder(windowLast);
m_buttonCancelForm->MoveAfterInTabOrder(m_buttonSubmitForm);
//m_buttonBack->MoveAfterInTabOrder(m_buttonCancelForm);
//m_buttonNext->MoveAfterInTabOrder(m_buttonBack);
//m_buttonCancel->MoveAfterInTabOrder(m_buttonNext);
this->Layout();
}
void CViewProductDialog::GetOrder(CWalletTx& wtx)
{
wtx.SetNull();
for (int i = 0; i < product.vOrderForm.size(); i++)
{
string strValue;
if (m_textCtrlField[i])
strValue = m_textCtrlField[i]->GetValue().Trim();
else
strValue = m_choiceField[i]->GetStringSelection();
wtx.vOrderForm.push_back(make_pair(m_staticTextLabel[i]->GetLabel(), strValue));
}
}
void CViewProductDialog::OnButtonSubmitForm(wxCommandEvent& event)
{
m_buttonSubmitForm->Enable(false);
m_buttonCancelForm->Enable(false);
CWalletTx wtx;
GetOrder(wtx);
CSendingDialog* pdialog = new CSendingDialog(this, product.addr, atoi64(product.mapValue["price"]), wtx);
if (!pdialog->ShowModal())
{
m_buttonSubmitForm->Enable(true);
m_buttonCancelForm->Enable(true);
return;
}
}
void CViewProductDialog::OnButtonCancelForm(wxCommandEvent& event)
{
Destroy();
}
void CViewProductDialog::OnButtonBack(wxCommandEvent& event)
{
Freeze();
m_htmlWinReviews->Show(true);
m_scrolledWindow->Show(false);
m_buttonBack->Enable(false);
m_buttonNext->Enable(!product.vOrderForm.empty());
this->Layout();
Thaw();
}
void CViewProductDialog::OnButtonNext(wxCommandEvent& event)
{
if (!product.vOrderForm.empty())
{
Freeze();
m_htmlWinReviews->Show(false);
m_scrolledWindow->Show(true);
m_buttonBack->Enable(true);
m_buttonNext->Enable(false);
this->Layout();
Thaw();
}
}
void CViewProductDialog::OnButtonCancel(wxCommandEvent& event)
{
Destroy();
}
//////////////////////////////////////////////////////////////////////////////
//
// CViewOrderDialog
//
CViewOrderDialog::CViewOrderDialog(wxWindow* parent, CWalletTx order, bool fReceived) : CViewOrderDialogBase(parent)
{
int64 nPrice = (fReceived ? order.GetCredit() : order.GetDebit());
string strHTML;
strHTML.reserve(4000);
strHTML += "<html>\n"
"<head>\n"
"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n"
"</head>\n"
"<body>\n";
strHTML += "<b>Time:</b> " + HtmlEscape(DateTimeStr(order.nTimeReceived)) + "<br>\n";
strHTML += "<b>Price:</b> " + HtmlEscape(FormatMoney(nPrice)) + "<br>\n";
strHTML += "<b>Status:</b> " + HtmlEscape(FormatTxStatus(order)) + "<br>\n";
strHTML += "<table>\n";
for (int i = 0; i < order.vOrderForm.size(); i++)
{
strHTML += " <tr><td><b>" + HtmlEscape(order.vOrderForm[i].first) + ":</b></td>";
strHTML += "<td>" + HtmlEscape(order.vOrderForm[i].second) + "</td></tr>\n";
}
strHTML += "</table>\n";
strHTML += "</body>\n</html>\n";
// Shrink capacity to fit
// (strings are ref counted, so it may live on in SetPage)
string(strHTML.begin(), strHTML.end()).swap(strHTML);
m_htmlWin->SetPage(strHTML);
}
void CViewOrderDialog::OnButtonOK(wxCommandEvent& event)
{
Destroy();
}
//////////////////////////////////////////////////////////////////////////////
//
// CEditReviewDialog
//
CEditReviewDialog::CEditReviewDialog(wxWindow* parent) : CEditReviewDialogBase(parent)
{
}
void CEditReviewDialog::OnButtonSubmit(wxCommandEvent& event)
{
if (m_choiceStars->GetSelection() == -1)
{
wxMessageBox("Please select a rating ");
return;
}
CReview review;
GetReview(review);
// Sign the review
review.vchPubKeyFrom = keyUser.GetPubKey();
if (!keyUser.Sign(review.GetSigHash(), review.vchSig))
{
wxMessageBox("Unable to digitally sign the review ");
return;
}
// Broadcast
if (!review.AcceptReview())
{
wxMessageBox("Save failed ");
return;
}
RelayMessage(CInv(MSG_REVIEW, review.GetHash()), review);
Destroy();
}
void CEditReviewDialog::OnButtonCancel(wxCommandEvent& event)
{
Destroy();
}
void CEditReviewDialog::GetReview(CReview& review)
{
review.mapValue["time"] = i64tostr(GetAdjustedTime());
review.mapValue["stars"] = itostr(m_choiceStars->GetSelection()+1);
review.mapValue["review"] = m_textCtrlReview->GetValue();
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// CMyTaskBarIcon // CMyTaskBarIcon

142
ui.h
View file

@ -6,12 +6,6 @@
DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1) DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY1, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY2, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY3, -1)
extern map<string, string> mapArgs; extern map<string, string> mapArgs;
@ -57,8 +51,8 @@ protected:
void OnButtonAddressBook(wxCommandEvent& event); void OnButtonAddressBook(wxCommandEvent& event);
void OnSetFocusAddress(wxFocusEvent& event); void OnSetFocusAddress(wxFocusEvent& event);
void OnMouseEventsAddress(wxMouseEvent& event); void OnMouseEventsAddress(wxMouseEvent& event);
void OnButtonCopy(wxCommandEvent& event);
void OnButtonChange(wxCommandEvent& event); void OnButtonChange(wxCommandEvent& event);
void OnButtonCopy(wxCommandEvent& event);
void OnListColBeginDrag(wxListEvent& event); void OnListColBeginDrag(wxListEvent& event);
void OnListItemActivated(wxListEvent& event); void OnListItemActivated(wxListEvent& event);
void OnListItemActivatedProductsSent(wxListEvent& event); void OnListItemActivatedProductsSent(wxListEvent& event);
@ -263,138 +257,6 @@ public:
class CProductsDialog : public CProductsDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnCombobox(wxCommandEvent& event);
void OnButtonSearch(wxCommandEvent& event);
void OnListItemActivated(wxListEvent& event);
public:
/** Constructor */
CProductsDialog(wxWindow* parent);
// Custom
vector<CProduct> m_vProduct;
};
class CEditProductDialog : public CEditProductDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnButtonDel0(wxCommandEvent& event);
void OnButtonDel1(wxCommandEvent& event);
void OnButtonDel2(wxCommandEvent& event);
void OnButtonDel3(wxCommandEvent& event);
void OnButtonDel4(wxCommandEvent& event);
void OnButtonDel5(wxCommandEvent& event);
void OnButtonDel6(wxCommandEvent& event);
void OnButtonDel7(wxCommandEvent& event);
void OnButtonDel8(wxCommandEvent& event);
void OnButtonDel9(wxCommandEvent& event);
void OnButtonDel10(wxCommandEvent& event);
void OnButtonDel11(wxCommandEvent& event);
void OnButtonDel12(wxCommandEvent& event);
void OnButtonDel13(wxCommandEvent& event);
void OnButtonDel14(wxCommandEvent& event);
void OnButtonDel15(wxCommandEvent& event);
void OnButtonDel16(wxCommandEvent& event);
void OnButtonDel17(wxCommandEvent& event);
void OnButtonDel18(wxCommandEvent& event);
void OnButtonDel19(wxCommandEvent& event);
void OnButtonAddField(wxCommandEvent& event);
void OnButtonSend(wxCommandEvent& event);
void OnButtonPreview(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CEditProductDialog(wxWindow* parent);
// Custom
enum { FIELDS_MAX = 20 };
wxTextCtrl* m_textCtrlLabel[FIELDS_MAX];
wxTextCtrl* m_textCtrlField[FIELDS_MAX];
wxButton* m_buttonDel[FIELDS_MAX];
void LayoutAll();
void ShowLine(int i, bool fShow=true);
void OnButtonDel(wxCommandEvent& event, int n);
void SetProduct(const CProduct& productIn);
void GetProduct(CProduct& product);
};
class CViewProductDialog : public CViewProductDialogBase
{
protected:
// Event handlers
void OnButtonSubmitForm(wxCommandEvent& event);
void OnButtonCancelForm(wxCommandEvent& event);
void OnButtonBack(wxCommandEvent& event);
void OnButtonNext(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CViewProductDialog(wxWindow* parent, const CProduct& productIn);
~CViewProductDialog();
// Custom
CProduct product;
enum { FIELDS_MAX = 20 };
wxStaticText* m_staticTextLabel[FIELDS_MAX];
wxTextCtrl* m_textCtrlField[FIELDS_MAX];
wxChoice* m_choiceField[FIELDS_MAX];
void GetOrder(CWalletTx& order);
void UpdateProductDisplay(bool fDetails);
void OnReply1(wxCommandEvent& event);
};
class CViewOrderDialog : public CViewOrderDialogBase
{
protected:
// Event handlers
void OnButtonOK(wxCommandEvent& event);
public:
/** Constructor */
CViewOrderDialog(wxWindow* parent, CWalletTx order, bool fReceived);
// Custom
bool fReceived;
};
class CEditReviewDialog : public CEditReviewDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnButtonSubmit(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CEditReviewDialog(wxWindow* parent);
// Custom
void GetReview(CReview& review);
};
class CGetTextFromUserDialog : public CGetTextFromUserDialogBase class CGetTextFromUserDialog : public CGetTextFromUserDialogBase
{ {
protected: protected:
@ -430,6 +292,8 @@ public:
m_textCtrl2->SetValue(strValue2); m_textCtrl2->SetValue(strValue2);
SetSize(wxDefaultCoord, 180); SetSize(wxDefaultCoord, 180);
} }
if (!fWindows)
SetSize(1.14 * GetSize().GetWidth(), 1.14 * GetSize().GetHeight());
} }
// Custom // Custom

File diff suppressed because it is too large Load diff

287
uibase.h
View file

@ -11,6 +11,8 @@
#ifndef __uibase__ #ifndef __uibase__
#define __uibase__ #define __uibase__
#include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
@ -37,8 +39,6 @@
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/scrolwin.h> #include <wx/scrolwin.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/combobox.h>
#include <wx/richtext/richtextctrl.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -49,8 +49,8 @@
#define wxID_BUTTONSEND 1004 #define wxID_BUTTONSEND 1004
#define wxID_BUTTONRECEIVE 1005 #define wxID_BUTTONRECEIVE 1005
#define wxID_TEXTCTRLADDRESS 1006 #define wxID_TEXTCTRLADDRESS 1006
#define wxID_BUTTONCOPY 1007 #define wxID_BUTTONCHANGE 1007
#define wxID_BUTTONCHANGE 1008 #define wxID_BUTTONCOPY 1008
#define wxID_TRANSACTIONFEE 1009 #define wxID_TRANSACTIONFEE 1009
#define wxID_PROXYIP 1010 #define wxID_PROXYIP 1010
#define wxID_PROXYPORT 1011 #define wxID_PROXYPORT 1011
@ -64,33 +64,7 @@
#define wxID_BUTTONNEW 1019 #define wxID_BUTTONNEW 1019
#define wxID_BUTTONEDIT 1020 #define wxID_BUTTONEDIT 1020
#define wxID_BUTTONDELETE 1021 #define wxID_BUTTONDELETE 1021
#define wxID_DEL0 1022 #define wxID_TEXTCTRL 1022
#define wxID_DEL1 1023
#define wxID_DEL2 1024
#define wxID_DEL3 1025
#define wxID_DEL4 1026
#define wxID_DEL5 1027
#define wxID_DEL6 1028
#define wxID_DEL7 1029
#define wxID_DEL8 1030
#define wxID_DEL9 1031
#define wxID_DEL10 1032
#define wxID_DEL11 1033
#define wxID_DEL12 1034
#define wxID_DEL13 1035
#define wxID_DEL14 1036
#define wxID_DEL15 1037
#define wxID_DEL16 1038
#define wxID_DEL17 1039
#define wxID_DEL18 1040
#define wxID_DEL19 1041
#define wxID_BUTTONPREVIEW 1042
#define wxID_BUTTONSAMPLE 1043
#define wxID_CANCEL2 1044
#define wxID_BUTTONBACK 1045
#define wxID_BUTTONNEXT 1046
#define wxID_SUBMIT 1047
#define wxID_TEXTCTRL 1048
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class CMainFrameBase /// Class CMainFrameBase
@ -109,8 +83,8 @@ class CMainFrameBase : public wxFrame
wxStaticText* m_staticText32; wxStaticText* m_staticText32;
wxTextCtrl* m_textCtrlAddress; wxTextCtrl* m_textCtrlAddress;
wxButton* m_buttonNew;
wxButton* m_buttonCopy; wxButton* m_buttonCopy;
wxButton* m_button91;
wxPanel* m_panel14; wxPanel* m_panel14;
wxStaticText* m_staticText41; wxStaticText* m_staticText41;
@ -137,8 +111,8 @@ class CMainFrameBase : public wxFrame
virtual void OnKeyDown( wxKeyEvent& event ){ event.Skip(); } virtual void OnKeyDown( wxKeyEvent& event ){ event.Skip(); }
virtual void OnMouseEventsAddress( wxMouseEvent& event ){ event.Skip(); } virtual void OnMouseEventsAddress( wxMouseEvent& event ){ event.Skip(); }
virtual void OnSetFocusAddress( wxFocusEvent& event ){ event.Skip(); } virtual void OnSetFocusAddress( wxFocusEvent& event ){ event.Skip(); }
virtual void OnButtonCopy( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonChange( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonChange( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCopy( wxCommandEvent& event ){ event.Skip(); }
virtual void OnListColBeginDrag( wxListEvent& event ){ event.Skip(); } virtual void OnListColBeginDrag( wxListEvent& event ){ event.Skip(); }
virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); } virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); }
virtual void OnPaintListCtrl( wxPaintEvent& event ){ event.Skip(); } virtual void OnPaintListCtrl( wxPaintEvent& event ){ event.Skip(); }
@ -147,7 +121,7 @@ class CMainFrameBase : public wxFrame
public: public:
wxMenu* m_menuOptions; wxMenu* m_menuOptions;
wxListCtrl* m_listCtrl; wxListCtrl* m_listCtrl;
CMainFrameBase( wxWindow* parent, wxWindowID id = wxID_MAINFRAME, const wxString& title = wxT("Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 712,484 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL ); CMainFrameBase( wxWindow* parent, wxWindowID id = wxID_MAINFRAME, const wxString& title = _("Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 712,484 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~CMainFrameBase(); ~CMainFrameBase();
}; };
@ -168,7 +142,7 @@ class CTxDetailsDialogBase : public wxDialog
public: public:
CTxDetailsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Transaction Details"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 620,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); CTxDetailsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Transaction Details"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 620,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~CTxDetailsDialogBase(); ~CTxDetailsDialogBase();
}; };
@ -223,7 +197,7 @@ class COptionsDialogBase : public wxDialog
public: public:
COptionsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 540,360 ), long style = wxDEFAULT_DIALOG_STYLE ); COptionsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 540,360 ), long style = wxDEFAULT_DIALOG_STYLE );
~COptionsDialogBase(); ~COptionsDialogBase();
}; };
@ -251,7 +225,7 @@ class CAboutDialogBase : public wxDialog
public: public:
wxStaticText* m_staticTextVersion; wxStaticText* m_staticTextVersion;
CAboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("About Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 532,329 ), long style = wxDEFAULT_DIALOG_STYLE ); CAboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 532,329 ), long style = wxDEFAULT_DIALOG_STYLE );
~CAboutDialogBase(); ~CAboutDialogBase();
}; };
@ -298,7 +272,7 @@ class CSendDialogBase : public wxDialog
public: public:
CSendDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Send Coins"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 675,312 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); CSendDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Send Coins"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 675,312 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~CSendDialogBase(); ~CSendDialogBase();
}; };
@ -325,7 +299,7 @@ class CSendingDialogBase : public wxDialog
public: public:
CSendingDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Sending..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 442,151 ), long style = wxDEFAULT_DIALOG_STYLE ); CSendingDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sending..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 442,151 ), long style = wxDEFAULT_DIALOG_STYLE );
~CSendingDialogBase(); ~CSendingDialogBase();
}; };
@ -361,7 +335,7 @@ class CYourAddressDialogBase : public wxDialog
public: public:
CYourAddressDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Your Bitcoin Addresses"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 610,390 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); CYourAddressDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Your Bitcoin Addresses"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 610,390 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~CYourAddressDialogBase(); ~CYourAddressDialogBase();
}; };
@ -397,242 +371,11 @@ class CAddressBookDialogBase : public wxDialog
public: public:
wxButton* m_buttonCancel; wxButton* m_buttonCancel;
CAddressBookDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Address Book"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 610,390 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); CAddressBookDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Address Book"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 610,390 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~CAddressBookDialogBase(); ~CAddressBookDialogBase();
}; };
///////////////////////////////////////////////////////////////////////////////
/// Class CProductsDialogBase
///////////////////////////////////////////////////////////////////////////////
class CProductsDialogBase : public wxDialog
{
private:
protected:
wxComboBox* m_comboBoxCategory;
wxTextCtrl* m_textCtrlSearch;
wxButton* m_buttonSearch;
wxListCtrl* m_listCtrl;
// Virtual event handlers, overide them in your derived class
virtual void OnCombobox( wxCommandEvent& event ){ event.Skip(); }
virtual void OnKeyDown( wxKeyEvent& event ){ event.Skip(); }
virtual void OnButtonSearch( wxCommandEvent& event ){ event.Skip(); }
virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); }
public:
CProductsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Marketplace"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 708,535 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~CProductsDialogBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class CEditProductDialogBase
///////////////////////////////////////////////////////////////////////////////
class CEditProductDialogBase : public wxFrame
{
private:
protected:
wxScrolledWindow* m_scrolledWindow;
wxStaticText* m_staticText106;
wxComboBox* m_comboBoxCategory;
wxStaticText* m_staticText108;
wxTextCtrl* m_textCtrlTitle;
wxStaticText* m_staticText107;
wxTextCtrl* m_textCtrlPrice;
wxStaticText* m_staticText22;
wxTextCtrl* m_textCtrlDescription;
wxStaticText* m_staticText23;
wxTextCtrl* m_textCtrlInstructions;
wxStaticText* m_staticText24;
wxStaticText* m_staticText25;
wxTextCtrl* m_textCtrlLabel0;
wxTextCtrl* m_textCtrlField0;
wxButton* m_buttonDel0;
wxTextCtrl* m_textCtrlLabel1;
wxTextCtrl* m_textCtrlField1;
wxButton* m_buttonDel1;
wxTextCtrl* m_textCtrlLabel2;
wxTextCtrl* m_textCtrlField2;
wxButton* m_buttonDel2;
wxTextCtrl* m_textCtrlLabel3;
wxTextCtrl* m_textCtrlField3;
wxButton* m_buttonDel3;
wxTextCtrl* m_textCtrlLabel4;
wxTextCtrl* m_textCtrlField4;
wxButton* m_buttonDel4;
wxTextCtrl* m_textCtrlLabel5;
wxTextCtrl* m_textCtrlField5;
wxButton* m_buttonDel5;
wxTextCtrl* m_textCtrlLabel6;
wxTextCtrl* m_textCtrlField6;
wxButton* m_buttonDel6;
wxTextCtrl* m_textCtrlLabel7;
wxTextCtrl* m_textCtrlField7;
wxButton* m_buttonDel7;
wxTextCtrl* m_textCtrlLabel8;
wxTextCtrl* m_textCtrlField8;
wxButton* m_buttonDel8;
wxTextCtrl* m_textCtrlLabel9;
wxTextCtrl* m_textCtrlField9;
wxButton* m_buttonDel9;
wxTextCtrl* m_textCtrlLabel10;
wxTextCtrl* m_textCtrlField10;
wxButton* m_buttonDel10;
wxTextCtrl* m_textCtrlLabel11;
wxTextCtrl* m_textCtrlField11;
wxButton* m_buttonDel11;
wxTextCtrl* m_textCtrlLabel12;
wxTextCtrl* m_textCtrlField12;
wxButton* m_buttonDel12;
wxTextCtrl* m_textCtrlLabel13;
wxTextCtrl* m_textCtrlField13;
wxButton* m_buttonDel13;
wxTextCtrl* m_textCtrlLabel14;
wxTextCtrl* m_textCtrlField14;
wxButton* m_buttonDel14;
wxTextCtrl* m_textCtrlLabel15;
wxTextCtrl* m_textCtrlField15;
wxButton* m_buttonDel15;
wxTextCtrl* m_textCtrlLabel16;
wxTextCtrl* m_textCtrlField16;
wxButton* m_buttonDel16;
wxTextCtrl* m_textCtrlLabel17;
wxTextCtrl* m_textCtrlField17;
wxButton* m_buttonDel17;
wxTextCtrl* m_textCtrlLabel18;
wxTextCtrl* m_textCtrlField18;
wxButton* m_buttonDel18;
wxTextCtrl* m_textCtrlLabel19;
wxTextCtrl* m_textCtrlField19;
wxButton* m_buttonDel19;
wxButton* m_buttonAddField;
wxButton* m_buttonOK;
wxButton* m_buttonPreview;
wxButton* m_buttonCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnKeyDown( wxKeyEvent& event ){ event.Skip(); }
virtual void OnButtonDel0( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel1( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel2( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel3( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel4( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel5( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel6( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel7( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel8( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel9( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel10( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel11( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel12( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel13( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel14( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel15( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel16( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel17( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel18( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDel19( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonAddField( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonSend( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonPreview( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancel( wxCommandEvent& event ){ event.Skip(); }
public:
wxFlexGridSizer* fgSizer5;
CEditProductDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Edit Product"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 660,640 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~CEditProductDialogBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class CViewProductDialogBase
///////////////////////////////////////////////////////////////////////////////
class CViewProductDialogBase : public wxFrame
{
private:
protected:
wxHtmlWindow* m_htmlWinReviews;
wxScrolledWindow* m_scrolledWindow;
wxRichTextCtrl* m_richTextHeading;
wxStaticText* m_staticTextInstructions;
wxButton* m_buttonSubmitForm;
wxButton* m_buttonCancelForm;
wxButton* m_buttonBack;
wxButton* m_buttonNext;
wxButton* m_buttonCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnButtonSubmitForm( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancelForm( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonBack( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonNext( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancel( wxCommandEvent& event ){ event.Skip(); }
public:
CViewProductDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Order Form"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 630,520 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~CViewProductDialogBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class CViewOrderDialogBase
///////////////////////////////////////////////////////////////////////////////
class CViewOrderDialogBase : public wxFrame
{
private:
protected:
wxHtmlWindow* m_htmlWin;
wxButton* m_buttonOK;
// Virtual event handlers, overide them in your derived class
virtual void OnButtonOK( wxCommandEvent& event ){ event.Skip(); }
public:
CViewOrderDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("View Order"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 630,520 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~CViewOrderDialogBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class CEditReviewDialogBase
///////////////////////////////////////////////////////////////////////////////
class CEditReviewDialogBase : public wxFrame
{
private:
protected:
wxStaticText* m_staticTextSeller;
wxStaticText* m_staticText110;
wxChoice* m_choiceStars;
wxStaticText* m_staticText43;
wxTextCtrl* m_textCtrlReview;
wxButton* m_buttonSubmit;
wxButton* m_buttonCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnKeyDown( wxKeyEvent& event ){ event.Skip(); }
virtual void OnButtonSubmit( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancel( wxCommandEvent& event ){ event.Skip(); }
public:
CEditReviewDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Enter Review"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 630,440 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~CEditReviewDialogBase();
};
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class CGetTextFromUserDialogBase /// Class CGetTextFromUserDialogBase
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

File diff suppressed because it is too large Load diff