nesting shit
This commit is contained in:
@@ -10,64 +10,66 @@ bool SettingsWindow::render() {
|
|||||||
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
||||||
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
||||||
|
|
||||||
if(ImGui::BeginPopupModal("Settings", &isOpen)) {
|
if(!ImGui::BeginPopupModal("Settings", &isOpen))
|
||||||
if(ImGui::BeginTabBar("SettingsTabBar")) {
|
return false;
|
||||||
if(ImGui::BeginTabItem("General")) {
|
|
||||||
if(ImGui::Button("Pick...")) {
|
if(!ImGui::BeginTabBar("SettingsTabBar"))
|
||||||
NFD::Guard guard;
|
return false;
|
||||||
NFD::UniquePath outPath;
|
|
||||||
|
|
||||||
auto result = NFD::PickFolder(outPath);
|
if(ImGui::BeginTabItem("General")) {
|
||||||
if(result == NFD_ERROR)
|
if(ImGui::Button("Pick...")) {
|
||||||
panic("Error: {}", NFD::GetError());
|
NFD::Guard guard;
|
||||||
|
NFD::UniquePath outPath;
|
||||||
|
|
||||||
if(result != NFD_CANCEL) {
|
auto result = NFD::PickFolder(outPath);
|
||||||
savesPath = outPath.get();
|
if(result == NFD_ERROR)
|
||||||
Options::GetInstance().SetValue<std::string>("general", "savePath", savesPath);
|
panic("Error: {}", NFD::GetError());
|
||||||
applyEnabled = true;
|
|
||||||
}
|
if(result != NFD_CANCEL) {
|
||||||
}
|
savesPath = outPath.get();
|
||||||
ImGui::SameLine();
|
Options::GetInstance().SetValue<std::string>("general", "savePath", savesPath);
|
||||||
ImGui::BeginDisabled();
|
applyEnabled = true;
|
||||||
ImGui::InputText("Save Path", (char*)savesPath.c_str(), savesPath.length());
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ImGui::BeginTabItem("Core")) {
|
|
||||||
if(cpuSettings.render()) {
|
|
||||||
if(cpuSettings.getModified())
|
|
||||||
applyEnabled = true;
|
|
||||||
}
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ImGui::BeginTabItem("Audio")) {
|
|
||||||
if(audioSettings.render()) {
|
|
||||||
if(audioSettings.getModified())
|
|
||||||
applyEnabled = true;
|
|
||||||
}
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTabBar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::BeginDisabled(!applyEnabled);
|
|
||||||
if(ImGui::Button("Apply")) {
|
|
||||||
applyEnabled = false;
|
|
||||||
Options::GetInstance().Apply();
|
|
||||||
}
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
ImGui::BeginDisabled();
|
||||||
if(ImGui::Button("Cancel")) {
|
ImGui::InputText("Save Path", (char*)savesPath.c_str(), savesPath.length());
|
||||||
isOpen = false;
|
ImGui::EndDisabled();
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::EndTabItem();
|
||||||
}
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ImGui::BeginTabItem("Core")) {
|
||||||
|
if(cpuSettings.render()) {
|
||||||
|
if(cpuSettings.getModified())
|
||||||
|
applyEnabled = true;
|
||||||
|
}
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ImGui::BeginTabItem("Audio")) {
|
||||||
|
if(audioSettings.render()) {
|
||||||
|
if(audioSettings.getModified())
|
||||||
|
applyEnabled = true;
|
||||||
|
}
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndTabBar();
|
||||||
|
|
||||||
|
ImGui::BeginDisabled(!applyEnabled);
|
||||||
|
if(ImGui::Button("Apply")) {
|
||||||
|
applyEnabled = false;
|
||||||
|
Options::GetInstance().Apply();
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
if(ImGui::Button("Cancel")) {
|
||||||
|
isOpen = false;
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user