Skip to content

Commit a2bb45b

Browse files
authored
Reworked console with new design and features (#754)
1 parent 1f58a24 commit a2bb45b

4 files changed

Lines changed: 436 additions & 78 deletions

File tree

Sources/OvEditor/include/OvEditor/Panels/Console.h

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,23 @@
66

77
#pragma once
88

9+
#include <cstdint>
10+
#include <string>
11+
#include <vector>
12+
913
#include <OvDebug/Logger.h>
1014

1115
#include <OvUI/Panels/PanelWindow.h>
12-
#include <OvUI/Widgets/Layout/Group.h>
13-
#include <OvUI/Widgets/Texts/TextColored.h>
16+
17+
namespace OvUI::Widgets::InputFields
18+
{
19+
class InputText;
20+
}
21+
22+
namespace OvUI::Widgets::Layout
23+
{
24+
class TextLogs;
25+
}
1426

1527
namespace OvEditor::Panels
1628
{
@@ -55,27 +67,47 @@ namespace OvEditor::Panels
5567
* Verify if a given log level is allowed by the current filter
5668
* @param p_logLevel
5769
*/
58-
bool IsAllowedByFilter(OvDebug::ELogLevel p_logLevel);
70+
bool IsAllowedByFilter(OvDebug::ELogLevel p_logLevel) const;
5971

6072
/**
6173
* Truncate the logs if the number of logs is greater than the max logs
6274
*/
6375
void TruncateLogs();
6476

77+
private:
78+
struct LogEntry
79+
{
80+
OvDebug::LogData data;
81+
};
82+
83+
struct VisibleLogEntry
84+
{
85+
size_t latestRawIndex = 0;
86+
uint32_t count = 0;
87+
};
88+
6589
private:
6690
void SetShowDefaultLogs(bool p_value);
6791
void SetShowInfoLogs(bool p_value);
6892
void SetShowWarningLogs(bool p_value);
6993
void SetShowErrorLogs(bool p_value);
94+
void SetCollapseIdenticalLogs(bool p_value);
95+
void RebuildVisibleLogs();
96+
void RefreshDisplayedLogs();
97+
bool MatchesSearch(const LogEntry& p_logEntry) const;
7098

7199
private:
72-
OvUI::Widgets::Layout::Group* m_logGroup;
73-
std::unordered_map<OvUI::Widgets::Texts::TextColored*, OvDebug::ELogLevel> m_logTextWidgets;
100+
std::vector<LogEntry> m_logs;
101+
std::vector<VisibleLogEntry> m_visibleLogs;
102+
103+
OvUI::Widgets::InputFields::InputText* m_searchField = nullptr;
104+
OvUI::Widgets::Layout::TextLogs* m_logsWidget = nullptr;
74105

75106
bool m_clearOnPlay = true;
76107
bool m_showDefaultLog = true;
77108
bool m_showInfoLog = true;
78109
bool m_showWarningLog = true;
79110
bool m_showErrorLog = true;
111+
bool m_collapseIdenticalLogs = false;
80112
};
81-
}
113+
}

0 commit comments

Comments
 (0)