BastionGuard/src/DashboardPage.hpp
specialworld83 f0f913a209 Release 2.0
2026-07-15 10:52:22 +02:00

75 lines
2.3 KiB
C++

/*
* BastionGuard™
* Copyright (C) 2025–2026 Calogero Scarnà
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* BastionGuard™ is a trademark of Calogero Scarnà.
* The BastionGuard™ name and branding are not licensed under the GPL.
*/
#pragma once
#include <gtkmm.h>
#include <string>
#include "LifetimeGuard.hpp"
class DashboardPage : public Gtk::Box {
public:
DashboardPage();
~DashboardPage() override;
void update_from_logs(const std::string& log_path,
const Glib::ustring& db_version,
bool on_access_enabled);
bool update_from_logs();
private:
Gtk::Label lbl_title_;
Gtk::Grid grid_cards_;
Gtk::Frame* card_status_ = nullptr;
Gtk::Frame* card_db_version_ = nullptr;
Gtk::Frame* card_db_date_ = nullptr;
Gtk::Frame* card_logs_ = nullptr;
Gtk::Label lbl_status_;
Gtk::Label lbl_db_version_;
Gtk::Label lbl_db_date_;
Gtk::Label lbl_ransomware_status_;
Gtk::Label lbl_phishing_status_;
Gtk::TextView txt_onaccess_report_;
Glib::RefPtr<Gtk::TextBuffer> buf_onaccess_report_;
Gtk::Box* footer_box_ = nullptr;
Gtk::Label lbl_update_status_;
Gtk::Button* btn_theme_light_ = nullptr;
Gtk::Button* btn_theme_dark_ = nullptr;
sigc::connection update_check_timer_;
void check_updates_async();
bool on_update_check_timer();
void set_update_status(const std::string& state);
bool update_check_in_progress_ = false;
sigc::connection refresh_timer_;
Gtk::Frame* make_card(const std::string& icon_path,
Gtk::Widget& content,
const Glib::ustring& title);
BastionGuard::AliveFlag alive_ = BastionGuard::make_alive_flag();
};