Skip to content
API Documentation
BastionGuard™
StatsPage Class Reference

#include <StatsPage.hpp>

Inheritance diagram for StatsPage:

Public Member Functions

 StatsPage ()
void updateStats (uint64_t allowed, uint64_t denied, uint64_t total)

Private Member Functions

void buildGrid ()

Private Attributes

Gtk::Grid m_grid
Gtk::Label m_allowedLabel
Gtk::Label m_deniedLabel
Gtk::Label m_totalLabel
Gtk::Label m_allowedVal { "0" }
Gtk::Label m_deniedVal { "0" }
Gtk::Label m_totalVal { "0" }

Detailed Description

Definition at line 9 of file StatsPage.hpp.

Constructor & Destructor Documentation

◆ StatsPage()

StatsPage::StatsPage ( )

Definition at line 9 of file StatsPage.cpp.

10 : Gtk::Box(Gtk::Orientation::VERTICAL, 16)
11{
12 set_margin_top(24);
13 set_margin_start(24);
14 set_margin_end(24);
15
16 auto title = Gtk::make_managed<Gtk::Label>();
17 title->set_markup(_("<b><big>📊 Statistiche sessione</big></b>"));
18 title->set_halign(Gtk::Align::START);
19 append(*title);
20
21 buildGrid();
22 append(m_grid);
23}
#define _(s)
Gtk::Grid m_grid
Definition StatsPage.hpp:17
void buildGrid()
Definition StatsPage.cpp:25

References _, buildGrid(), and m_grid.

Member Function Documentation

◆ buildGrid()

void StatsPage::buildGrid ( )
private

Definition at line 25 of file StatsPage.cpp.

26{
27 m_grid.set_row_spacing(12);
28 m_grid.set_column_spacing(24);
29
30 m_allowedLabel.set_markup(_("<b>Connessioni consentite</b>"));
31 m_deniedLabel.set_markup(_("<b>Connessioni negate</b>"));
32 m_totalLabel.set_markup(_("<b>Totale intercettate</b>"));
33
34 m_allowedVal.set_markup("<span foreground='#22c55e' size='xx-large'><b>0</b></span>");
35 m_deniedVal.set_markup("<span foreground='#ef4444' size='xx-large'><b>0</b></span>");
36 m_totalVal.set_markup("<span size='xx-large'><b>0</b></span>");
37
38 for (auto* l : {&m_allowedLabel, &m_deniedLabel, &m_totalLabel,
40 l->set_halign(Gtk::Align::START);
41
42 m_grid.attach(m_allowedLabel, 0, 0);
43 m_grid.attach(m_allowedVal, 1, 0);
44 m_grid.attach(m_deniedLabel, 0, 1);
45 m_grid.attach(m_deniedVal, 1, 1);
46 m_grid.attach(m_totalLabel, 0, 2);
47 m_grid.attach(m_totalVal, 1, 2);
48}
Gtk::Label m_deniedLabel
Definition StatsPage.hpp:19
Gtk::Label m_totalLabel
Definition StatsPage.hpp:20
Gtk::Label m_deniedVal
Definition StatsPage.hpp:22
Gtk::Label m_allowedVal
Definition StatsPage.hpp:21
Gtk::Label m_totalVal
Definition StatsPage.hpp:23
Gtk::Label m_allowedLabel
Definition StatsPage.hpp:18

References _, m_allowedLabel, m_allowedVal, m_deniedLabel, m_deniedVal, m_grid, m_totalLabel, and m_totalVal.

Referenced by StatsPage().

◆ updateStats()

void StatsPage::updateStats ( uint64_t allowed,
uint64_t denied,
uint64_t total )

Definition at line 50 of file StatsPage.cpp.

51{
52 m_allowedVal.set_markup(
53 "<span foreground='#22c55e' size='xx-large'><b>" +
54 std::to_string(allowed) + "</b></span>");
55 m_deniedVal.set_markup(
56 "<span foreground='#ef4444' size='xx-large'><b>" +
57 std::to_string(denied) + "</b></span>");
58 m_totalVal.set_markup(
59 "<span size='xx-large'><b>" + std::to_string(total) + "</b></span>");
60}

References m_allowedVal, m_deniedVal, and m_totalVal.

Referenced by MainWindow::onDaemonAlert(), MainWindow::onNewConnection(), and MainWindow::onVerdict().

Member Data Documentation

◆ m_allowedLabel

Gtk::Label StatsPage::m_allowedLabel
private

Definition at line 18 of file StatsPage.hpp.

Referenced by buildGrid().

◆ m_allowedVal

Gtk::Label StatsPage::m_allowedVal { "0" }
private

Definition at line 21 of file StatsPage.hpp.

Referenced by buildGrid(), and updateStats().

◆ m_deniedLabel

Gtk::Label StatsPage::m_deniedLabel
private

Definition at line 19 of file StatsPage.hpp.

Referenced by buildGrid().

◆ m_deniedVal

Gtk::Label StatsPage::m_deniedVal { "0" }
private

Definition at line 22 of file StatsPage.hpp.

Referenced by buildGrid(), and updateStats().

◆ m_grid

Gtk::Grid StatsPage::m_grid
private

Definition at line 17 of file StatsPage.hpp.

Referenced by buildGrid(), and StatsPage().

◆ m_totalLabel

Gtk::Label StatsPage::m_totalLabel
private

Definition at line 20 of file StatsPage.hpp.

Referenced by buildGrid().

◆ m_totalVal

Gtk::Label StatsPage::m_totalVal { "0" }
private

Definition at line 23 of file StatsPage.hpp.

Referenced by buildGrid(), and updateStats().


The documentation for this class was generated from the following files:
  • BastionGuard/thirdparty/bastionguard-secure-connection/ui/src/pages/StatsPage.hpp
  • BastionGuard/thirdparty/bastionguard-secure-connection/ui/src/pages/StatsPage.cpp