Skip to content
API Documentation
BastionGuard™
app_window.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "models.hpp"
4#include "scan_worker.hpp"
5#include "recovery_worker.hpp"
6
7#include <giomm.h>
8#include <gtkmm.h>
9
10class ResultRow : public Glib::Object {
11public:
12 Glib::Property<Glib::ustring> offset;
13 Glib::Property<Glib::ustring> size;
14 Glib::Property<Glib::ustring> type;
15 Glib::Property<Glib::ustring> source;
16 Glib::Property<Glib::ustring> detail;
17 Glib::Property<Glib::ustring> confidence;
18
19 static Glib::RefPtr<ResultRow> create(const Glib::ustring& offset,
20 const Glib::ustring& size,
21 const Glib::ustring& type,
22 const Glib::ustring& source,
23 const Glib::ustring& detail,
24 const Glib::ustring& confidence);
25
26private:
27 ResultRow();
28};
29
30class AppWindow : public Gtk::ApplicationWindow {
31public:
32 AppWindow();
33 ~AppWindow() override;
34
35private:
36 void setup_columns();
37 void add_text_column(const Glib::ustring& title, const char* property_name);
38 void on_choose_file();
39 void on_file_chosen(const Glib::RefPtr<Gio::AsyncResult>& result);
40 void on_scan_clicked();
41 void on_scan_completed(const ScanReport& report);
43 void on_report_file_chosen(const Glib::RefPtr<Gio::AsyncResult>& result);
45 void on_output_folder_chosen(const Glib::RefPtr<Gio::AsyncResult>& result);
46 void on_recovery_completed(const RecoveryResult& result);
47 void append_log(const std::string& line);
48
49 static std::string human_size(uint64_t bytes);
50 static std::string human_offset(uint64_t bytes);
51
52 Gtk::Box root_ {Gtk::Orientation::VERTICAL, 8};
53 Gtk::Box toolbar_ {Gtk::Orientation::HORIZONTAL, 8};
54 Gtk::Button btn_open_;
55 Gtk::Button btn_scan_;
56 Gtk::Button btn_save_report_;
57 Gtk::Button btn_recover_;
58 Gtk::Entry entry_path_;
59 Gtk::Label status_;
60 Gtk::Paned paned_ {Gtk::Orientation::VERTICAL};
61 Gtk::ScrolledWindow results_scroller_;
62 Gtk::ScrolledWindow logs_scroller_;
63 Gtk::ColumnView column_view_;
64 Gtk::TextView log_view_;
65 Glib::RefPtr<Gtk::TextBuffer> log_buffer_;
66 Glib::RefPtr<Gio::ListStore<ResultRow>> store_;
67 Glib::RefPtr<Gtk::SingleSelection> selection_model_;
68 Glib::RefPtr<Gtk::FileDialog> file_dialog_;
69 Glib::RefPtr<Gtk::FileDialog> save_dialog_;
70 Glib::RefPtr<Gtk::FileDialog> output_dialog_;
71 std::string selected_path_;
72 std::string output_dir_;
76};
Gtk::ColumnView column_view_
void on_scan_clicked()
void on_recovery_completed(const RecoveryResult &result)
Glib::RefPtr< Gtk::FileDialog > file_dialog_
void on_output_folder_chosen(const Glib::RefPtr< Gio::AsyncResult > &result)
ScanWorker worker_
std::string output_dir_
RecoveryWorker recovery_worker_
static std::string human_offset(uint64_t bytes)
void on_report_file_chosen(const Glib::RefPtr< Gio::AsyncResult > &result)
void on_save_report_clicked()
void on_file_chosen(const Glib::RefPtr< Gio::AsyncResult > &result)
void on_choose_output_folder()
Gtk::Paned paned_
void append_log(const std::string &line)
Gtk::Button btn_save_report_
Glib::RefPtr< Gtk::TextBuffer > log_buffer_
std::string selected_path_
Gtk::Button btn_open_
~AppWindow() override
Gtk::ScrolledWindow results_scroller_
static std::string human_size(uint64_t bytes)
Glib::RefPtr< Gtk::FileDialog > save_dialog_
Gtk::Box toolbar_
Glib::RefPtr< Gtk::SingleSelection > selection_model_
void on_choose_file()
void on_scan_completed(const ScanReport &report)
Gtk::Entry entry_path_
void add_text_column(const Glib::ustring &title, const char *property_name)
Glib::RefPtr< Gtk::FileDialog > output_dialog_
Gtk::Label status_
Glib::RefPtr< Gio::ListStore< ResultRow > > store_
void setup_columns()
Gtk::TextView log_view_
Gtk::Button btn_scan_
Gtk::Box root_
Gtk::ScrolledWindow logs_scroller_
ScanReport last_report_
Gtk::Button btn_recover_
static Glib::RefPtr< ResultRow > create(const Glib::ustring &offset, const Glib::ustring &size, const Glib::ustring &type, const Glib::ustring &source, const Glib::ustring &detail, const Glib::ustring &confidence)
Glib::Property< Glib::ustring > offset
Glib::Property< Glib::ustring > confidence
Glib::Property< Glib::ustring > type
Glib::Property< Glib::ustring > source
Glib::Property< Glib::ustring > size
Glib::Property< Glib::ustring > detail