ImGui: display all current registry settings.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-04-04 14:31:57 +01:00
parent e40d16c2d7
commit dd683e8e48
6 changed files with 65 additions and 0 deletions

View file

@ -66,4 +66,17 @@ namespace common2
myINI.put(path, value);
}
std::map<std::string, std::map<std::string, std::string>> PTreeRegistry::getAllValues() const
{
std::map<std::string, std::map<std::string, std::string>> values;
for (const auto & it1 : myINI)
{
for (const auto & it2 : it1.second)
{
values[it1.first][it2.first] = it2.second.get_value<std::string>();
}
}
return values;
}
}

View file

@ -33,6 +33,8 @@ namespace common2
template<typename T>
void putValue(const std::string & section, const std::string & key, const T & value);
std::map<std::string, std::map<std::string, std::string>> getAllValues() const override;
protected:
ini_t myINI;
};

View file

@ -44,3 +44,8 @@ void Configuration::putDWord(const std::string & section, const std::string & ke
{
mySettings.setValue(getKey(section, key), QVariant::fromValue(value));
}
std::map<std::string, std::map<std::string, std::string>> Configuration::getAllValues() const
{
throw std::runtime_error("Configuration::getAllValues not implemented.");
}

View file

@ -15,6 +15,8 @@ public:
void putString(const std::string & section, const std::string & key, const std::string & value) override;
void putDWord(const std::string & section, const std::string & key, const DWORD value) override;
std::map<std::string, std::map<std::string, std::string>> getAllValues() const override;
private:
QSettings mySettings;
};

View file

@ -2,6 +2,7 @@
#include "frontends/sdl/imgui/sdlsettings.h"
#include "frontends/sdl/imgui/settingshelper.h"
#include "frontends/sdl/sdlframe.h"
#include "linux/registry.h"
#include "Interface.h"
#include "CardManager.h"
@ -555,6 +556,44 @@ namespace sa2
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Registry"))
{
if (ImGui::BeginTable("Registry", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit))
{
ImGui::TableSetupColumn("Option", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableHeadersRow();
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (ImGui::TreeNode("Registry"))
{
const std::map<std::string, std::map<std::string, std::string>> values = Registry::instance->getAllValues();
for (const auto & it1 : values)
{
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (ImGui::TreeNodeEx(it1.first.c_str(), ImGuiTreeNodeFlags_SpanFullWidth))
{
for (const auto & it2 : it1.second)
{
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TreeNodeEx(it2.first.c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_Bullet | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth);
ImGui::TableNextColumn();
ImGui::TextUnformatted(it2.second.c_str());
}
ImGui::TreePop();
}
}
ImGui::TreePop();
}
ImGui::EndTable();
}
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}

View file

@ -2,6 +2,7 @@
#include "linux/windows/wincompat.h"
#include <string>
#include <map>
#include <memory>
#include <cstring>
@ -18,6 +19,9 @@ public:
virtual void putString(const std::string & section, const std::string & key, const std::string & value) = 0;
virtual void putDWord(const std::string & section, const std::string & key, const DWORD value) = 0;
virtual std::map<std::string, std::map<std::string, std::string>> getAllValues() const = 0;
};
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars);