1
0

Display fixes

This commit is contained in:
Scott E. Graves
2017-04-11 17:43:16 -05:00
parent cd76060741
commit 1b7d84efcc
4 changed files with 24 additions and 19 deletions

View File

@@ -100,15 +100,10 @@ public:
public:
void BuildTree(const json& result);
std::shared_ptr<std::vector<std::shared_ptr<_CSiaFile>>> GetFileList() const;
std::vector<std::shared_ptr<_CSiaFile>> Query(SString query) const;
std::shared_ptr<_CSiaFile> GetFile(const SString& siaPath) const;
std::vector<SString> QueryDirectories(SString query) const;
bool FileExists(const SString& siaPath) const;
};
@@ -276,6 +271,8 @@ public:
static SString FormatToSiaPath(SString path);
public:
void StartBackgroundRefresh();
void StopBackgroundRefresh();
std::shared_ptr<_CSiaWallet> GetWallet() const;
std::shared_ptr<_CSiaRenter> GetRenter() const;
std::shared_ptr<_CSiaConsensus> GetConsensus() const;

View File

@@ -271,10 +271,19 @@ CSiaDriveApp::CSiaDriveApp()
hostConfig.RequiredVersion = COMPAT_SIAD_VERSION;
_siaCurl.reset(new CSiaCurl(hostConfig));
_siaApi.reset(new CSiaApi(hostConfig, _siaDriveConfig.get()));
_siaApi->StartBackgroundRefresh();
#ifdef _WIN32
_siaDrive.reset(new Dokan::CSiaDokanDrive(*_siaApi, _siaDriveConfig.get()));
#else
a
#endif
}
CSiaDriveApp::~CSiaDriveApp()
{
_siaApi->StopBackgroundRefresh();
ShutdownServices();
_siaDrive.reset(nullptr);
_siaApi.reset(nullptr);
_siaCurl.reset(nullptr);
}
@@ -380,7 +389,6 @@ void CSiaDriveApp::ShutdownServices()
if (_siaDrive)
{
_siaDrive->Unmount();
_siaDrive.reset(nullptr);
}
}
@@ -392,7 +400,6 @@ void CSiaDriveApp::SiaApiRefreshCallback(CefRefPtr<CefV8Context> context, const
auto global = context->GetGlobal();
bool wasOnline = global->GetValue("uiState")->GetValue("isOnline")->GetBoolValue();
bool isOnline = _siaApi->GetWallet()->GetConnected();
if (wasOnline != isOnline)
{
_appStarted = false;
@@ -400,15 +407,6 @@ void CSiaDriveApp::SiaApiRefreshCallback(CefRefPtr<CefV8Context> context, const
}
else if (_appStarted)
{
#ifdef _WIN32
if (!_siaDrive)
{
_siaDrive.reset(new Dokan::CSiaDokanDrive(*_siaApi, _siaDriveConfig.get()));
}
#else
a
#endif
auto uiActions = global->GetValue("uiUpdate");
auto renterActions = uiActions->GetValue("Renter");
auto walletActions = uiActions->GetValue("Wallet");

View File

@@ -14,8 +14,6 @@ CSiaApi::CSiaApi(const SiaHostConfig& hostConfig, CSiaDriveConfig* siaDriveConfi
_hostDb(new CSiaHostDb(_siaCurl, siaDriveConfig)),
_refreshThread(new CAutoThread(_siaCurl, _siaDriveConfig, [this] (const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig) { this->Refresh(siaCurl, siaDriveConfig); }))
{
this->Refresh(_siaCurl, _siaDriveConfig);
_refreshThread->StartAutoThread();
}
CSiaApi::~CSiaApi()
@@ -27,10 +25,11 @@ CSiaApi::~CSiaApi()
void CSiaApi::Refresh(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig)
{
this->_wallet->Refresh(siaCurl, siaDriveConfig);
this->_consensus->Refresh(siaCurl, siaDriveConfig);
this->_renter->Refresh(siaCurl, siaDriveConfig);
this->_hostDb->Refresh(siaCurl, siaDriveConfig);
// Initialize last - wallet contains connection status
this->_wallet->Refresh(siaCurl, siaDriveConfig);
}
SString CSiaApi::FormatToSiaPath(SString path)
@@ -55,6 +54,16 @@ SString CSiaApi::FormatToSiaPath(SString path)
return path;
}
void CSiaApi::StartBackgroundRefresh()
{
_refreshThread->StartAutoThread();
}
void CSiaApi::StopBackgroundRefresh()
{
_refreshThread->StartAutoThread();
}
SString CSiaApi::GetServerVersion() const
{
return _siaCurl.GetServerVersion();

View File

@@ -78,6 +78,7 @@ void CSiaApi::_CSiaWallet::Refresh(const CSiaCurl& siaCurl, CSiaDriveConfig* sia
SetConfirmedBalance(confirmed);
SetUnconfirmedBalance(unconfirmed);
SetReceiveAddress(address);
// Update connected status last so all properties are current
SetConnected(connected);
}