Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
personalities
jmccay:
I tried the tests explained in the wiki documentation for personalities. I created the '--personality="Lite"' as described in the instructions. Then I crated another desktop shortcut with --personality="ask". After running the lite version, I ran the ask version. The were no personalities listed. Did I do something wrong? Also, is there a way to edit these from the menu?
jmccay
stahta01:
No, you did it right. I am trying to find why the code is not looking in the right folder to find the .conf files. I just have not had the time to determine where the code is wrong.
Tim S
stahta01:
Partial untested patch. Tim S
I ran it once and it gave me a list of configs, but picking one did not seem to work.
--- Code: ---Index: src/sdk/personalitymanager.cpp
===================================================================
--- src/sdk/personalitymanager.cpp (revision 3635)
+++ src/sdk/personalitymanager.cpp (working copy)
@@ -55,7 +55,7 @@
const wxArrayString PersonalityManager::GetPersonalitiesList()
{
wxArrayString list;
- wxDir::GetAllFiles(ConfigManager::GetConfigFolder(), &list, _T("*.conf"), wxDIR_FILES);
+ wxDir::GetAllFiles(ConfigManager::GetFolder(sdConfig), &list, _T("*.conf"), wxDIR_FILES);
for(size_t i = 0; i < list.GetCount(); ++i)
list[i] = wxFileName(list[i]).GetName();
--- End code ---
stahta01:
I am giving up for tonight may or may not try tomorrow, the problem is it is being set to default before the selected config can be set and it never looks for the set config that I can find.
Edit: Thought of something else to try, it failed, but the next thing worked.
Working on finding out what of the several changes I did are needed.
Tim S
stahta01:
Here's the patch that works for me.
Submitted [ Patch #1897 ] Windows XP --personality=ask not working
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1897&group_id=5358
File 1: src/sdk/personalitymanager.cpp
Problem 1: ConfigManager::GetConfigFolder() returns empty string or null string.
Solution 1: Replaced with ConfigManager::GetFolder(sdConfig).
File 2: src/src/app.cpp
Problem 2: Under windows XP SP2, my guess is that wxSingleChoiceDialog has some unknown side effect that prevents code from working.
Solution 2: re-wrote logic using wxGetSingleChoiceIndex
--- Code: ---Index: src/sdk/personalitymanager.cpp
===================================================================
--- src/sdk/personalitymanager.cpp (revision 3639)
+++ src/sdk/personalitymanager.cpp (working copy)
@@ -55,7 +55,7 @@
const wxArrayString PersonalityManager::GetPersonalitiesList()
{
wxArrayString list;
- wxDir::GetAllFiles(ConfigManager::GetConfigFolder(), &list, _T("*.conf"), wxDIR_FILES);
+ wxDir::GetAllFiles(ConfigManager::GetFolder(sdConfig), &list, _T("*.conf"), wxDIR_FILES);
for(size_t i = 0; i < list.GetCount(); ++i)
list[i] = wxFileName(list[i]).GetName();
Index: src/src/app.cpp
===================================================================
--- src/src/app.cpp (revision 3639)
+++ src/src/app.cpp (working copy)
@@ -880,6 +880,7 @@
{
if (personality.CmpNoCase(_T("ask")) == 0)
{
+/* This Code failed to work under windows XP SP2 reason unkwown
#if (wxMAJOR_VERSION == 2) && (wxMINOR_VERSION < 5)
// wx < 2.5.x single choice dialog wants wxString*
const wxArrayString& list = Manager::Get()->GetPersonalityManager()->GetPersonalitiesList();
@@ -902,6 +903,21 @@
#if (wxMAJOR_VERSION == 2) && (wxMINOR_VERSION < 5)
delete[] strings;
#endif
+*/
+ wxArrayString persNames = Manager::Get()->GetPersonalityManager()->GetPersonalitiesList();
+ int persIndex;
+ persIndex = wxGetSingleChoiceIndex
+ (
+ _("Please choose which personality (profile) to load:"),
+ _("Personalities (profiles)"),
+ persNames
+ );
+
+ if ( persIndex != -1 )
+ Manager::Get()->GetPersonalityManager()->SetPersonality(persNames[persIndex]);
+ else
+ Manager::Get()->GetPersonalityManager()->SetPersonality(_T("default"));
+
}
else
Manager::Get()->GetPersonalityManager()->SetPersonality(personality, true);
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version