Access to the current location mode from settings.

This commit is contained in:
Alex Zolotarev 2016-02-25 13:53:23 +03:00 committed by Sergey Yershov
parent 89505d6f76
commit 4796e428ba
3 changed files with 12 additions and 11 deletions

View file

@ -15,14 +15,6 @@
namespace df
{
namespace
{
string const LocationStateMode = "LastLocationStateMode";
}
DrapeEngine::DrapeEngine(Params && params)
: m_viewport(params.m_viewport)
{
@ -37,7 +29,7 @@ DrapeEngine::DrapeEngine(Params && params)
m_requestedTiles = make_unique_dp<RequestedTiles>();
location::EMyPositionMode mode = params.m_initialMyPositionMode.first;
if (!params.m_initialMyPositionMode.second && !Settings::Get(LocationStateMode, mode))
if (!params.m_initialMyPositionMode.second && !Settings::Get(Settings::kLocationStateMode, mode))
mode = location::MODE_FOLLOW;
FrontendRenderer::Params frParams(make_ref(m_threadCommutator), params.m_factory,
@ -221,7 +213,7 @@ void DrapeEngine::ModelViewChangedGuiThread(ScreenBase const & screen)
void DrapeEngine::MyPositionModeChanged(location::EMyPositionMode mode)
{
Settings::Set(LocationStateMode, mode);
Settings::Set(Settings::kLocationStateMode, mode);
GetPlatform().RunOnGuiThread([this, mode]()
{
if (m_myPositionModeChanged != nullptr)

View file

@ -20,10 +20,16 @@
#define FIRST_LAUNCH_KEY "FirstLaunchOnDate"
static char const DELIM_CHAR = '=';
namespace
{
char const DELIM_CHAR = '=';
}
char const * Settings::kLocationStateMode = "LastLocationStateMode";
namespace Settings
{
StringStorage::StringStorage()
{
lock_guard<mutex> guard(m_mutex);

View file

@ -6,6 +6,9 @@
namespace Settings
{
// Current location state mode. @See location::EMyPositionMode.
extern char const * kLocationStateMode;
template <class T> bool FromString(string const & str, T & outValue);
template <class T> string ToString(T const & value);