From 6454a5c0e74c364905e34792365b7075053ab83a Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 16 May 2023 16:50:56 +0600 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D0=BA=D0=BD=D0=BE=20=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BA=D0=B2=D0=BE=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 6 +- source/controller.cc | 2 + source/controller.h | 4 + source/view/model/my_device.cc | 29 - source/view/model/my_device.h | 20 - source/view/ubl-settings-diskquota.cc | 41 +- source/view/ubl-settings-diskquota.h | 10 +- source/view/view_add_project.cc | 52 + source/view/view_add_project.h | 25 + ...t_user_group.cc => view_add_user_group.cc} | 52 +- ...set_user_group.h => view_add_user_group.h} | 11 +- source/view/view_edit_project.cc | 52 + source/view/view_edit_project.h | 25 + source/view/view_edit_user_group.cc | 114 + source/view/view_edit_user_group.h | 61 + ubl-settings-diskquota.glade | 2221 ++++++++++++++++- 16 files changed, 2622 insertions(+), 103 deletions(-) delete mode 100644 source/view/model/my_device.cc delete mode 100644 source/view/model/my_device.h create mode 100644 source/view/view_add_project.cc create mode 100644 source/view/view_add_project.h rename source/view/{view_set_user_group.cc => view_add_user_group.cc} (72%) rename source/view/{view_set_user_group.h => view_add_user_group.h} (92%) create mode 100644 source/view/view_edit_project.cc create mode 100644 source/view/view_edit_project.h create mode 100644 source/view/view_edit_user_group.cc create mode 100644 source/view/view_edit_user_group.h diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 87f1658..041d209 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -30,14 +30,16 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin -fstack-clash-protection -fcf-protection -g") set(SOURCE_FILES + view/view_add_user_group.h + view/view_add_user_group.cc + view/view_edit_user_group.cc + view/view_edit_user_group.h view/view_filters.cc view/view_filters.h view/ubl-settings-diskquota.h view/ubl-settings-diskquota.cc view/model/ubconfig_quota.cc view/model/ubconfig_quota.h - view/model/my_device.h - view/model/my_device.cc view/model/save.h view/model/save.cc view/model/load.h diff --git a/source/controller.cc b/source/controller.cc index 20015bf..8cf9572 100644 --- a/source/controller.cc +++ b/source/controller.cc @@ -27,6 +27,8 @@ void Controller::settings() { obj_main_window->set_map_global(&map_global_cfg); obj_main_window->set_map_local(&map_system_cfg); obj_main_window->set_obj_view_filters(&obj_view_filters); + obj_main_window->set_obj_view_edit(&obj_view_edit); + obj_main_window->set_obj_view_add(&obj_view_add); obj_main_window->settings(); } diff --git a/source/controller.h b/source/controller.h index 5df2011..a4f4466 100644 --- a/source/controller.h +++ b/source/controller.h @@ -6,6 +6,8 @@ #include "view/ubl-settings-diskquota.h" #include "view/model/wrapper_load_save.h" #include "view/view_filters.h" +#include "view/view_add_user_group.h" +#include "view/view_edit_user_group.h" extern int socket_ext_id_I; extern int socket_trd_id_I; @@ -26,6 +28,8 @@ public: MainWindow* obj_main_window; Wrapper_load_save *obj_wrapper_load_save = new Wrapper_load_save(); View_filters obj_view_filters = View_filters(); + View_add_user_group obj_view_add = View_add_user_group(); + View_edit_user_group obj_view_edit = View_edit_user_group(); Controller(BaseObjectType* obj, Glib::RefPtr const& builder); Controller(Glib::RefPtr const& builder); diff --git a/source/view/model/my_device.cc b/source/view/model/my_device.cc deleted file mode 100644 index 7dedf0c..0000000 --- a/source/view/model/my_device.cc +++ /dev/null @@ -1,29 +0,0 @@ -#include "my_device.h" - - -namespace Devices { - - map_str_str Parted::get_parted() { - string cmd = "lsblk --fs --raw --output PATH,FSTYPE --exclude 7,11,253"; - string response = obj_process_call.call_all_sections(cmd); - vector vec_parted = Utils::split(response, '\n'); - map_str_str dict_parted; - string key = ""; - string value = ""; - if (vec_parted.size()>1) { - vec_parted.erase(vec_parted.begin()); - } - for (const string& str_parted : vec_parted) { - key = str_parted.substr(0, str_parted.find(" ")); - if (str_parted.find(" ") != string::npos) { - value = str_parted.substr(str_parted.find(" ") + 1, str_parted.length()); - if (value.length()>0) { - dict_parted[key] = value; - } - } - } - - return dict_parted; - } - -} \ No newline at end of file diff --git a/source/view/model/my_device.h b/source/view/model/my_device.h deleted file mode 100644 index 73b0e76..0000000 --- a/source/view/model/my_device.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MY_DEVICE_H -#define MY_DEVICE_H - -#include "../../project_lib.h" -#include "my_process.h" -#include "util.h" -#include "../../my_type.h" - - -namespace Devices { - class Parted{ - protected: - My_Process::My_Process_call obj_process_call = My_Process::My_Process_call(); - public: - map_str_str get_parted(); - }; - -} -#endif - diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index cb06244..37f868c 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -40,6 +40,14 @@ void MainWindow::set_obj_view_filters(View_filters* obj_view_filters) { this->obj_view_filters = obj_view_filters; } +void MainWindow::set_obj_view_add(View_add_user_group* obj_view_add) { + this->obj_view_add = obj_view_add; +} + +void MainWindow::set_obj_view_edit(View_edit_user_group* obj_view_edit) { + this->obj_view_edit = obj_view_edit; +} + void MainWindow::settings() { this->get_builder(); this->lacalization(); @@ -454,6 +462,12 @@ void MainWindow::event() { btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system();}); btnLoadGlob->signal_activate().connect([&]() {this->wrapper_load_global();}); btnLoadLocal->signal_activate().connect([&]() {this->wrapper_load_system();}); + btnEditGroups->signal_clicked().connect(sigc::bind (sigc::mem_fun( *this, + &MainWindow::edit_quota_show), str_groups)); + btnEditUsers->signal_clicked().connect(sigc::bind (sigc::mem_fun( *this, + &MainWindow::edit_quota_show), str_users)); + btnEditProject->signal_clicked().connect(sigc::bind (sigc::mem_fun( *this, + &MainWindow::edit_quota_show), str_projects)); chbMangSystemFile->signal_toggled().connect([&]() {this->mode_switch_quota();}); btnDelGroups->signal_clicked().connect( sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, @@ -465,14 +479,24 @@ void MainWindow::event() { sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, &MainWindow::remove_template), &list_store_project, &iter_project, flag_validate_del_project)); btnAddProject->signal_clicked().connect( - sigc::bind&, struct tv_g_u_p> (sigc::mem_fun( *this, - &MainWindow::set_add_tv_g_u_p),ProjectQuotasTree, row, list_store_project, obj_tv_g_u_p)); + sigc::bind&, struct tv_g_u_p> (sigc::mem_fun( *this, + &MainWindow::set_add_tv_g_u_p), str_projects, ProjectQuotasTree, row, list_store_project, obj_tv_g_u_p)); btnAddUsers->signal_clicked().connect( - sigc::bind&, struct tv_g_u_p> (sigc::mem_fun( *this, - &MainWindow::set_add_tv_g_u_p),usersQuotasTree, row, list_store_users, obj_tv_g_u_p)); + sigc::bind&, struct tv_g_u_p> (sigc::mem_fun( *this, + &MainWindow::set_add_tv_g_u_p), str_users, usersQuotasTree, row, list_store_users, obj_tv_g_u_p)); btnAddGroups->signal_clicked().connect( - sigc::bind&, struct tv_g_u_p> (sigc::mem_fun( *this, - &MainWindow::set_add_tv_g_u_p),groupsQuotasTree, row, list_store_groups, obj_tv_g_u_p)); + sigc::bind&, struct tv_g_u_p> (sigc::mem_fun( *this, + &MainWindow::set_add_tv_g_u_p), str_groups, groupsQuotasTree, row, list_store_groups, obj_tv_g_u_p)); +} + +void MainWindow::add_quota_show(string name) { + obj_view_add->set_label_type_quota(name); + obj_view_add->show(); +} + +void MainWindow::edit_quota_show(string name) { + obj_view_edit->set_label_type_quota(name); + obj_view_edit->show(); } void MainWindow::remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del) { @@ -488,12 +512,12 @@ void MainWindow::remove_template(Glib::RefPtr* list_store, const flag_validate_del = false; info_status_app(info_box_ok_css); imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU); - lblWarning->set_text(""); + // lblWarning->set_text(""); } flag_validate_del = false; } -void MainWindow::set_add_tv_g_u_p(Gtk::TreeView* tree_view, Gtk::TreeModel::Row &row, Glib::RefPtr& list_store, struct tv_g_u_p obj_tv_g_u_p) { +void MainWindow::set_add_tv_g_u_p(string name, Gtk::TreeView* tree_view, Gtk::TreeModel::Row &row, Glib::RefPtr& list_store, struct tv_g_u_p obj_tv_g_u_p) { if (this->check_space(tree_view)) { row = *(list_store->append()); row[m_columns.name] = obj_tv_g_u_p.name; @@ -506,6 +530,7 @@ void MainWindow::set_add_tv_g_u_p(Gtk::TreeView* tree_view, Gtk::TreeModel::Row row[m_columns.soft_limit_files] = obj_tv_g_u_p.soft_limit_files; row[m_columns.hard_limit_delay] = obj_tv_g_u_p.hard_limit_delay; row[m_columns.deferring_files] = obj_tv_g_u_p.deferring_files; + this->add_quota_show(name); } } diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index 3a9a0d2..e107f6d 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -9,6 +9,8 @@ #include "../var.h" #include "model/wrapper_load_save.h" #include "view_filters.h" +#include "view_add_user_group.h" +#include "view_edit_user_group.h" using namespace std; @@ -167,7 +169,9 @@ class MainWindow { map_str_str* map_global_cfg = NULL; map_str_str* map_system_cfg = NULL; Wrapper_load_save* obj_wrapper_load_save = NULL; + View_edit_user_group* obj_view_edit = NULL; View_filters* obj_view_filters = NULL; + View_add_user_group* obj_view_add = NULL; //Devices::Parted obj_device = Devices::Parted(); //Quotas_sys::Quotas_sys obj_quotas_sys = Quotas_sys::Quotas_sys(); //Quotas_ubconfig::Quotas_ubconfig obj_quotas_ubconfig = Quotas_ubconfig::Quotas_ubconfig(); @@ -215,7 +219,7 @@ class MainWindow { void init_tree_view(); void del_columns(); void set_obj_browser(View_open_browser* obj_open_browser); - void set_add_tv_g_u_p(Gtk::TreeView* tree_view, Gtk::TreeModel::Row &row, Glib::RefPtr& list_store, struct tv_g_u_p obj_tv_g_u_p); + void set_add_tv_g_u_p(string name, Gtk::TreeView* tree_view, Gtk::TreeModel::Row &row, Glib::RefPtr& list_store, struct tv_g_u_p obj_tv_g_u_p); void off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type); void mode_switch_quota(); void save_quotegroupSaveButton(); @@ -237,6 +241,10 @@ class MainWindow { void wrapper_save_global(); void set_obj_view_filters(View_filters* obj_view_filters); bool check_space(Gtk::TreeView* tree_view); + void set_obj_view_add(View_add_user_group* obj_view_edit); + void add_quota_show(string name); + void edit_quota_show(string name); + void set_obj_view_edit(View_edit_user_group* obj_view_edit); }; void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); void help(); diff --git a/source/view/view_add_project.cc b/source/view/view_add_project.cc new file mode 100644 index 0000000..2e9c7ff --- /dev/null +++ b/source/view/view_add_project.cc @@ -0,0 +1,52 @@ +#include "view_edit_user_group.h" + +View_edit_user_group::View_edit_user_group(/* args */) { + builder = Gtk::Builder::create_from_file(path_glade); + this->settings(); +} + +View_edit_user_group::~View_edit_user_group() +{ +} + +void View_edit_user_group::setting() { + this->get_builder(); + this->lacalization(); + + this->event(); +} + +void View_edit_user_group::event() { + +} + +void View_edit_user_group::show() { + +} + +void View_edit_user_group::get_builder() { + +} + +void View_edit_user_group::lacalization(); + + +void View_edit_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box) { + spin->set_sensitive(check_button->get_active()); + combo_box->set_sensitive(check_button->get_active()); +} +void View_edit_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box) { + spin->set_sensitive(check_button->get_active()); + combo_box->set_sensitive(check_button->get_active()); +} + +void View_edit_user_group::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { + cb_text->append(str_prefix_KB); + cb_text->append(str_prefix_MB); + cb_text->append(str_prefix_GB); + cb_text->append(str_prefix_TB); +} + +void View_edit_user_group::set_label_type_quota(string name) { + ->set_text(name); +} \ No newline at end of file diff --git a/source/view/view_add_project.h b/source/view/view_add_project.h new file mode 100644 index 0000000..880dc90 --- /dev/null +++ b/source/view/view_add_project.h @@ -0,0 +1,25 @@ +#ifndef VIEW_ADD_USER_GROUP_H +#define VIEW_ADD_USER_GROUP_H +#include "../project_lib.h" +#include "../var.h" +class View_edit_user_group +{ +private: + Glib::RefPtr builder; +public: + View_edit_user_group(/* args */); + ~View_edit_user_group(); + void setting(); + void event(); + void show(); + void get_builder(); + void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box); + void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box); + void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); + void set_label_type_quota(string name); +}; + + + + +#endif \ No newline at end of file diff --git a/source/view/view_set_user_group.cc b/source/view/view_add_user_group.cc similarity index 72% rename from source/view/view_set_user_group.cc rename to source/view/view_add_user_group.cc index 342b2ce..1ca34dc 100644 --- a/source/view/view_set_user_group.cc +++ b/source/view/view_add_user_group.cc @@ -1,15 +1,15 @@ -#include "view_set_user_group.h" +#include "view_add_user_group.h" -view_set_user_group::view_set_user_group(/* args */) { +View_add_user_group::View_add_user_group(/* args */) { builder = Gtk::Builder::create_from_file(path_glade); this->settings(); } -view_set_user_group::~view_set_user_group() { +View_add_user_group::~View_add_user_group() { } -void view_set_user_group::settings() { +void View_add_user_group::settings() { this->get_builder(); this->lacalization(); check_limit(quotegroupSizeSoftLimitCheck @@ -27,7 +27,7 @@ void view_set_user_group::settings() { this->event(); } -void view_set_user_group::event() { +void View_add_user_group::event() { quotegroupCancelButton->signal_clicked().connect([&]() {QuotasEditWindow->hide();}); quotegroupSaveButton->signal_clicked().connect([&]() {}); quotegroupSizeSoftLimitCheck->signal_toggled().connect([&]() { @@ -53,7 +53,7 @@ void view_set_user_group::event() { } -void view_set_user_group::get_builder() { +void View_add_user_group::get_builder() { builder->get_widget("lblSetDevice", lblSetDevice); builder->get_widget("lblQuotasStatus", lblQuotasStatus); builder->get_widget("lblSetUGP", lblSetUGP); @@ -87,11 +87,11 @@ void view_set_user_group::get_builder() { } -void view_set_user_group::show() { +void View_add_user_group::show() { QuotasEditWindow->show(); } -void lacalization() { +void View_add_user_group::lacalization() { lblSetDevice->set_text(str_device); lblQuotasStatus->set_text(str_quota_status); // lblSetUGP->set_text(""); @@ -108,46 +108,22 @@ void lacalization() { } -void MainWindow::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box) { +void View_add_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box) { spin->set_sensitive(check_button->get_active()); combo_box->set_sensitive(check_button->get_active()); } -void MainWindow::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box) { +void View_add_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box) { spin->set_sensitive(check_button->get_active()); combo_box->set_sensitive(check_button->get_active()); } -void MainWindow::edit_tree_view_U(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate) { - lblSetUGP->set_text(str_user_1); - set_change_gui(list_store, iter, flag_validate, usersDeviceCombo); -} - -void MainWindow::edit_tree_view_G(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate) { - lblSetUGP->set_text(str_group_1); - set_change_gui(list_store, iter, flag_validate, groupsDeviceCombo); -} - -void MainWindow::edit_tree_view_P(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate) { - lblSetUGP->set_text(str_project_1); - set_change_gui(list_store, iter, flag_validate, usersProjectCombo); -} - -void MainWindow::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { +void View_add_user_group::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { cb_text->append(str_prefix_KB); cb_text->append(str_prefix_MB); cb_text->append(str_prefix_GB); cb_text->append(str_prefix_TB); } -void MainWindow::set_change_gui(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate, Gtk::ComboBoxText *combo_box) { - if (flag_validate && (*list_store)->iter_is_valid(*(iter))) { - Gtk::TreeModel::Row row = *(*iter); - if(row) { - string name = row[m_columns.name] + ""; - lblSetNameDevice->set_text(combo_box->get_active_text()); - cmbSetNameUGP->set_active_text(name); - QuotasEditWindow->show(); - } - } - flag_validate = false; -} \ No newline at end of file +void View_add_user_group::set_label_type_quota(string name) { + lblSetUGP->set_text(name); +} diff --git a/source/view/view_set_user_group.h b/source/view/view_add_user_group.h similarity index 92% rename from source/view/view_set_user_group.h rename to source/view/view_add_user_group.h index fa025d4..27a4b99 100644 --- a/source/view/view_set_user_group.h +++ b/source/view/view_add_user_group.h @@ -2,12 +2,14 @@ #define VIEW_SET_USER_GROUP_H #include "../project_lib.h" #include "../var.h" -class view_set_user_group + +using namespace std; +class View_add_user_group { private: string str_path_glade; private: - Glib::RefPtr const& builder; + Glib::RefPtr builder; Gtk::Label* lblSetDevice; Gtk::Label* lblQuotasStatus; Gtk::Label* lblSetUGP; @@ -39,14 +41,15 @@ private: Gtk::CheckButton *quotegroupFilesSoftLimitCheck; Gtk::CheckButton *quotegroupFilesHardLimitCheck; public: - view_set_user_group(/* args */); - ~view_set_user_group(); + View_add_user_group(/* args */); + ~View_add_user_group(); void lacalization(); void event(); void get_builder(); void settings(); void show(); void set_path_glade(string str_path_glade); + void set_label_type_quota(string name); private: void set_change_gui(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate, Gtk::ComboBoxText *combo_box); void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); diff --git a/source/view/view_edit_project.cc b/source/view/view_edit_project.cc new file mode 100644 index 0000000..2e9c7ff --- /dev/null +++ b/source/view/view_edit_project.cc @@ -0,0 +1,52 @@ +#include "view_edit_user_group.h" + +View_edit_user_group::View_edit_user_group(/* args */) { + builder = Gtk::Builder::create_from_file(path_glade); + this->settings(); +} + +View_edit_user_group::~View_edit_user_group() +{ +} + +void View_edit_user_group::setting() { + this->get_builder(); + this->lacalization(); + + this->event(); +} + +void View_edit_user_group::event() { + +} + +void View_edit_user_group::show() { + +} + +void View_edit_user_group::get_builder() { + +} + +void View_edit_user_group::lacalization(); + + +void View_edit_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box) { + spin->set_sensitive(check_button->get_active()); + combo_box->set_sensitive(check_button->get_active()); +} +void View_edit_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box) { + spin->set_sensitive(check_button->get_active()); + combo_box->set_sensitive(check_button->get_active()); +} + +void View_edit_user_group::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { + cb_text->append(str_prefix_KB); + cb_text->append(str_prefix_MB); + cb_text->append(str_prefix_GB); + cb_text->append(str_prefix_TB); +} + +void View_edit_user_group::set_label_type_quota(string name) { + ->set_text(name); +} \ No newline at end of file diff --git a/source/view/view_edit_project.h b/source/view/view_edit_project.h new file mode 100644 index 0000000..880dc90 --- /dev/null +++ b/source/view/view_edit_project.h @@ -0,0 +1,25 @@ +#ifndef VIEW_ADD_USER_GROUP_H +#define VIEW_ADD_USER_GROUP_H +#include "../project_lib.h" +#include "../var.h" +class View_edit_user_group +{ +private: + Glib::RefPtr builder; +public: + View_edit_user_group(/* args */); + ~View_edit_user_group(); + void setting(); + void event(); + void show(); + void get_builder(); + void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box); + void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box); + void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); + void set_label_type_quota(string name); +}; + + + + +#endif \ No newline at end of file diff --git a/source/view/view_edit_user_group.cc b/source/view/view_edit_user_group.cc new file mode 100644 index 0000000..87bc1dd --- /dev/null +++ b/source/view/view_edit_user_group.cc @@ -0,0 +1,114 @@ +#include "view_edit_user_group.h" + +View_edit_user_group::View_edit_user_group(/* args */) { + builder = Gtk::Builder::create_from_file(path_glade); + this->setting(); +} + +View_edit_user_group::~View_edit_user_group() +{ +} + +void View_edit_user_group::setting() { + this->get_builder(); + this->lacalization(); + + this->event(); +} + +void View_edit_user_group::event() { + btnCancelEditUser->signal_clicked().connect([&]() {wndQuotasEditUser->hide();}); + btnSaveEditUser->signal_clicked().connect([&]() {}); + quotegroupSizeSoftLimitCheckUser->signal_toggled().connect([&]() { + check_limit(quotegroupSizeSoftLimitCheckUser + ,quotegroupSizeSoftLimitSpinUser + ,quotegroupSizeSoftLimitComboUser); + }); + quotegroupSizeHardLimitCheckUser->signal_toggled().connect([&]() { + check_limit(quotegroupSizeHardLimitCheckUser + ,quotegroupSizeHardLimitSpinUser + ,quotegroupSizeHardLimitComboUser); + }); + quotegroupFilesSoftLimitCheckUser->signal_toggled().connect([&]() { + check_limit(quotegroupFilesSoftLimitCheckUser + ,quotegroupFilesSoftLimitSpinUser + ,quotegroupFilesSoftLimitlabelUser); + }); + quotegroupFilesHardLimitCheckUser->signal_toggled().connect([&]() { + check_limit(quotegroupFilesHardLimitCheckUser + ,quotegroupFilesHardLimitSpinUser + ,quotegroupFilesHarLimitLabelUser); + }); +} + +void View_edit_user_group::get_builder() { + builder->get_widget("wndQuotasEditUser", wndQuotasEditUser); + builder->get_widget("btnCancelEditUser", btnCancelEditUser); + builder->get_widget("btnSaveEditUser", btnSaveEditUser); + builder->get_widget("quotegroupSizeSoftLimitCheckUser", quotegroupSizeSoftLimitCheckUser); + builder->get_widget("quotegroupSizeHardLimitCheckUser", quotegroupSizeHardLimitCheckUser); + builder->get_widget("quotegroupFilesSoftLimitCheckUser", quotegroupFilesSoftLimitCheckUser); + builder->get_widget("quotegroupFilesHardLimitCheckUser", quotegroupFilesHardLimitCheckUser); + builder->get_widget("quotegroupSizeSoftLimitSpinUser", quotegroupSizeSoftLimitSpinUser); + builder->get_widget("quotegroupSizeHardLimitSpinUser", quotegroupSizeHardLimitSpinUser); + builder->get_widget("quotegroupFilesSoftLimitSpinUser", quotegroupFilesSoftLimitSpinUser); + builder->get_widget("quotegroupFilesHardLimitSpinUser", quotegroupFilesHardLimitSpinUser); + builder->get_widget("quotegroupSizeSoftLimitComboUser", quotegroupSizeSoftLimitComboUser); + builder->get_widget("quotegroupSizeHardLimitComboUser", quotegroupSizeHardLimitComboUser); + builder->get_widget("quotegroupFilesSoftLimitlabelUser", quotegroupFilesSoftLimitlabelUser); + builder->get_widget("quotegroupFilesHarLimitLabelUser", quotegroupFilesHarLimitLabelUser); + builder->get_widget("quotegroupSizeSoftLimitLabelUser", quotegroupSizeSoftLimitLabelUser); + builder->get_widget("quotegroupFilesSoftLimitLabelUser", quotegroupFilesSoftLimitLabelUser); + builder->get_widget("quotegroupSizeCurrentlyLabelUser", quotegroupSizeCurrentlyLabelUser); + builder->get_widget("quotegroupFilesCurrentlyLabelUser", quotegroupFilesCurrentlyLabelUser); + builder->get_widget("quotegroupSizeFrameLabelUser", quotegroupSizeFrameLabelUser); + builder->get_widget("quotegroupFilesFrameLabelUser", quotegroupFilesFrameLabelUser); + builder->get_widget("lblSetDeviceUser", lblSetDeviceUser); + builder->get_widget("lblQuotasStatusUser", lblQuotasStatusUser); + builder->get_widget("lblSetUGPUser", lblSetUGPUser); + builder->get_widget("lblSetNameDeviceUser", lblSetNameDeviceUser); + builder->get_widget("lblSetQuotasStatusUser", lblSetQuotasStatusUser); + builder->get_widget("lblSetUGPUserValue", lblSetUGPUserValue); + builder->get_widget("lblHeadQuotasEditWindowUser", lblHeadQuotasEditWindowUser); + builder->get_widget("quoteSizeHardLimitLabel1", quoteSizeHardLimitLabel1); + builder->get_widget("quoteFilesHardLimitLabelUser", quoteFilesHardLimitLabelUser); +} + +void View_edit_user_group::lacalization() { + lblSetDeviceUser->set_text(str_device); + lblQuotasStatusUser->set_text(str_quota_status); + quotegroupSizeFrameLabelUser->set_text(str_size); + quotegroupFilesFrameLabelUser->set_text(str_files); + quotegroupSizeCurrentlyLabelUser->set_text(str_currently_using); + quotegroupSizeSoftLimitLabelUser->set_text(str_soft_limit); + quoteSizeHardLimitLabel1->set_text(str_hard_limit); + quoteFilesHardLimitLabelUser->set_text(str_hard_limit); + quotegroupFilesSoftLimitLabelUser->set_text(str_soft_limit); + quotegroupFilesCurrentlyLabelUser->set_text(str_currently_using); + this->fill_in_pow_memory(quotegroupSizeSoftLimitComboUser); + this->fill_in_pow_memory(quotegroupSizeHardLimitComboUser); +} + + +void View_edit_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box) { + spin->set_sensitive(check_button->get_active()); + combo_box->set_sensitive(check_button->get_active()); +} +void View_edit_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box) { + spin->set_sensitive(check_button->get_active()); + combo_box->set_sensitive(check_button->get_active()); +} + +void View_edit_user_group::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { + cb_text->append(str_prefix_KB); + cb_text->append(str_prefix_MB); + cb_text->append(str_prefix_GB); + cb_text->append(str_prefix_TB); +} + +void View_edit_user_group::set_label_type_quota(string name) { + lblSetUGPUser->set_text(name); +} +void View_edit_user_group::show() { + wndQuotasEditUser->show(); +} \ No newline at end of file diff --git a/source/view/view_edit_user_group.h b/source/view/view_edit_user_group.h new file mode 100644 index 0000000..696ceb4 --- /dev/null +++ b/source/view/view_edit_user_group.h @@ -0,0 +1,61 @@ +#ifndef VIEW_ADD_USER_GROUP_H +#define VIEW_ADD_USER_GROUP_H +#include "../project_lib.h" +#include "../var.h" +using namespace std; + +class View_edit_user_group +{ +private: + Glib::RefPtr builder; +private: + Gtk::Window* wndQuotasEditUser; + Gtk::Button* btnCancelEditUser; + Gtk::Button* btnSaveEditUser; + Gtk::CheckButton* quotegroupSizeSoftLimitCheckUser; + Gtk::CheckButton* quotegroupSizeHardLimitCheckUser; + Gtk::CheckButton* quotegroupFilesSoftLimitCheckUser; + Gtk::CheckButton* quotegroupFilesHardLimitCheckUser; + Gtk::SpinButton* quotegroupSizeSoftLimitSpinUser; + Gtk::SpinButton* quotegroupSizeHardLimitSpinUser; + Gtk::SpinButton* quotegroupFilesSoftLimitSpinUser; + Gtk::SpinButton* quotegroupFilesHardLimitSpinUser; + Gtk::ComboBoxText* quotegroupSizeSoftLimitComboUser; + Gtk::ComboBoxText* quotegroupSizeHardLimitComboUser; + Gtk::Label* quotegroupFilesSoftLimitlabelUser; + Gtk::Label* quotegroupFilesHarLimitLabelUser; + Gtk::Label* quotegroupSizeSoftLimitLabelUser; + Gtk::Label* quotegroupFilesSoftLimitLabelUser; + Gtk::Label* quotegroupSizeCurrentlyLabelUser; + Gtk::Label* quotegroupFilesCurrentlyLabelUser; + Gtk::Label* quotegroupSizeFrameLabelUser; + Gtk::Label* quotegroupFilesFrameLabelUser; + Gtk::Label* lblSetDeviceUser; + Gtk::Label* lblQuotasStatusUser; + Gtk::Label* lblSetUGPUser; + Gtk::Label* lblSetNameDeviceUser; + Gtk::Label* lblSetQuotasStatusUser; + Gtk::Label* lblSetUGPUserValue; + Gtk::Label* lblHeadQuotasEditWindowUser; + Gtk::Label* quoteSizeHardLimitLabel1; + Gtk::Label* quoteFilesHardLimitLabelUser; + + +public: + View_edit_user_group(/* args */); + ~View_edit_user_group(); + void setting(); + void event(); + void show(); + void get_builder(); + void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box); + void check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::Label *combo_box); + void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); + void set_label_type_quota(string name); + void lacalization(); +}; + + + + +#endif \ No newline at end of file diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 9ecaebd..4529d4b 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -1787,6 +1787,7 @@ 2 + False @@ -2808,7 +2809,9 @@ True False 5 + 5 5 + 5 0 @@ -2845,9 +2848,13 @@ True False + 5 + 5 + 5 + 5 - False + True True 1 @@ -3627,6 +3634,2218 @@ + + False + start + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + True + False + vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Device: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 1 + + + + + True + True + 0 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Status of quota use + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 1 + + + + + True + True + 1 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Catalog + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + + + True + True + 1 + + + + + True + True + True + 5 + 5 + 5 + 5 + + + True + False + + + True + False + gtk-zoom-fit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Review + + + False + True + 1 + + + + + + + True + True + 2 + + + + + False + True + 2 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Project ID + + + False + True + 0 + + + + + Auto + True + True + False + 5 + 5 + 5 + 5 + True + + + False + True + 1 + + + + + True + True + 5 + 5 + 5 + 5 + + + True + True + 2 + + + + + Generate + True + True + True + 5 + 5 + 5 + 5 + + + True + True + 3 + + + + + False + True + 3 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Project Name + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + + + True + True + 1 + + + + + False + True + 4 + + + + + False + True + 0 + + + + + True + False + True + + + True + False + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Currently using: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Soft limit + 0 + + + False + True + 1 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupSizeSoftLimitAdjustment + + + True + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 2 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Hard limit + 0 + + + False + True + 3 + + + + + True + False + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupSizeHardLimitAdjustment + + + True + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 4 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Size + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Currently using: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Soft limit + 0 + + + False + True + 1 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupFilesSoftLimitAdjustment + + + True + True + 1 + + + + + True + False + files + + + False + True + 2 + + + + + True + True + 2 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Hard limit + 0 + + + False + True + 3 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupFilesHardLimitAdjustment + + + True + True + 1 + + + + + True + False + files + + + False + True + 2 + + + + + True + True + 4 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Files + + + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + vertical + True + + + True + False + end + 5 + True + + + gtk-cancel + True + True + True + True + + + False + True + 0 + + + + + gtk-save + True + True + True + True + + + False + True + 1 + + + + + False + True + 0 + + + + + False + True + 2 + + + + + + + True + False + + + True + False + UBConfig - Quotas + + + + + True + False + 32 + com.ublinux.ubl-settings-diskquota + 5 + + + + + + + True + + + + + + + False + start + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + True + False + vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Device: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 1 + + + + + True + True + 0 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Status of quota use + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 1 + + + + + True + True + 1 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Catalog + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Project ID + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + False + True + 3 + + + + + True + False + + + True + False + 5 + 5 + 5 + 5 + Project Name + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + + + True + True + 1 + + + + + False + True + 4 + + + + + False + True + 0 + + + + + True + False + True + + + True + False + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Currently using: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Soft limit + 0 + + + False + True + 1 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupSizeSoftLimitAdjustment + + + True + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 2 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Hard limit + 0 + + + False + True + 3 + + + + + True + False + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupSizeHardLimitAdjustment + + + True + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 4 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Size + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Currently using: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Soft limit + 0 + + + False + True + 1 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupFilesSoftLimitAdjustment + + + True + True + 1 + + + + + True + False + files + + + False + True + 2 + + + + + True + True + 2 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Hard limit + 0 + + + False + True + 3 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupFilesHardLimitAdjustment + + + True + True + 1 + + + + + True + False + files + + + False + True + 2 + + + + + True + True + 4 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Files + + + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + vertical + True + + + True + False + end + 5 + True + + + gtk-cancel + True + True + True + True + + + False + True + 0 + + + + + gtk-save + True + True + True + True + + + False + True + 1 + + + + + False + True + 0 + + + + + False + True + 2 + + + + + + + True + False + + + True + False + UBConfig - Quotas + + + + + True + False + 32 + com.ublinux.ubl-settings-diskquota + 5 + + + + + + + False + start + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + True + False + vertical + + + True + False + + + True + False + Device: + + + False + True + 0 + + + + + True + False + 5 + 5 + + + True + True + 1 + + + + + True + True + 0 + + + + + True + False + + + True + False + Quota use status: + 0 + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 0 + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + + + True + False + UserGropProject: + 0 + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 1 + + + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + True + + + True + False + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Currently using: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Soft limit + 0 + + + False + True + 1 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupSizeSoftLimitAdjustment + + + True + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 2 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Hard limit + 0 + + + False + True + 3 + + + + + True + False + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupSizeHardLimitAdjustment + + + True + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + True + 4 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Size + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Currently using: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Soft limit + 0 + + + False + True + 1 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupFilesSoftLimitAdjustment + + + True + True + 1 + + + + + True + False + files + + + False + True + 2 + + + + + True + True + 2 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Hard limit + 0 + + + False + True + 3 + + + + + True + False + 5 + + + True + True + False + right + True + + + False + True + 0 + + + + + True + True + 0 + quotegroupFilesHardLimitAdjustment + + + True + True + 1 + + + + + True + False + files + + + False + True + 2 + + + + + True + True + 4 + + + + + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + Files + + + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + vertical + True + + + True + False + end + 5 + True + + + gtk-cancel + True + True + True + True + + + False + True + 0 + + + + + gtk-save + True + True + True + True + + + False + True + 1 + + + + + False + True + 0 + + + + + False + True + 2 + + + + + + + True + False + + + True + False + UBConfig - Quotas + + + + + True + False + 32 + com.ublinux.ubl-settings-diskquota + 5 + + + + + False start