2006-07-29 02:27:28 -06:00
|
|
|
/* Copyright (C) 2004 Bart 'plors' Hakvoort
|
2009-11-05 11:08:32 -07:00
|
|
|
* Copyright (C) 2008 Curtis Gedak
|
2006-07-29 02:27:28 -06:00
|
|
|
*
|
|
|
|
* 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; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
2014-01-23 03:59:48 -07:00
|
|
|
* GNU General Public License for more details.
|
2006-07-29 02:27:28 -06:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-23 03:59:48 -07:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2006-07-29 02:27:28 -06:00
|
|
|
*/
|
|
|
|
|
2013-05-27 05:20:16 -06:00
|
|
|
#ifndef GPARTED_OPERATIONDETAIL_H
|
|
|
|
#define GPARTED_OPERATIONDETAIL_H
|
2006-07-29 02:27:28 -06:00
|
|
|
|
2016-10-18 16:45:28 -06:00
|
|
|
#include "ProgressBar.h"
|
2016-01-11 06:58:45 -07:00
|
|
|
|
2006-07-29 02:27:28 -06:00
|
|
|
#include <glibmm/ustring.h>
|
|
|
|
#include <glibmm/markup.h>
|
|
|
|
|
|
|
|
#include <vector>
|
2008-04-07 09:26:19 -06:00
|
|
|
#include <ctime>
|
2006-07-29 02:27:28 -06:00
|
|
|
|
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
|
|
|
enum OperationDetailStatus {
|
|
|
|
STATUS_NONE = 0,
|
|
|
|
STATUS_EXECUTE = 1,
|
|
|
|
STATUS_SUCCES = 2,
|
|
|
|
STATUS_ERROR = 3,
|
2006-07-30 09:13:41 -06:00
|
|
|
STATUS_INFO = 4,
|
|
|
|
STATUS_N_A = 5
|
2006-07-29 02:27:28 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
enum Font {
|
|
|
|
FONT_NORMAL = 0,
|
|
|
|
FONT_BOLD = 1,
|
|
|
|
FONT_ITALIC = 2,
|
|
|
|
FONT_BOLD_ITALIC = 3
|
|
|
|
} ;
|
|
|
|
|
|
|
|
class OperationDetail
|
|
|
|
{
|
2016-01-17 05:38:58 -07:00
|
|
|
|
|
|
|
friend class Dialog_Progress; // To allow Dialog_Progress::on_signal_update() to call
|
|
|
|
// get_progressbar() and get direct access to the progress bar.
|
|
|
|
|
2006-07-29 02:27:28 -06:00
|
|
|
public:
|
|
|
|
OperationDetail() ;
|
2013-01-20 19:50:55 -07:00
|
|
|
~OperationDetail();
|
2006-07-29 02:27:28 -06:00
|
|
|
OperationDetail( const Glib::ustring & description,
|
|
|
|
OperationDetailStatus status = STATUS_EXECUTE,
|
|
|
|
Font font = FONT_NORMAL ) ;
|
|
|
|
void set_description( const Glib::ustring & description, Font font = FONT_NORMAL ) ;
|
|
|
|
Glib::ustring get_description() const ;
|
2006-08-20 03:33:54 -06:00
|
|
|
void set_status( OperationDetailStatus status ) ;
|
2017-11-25 06:20:21 -07:00
|
|
|
void set_success_and_capture_errors( bool success );
|
2006-08-20 03:33:54 -06:00
|
|
|
OperationDetailStatus get_status() const ;
|
|
|
|
void set_treepath( const Glib::ustring & treepath ) ;
|
|
|
|
Glib::ustring get_treepath() const ;
|
2006-08-22 13:29:59 -06:00
|
|
|
Glib::ustring get_elapsed_time() const ;
|
2006-08-20 03:33:54 -06:00
|
|
|
|
|
|
|
void add_child( const OperationDetail & operationdetail ) ;
|
2014-04-01 20:04:01 -06:00
|
|
|
std::vector<OperationDetail*> & get_childs() ;
|
|
|
|
const std::vector<OperationDetail*> & get_childs() const ;
|
2006-08-20 03:33:54 -06:00
|
|
|
OperationDetail & get_last_child() ;
|
2016-01-17 05:38:58 -07:00
|
|
|
void run_progressbar( double progress, double target, ProgressBar_Text text_mode = PROGRESSBAR_TEXT_NONE );
|
|
|
|
void stop_progressbar();
|
2006-07-29 02:27:28 -06:00
|
|
|
|
2006-08-20 03:33:54 -06:00
|
|
|
sigc::signal< void, const OperationDetail & > signal_update ;
|
2013-01-20 19:50:55 -07:00
|
|
|
sigc::signal< void, bool > signal_cancel;
|
2017-11-25 06:20:21 -07:00
|
|
|
sigc::signal< void, OperationDetail & > signal_capture_errors;
|
2013-01-20 19:50:55 -07:00
|
|
|
char cancelflag;
|
2016-01-17 05:38:58 -07:00
|
|
|
|
2006-07-29 02:27:28 -06:00
|
|
|
private:
|
2017-11-25 03:37:52 -07:00
|
|
|
void add_child_implement( const OperationDetail & operationdetail );
|
2006-08-20 03:33:54 -06:00
|
|
|
void on_update( const OperationDetail & operationdetail ) ;
|
2013-01-20 19:50:55 -07:00
|
|
|
void cancel( bool force );
|
2016-01-17 05:38:58 -07:00
|
|
|
ProgressBar & get_progressbar() const;
|
|
|
|
|
2006-07-29 02:27:28 -06:00
|
|
|
Glib::ustring description ;
|
2006-08-20 03:33:54 -06:00
|
|
|
OperationDetailStatus status ;
|
|
|
|
|
|
|
|
Glib::ustring treepath ;
|
|
|
|
|
2014-04-01 20:04:01 -06:00
|
|
|
std::vector<OperationDetail*> sub_details;
|
2006-08-22 13:29:59 -06:00
|
|
|
std::time_t time_start, time_elapsed ;
|
2017-11-25 03:37:52 -07:00
|
|
|
bool no_more_children; // Disallow adding more children to ensure captured errors
|
|
|
|
// remain the last child of this operation detail.
|
|
|
|
|
2013-01-20 19:50:55 -07:00
|
|
|
sigc::connection cancelconnection;
|
2006-07-29 02:27:28 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
} //GParted
|
|
|
|
|
2013-05-27 05:20:16 -06:00
|
|
|
#endif /* GPARTED_OPERATIONDETAIL_H */
|