log tweak
This commit is contained in:
@@ -526,7 +526,15 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
|
||||
|
||||
// Filtre de recherche
|
||||
static ImGuiTextFilter filter;
|
||||
filter.Draw("Filter (inc,-exc)", 180);
|
||||
filter.Draw("Filter ", 180);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
// Bouton pour ouvrir le fichier de log
|
||||
if (ImGui::Button("Open Log File"))
|
||||
{
|
||||
ShellExecuteA(NULL, "open", Logger::Get().m_logFilePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
// Place the menu on the same line as the filter
|
||||
ImGui::SameLine();
|
||||
@@ -548,22 +556,19 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
|
||||
const auto& logBuffer = Logger::Get().GetLogBuffer();
|
||||
std::vector<Logger::LogEntry> logfiltered;
|
||||
int logCount = logBuffer.size();
|
||||
int filteredLogCount = 0;
|
||||
|
||||
// Affichage des logs filtr<74>s
|
||||
ImGui::BeginChild("Log");
|
||||
|
||||
// Compter le nombre de logs qui passent le filtre et les ajouter a la liste des message a afficher
|
||||
for (const auto& log : logBuffer)
|
||||
{
|
||||
if (filter.PassFilter(log.message.c_str()) && !Logger::Get().m_disabledLogLevels[static_cast<size_t>(log.level)])
|
||||
{
|
||||
logfiltered.push_back(log);
|
||||
filteredLogCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (filteredLogCount == 0)
|
||||
if (logfiltered.size() == 0)
|
||||
{
|
||||
ImGui::Text("No logs to display.");
|
||||
}
|
||||
@@ -585,6 +590,12 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
|
||||
clipper.End();
|
||||
}
|
||||
|
||||
// Scroll to the bottom
|
||||
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
|
||||
{
|
||||
ImGui::SetScrollHereY(1.0f);
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::End();
|
||||
|
||||
Reference in New Issue
Block a user