CoreTrace Qt IDE 1.0
The CoreTrace Text editor
 
Loading...
Searching...
No Matches
main_window.hpp
Go to the documentation of this file.
1#ifndef MAIN_WINDOW_HPP
2#define MAIN_WINDOW_HPP
3
4#include "ui_component.hpp"
5#include "audit_result.hpp"
6#include "file_tree_view.hpp"
8#include "output_display.hpp"
9#include <QMainWindow>
10#include <QList>
11#include <QToolBar>
12#include <QAction>
13#include <QHBoxLayout>
14#include <QSplitter>
15#include <QTextEdit>
16#include <QFileSystemModel>
17#include <QKeyEvent>
18#include <QVBoxLayout>
19#include <QTimer>
20#include <QPropertyAnimation>
21#include <QGraphicsOpacityEffect>
22#include <QLabel>
23#include <QFrame>
25
26class MainWindow : public QMainWindow {
27 Q_OBJECT
28
29public:
30 explicit MainWindow(QWidget* parent = nullptr);
32 void show();
33 void updateAuditResults(const QList<AuditResult>& results);
34 void setProjectRoot(const QString& path);
35
36 // Widget management
37 void addToolButton(const QString& text, const QString& toolTip, const QIcon& icon,
38 const char* slot, QObject* receiver);
39 void addToolSeparator();
40 void addWidget(QWidget* widget, Qt::Alignment alignment = Qt::Alignment());
41
43 QTextEdit* getTextEditor() const { return textEditor; }
44 void highlightSecurityIssue(const AuditResult& result);
46 void showSecurityNotification(const AuditResult& result);
47
48public slots:
49 void toggleCliPanel();
50 void saveCurrentFile();
51 void importFile();
52 void toggleAutosave();
53 void findNext();
55
56protected:
57 bool eventFilter(QObject* obj, QEvent* event) override;
58
59private:
60 void setupUi();
61 void setupMenuBar();
62 void setupToolBar();
63 void setupStatusBar();
64 void setupCentralWidget();
66 void animateHighlight(const QTextCursor& cursor, const QString& severity);
67
68 // Member variables in initialization order
69 QSplitter* mainSplitter;
70 QToolBar* mainToolBar;
71 QWidget* centralWidget;
72 QVBoxLayout* mainLayout;
74 QTextEdit* textEditor;
75 QFileSystemModel* fileSystemModel;
79 QAction* saveAction;
80 QAction* importAction;
84 QList<UIComponent*> uiComponents;
86
87 // Enhanced highlighting members
92 QPropertyAnimation* notificationAnimation;
93 QGraphicsOpacityEffect* notificationOpacity;
94 QList<QTextEdit::ExtraSelection> currentHighlights;
95 QTimer* blinkTimer;
97};
98
99#endif // MAIN_WINDOW_HPP
Represents the results of an audit for a specific file.
Definition audit_result.hpp:6
Definition cli_options_panel.hpp:11
Definition syntax_highlighter.hpp:19
A custom QTreeView for displaying and managing files.
Definition file_tree_view.hpp:10
Definition main_window.hpp:26
void addWidget(QWidget *widget, Qt::Alignment alignment=Qt::Alignment())
Adds a widget to the main layout.
Definition main_window.cpp:499
bool autosaveEnabled
Definition main_window.hpp:82
QAction * saveAction
Definition main_window.hpp:79
void setupStatusBar()
Sets up the status bar.
Definition main_window.cpp:166
void setupMenuBar()
Sets up the menu bar and its actions.
Definition main_window.cpp:113
void addToolButton(const QString &text, const QString &toolTip, const QIcon &icon, const char *slot, QObject *receiver)
Adds a tool button to the toolbar.
Definition main_window.cpp:479
QTimer * blinkTimer
Definition main_window.hpp:95
void showSecurityNotification(const AuditResult &result)
Shows a prominent security notification for the given result.
Definition main_window.cpp:957
QSplitter * mainSplitter
Definition main_window.hpp:69
CliOptionsPanel * cliPanel
Definition main_window.hpp:76
void hideSecurityNotification()
Hides the security notification with fade-out animation.
Definition main_window.cpp:1030
void createSecurityNotificationWidget()
Creates and sets up the security notification widget.
Definition main_window.cpp:869
QString currentFilePath
Definition main_window.hpp:83
void clearSecurityHighlights()
Clears all security issue highlights from the text editor.
Definition main_window.cpp:848
QVBoxLayout * mainLayout
Definition main_window.hpp:72
void saveCurrentFile()
Saves the current file being edited.
Definition main_window.cpp:514
QList< QTextEdit::ExtraSelection > currentHighlights
Definition main_window.hpp:94
QGraphicsOpacityEffect * notificationOpacity
Definition main_window.hpp:93
QLabel * securityNotificationText
Definition main_window.hpp:90
QFileSystemModel * fileSystemModel
Definition main_window.hpp:75
void animateHighlight(const QTextCursor &cursor, const QString &severity)
Creates an animated highlight effect for the specified cursor position.
Definition main_window.cpp:1053
QLabel * securityNotificationIcon
Definition main_window.hpp:89
QTextEdit * textEditor
Definition main_window.hpp:74
void addToolSeparator()
Adds a separator to the toolbar.
Definition main_window.cpp:490
void findNext()
Opens a search dialog and highlights all occurrences of the search term.
Definition main_window.cpp:576
CppHighlighter * syntaxHighlighter
Definition main_window.hpp:85
QList< UIComponent * > uiComponents
Definition main_window.hpp:84
void setupUi()
Sets up the UI for the main window.
Definition main_window.cpp:104
void setProjectRoot(const QString &path)
Sets the root path for the project.
Definition main_window.cpp:507
bool blinkState
Definition main_window.hpp:96
FileTreeView * getFileTreeView() const
Definition main_window.hpp:42
OutputDisplay * outputDisplay
Definition main_window.hpp:77
QTimer * notificationTimer
Definition main_window.hpp:91
void setupCentralWidget()
Sets up the central widget and its layout.
Definition main_window.cpp:174
QWidget * centralWidget
Definition main_window.hpp:71
QAction * importAction
Definition main_window.hpp:80
QPropertyAnimation * notificationAnimation
Definition main_window.hpp:92
void toggleCliPanel()
Toggles the visibility of the CLI panel.
Definition main_window.cpp:408
void setupToolBar()
Sets up the toolbar and its actions.
Definition main_window.cpp:149
void show()
Displays the main window.
Definition main_window.cpp:431
QFrame * securityNotificationFrame
Definition main_window.hpp:88
~MainWindow()
Destructor for MainWindow.
Definition main_window.cpp:88
bool eventFilter(QObject *obj, QEvent *event) override
Event filter to handle keyboard shortcuts and focus events.
Definition main_window.cpp:376
QToolBar * mainToolBar
Definition main_window.hpp:70
QAction * toggleCliPanelAction
Definition main_window.hpp:78
QAction * autosaveAction
Definition main_window.hpp:81
void highlightSecurityIssue(const AuditResult &result)
Highlights a security issue in the text editor with enhanced visual effects.
Definition main_window.cpp:640
void importFile()
Opens a folder and sets it as the project root.
Definition main_window.cpp:539
void toggleAutosave()
Toggles the autosave feature.
Definition main_window.cpp:557
QTextEdit * getTextEditor() const
Definition main_window.hpp:43
void updateAuditResults(const QList< AuditResult > &results)
Updates the audit results in the UI.
Definition main_window.cpp:439
FileTreeView * fileTree
Definition main_window.hpp:73
Definition output_display.hpp:8