parent
							
								
									f5f4809531
								
							
						
					
					
						commit
						aa5e8a51c5
					
				| @ -0,0 +1,125 @@ | |||||||
|  | #include "view_filters.h" | ||||||
|  | 
 | ||||||
|  | view_filters::view_filters(/* args */){ | ||||||
|  |     builder = Gtk::Builder::create_from_file(path_glade); | ||||||
|  |     this->settings(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | view_filters::~view_filters() | ||||||
|  | { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::settings() { | ||||||
|  |     this->get_builder(); | ||||||
|  |     this->lacalization(); | ||||||
|  |     this->set_map_flag(chbFilterName); | ||||||
|  |     this->set_map_flag(chbFilterQuotas); | ||||||
|  |     this->set_map_flag(chbFilterSize); | ||||||
|  |     this->set_map_flag(chbFilterSoftLimitSize); | ||||||
|  |     this->set_map_flag(chbFilterHardLimitSize); | ||||||
|  |     this->set_map_flag(chbFilterHardLimitSizeDelay); | ||||||
|  |     this->set_map_flag(chbFilterFiles); | ||||||
|  |     this->set_map_flag(chbFilterSoftLimitFile); | ||||||
|  |     this->set_map_flag(chbFilterHardLimitFile); | ||||||
|  |     this->set_map_flag(chbFilterHardLimitFileDelay); | ||||||
|  |     this->event(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::set_path_glade(string path_glade) { | ||||||
|  |     this->path_glade = path_glade; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::get_builder() { | ||||||
|  |     builder->get_widget("wndFilters", wndFilters); | ||||||
|  |     builder->get_widget("chbFilterName", chbFilterName); | ||||||
|  |     builder->get_widget("chbFilterQuotas", chbFilterQuotas); | ||||||
|  |     builder->get_widget("chbFilterSize", chbFilterSize); | ||||||
|  |     builder->get_widget("chbFilterSoftLimitSize", chbFilterSoftLimitSize); | ||||||
|  |     builder->get_widget("chbFilterHardLimitSize", chbFilterHardLimitSize); | ||||||
|  |     builder->get_widget("chbFilterHardLimitSizeDelay", chbFilterHardLimitSizeDelay); | ||||||
|  |     builder->get_widget("chbFilterFiles", chbFilterFiles); | ||||||
|  |     builder->get_widget("chbFilterSoftLimitFile", chbFilterSoftLimitFile); | ||||||
|  |     builder->get_widget("chbFilterHardLimitFile", chbFilterHardLimitFile); | ||||||
|  |     builder->get_widget("chbFilterHardLimitFileDelay", chbFilterHardLimitFileDelay); | ||||||
|  |     builder->get_widget("lblFiltersHead", lblFiltersHead); | ||||||
|  |     builder->get_widget("btnFiltersSave", btnFiltersSave); | ||||||
|  |     builder->get_widget("btnFiltersCancel", btnFiltersCancel); | ||||||
|  |     lblFiltersHead->set_label(str_filters); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::show() { | ||||||
|  |     this->set_map_flag_false(); | ||||||
|  |     wndFilters->show(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::lacalization() { | ||||||
|  |     chbFilterName->set_label(str_name); | ||||||
|  |     chbFilterQuotas->set_label(str_quotas); | ||||||
|  |     chbFilterSize->set_label(str_size); | ||||||
|  |     chbFilterSoftLimitSize->set_label(str_soft_limit_size); | ||||||
|  |     chbFilterHardLimitSize->set_label(str_hard_limit_size); | ||||||
|  |     chbFilterHardLimitSizeDelay->set_label(str_deferring_hard_limit_size); | ||||||
|  |     chbFilterFiles->set_label(str_files); | ||||||
|  |     chbFilterSoftLimitFile->set_label(str_soft_restriction_files); | ||||||
|  |     chbFilterHardLimitFile->set_label(str_severe_limitation_files); | ||||||
|  |     chbFilterHardLimitFileDelay->set_label(str_deferring_limit_files); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::event() { | ||||||
|  |     chbFilterName->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterName)); | ||||||
|  |     chbFilterQuotas->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterQuotas)); | ||||||
|  |     chbFilterSize->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterSize)); | ||||||
|  |     chbFilterSoftLimitSize->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterSoftLimitSize)); | ||||||
|  |     chbFilterHardLimitSize->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterHardLimitSize)); | ||||||
|  |     chbFilterHardLimitSizeDelay->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterHardLimitSizeDelay)); | ||||||
|  |     chbFilterFiles->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterFiles)); | ||||||
|  |     chbFilterSoftLimitFile->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterSoftLimitFile)); | ||||||
|  |     chbFilterHardLimitFile->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterHardLimitFile)); | ||||||
|  |     chbFilterHardLimitFileDelay->signal_toggled().connect(  | ||||||
|  |         sigc::bind<Gtk::CheckButton*> (sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::set_map_flag), chbFilterHardLimitFileDelay)); | ||||||
|  |     btnFiltersSave->signal_clicked().connect(sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::save)); | ||||||
|  |     btnFiltersCancel->signal_clicked().connect(sigc::mem_fun(*this,  | ||||||
|  |         &MainWindow::cancel)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::set_map_flag(Gtk::CheckButton* check_button) { | ||||||
|  |     map_filters_flag[check_button->get_label()] = check_button->get_active(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::save() { | ||||||
|  |     wndFilters->hide(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::cancel() { | ||||||
|  |     wndFilters->hide(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | map<string, bool> view_filters::get_filters() { | ||||||
|  |     return map_filters_flag; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void view_filters::set_map_flag_false() { | ||||||
|  |     for (auto& [key: value]: map_filters_flag) { | ||||||
|  |         map_filters_flag[key] = false; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,48 @@ | |||||||
|  | #include "project_lib.h" | ||||||
|  | 
 | ||||||
|  | #define str_name _("Name") | ||||||
|  | #define str_size _("Size") | ||||||
|  | #define str_filters _("Filters") | ||||||
|  | #define str_quotas _("Quotas") | ||||||
|  | #define str_soft_limit_size _("Soft limit (size)") | ||||||
|  | #define str_hard_limit_size _("Hard limit (size)") | ||||||
|  | #define str_hard_limit_size_delay _("Hard limit (size) delay") | ||||||
|  | #define str_soft_limit_files _("Soft limit (files)") | ||||||
|  | #define str_hard_limit_size_delay _("Hard limit (files) delay") | ||||||
|  | class view_filters | ||||||
|  | { | ||||||
|  | private: | ||||||
|  |     Glib::RefPtr<Gtk::Builder> const& builder; | ||||||
|  |     string path_glade; | ||||||
|  |     Gtk::Window *wndFilters; | ||||||
|  |     Gtk::CheckButton *chbFilterName; | ||||||
|  |     Gtk::CheckButton *chbFilterQuotas; | ||||||
|  |     Gtk::CheckButton *chbFilterSize; | ||||||
|  |     Gtk::CheckButton *chbFilterSoftLimitSize; | ||||||
|  |     Gtk::CheckButton *chbFilterHardLimitSize; | ||||||
|  |     Gtk::CheckButton *chbFilterHardLimitSizeDelay; | ||||||
|  |     Gtk::CheckButton *filtersHardSizeActivationFilterCheckbox; | ||||||
|  |     Gtk::CheckButton *chbFilterFiles; | ||||||
|  |     Gtk::CheckButton *chbFilterSoftLimitFile; | ||||||
|  |     Gtk::CheckButton *chbFilterHardLimitFile; | ||||||
|  |     Gtk::CheckButton *chbFilterHardLimitFileDelay; | ||||||
|  |     Gtk::Label *lblFiltersHead; | ||||||
|  |     Gtk::Button *btnFiltersSave; | ||||||
|  |     Gtk::Button *btnFiltersCancel; | ||||||
|  |     std::map<string, bool> map_filters_flag; | ||||||
|  | public: | ||||||
|  |     view_filters(/* args */); | ||||||
|  |     ~view_filters(); | ||||||
|  |     void lacalization(); | ||||||
|  |     void event(); | ||||||
|  |     void get_builder(); | ||||||
|  |     void settings(); | ||||||
|  |     void show(); | ||||||
|  |     void set_map_flag(Gtk::CheckButton* check_button); | ||||||
|  |     void save(); | ||||||
|  |     void cancel(); | ||||||
|  |     void set_map_flag_false(); | ||||||
|  |     map<string, bool> get_filters() | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
					Loading…
					
					
				
		Reference in new issue
	
	