Layout changes - display receive address
This commit is contained in:
@@ -50,6 +50,7 @@ public:
|
||||
_SiaApiError Unlock(const String& password);
|
||||
_SiaApiError GetConfirmedBalance(SiaCurrency& balance) const;
|
||||
_SiaApiError GetUnonfirmedBalance(SiaCurrency& balance) const;
|
||||
_SiaApiError GetAddress(String& address) const;
|
||||
};
|
||||
|
||||
class AFX_EXT_CLASS _CSiaRenter
|
||||
|
@@ -159,3 +159,19 @@ SiaApiError CSiaApi::_CSiaWallet::GetUnonfirmedBalance(SiaCurrency& balance) con
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SiaApiError CSiaApi::_CSiaWallet::GetAddress(String& address) const
|
||||
{
|
||||
SiaApiError ret = SiaApiError::RequestError;
|
||||
address = L"";
|
||||
|
||||
json result;
|
||||
SiaCurlError cerror = _siaCurl.Get(L"/wallet/address", result);
|
||||
if (API_SUCCESS(SiaCurlError, cerror))
|
||||
{
|
||||
address = CA2W(result["address"].get<std::string>().c_str());
|
||||
ret = SiaApiError::Success;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
<HEAD>
|
||||
</HEAD>
|
||||
<BODY ID=CSiaDriveDlg BGCOLOR=LIGHTGREY style="font-family: MS Shell Dlg; font-size: 14">
|
||||
<h3 style="margin-bottom: 5px">Sia Information</h3>
|
||||
<div style="float: right;">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -30,9 +31,11 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="main_window" style="padding: 10">
|
||||
|
||||
<div id="main_window" style="padding: 0">
|
||||
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; bottom: 10; left: 10; width: 100%">
|
||||
<table width="100%">
|
||||
<TR width=100%">
|
||||
@@ -48,29 +51,31 @@
|
||||
</div>
|
||||
|
||||
<div id="create_wallet" style="display: none">
|
||||
<h3>Create New Wallet</h3>
|
||||
<p>Click 'Create' to create a new Sia wallet or exit the application if this is not what you want to do.</p>
|
||||
<h3 style="margin-bottom: 5px">Create New Wallet</h3>
|
||||
<p style="margin-top: 0">Click 'Create' to create a new Sia wallet or exit the application if this is not what you want to do.</p>
|
||||
<button ID="CreateWalletButton">Create</button>
|
||||
</div>
|
||||
|
||||
<div id="unlock_wallet" style="display: none" width="100%">
|
||||
<h3>Unlock Wallet</h3>
|
||||
<p>Enter wallet password and click 'Unlock' to continue.</p>
|
||||
<h3 style="margin-bottom: 5px">Unlock Wallet</h3>
|
||||
<p style="margin-top: 0">Enter wallet password and click 'Unlock' to continue.</p>
|
||||
<input type="password" id="WalletUnlockPwd" style="width: 100%"/><br/><br/>
|
||||
<button ID="UnlockWalletButton">Unlock</button>
|
||||
</div>
|
||||
|
||||
<div width="100%" id="disp_wallet_seed" style="display: none">
|
||||
<h3>Wallet Created</h3>
|
||||
<p>Please save the following seed. You will need this to unlock and/or restore your wallet. Click 'Done' once you've backed-up your seed.</p>
|
||||
<h3 style="margin-bottom: 5px">Wallet Created</h3>
|
||||
<p style="margin-top: 0">Please save the following seed. You will need this to unlock and/or restore your wallet. Click 'Done' once you've backed-up your seed.</p>
|
||||
<textarea rows=4 cols=60 width="100%" id="WalletCreatedSeed"></textarea><br/><br/>
|
||||
<button ID="ConfirmSeedButton">Done</button>
|
||||
</div>
|
||||
|
||||
<div id="tab_page" style="display: none">
|
||||
<div id="tab_view" style="display: none">
|
||||
<h3 style="margin-bottom: 5px">Receive Address</h3>
|
||||
<label id="WalletAddress"></label><br/><br/>
|
||||
<TABLE WIDTH=100%>
|
||||
<TR WIDTH=100%>
|
||||
<TD ALIGN=LEFT VALIGN=TOP>
|
||||
<TD ALIGN=CENTER VALIGN=TOP>
|
||||
<input id="wallet_btn" type="button" value="Wallet"/>
|
||||
<input id="host_btn" type="button" value="Host"/>
|
||||
<input id="mount_btn" type="button" value="Mount"/>
|
||||
|
Binary file not shown.
@@ -79,6 +79,7 @@ void CSiaDriveDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceTotal"), _walletBalanceTotal);
|
||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceConfirmed"), _walletBalanceConfirmed);
|
||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceUnconfirmed"), _walletBalanceUnconfirmed);
|
||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletAddress"), _walletAddress);
|
||||
DDX_DHtml_ElementInnerText(pDX, _T("WalletCreatedSeed"), _walletCreatedSeed);
|
||||
DDX_DHtml_ElementValue(pDX, _T("WalletUnlockPwd"), _unlockWalletPwd);
|
||||
}
|
||||
@@ -247,19 +248,13 @@ void CSiaDriveDlg::OnDocumentComplete(LPDISPATCH, LPCTSTR)
|
||||
_walletBalanceConfirmed = L"";
|
||||
_walletBalanceUnconfirmed = L"";
|
||||
_walletBalanceTotal = L"";
|
||||
_walletAddress = L"";
|
||||
|
||||
SetTimer(IDT_UPDATE, 2000, nullptr);
|
||||
|
||||
if ((_connected = UpdateUi(false)))
|
||||
{
|
||||
switch (_siaConfig.GetUI_Main_TabIndex())
|
||||
{
|
||||
case WALLET_TAB:
|
||||
{
|
||||
DisplayWalletTab();
|
||||
}
|
||||
break;
|
||||
}
|
||||
ConfigureWallet();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -298,6 +293,12 @@ bool CSiaDriveDlg::UpdateSiaInfo()
|
||||
_walletBalanceUnconfirmed = SiaCurrencyToString(unconfirmed).c_str();
|
||||
_walletBalanceTotal = SiaCurrencyToString(total).c_str();
|
||||
|
||||
if (!_walletAddress.GetLength())
|
||||
{
|
||||
String address;
|
||||
_siaApi.GetWallet()->GetAddress(address);
|
||||
_walletAddress = address.c_str();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -305,7 +306,7 @@ bool CSiaDriveDlg::UpdateSiaInfo()
|
||||
}
|
||||
|
||||
_serverVersion = L"x.x.x";
|
||||
_walletBalanceConfirmed = _walletBalanceUnconfirmed = _walletBalanceTotal = L"";
|
||||
_walletAddress = _walletBalanceConfirmed = _walletBalanceUnconfirmed = _walletBalanceTotal = L"";
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -377,7 +378,7 @@ void CSiaDriveDlg::DisplayCreateWallet()
|
||||
SetMainWindow(L"create_wallet");
|
||||
}
|
||||
|
||||
void CSiaDriveDlg::DisplayWalletTab()
|
||||
void CSiaDriveDlg::ConfigureWallet()
|
||||
{
|
||||
if (_siaApi.GetWallet()->GetCreated())
|
||||
{
|
||||
@@ -388,7 +389,16 @@ void CSiaDriveDlg::DisplayWalletTab()
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMainWindow(L"tab_view");
|
||||
|
||||
switch (_siaConfig.GetUI_Main_TabIndex())
|
||||
{
|
||||
case WALLET_TAB:
|
||||
{
|
||||
//DisplayWalletTab();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -50,7 +50,7 @@ private:
|
||||
void DisplaySeedCreated(const String& seed);
|
||||
bool UpdateSiaInfo();
|
||||
void DisplayUnlockWallet();
|
||||
void DisplayWalletTab();
|
||||
void ConfigureWallet();
|
||||
void RemoveCreateWalletItems();
|
||||
void RemoveDomNodeById(const String& id);
|
||||
void SetMainWindow(const String& name);
|
||||
@@ -67,6 +67,7 @@ private:
|
||||
CString _walletBalanceTotal;
|
||||
CString _walletBalanceUnconfirmed;
|
||||
CString _walletCreatedSeed;
|
||||
CString _walletAddress;
|
||||
CString _unlockWalletPwd;
|
||||
bool _connected = false;
|
||||
bool _seedCreation = false;
|
||||
|
Reference in New Issue
Block a user