mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
Get rid of indexes in dropdowns (#7278)
This commit is contained in:
@@ -27,7 +27,7 @@ std::vector<DWORD> LayoutMap::GetKeyCodeList(const bool isShortcut)
|
||||
return impl->GetKeyCodeList(isShortcut);
|
||||
}
|
||||
|
||||
std::vector<std::wstring> LayoutMap::GetKeyNameList(const bool isShortcut)
|
||||
std::vector<std::pair<DWORD, std::wstring>> LayoutMap::GetKeyNameList(const bool isShortcut)
|
||||
{
|
||||
return impl->GetKeyNameList(isShortcut);
|
||||
}
|
||||
@@ -305,25 +305,25 @@ std::vector<DWORD> LayoutMap::LayoutMapImpl::GetKeyCodeList(const bool isShortcu
|
||||
return keyCodes;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> LayoutMap::LayoutMapImpl::GetKeyNameList(const bool isShortcut)
|
||||
std::vector<std::pair<DWORD, std::wstring>> LayoutMap::LayoutMapImpl::GetKeyNameList(const bool isShortcut)
|
||||
{
|
||||
std::vector<std::wstring> keyNames;
|
||||
std::vector<std::pair<DWORD, std::wstring>> keyNames;
|
||||
std::vector<DWORD> keyCodes = GetKeyCodeList(isShortcut);
|
||||
std::lock_guard<std::mutex> lock(keyboardLayoutMap_mutex);
|
||||
// If it is a key list for the shortcut control then we add a "None" key at the start
|
||||
if (isShortcut)
|
||||
{
|
||||
keyNames.push_back(L"None");
|
||||
keyNames.push_back({ 0, L"None" });
|
||||
for (int i = 1; i < keyCodes.size(); i++)
|
||||
{
|
||||
keyNames.push_back(keyboardLayoutMap[keyCodes[i]]);
|
||||
keyNames.push_back({ keyCodes[i], keyboardLayoutMap[keyCodes[i]] });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < keyCodes.size(); i++)
|
||||
{
|
||||
keyNames.push_back(keyboardLayoutMap[keyCodes[i]]);
|
||||
keyNames.push_back({ keyCodes[i], keyboardLayoutMap[keyCodes[i]] });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
void UpdateLayout();
|
||||
std::wstring GetKeyName(DWORD key);
|
||||
std::vector<DWORD> GetKeyCodeList(const bool isShortcut = false);
|
||||
std::vector<std::wstring> GetKeyNameList(const bool isShortcut = false);
|
||||
std::vector<std::pair<DWORD, std::wstring>> GetKeyNameList(const bool isShortcut = false);
|
||||
|
||||
private:
|
||||
class LayoutMapImpl;
|
||||
|
||||
@@ -46,6 +46,6 @@ public:
|
||||
// Function to return the list of key codes in the order for the drop down. It creates it if it doesn't exist
|
||||
std::vector<DWORD> GetKeyCodeList(const bool isShortcut);
|
||||
|
||||
// Function to return the list of key name in the order for the drop down based on the key codes
|
||||
std::vector<std::wstring> GetKeyNameList(const bool isShortcut);
|
||||
// Function to return the list of key name pairs in the order for the drop down based on the key codes
|
||||
std::vector<std::pair<DWORD, std::wstring>> GetKeyNameList(const bool isShortcut);
|
||||
};
|
||||
Reference in New Issue
Block a user