Webdar 1.0.0
Web user interface to libdar
html_libdar_running_popup.hpp
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef HTML_LIBDAR_RUNNING_POPUP_HPP
25#define HTML_LIBDAR_RUNNING_POPUP_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35#include <libthreadar/libthreadar.hpp>
36
37 // webdar headers
38#include "html_popup.hpp"
39#include "events.hpp"
40#include "actor.hpp"
41#include "html_web_user_interaction.hpp"
42
44
46
47class html_libdar_running_popup : public html_popup, public events, public actor
48{
49public:
50 // this class generates the following events:
51 static const std::string libdar_has_finished;
52
53 // constructor
57 html_libdar_running_popup & operator = (const html_libdar_running_popup & ref) = delete;
58 html_libdar_running_popup & operator = (html_libdar_running_popup && ref) noexcept = delete;
60
62 virtual void on_event(const std::string & event_name) override;
63
65 std::shared_ptr<html_web_user_interaction> & get_html_user_interaction() { return web_ui; };
66
68 void run_and_control_thread(libthreadar::thread* arg) { web_ui->run_and_control_thread(arg); };
69
71 void join_controlled_thread() { web_ui->join_controlled_thread(); };
72
74 bool is_libdar_running() const { return web_ui->is_libdar_running(); };
75
77 bool has_libdar_been_aborted() const { return web_ui->has_libdar_been_aborted(); };
78
79protected:
81 virtual std::string inherited_get_body_part(const chemin & path,
82 const request & req) override;
83
85 virtual void my_visibility_has_changed() override;
86
87private:
88 bool enable_refresh;
89
90 std::shared_ptr<html_web_user_interaction> web_ui;
91
92};
93
94#endif
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
class chemin definition
Definition: chemin.hpp:51
class events
Definition: events.hpp:52
html_libdar_running_popup wraps up an html_web_user_interaction in a html_popup component
Definition: html_libdar_running_popup.hpp:48
void run_and_control_thread(libthreadar::thread *arg)
propagate request to web_ui
Definition: html_libdar_running_popup.hpp:68
bool has_libdar_been_aborted() const
whether libdar thread has been aborted (to be checked by the caller upon libdar_has_finished event)
Definition: html_libdar_running_popup.hpp:77
static const std::string libdar_has_finished
libdar execution has ended and user has acknoledged it
Definition: html_libdar_running_popup.hpp:51
virtual void my_visibility_has_changed() override
inherited from body_builder
Definition: html_libdar_running_popup.cpp:104
bool is_libdar_running() const
whether a libdar thread is running under "this" management
Definition: html_libdar_running_popup.hpp:74
virtual std::string inherited_get_body_part(const chemin &path, const request &req) override
inherited from body_builder
Definition: html_libdar_running_popup.cpp:64
void join_controlled_thread()
propagate request to web_ui
Definition: html_libdar_running_popup.hpp:71
virtual void on_event(const std::string &event_name) override
inherited from actor
Definition: html_libdar_running_popup.cpp:111
std::shared_ptr< html_web_user_interaction > & get_html_user_interaction()
propagate request to web_ui
Definition: html_libdar_running_popup.hpp:65
class html_popup is the implementation of
Definition: html_popup.hpp:50
class holding fields of an HTTP request (method, URI, header, cookies, and so on)
Definition: request.hpp:45
defines the event class