Skip to content
API Documentation
BastionGuard™
AlertDialog.hpp
Go to the documentation of this file.
1/*
2 * BastionGuard™ Secure Connection
3 * Copyright (C) 2025–2026 Calogero Scarnà
4 * GPL-3.0 — BastionGuard™ is a trademark of Calogero Scarnà.
5 */
6
7#pragma once
8#include <gtkmm.h>
9#include <string>
10#include <cstdint>
11#include <vector>
12
19
20class AlertDialog : public Gtk::Window
21{
22public:
23 AlertDialog(const std::string& appComm,
24 const std::string& appPath,
25 const std::vector<std::string>& appArgs,
26 const std::string& destHost,
27 const std::string& destIp,
28 uint32_t destPort,
29 int timeoutSecs = 15);
30 ~AlertDialog() override;
31
32 sigc::signal<void(Verdict)> signal_verdict;
33
34private:
35 // Layout
36 Gtk::Box m_vbox { Gtk::Orientation::VERTICAL, 16 };
37 Gtk::Box m_infoBox { Gtk::Orientation::VERTICAL, 8 };
38 Gtk::Box m_btnBox { Gtk::Orientation::HORIZONTAL, 6 };
39
40 // Widgets info
41 Gtk::Image m_appIcon;
42 Gtk::Label m_appName;
43 Gtk::Label m_appPath;
44 Gtk::Label m_hostLabel; // 🌐 Sito: hostname
45 Gtk::Label m_ipLabel; // 📍 IP: indirizzo
46 Gtk::Label m_portLabel; // 🔌 Porta: numero
47 Gtk::ProgressBar m_countdown;
48
49 // Pulsanti
50 Gtk::Button m_allowOnce;
51 Gtk::Button m_allowAlways;
52 Gtk::Button m_denyOnce;
53 Gtk::Button m_denyAlways;
54
55 // Timeout
58 sigc::connection m_timerConn;
59
60 void buildHeaderBar();
61 void buildUI(const std::string& appComm,
62 const std::string& appPath,
63 const std::vector<std::string>& appArgs,
64 const std::string& destHost,
65 const std::string& destIp,
66 uint32_t destPort);
67 void startCountdown();
68 bool onTick();
69 void emitVerdict(Verdict v);
70};
Verdict
Gtk::Label m_appName
Gtk::Button m_allowAlways
Gtk::Label m_portLabel
Gtk::Button m_denyOnce
AlertDialog(const std::string &appComm, const std::string &appPath, const std::vector< std::string > &appArgs, const std::string &destHost, const std::string &destIp, uint32_t destPort, int timeoutSecs=15)
sigc::connection m_timerConn
void buildHeaderBar()
void emitVerdict(Verdict v)
Gtk::Image m_appIcon
Gtk::Button m_denyAlways
Gtk::Label m_ipLabel
Gtk::ProgressBar m_countdown
void buildUI(const std::string &appComm, const std::string &appPath, const std::vector< std::string > &appArgs, const std::string &destHost, const std::string &destIp, uint32_t destPort)
Gtk::Box m_btnBox
void startCountdown()
Gtk::Label m_hostLabel
Gtk::Box m_vbox
Gtk::Button m_allowOnce
sigc::signal< void(Verdict)> signal_verdict
Gtk::Label m_appPath
Gtk::Box m_infoBox