88 lines
3 KiB
C++
88 lines
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.
|
|
*/
|
|
|
|
#include "Resource.hpp"
|
|
#include "DonatePage.hpp"
|
|
#include <giomm.h>
|
|
#include <iostream>
|
|
#include <glib/gi18n.h>
|
|
|
|
DonatePage::DonatePage()
|
|
: Gtk::Box(Gtk::Orientation::VERTICAL, 12)
|
|
{
|
|
set_margin(20);
|
|
|
|
auto lbl_title = Gtk::make_managed<Gtk::Label>("<b>" + Glib::ustring(_("Sostieni BastionGuard")) + " Endpoint </b>");
|
|
lbl_title->set_use_markup(true);
|
|
lbl_title->set_halign(Gtk::Align::CENTER);
|
|
append(*lbl_title);
|
|
|
|
|
|
auto lbl_desc = Gtk::make_managed<Gtk::Label>(
|
|
_("Grazie al tuo contributo possiamo migliorare BastionGuard, "
|
|
"basta un piccolo gesto. Il contributo è prettamente volontario, "
|
|
"vi chiediamo solo di sostenerci a portare avanti qualcosa del tutto gratuito per voi.")
|
|
);
|
|
lbl_desc->set_wrap(true);
|
|
lbl_desc->set_justify(Gtk::Justification::CENTER);
|
|
lbl_desc->set_margin(10);
|
|
append(*lbl_desc);
|
|
|
|
|
|
auto picture = Gtk::make_managed<Gtk::Picture>();
|
|
try {
|
|
picture->set_file(Gio::File::create_for_path(resource("donate.png")));
|
|
} catch (...) {
|
|
std::cerr << _("❌ Impossibile caricare l'immagine data/donate.png") << "\n";
|
|
}
|
|
|
|
picture->set_content_fit(Gtk::ContentFit::CONTAIN);
|
|
picture->set_size_request(350, 121);
|
|
picture->set_halign(Gtk::Align::CENTER);
|
|
picture->set_valign(Gtk::Align::CENTER);
|
|
picture->set_margin(10);
|
|
|
|
append(*picture);
|
|
|
|
|
|
auto btn_box = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL, 6);
|
|
|
|
auto icon = Gtk::make_managed<Gtk::Image>();
|
|
icon->set_from_icon_name("emblem-favorite");
|
|
btn_box->append(*icon);
|
|
|
|
auto lbl = Gtk::make_managed<Gtk::Label>(_("Vai alla donazione"));
|
|
btn_box->append(*lbl);
|
|
|
|
auto btn_donate = Gtk::make_managed<Gtk::Button>();
|
|
btn_donate->set_child(*btn_box);
|
|
btn_donate->set_halign(Gtk::Align::CENTER);
|
|
btn_donate->signal_clicked().connect(sigc::mem_fun(*this, &DonatePage::on_open_donate));
|
|
|
|
append(*btn_donate);
|
|
}
|
|
|
|
void DonatePage::on_open_donate() {
|
|
try {
|
|
Gio::AppInfo::launch_default_for_uri("https://www.paypal.com/donate/?hosted_button_id=XR4622XJZMKGN");
|
|
} catch (const Glib::Error& ex) {
|
|
std::cerr << _("❌ Errore apertura link donazione: ") << ex.what() << "\n";
|
|
}
|
|
}
|