Skip to content

Commit

Permalink
Profile is now saved in the ASR
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Ferran committed Jul 5, 2015
1 parent b82b1f8 commit 121ba44
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
10 changes: 10 additions & 0 deletions vSMR/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ class CConfig
active_profile = profiles[newProfile];
};

inline string getActiveProfileName() {
string name;
for (std::map<string, rapidjson::SizeType>::iterator it = profiles.begin(); it != profiles.end(); ++it)
{
if (it->second == active_profile)
name = it->first; break;
}
return name;
};

Document document;

protected:
Expand Down
13 changes: 9 additions & 4 deletions vSMR/SMRRadar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ void CSMRRadar::OnAsrContentLoaded(bool Loaded)
RimcasInstance->RunwayTimerShort = true;
}

if ((p_value = GetDataFromAsr("Profile")) != NULL)
CurrentConfig->setActiveProfile(string(p_value));

/*
if ((p_value = GetDataFromAsr("AppWindowTopLeftX")) != NULL)
{
Expand Down Expand Up @@ -167,10 +170,11 @@ void CSMRRadar::OnAsrContentToBeSaved(void)
{
SaveDataToAsr("Airport", "Active airport for RIMCAS", getActiveAirport().c_str());

const char * to_save = "0";
SaveDataToAsr("Profile", "vSMR active profile", CurrentConfig->getActiveProfileName().c_str());

/*const char * to_save = "0";
string temp;
/*
temp = std::to_string(appWindowArea.left);
SaveDataToAsr("AppWindowTopLeftX", "Approach window position", temp.c_str());
Expand All @@ -193,11 +197,11 @@ void CSMRRadar::OnAsrContentToBeSaved(void)
if (appWindow)
to_save = "1";
SaveDataToAsr("AppWindow", "Display Approach window", to_save);
*/
to_save = "0";
if (RimcasInstance->RunwayTimerShort)
to_save = "1";
SaveDataToAsr("ShortTimer", "Timer lenght", to_save);
SaveDataToAsr("ShortTimer", "Timer lenght", to_save);*/

}

Expand Down Expand Up @@ -445,6 +449,7 @@ void CSMRRadar::OnFunctionCall(int FunctionId, const char * sItemString, POINT P

if (FunctionId == RIMCAS_UPDATE_PROFILE) {
CurrentConfig->setActiveProfile(sItemString);
SaveDataToAsr("Profile", "vSMR active profile", sItemString);

ShowLists["Profiles"] = true;
}
Expand Down

0 comments on commit 121ba44

Please sign in to comment.