Skip to content

Commit 121ba44

Browse files
author
Pierre Ferran
committed
Profile is now saved in the ASR
1 parent b82b1f8 commit 121ba44

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

vSMR/Config.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ class CConfig
3535
active_profile = profiles[newProfile];
3636
};
3737

38+
inline string getActiveProfileName() {
39+
string name;
40+
for (std::map<string, rapidjson::SizeType>::iterator it = profiles.begin(); it != profiles.end(); ++it)
41+
{
42+
if (it->second == active_profile)
43+
name = it->first; break;
44+
}
45+
return name;
46+
};
47+
3848
Document document;
3949

4050
protected:

vSMR/SMRRadar.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ void CSMRRadar::OnAsrContentLoaded(bool Loaded)
101101
RimcasInstance->RunwayTimerShort = true;
102102
}
103103

104+
if ((p_value = GetDataFromAsr("Profile")) != NULL)
105+
CurrentConfig->setActiveProfile(string(p_value));
106+
104107
/*
105108
if ((p_value = GetDataFromAsr("AppWindowTopLeftX")) != NULL)
106109
{
@@ -167,10 +170,11 @@ void CSMRRadar::OnAsrContentToBeSaved(void)
167170
{
168171
SaveDataToAsr("Airport", "Active airport for RIMCAS", getActiveAirport().c_str());
169172

170-
const char * to_save = "0";
173+
SaveDataToAsr("Profile", "vSMR active profile", CurrentConfig->getActiveProfileName().c_str());
174+
175+
/*const char * to_save = "0";
171176
string temp;
172177
173-
/*
174178
temp = std::to_string(appWindowArea.left);
175179
SaveDataToAsr("AppWindowTopLeftX", "Approach window position", temp.c_str());
176180
@@ -193,11 +197,11 @@ void CSMRRadar::OnAsrContentToBeSaved(void)
193197
if (appWindow)
194198
to_save = "1";
195199
SaveDataToAsr("AppWindow", "Display Approach window", to_save);
196-
*/
200+
197201
to_save = "0";
198202
if (RimcasInstance->RunwayTimerShort)
199203
to_save = "1";
200-
SaveDataToAsr("ShortTimer", "Timer lenght", to_save);
204+
SaveDataToAsr("ShortTimer", "Timer lenght", to_save);*/
201205

202206
}
203207

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

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

449454
ShowLists["Profiles"] = true;
450455
}

0 commit comments

Comments
 (0)