strawberry/app/app_controller.hpp
trvon 76ec40e4f5
Replace web UI with a Qt tray app
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>
2026-10-25 18:17:03 -06:00

78 lines
2 KiB
C++

#ifndef STRAWBERRY_APP_APP_CONTROLLER_HPP
#define STRAWBERRY_APP_APP_CONTROLLER_HPP
#include "strawberry/evidence_store.hpp"
#include "tray_state.hpp"
#include <QJsonObject>
#include <QObject>
#include <QSet>
#include <QSettings>
#include <QString>
class QTimer;
namespace strawberry::app {
class DaemonClient;
class MainWindow;
class Notifier;
class Tray;
struct AppOptions {
QString socket_path;
QString db_path_override; // empty = use the daemon's reported path
bool show_window = false;
QString initial_tab;
bool tray = true;
int poll_ms = 3000;
};
/// Owns the tray, window, daemon client and evidence store; drives polling.
class AppController : public QObject {
Q_OBJECT
public:
explicit AppController(AppOptions options, QObject* parent = nullptr);
~AppController() override;
void start();
void show_window();
private:
void poll();
void on_reply(const QString& verb, bool ok, const QJsonObject& data, const QString& error);
void refresh_evidence(bool force_view_refresh);
void update_tray();
void notify_new_findings();
void mark_seen(const QString& id, qint64 last_seen);
void mark_all_seen();
std::vector<FindingSummary> finding_summaries() const;
static AckMap load_map(const QSettings& settings, const QString& key);
static void save_map(QSettings& settings, const QString& key, const AckMap& map);
AppOptions options_;
QSettings settings_;
EvidenceStore store_;
DaemonClient* client_ = nullptr;
Tray* tray_ = nullptr;
Notifier* notifier_ = nullptr;
MainWindow* window_ = nullptr;
QTimer* timer_ = nullptr;
DaemonSnapshot snapshot_;
QJsonObject status_;
QString status_error_;
uint64_t previous_scan_errors_ = 0;
bool first_evidence_load_ = true;
AckMap seen_;
AckMap notified_;
TrayState tray_state_;
QSet<QString> known_containments_;
bool containments_seeded_ = false;
};
} // namespace strawberry::app
#endif // STRAWBERRY_APP_APP_CONTROLLER_HPP