Skip to content

Commit 4ea57bb

Browse files
Modernisering van de GUI met Glassmorphism, geanimeerde Zen-achtergrond, iconen en verbeterde vensterfunctionaliteit
1 parent 7b71519 commit 4ea57bb

File tree

153 files changed

+163181
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+163181
-328
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.14)
22
project(LogAnalyzer VERSION 1.0.0 LANGUAGES CXX)
33

4-
set(CMAKE_CXX_STANDARD 17)
4+
set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
set(CMAKE_CXX_EXTENSIONS OFF)
77

@@ -29,12 +29,14 @@ set(IMGUI_SOURCES
2929
${IMGUI_DIR}/imgui_widgets.cpp
3030
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
3131
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
32+
${IMGUI_DIR}/misc/cpp/imgui_stdlib.cpp
3233
)
3334

3435
add_library(imgui STATIC ${IMGUI_SOURCES})
3536
target_include_directories(imgui PUBLIC
3637
${IMGUI_DIR}
3738
${IMGUI_DIR}/backends
39+
${IMGUI_DIR}/misc/cpp
3840
)
3941
# Link GLFW so that ImGui can find <GLFW/glfw3.h>
4042
target_link_libraries(imgui PUBLIC glfw)
@@ -43,12 +45,14 @@ target_link_libraries(imgui PUBLIC glfw)
4345
set(CORE_SOURCES
4446
core/LogParser.cpp
4547
core/Timestamp.cpp
46-
io/FileReader.cpp
48+
core/ConfigManager.cpp
49+
io/MemoryMappedFile.cpp
4750
io/FileWriter.cpp
4851
analysis/LevelCountAnalyzer.cpp
4952
analysis/KeywordHitAnalyzer.cpp
5053
analysis/TopErrorAnalyzer.cpp
5154
analysis/TimeRangeFilter.cpp
55+
analysis/AnalysisResult.cpp
5256
analysis/Pipeline.cpp
5357
app/Application.cpp
5458
)
@@ -64,6 +68,7 @@ add_executable(log_analyzer
6468
add_executable(log_analyzer_gui
6569
${CORE_SOURCES}
6670
gui/GuiController.cpp
71+
gui/LogViewer.cpp
6772
gui/main_gui.cpp
6873
)
6974
# Link imgui (which links glfw), and macOS frameworks

analysis/AnalysisResult.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#include "AnalysisResult.h"
2+
#include <algorithm>
3+
#include <map>
4+
5+
namespace loganalyzer {
6+
7+
void AnalysisResult::merge(const AnalysisResult &other) {
8+
totalLines += other.totalLines;
9+
parsedLines += other.parsedLines;
10+
invalidLines += other.invalidLines;
11+
keywordHits += other.keywordHits;
12+
timeRangeMatched += other.timeRangeMatched;
13+
14+
// Merge maps
15+
for (const auto &[code, count] : other.parseErrors) {
16+
parseErrors[code] += count;
17+
}
18+
19+
for (const auto &[level, count] : other.levelCounts) {
20+
levelCounts[level] += count;
21+
}
22+
23+
// Merge topErrors
24+
// Strategy: Combine both vectors into a map to sum counts, then recreate
25+
// vector
26+
std::map<std::string, uint64_t> errorMap;
27+
28+
// Add current
29+
for (const auto &pair : topErrors) {
30+
errorMap[pair.first] += pair.second;
31+
}
32+
33+
// Add other
34+
for (const auto &pair : other.topErrors) {
35+
errorMap[pair.first] += pair.second;
36+
}
37+
38+
// Convert back to vector
39+
std::vector<std::pair<std::string, uint64_t>> vec(errorMap.begin(),
40+
errorMap.end());
41+
42+
// Sort: descending by count, then alphabetically
43+
std::sort(vec.begin(), vec.end(), [](const auto &a, const auto &b) {
44+
if (a.second != b.second) {
45+
return a.second > b.second; // Higher count first
46+
}
47+
return a.first < b.first; // Alphabetical tie-break
48+
});
49+
50+
// Limit to top 10
51+
size_t limit = std::min(vec.size(), size_t(10));
52+
topErrors.assign(vec.begin(), vec.begin() + limit);
53+
}
54+
55+
} // namespace loganalyzer

analysis/AnalysisResult.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ struct AnalysisResult {
2323

2424
// Top 10 ERROR messages: (message, count), deterministically sorted
2525
std::vector<std::pair<std::string, uint64_t>> topErrors;
26+
27+
void merge(const AnalysisResult &other);
2628
};
2729

2830
} // namespace loganalyzer

analysis/IAnalyzer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "../core/LogEntry.h"
44
#include "AnalysisResult.h"
5+
#include <concepts>
56

67
namespace loganalyzer {
78

@@ -16,4 +17,12 @@ class IAnalyzer {
1617
virtual void finalize(AnalysisResult &result) = 0;
1718
};
1819

20+
// C++20 Concept
21+
template <typename T>
22+
concept Analyzer =
23+
requires(T a, const LogEntry &entry, AnalysisResult &result) {
24+
{ a.process(entry) } -> std::same_as<void>;
25+
{ a.finalize(result) } -> std::same_as<void>;
26+
};
27+
1928
} // namespace loganalyzer

0 commit comments

Comments
 (0)