Remove the browser UI, its Python server and the web API contract test. Add the Qt6 tray app (status, findings, process search, policy controls, notifications) and EvidenceStore, the read-only view of the daemon's evidence that the app and MCP server share. The GUI demo config becomes strawberry.demo.conf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
122 lines
4 KiB
C++
122 lines
4 KiB
C++
#ifndef STRAWBERRY_APP_MAIN_WINDOW_HPP
|
|
#define STRAWBERRY_APP_MAIN_WINDOW_HPP
|
|
|
|
#include "strawberry/evidence_store.hpp"
|
|
#include "tray_state.hpp"
|
|
|
|
#include <QJsonObject>
|
|
#include <QMainWindow>
|
|
|
|
#include <vector>
|
|
|
|
class QCheckBox;
|
|
class QComboBox;
|
|
class QLabel;
|
|
class QLineEdit;
|
|
class QListWidget;
|
|
class QPushButton;
|
|
class QTabWidget;
|
|
class QTableWidget;
|
|
class QTextBrowser;
|
|
class QUrl;
|
|
|
|
namespace strawberry::app {
|
|
|
|
class MainWindow : public QMainWindow {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(const EvidenceStore& store, QWidget* parent = nullptr);
|
|
|
|
/// Refresh the findings table (store contents or seen-state changed).
|
|
void refresh_findings(const AckMap& seen);
|
|
/// Daemon status (empty object + error when unreachable).
|
|
void update_status(const QJsonObject& status, const QString& error, const TrayState& tray);
|
|
/// Result line for a reload/rescan command.
|
|
void show_command_result(const QString& verb, bool ok, const QString& message);
|
|
|
|
void show_finding(const QString& finding_id);
|
|
void show_process(const QString& node_id);
|
|
/// Select a tab by name (findings, processes, rules, allowlist, diagnostics).
|
|
void select_tab(const QString& name);
|
|
|
|
/// Reply data of the `policy` verb (feeds, allowlist, history, feed state).
|
|
void update_policy(const QJsonObject& policy, const QString& error);
|
|
/// Result of a policy change (allowlist/feed edit).
|
|
void show_policy_result(const QString& verb, bool ok, const QString& message);
|
|
|
|
signals:
|
|
void finding_viewed(const QString& finding_id, qint64 last_seen);
|
|
void mark_all_seen_requested();
|
|
void command_requested(const QString& verb);
|
|
void policy_change_requested(const QString& verb, const QJsonObject& payload);
|
|
|
|
private:
|
|
QWidget* build_findings_tab();
|
|
QWidget* build_processes_tab();
|
|
QWidget* build_diagnostics_tab();
|
|
QWidget* build_rules_tab();
|
|
QWidget* build_allowlist_tab();
|
|
QWidget* build_response_tab();
|
|
void render_response();
|
|
void render_rules();
|
|
void render_allowlist();
|
|
void add_feed_dialog();
|
|
void add_allowlist_dialog();
|
|
/// Confirm, then request an allowlist entry.
|
|
void propose_allowlist(const QString& kind, const QString& value, const QString& rule, const QString& context);
|
|
void render_finding_detail(const FindingRecord& finding);
|
|
void run_process_search();
|
|
void render_process_detail(const ProcessSearchResult& result);
|
|
void on_link(const QUrl& url);
|
|
void render_diagnostics();
|
|
|
|
const EvidenceStore& store_;
|
|
AckMap seen_;
|
|
std::vector<FindingRecord> findings_;
|
|
|
|
QTabWidget* tabs_ = nullptr;
|
|
|
|
QComboBox* severity_filter_ = nullptr;
|
|
QCheckBox* unseen_only_ = nullptr;
|
|
QTableWidget* findings_table_ = nullptr;
|
|
QTextBrowser* finding_detail_ = nullptr;
|
|
QLabel* findings_banner_ = nullptr;
|
|
|
|
QLineEdit* process_query_ = nullptr;
|
|
QListWidget* process_results_ = nullptr;
|
|
QTextBrowser* process_detail_ = nullptr;
|
|
std::vector<ProcessSearchResult> process_hits_;
|
|
|
|
QTextBrowser* diagnostics_ = nullptr;
|
|
QLabel* command_result_ = nullptr;
|
|
QPushButton* reload_button_ = nullptr;
|
|
QPushButton* rescan_button_ = nullptr;
|
|
QJsonObject status_;
|
|
QString status_error_;
|
|
TrayState tray_;
|
|
|
|
QLabel* rules_summary_ = nullptr;
|
|
QTableWidget* feeds_table_ = nullptr;
|
|
QLabel* rules_result_ = nullptr;
|
|
QTableWidget* allow_table_ = nullptr;
|
|
QListWidget* history_list_ = nullptr;
|
|
QLabel* allow_result_ = nullptr;
|
|
QJsonObject policy_;
|
|
QString policy_error_;
|
|
|
|
QLabel* response_status_ = nullptr;
|
|
QCheckBox* contain_auto_ = nullptr;
|
|
QComboBox* contain_severity_ = nullptr;
|
|
QComboBox* prevention_mode_ = nullptr;
|
|
QComboBox* prevention_severity_ = nullptr;
|
|
QTableWidget* contain_table_ = nullptr;
|
|
QTableWidget* quarantine_table_ = nullptr;
|
|
QLabel* response_result_ = nullptr;
|
|
QLabel* process_result_ = nullptr;
|
|
bool protection_dirty_ = false;
|
|
};
|
|
|
|
} // namespace strawberry::app
|
|
|
|
#endif // STRAWBERRY_APP_MAIN_WINDOW_HPP
|