[RAPPS] Rework application handling

Previously, there would be function duplication between installed and available applications.
Now this is handled with polymorphism, which allows to re-use a lot of code.
Additionally, toolbar buttons are properly disabled now.
The mutex used to guard rapps' single instance is renamed,
so that the 'new' and old rapps can be run at the same time for testing.

CORE-18459
This commit is contained in:
Mark Jansen 2023-02-20 19:30:02 +01:00
parent 0cd80c17f6
commit 33c2903e6d
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
30 changed files with 3758 additions and 4076 deletions

View file

@ -24,12 +24,11 @@ struct CSectionNames
};
static CSectionNames g_Names;
static
ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName)
static CStringW
GetINIFullPath(const CStringW &FileName)
{
ATL::CStringW szDir;
ATL::CStringW szBuffer;
CStringW szDir;
CStringW szBuffer;
GetStorageDirectory(szDir);
szBuffer.Format(L"%ls\\rapps\\%ls", szDir.GetString(), FileName.GetString());
@ -37,13 +36,13 @@ ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName)
return szBuffer;
}
CConfigParser::CConfigParser(const ATL::CStringW& FileName)
: szConfigPath(GetINIFullPath(FileName))
CConfigParser::CConfigParser(const CStringW &FileName) : szConfigPath(GetINIFullPath(FileName))
{
CacheINI();
}
void CConfigParser::ReadSection(ATL::CStringW& Buffer, const ATL::CStringW& Section, BOOL isArch)
void
CConfigParser::ReadSection(CStringW &Buffer, const CStringW &Section, BOOL isArch)
{
DWORD len = 512;
DWORD result;
@ -84,7 +83,7 @@ void CConfigParser::ReadSection(ATL::CStringW& Buffer, const ATL::CStringW& Sect
continue;
}
CString value = tmp.Mid(idx+1);
CString value = tmp.Mid(idx + 1);
m_Keys.Add(key, value);
}
else
@ -99,7 +98,8 @@ void CConfigParser::ReadSection(ATL::CStringW& Buffer, const ATL::CStringW& Sect
}
}
VOID CConfigParser::CacheINI()
VOID
CConfigParser::CacheINI()
{
// Cache section names
if (g_Names.ArchSpecific.Locale.IsEmpty())
@ -135,7 +135,6 @@ VOID CConfigParser::CacheINI()
}
ReadSection(Buffer, g_Names.ArchSpecific.Section, TRUE);
ReadSection(Buffer, g_Names.ArchNeutral.Locale, FALSE);
if (!g_Names.ArchNeutral.LocaleNeutral.IsEmpty())
{
@ -144,7 +143,8 @@ VOID CConfigParser::CacheINI()
ReadSection(Buffer, g_Names.ArchNeutral.Section, FALSE);
}
BOOL CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString)
BOOL
CConfigParser::GetString(const CStringW &KeyName, CStringW &ResultString)
{
int nIndex = m_Keys.FindKey(KeyName);
if (nIndex >= 0)
@ -157,9 +157,10 @@ BOOL CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& Resul
return FALSE;
}
BOOL CConfigParser::GetInt(const ATL::CStringW& KeyName, INT& iResult)
BOOL
CConfigParser::GetInt(const CStringW &KeyName, INT &iResult)
{
ATL::CStringW Buffer;
CStringW Buffer;
iResult = 0;