mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Android: Replace log type names map with array
Storing the log type names in a map results in them getting re-sorted by their keys, which doesn't quite give us the sorting we want. In particular, the Achievements category ended up being sorted at R (for RetroAchivements) instead of at A. Every use of the map is just iterating through it, so there's no real reason why it has to be a map anyway.
This commit is contained in:
@ -252,12 +252,13 @@ bool LogManager::IsEnabled(LogType type, LogLevel level) const
|
||||
return m_log[type].m_enable && GetLogLevel() >= level;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> LogManager::GetLogTypes()
|
||||
std::vector<LogManager::LogContainer> LogManager::GetLogTypes()
|
||||
{
|
||||
std::map<std::string, std::string> log_types;
|
||||
std::vector<LogContainer> log_types;
|
||||
log_types.reserve(m_log.size());
|
||||
|
||||
for (const auto& container : m_log)
|
||||
log_types.emplace(container.m_short_name, container.m_full_name);
|
||||
log_types.emplace_back(container);
|
||||
|
||||
return log_types;
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
#include <array>
|
||||
#include <cstdarg>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/BitSet.h"
|
||||
#include "Common/EnumMap.h"
|
||||
@ -34,6 +34,13 @@ public:
|
||||
class LogManager
|
||||
{
|
||||
public:
|
||||
struct LogContainer
|
||||
{
|
||||
const char* m_short_name;
|
||||
const char* m_full_name;
|
||||
bool m_enable = false;
|
||||
};
|
||||
|
||||
static LogManager* GetInstance();
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
@ -48,7 +55,7 @@ public:
|
||||
void SetEnable(LogType type, bool enable);
|
||||
bool IsEnabled(LogType type, LogLevel level = LogLevel::LNOTICE) const;
|
||||
|
||||
std::map<std::string, std::string> GetLogTypes();
|
||||
std::vector<LogContainer> GetLogTypes();
|
||||
|
||||
const char* GetShortName(LogType type) const;
|
||||
const char* GetFullName(LogType type) const;
|
||||
@ -60,13 +67,6 @@ public:
|
||||
void SaveSettings();
|
||||
|
||||
private:
|
||||
struct LogContainer
|
||||
{
|
||||
const char* m_short_name;
|
||||
const char* m_full_name;
|
||||
bool m_enable = false;
|
||||
};
|
||||
|
||||
LogManager();
|
||||
~LogManager();
|
||||
|
||||
|
Reference in New Issue
Block a user