From 098edef3d1bb6f1040a813f2935d60faae71561c Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Fri, 14 Apr 2023 11:23:29 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=83=20=D0=BF=D0=BE=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8E=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 2 + source/global_var.h | 3 + source/my_device.cc | 9 +- source/my_type.h | 16 ++++ source/save.cc | 44 ++++++++++ source/save.h | 43 ++++----- source/system_cmd_quotas.cc | 159 +++++++++++++++++++++++++++++++++ source/system_cmd_quotas.h | 29 ++++++ source/ubl-settings-quotas.cc | 161 +++++++++++++++++++++++++++++++++- source/ubl-settings-quotas.h | 33 +++++++ ubl-settings-quotas.glade | 134 +++++++++++++++++++++++++++- 11 files changed, 605 insertions(+), 28 deletions(-) create mode 100644 source/global_var.h create mode 100644 source/system_cmd_quotas.cc create mode 100644 source/system_cmd_quotas.h diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 73f1eb7..7c074b9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -18,6 +18,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin set(SOURCE_FILES ubl-settings-quotas.h ubl-settings-quotas.cc + system_cmd_quotas.cc + system_cmd_quotas.h my_device.h my_device.cc project_lib.h diff --git a/source/global_var.h b/source/global_var.h new file mode 100644 index 0000000..e88d924 --- /dev/null +++ b/source/global_var.h @@ -0,0 +1,3 @@ + +#include "project_lib.h" +#include "my_tupe.h" \ No newline at end of file diff --git a/source/my_device.cc b/source/my_device.cc index 5005baf..7dedf0c 100644 --- a/source/my_device.cc +++ b/source/my_device.cc @@ -9,16 +9,17 @@ namespace Devices { 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) { - dict_parted[key] = str_parted.substr(str_parted.find(" ") + 1, str_parted.length()); - } - else { - dict_parted[key] = ""; + value = str_parted.substr(str_parted.find(" ") + 1, str_parted.length()); + if (value.length()>0) { + dict_parted[key] = value; + } } } diff --git a/source/my_type.h b/source/my_type.h index 45c7148..cbf21fa 100644 --- a/source/my_type.h +++ b/source/my_type.h @@ -29,6 +29,22 @@ struct Mount { std::string dump; std::string pass; }; +struct partition_cmd { + string device; + string cmd; +}; +struct struct_quotas { + string device; + string cmd; + string type_quotas; + string name; +}; +struct status_quotas { + bool user; + bool group; + bool project; + bool status; +}; typedef struct users_grups USER_GRUPS; typedef map map_str_str; typedef map * map_s_s_ptr; diff --git a/source/save.cc b/source/save.cc index 584e7ea..7134507 100644 --- a/source/save.cc +++ b/source/save.cc @@ -152,4 +152,48 @@ void Save::save_all(string sections, string str_flag_save) { } } } +void Save::save_all_1(string sections, string str_flag_save) { + string key = ""; + string value = ""; + string cmd_all = "ubconfig --target " + str_flag_save + " set " + sections; + size_t len_start_cmd_all = cmd_all.length(); + string str_error = ""; + this->flag_no_save = true; + string cmd = ""; + string cmd_remove = ""; + for (const auto &iter: (*map_gui)) { + value = iter.second; + key = iter.first; + if (this->check_save(str_flag_save, key)) { + if (value.length() != 0) { + cmd_all += " " + key + "=\"" + value + "\""; + } + else if (value.length() == 0) { + cmd = "ubconfig --target " + str_flag_save + " remove " + sections + " " + key; + } + else { + cmd = ""; + } + if (cmd.length() != 0) { + process.call(cmd, ""); + this->flag_no_save = false; + str_error = process.get_cmd_error(); + if (str_error.length() != 0) { + this->vec_errors.push_back(str_error); + str_error = ""; + } + } + } + + } + if (len_start_cmd_all != cmd_all.length()) { + process.call(cmd, ""); + this->flag_no_save = false; + str_error = process.get_cmd_error(); + if (str_error.length() != 0) { + this->vec_errors.push_back(str_error); + str_error = ""; + } + } +} } diff --git a/source/save.h b/source/save.h index 5449b69..b5ed023 100644 --- a/source/save.h +++ b/source/save.h @@ -6,27 +6,28 @@ namespace Lib_save { class Save { -private: - std::map *map_global; - std::map *map_local; - std::map *map_gui; - vector vec_errors; - vector* vec_param_names; - My_Process::My_Process_system process = My_Process::My_Process_system(); - bool flag_no_save; -public: - void set_data_global(std::map &map_global); - void set_data_local(std::map &map_local); - void set_data_gui(std::map &map_gui); - bool check_save(string flag_save, string key_name); - bool get_state_save(); - int get_count_error(); - string get_cmd_error(); - void save_all(string sections, string str_flag_save); - void set_count_error(int count_error); - void set_vec_params(vector& vec_param_names); - void save(string sections, string str_flag_save) ; - vector get_error(); + private: + std::map *map_global; + std::map *map_local; + std::map *map_gui; + vector vec_errors; + vector* vec_param_names; + My_Process::My_Process_system process = My_Process::My_Process_system(); + bool flag_no_save; + public: + void set_data_global(std::map &map_global); + void set_data_local(std::map &map_local); + void set_data_gui(std::map &map_gui); + bool check_save(string flag_save, string key_name); + bool get_state_save(); + int get_count_error(); + string get_cmd_error(); + void save_all(string sections, string str_flag_save); + void save_all_1(string sections, string str_flag_save); + void set_count_error(int count_error); + void set_vec_params(vector& vec_param_names); + void save(string sections, string str_flag_save) ; + vector get_error(); }; } #endif \ No newline at end of file diff --git a/source/system_cmd_quotas.cc b/source/system_cmd_quotas.cc new file mode 100644 index 0000000..1b2ad1e --- /dev/null +++ b/source/system_cmd_quotas.cc @@ -0,0 +1,159 @@ +#include "system_cmd_quotas.h" + +namespace Quotas_sys { +Quotas_sys::Quotas_sys() { + map_hw_or_sw["ext2"] = "hw"; + map_hw_or_sw["ext3"] = "hw"; + map_hw_or_sw["nfs"] = "sw"; + map_hw_or_sw["NFS"] = "sw"; +} +void Quotas_sys::format_cmd_quotas_ubconfig(struct struct_quotas& _struct_quota) { + string key = "DISK_QUOTA["; + key += ":" + _struct_quota.device + "]"; + string value = _struct_quota.name + ":" + _struct_quota.cmd; + (*map_gui_cfg)[key] = value; +} + +void Quotas_sys::format_cmd_quotas_system(struct struct_quotas& _struct_quota) { + string key = "DISK_QUOTA["; + key += ":" + _struct_quota.device + "]"; + string value = _struct_quota.name + ":" + _struct_quota.cmd; + (*map_gui_cfg)[key] = value; +} + +void Quotas_sys::off_quota_ubconfig(Gtk::ComboBoxText* combo_box, string quota_type) { + string partition = combo_box->get_active_text(); + string key = "DISK_QUOTA[" + quota_type + ":" + partition + "]"; + string value = "disable"; + (*map_gui_cfg)[key] = value; +} + +void Quotas_sys::set_map_gui(map_str_str &map_gui) { + map_gui_cfg = &map_gui; +} + +bool Quotas_sys::check_on_quotas_system(string cmd) { + string response = obj_process_call.call_all_sections(cmd); + if (response.length() > 0) { + return true; + } + else { + return false; + } +} + +struct status_quotas Quotas_sys::check_on_quotas_system_2_hw(string params) { + string cmd = "quotaon -ugPvp " + params; + string response = obj_process_call.call_all_sections(cmd); + struct status_quotas status; + if (response.length() > 0 && response.find("Cannot find mountpoint for device ") == string::npos) { + status.status = true; + vector vec_str = Utils::split(response, '\n'); + string array_str[3] = {"group", "user", "project"}; + for (int index = 0; index < 3; index++) { + string u_g_p = array_str[index]; + for (const string& vec_u_g_p : vec_str) { + if (vec_u_g_p.find(u_g_p) != string::npos && vec_u_g_p.find("accounting") != string::npos ) { + if (index == 0) { + status.group = true; + } + else if (index == 1) { + status.user = true; + } + else if (index == 2) { + status.project = true; + } + } + else if (vec_u_g_p.find(u_g_p) != string::npos && vec_u_g_p.find("enforced") != string::npos){ + if (index == 0) { + status.group = false; + } + else if (index == 1) { + status.user = false; + } + else if (index == 2) { + status.project = false; + } + } + } + } + } + else { + status.group = false; + status.user = false; + status.project = false; + status.status = false; + } + return status; + +} +bool Quotas_sys::on_quota_hw(string partition, string cmd_hw, string cmd_sw) { + if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) { + if (map_hw_or_sw[partition] == "hw") { + obj_process_system.call(cmd_hw, ""); + obj_process_system.call("ubconfig set config SERVICESSTART+=,quotaon.service", ""); + return true; + } + else if (map_hw_or_sw[partition] == "sw") { + obj_process_system.call(cmd_sw, ""); + obj_process_system.call("ubconfig set config SERVICESSTART+=,quotaon.service", ""); + return true; + } + else{ + return false; + } + } + + return false; +} +bool Quotas_sys::on_quota_sw(string partition, int mode) { + if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) { + string cmd = ""; + if (mode == 0) { + cmd += "mount -vo remount,usrquota " + partition; + cmd += "quotacheck -ucm " + partition; + cmd += "quotaon -uv " + partition; + } + else if (mode == 1) { + cmd += "mount -vo remount,grpquota " + partition; + cmd += "quotacheck -gcm " + partition; + cmd += "quotaon -gv " + partition; + } + else if (mode == 2) { + cmd += "quotaon -ugPv " + partition; + } + else if (mode == 3) { + cmd += "quotaon -augPv"; + } + else { + return false; + } + cmd += "ubconfig set config SERVICESSTART+=,quotaon.service"; + obj_process_system.call(cmd, ""); + return true; + } + return false; + +} + +void Quotas_sys::off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type) { + string partition = combo_box->get_active_text(); + string cmd = ""; + if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) { + if (map_hw_or_sw[partition] == "hw") { + cmd = "tune2fs -Q ^" + quota_type + " " + partition; + } + else if (map_hw_or_sw[partition] == "sw") { + cmd = "quotaoff -u " + quota_type.substr(0,1) + " " + partition; + + } + else { + // TODO: + // Убрать после тестирования + throw "Опа цэ!"; + } + obj_process_system.call(cmd, ""); + } + +} +} \ No newline at end of file diff --git a/source/system_cmd_quotas.h b/source/system_cmd_quotas.h new file mode 100644 index 0000000..71d8f08 --- /dev/null +++ b/source/system_cmd_quotas.h @@ -0,0 +1,29 @@ +#ifndef SYSTEM_CMD_QUOTAS +#define SYSTEM_CMD_QUOTAS +#include "project_lib.h" +#include "my_type.h" +#include "my_process.h" +#include "util.h" + +namespace Quotas_sys { +class Quotas_sys { + public: + map_str_str map_hw_or_sw; + + map_str_str* map_gui_cfg; + My_Process::My_Process_system obj_process_system = My_Process::My_Process_system(); + My_Process::My_Process_call obj_process_call = My_Process::My_Process_call(); + public: + Quotas_sys(); + void set_map_gui(map_str_str &map_gui); + void format_cmd_quotas_ubconfig(struct struct_quotas& _struct_quota); + void format_cmd_quotas_system(struct struct_quotas& _struct_quota); + void off_quota_ubconfig(Gtk::ComboBoxText* combo_box, string quota_type); + void off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type); + bool check_on_quotas_system(string cmd); + struct status_quotas check_on_quotas_system_2_hw(string params); + bool on_quota_hw(string partition, string cmd_hw, string cmd_sw); + bool on_quota_sw(string partition, int mode); +}; +} +#endif \ No newline at end of file diff --git a/source/ubl-settings-quotas.cc b/source/ubl-settings-quotas.cc index aa38d13..da8eb3a 100755 --- a/source/ubl-settings-quotas.cc +++ b/source/ubl-settings-quotas.cc @@ -36,11 +36,26 @@ void MainWindow::settings() { this->filling_device_combo_box_template(generalDeviceCombo, map_device); this->filling_device_combo_box_template(groupsDeviceCombo, map_device); this->filling_device_combo_box_template(usersDeviceCombo, map_device); + this->filling_device_combo_box_template(quotegroupDeviceCombo, map_device); this->entry_combo_box_temp(generalDeviceCombo,lblFstypeGeneralSettings); this->entry_combo_box_temp(groupsDeviceCombo, lblFstypeGroups); this->entry_combo_box_temp(usersDeviceCombo, lblFstypeUsers); + this->entry_combo_box_temp(quotegroupDeviceCombo, lblEditWndFsys); this->init_tree_view(); this->init_spin_all(); + check_limit(quotegroupSizeSoftLimitCheck + ,quotegroupSizeSoftLimitSpin + ,quotegroupSizeSoftLimitCombo); + check_limit(quotegroupSizeHardLimitCheck + ,quotegroupSizeHardLimitSpin + ,quotegroupSizeHardLimitCombo); + check_limit(quotegroupFilesSoftLimitCheck + ,quotegroupFilesSoftLimitSpin + ,quotegroupFilesSoftLimitlabel); + check_limit(quotegroupFilesHardLimitCheck + ,quotegroupFilesHardLimitSpin + ,quotegroupFilesHarLimitLabel); + obj_quotas_sys.set_map_gui(map_gui_cfg); if (geteuid() == 0) { this->load_system_cfg(); this->load_global_cfg(); @@ -443,10 +458,29 @@ void MainWindow::get_builder() { builder->get_widget("generalUsersFilesHoursSpin", generalUsersFilesHoursSpin); builder->get_widget("generalUsersSizeMinuteSpin", generalUsersSizeMinuteSpin); builder->get_widget("generalUsersFilesMinutesSpin", generalUsersFilesMinutesSpin); - + builder->get_widget("lblEditWndFsys", lblEditWndFsys); + builder->get_widget("quotegroupSizeSoftLimitCheck", quotegroupSizeSoftLimitCheck); + builder->get_widget("quotegroupSizeHardLimitCheck", quotegroupSizeHardLimitCheck); + builder->get_widget("quotegroupFilesSoftLimitCheck", quotegroupFilesSoftLimitCheck); + builder->get_widget("quotegroupFilesHardLimitCheck", quotegroupFilesHardLimitCheck); + builder->get_widget("quotegroupSizeSoftLimitSpin", quotegroupSizeSoftLimitSpin); + builder->get_widget("quotegroupSizeSoftLimitCombo", quotegroupSizeSoftLimitCombo); + builder->get_widget("quotegroupSizeHardLimitSpin", quotegroupSizeHardLimitSpin); + builder->get_widget("quotegroupSizeHardLimitCombo", quotegroupSizeHardLimitCombo); + builder->get_widget("quotegroupFilesSoftLimitSpin", quotegroupFilesSoftLimitSpin); + builder->get_widget("quotegroupFilesSoftLimitlabel", quotegroupFilesSoftLimitlabel); + builder->get_widget("quotegroupFilesHardLimitSpin", quotegroupFilesHardLimitSpin); + builder->get_widget("quotegroupSaveButton", quotegroupSaveButton); + builder->get_widget("quotegroupCancelButton", quotegroupCancelButton); + builder->get_widget("quotegroupDeviceCombo", quotegroupDeviceCombo); + builder->get_widget("btnDeleteUserQuota", btnDeleteUserQuota); + builder->get_widget("btnDeleteGroupQuota", btnDeleteGroupQuota); } void MainWindow::event() { + quotegroupSaveButton->signal_clicked().connect([&]() {}); + btnDeleteGroupQuota->signal_clicked().connect([&]() {obj_quotas_sys.off_quota_ubconfig(groupsDeviceCombo, "grpquota");}); + btnDeleteUserQuota->signal_clicked().connect([&]() {obj_quotas_sys.off_quota_ubconfig(usersDeviceCombo, "usrquota");}); btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); @@ -461,12 +495,137 @@ void MainWindow::event() { generalDeviceCombo->signal_changed().connect([&]() {entry_combo_box_temp(generalDeviceCombo,lblFstypeGeneralSettings);}); groupsDeviceCombo->signal_changed().connect([&]() {entry_combo_box_temp(groupsDeviceCombo, lblFstypeGroups);}); usersDeviceCombo->signal_changed().connect([&]() {entry_combo_box_temp(usersDeviceCombo, lblFstypeUsers);}); + quotegroupDeviceCombo->signal_changed().connect([&]() {entry_combo_box_temp(quotegroupDeviceCombo, lblEditWndFsys);}); + quotegroupSizeSoftLimitCheck->signal_toggled().connect([&]() { + check_limit(quotegroupSizeSoftLimitCheck + ,quotegroupSizeSoftLimitSpin + ,quotegroupSizeSoftLimitCombo); + }); + quotegroupSizeHardLimitCheck->signal_toggled().connect([&]() { + check_limit(quotegroupSizeHardLimitCheck + ,quotegroupSizeHardLimitSpin + ,quotegroupSizeHardLimitCombo); + }); + quotegroupFilesSoftLimitCheck->signal_toggled().connect([&]() { + check_limit(quotegroupFilesSoftLimitCheck + ,quotegroupFilesSoftLimitSpin + ,quotegroupFilesSoftLimitlabel); + }); + quotegroupFilesHardLimitCheck->signal_toggled().connect([&]() { + check_limit(quotegroupFilesHardLimitCheck + ,quotegroupFilesHardLimitSpin + ,quotegroupFilesHarLimitLabel); + }); + quotegroupCancelButton->signal_clicked().connect([&]() {QuotasEditWindow->hide();}); + QuotasEditWindow->show(); +} + +string MainWindow::format_str_size(Gtk::SpinButton* spb, Gtk::ComboBoxText* combo_box) { + string value = ""; + int num = spb->get_value(); + int index = combo_box->get_active_row_number(); + value = to_string(num); + if (num == 0) { + return value; + } + if (index == 1) { + value += "M"; + } + else if (index == 2) { + value += "G"; + } + else if (index == 3) { + value += "T"; + } + return value; +} +void MainWindow::wrapper_settings_quotas_temp(string save_user_or_group) { + struct partition_cmd _struct_partition_cmd = this->wrapper_settings_quotas(); + string device = _struct_partition_cmd.device; + string cmd = _struct_partition_cmd.cmd; + string type_quotas = save_user_or_group; + string user = ""; + struct struct_quotas _struct_quota; + _struct_quota.device = device; + _struct_quota.cmd = cmd; + _struct_quota.type_quotas = type_quotas; + _struct_quota.name = user; + obj_quotas_sys.format_cmd_quotas_ubconfig(_struct_quota); + +} +void MainWindow::save_quotegroupSaveButton() { + if (sys_or_ubconfig == "ubconfig") { + if (save_user_or_group == "usrquota") { + this->wrapper_settings_quotas_temp(save_user_or_group); + } + else { + this->wrapper_settings_quotas_temp(save_user_or_group); + } + } + else { + if (save_user_or_group == "usrquota") { + + } + else { + + } + } +} + + + + + +struct partition_cmd MainWindow::wrapper_settings_quotas() { + string str_parted = quotegroupDeviceCombo->get_active_text(); + string value = ""; + if (quotegroupSizeSoftLimitCheck->get_active()) { + value = format_str_size(quotegroupSizeSoftLimitSpin, quotegroupSizeSoftLimitCombo); + value += ":"; + } + else { + value += "0:"; + } + if (quotegroupSizeHardLimitCheck->get_active()) { + value += format_str_size(quotegroupSizeHardLimitSpin, quotegroupSizeHardLimitCombo); + value += ":"; + } + else { + value += "0:"; + } + if (quotegroupFilesSoftLimitCheck->get_active()) { + value += to_string(quotegroupFilesSoftLimitSpin->get_value()); + value += ":"; + } + else { + value += "0:"; + } + if (quotegroupFilesHardLimitCheck->get_active()) { + value += to_string(quotegroupFilesHardLimitSpin->get_value()); + value += ":"; + } + else { + value += "0:"; + } + struct partition_cmd _struct_partition_cmd; + _struct_partition_cmd.device = str_parted; + _struct_partition_cmd.cmd = value; + return _struct_partition_cmd; } void MainWindow::groupsFilters_show() { FiltersWindow->show_all(); } +void MainWindow::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) { + spin->set_sensitive(check_button->get_active()); + combo_box->set_sensitive(check_button->get_active()); +} + void MainWindow::info_status_app(string stule) { Glib::RefPtr boxInfo = boxInfoError->get_style_context(); boxInfo->remove_class("boxInfoMessOK"); diff --git a/source/ubl-settings-quotas.h b/source/ubl-settings-quotas.h index 5f83161..978da6b 100644 --- a/source/ubl-settings-quotas.h +++ b/source/ubl-settings-quotas.h @@ -7,6 +7,7 @@ #include "my_process.h" #include "my_type.h" #include "my_device.h" +#include "system_cmd_quotas.h" extern int socket_ext_id_I; @@ -182,10 +183,29 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::SpinButton *generalUsersFilesHoursSpin; Gtk::SpinButton *generalUsersSizeMinuteSpin; Gtk::SpinButton *generalUsersFilesMinutesSpin; + Gtk::Label *lblEditWndFsys; + Gtk::CheckButton *quotegroupSizeSoftLimitCheck; + Gtk::CheckButton *quotegroupSizeHardLimitCheck; + Gtk::CheckButton *quotegroupFilesSoftLimitCheck; + Gtk::CheckButton *quotegroupFilesHardLimitCheck; + Gtk::SpinButton *quotegroupSizeSoftLimitSpin; + Gtk::SpinButton *quotegroupSizeHardLimitSpin; + Gtk::SpinButton *quotegroupFilesSoftLimitSpin; + Gtk::SpinButton *quotegroupFilesHardLimitSpin; + Gtk::Label *quotegroupFilesSoftLimitlabel; + Gtk::ComboBoxText *quotegroupSizeSoftLimitCombo; + Gtk::ComboBoxText *quotegroupSizeHardLimitCombo; + Gtk::Button *quotegroupCancelButton; + Gtk::Button *quotegroupSaveButton; + Gtk::ComboBoxText *quotegroupDeviceCombo; + Gtk::Button *btnDeleteUserQuota; + Gtk::Button *btnDeleteGroupQuota; + public: Lib_save::Save obj_save = Lib_save::Save(); Lib_Load::Load obj_load = Lib_Load::Load(); Devices::Parted obj_device = Devices::Parted(); + Quotas_sys::Quotas_sys obj_quotas_sys = Quotas_sys::Quotas_sys(); My_Process::My_Process_system obj_process_system = My_Process::My_Process_system(); My_Process::My_Process_call obj_process_call = My_Process::My_Process_call(); map_str_str map_gui_cfg; @@ -194,6 +214,9 @@ class MainWindow : public Gtk::ApplicationWindow { vector vec_param_names; map_str_str map_device; string str_cmd_error; + string save_user_or_group; + string sys_or_ubconfig; + string hw_or_sw = ""; public: MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder); MainWindow(Glib::RefPtr const& builder); @@ -211,17 +234,27 @@ class MainWindow : public Gtk::ApplicationWindow { void init_tree_view(); void load_template(map_str_str* map_temp, string str_load); void info_warning_error(int mess); + void off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type); void wrapper_save_system_cfg(); void wrapper_save_global_cfg(); + string format_str_size(Gtk::SpinButton* spb, Gtk::ComboBoxText* combo_box); void wrapper_save_all_cfg(); void init_dict(string flag_load); void set_data_cfg(); + void save_quotegroupSaveButton(); + void wrapper_settings_quotas_temp(string save_user_or_group); + void off_quota_ubconfig(Gtk::ComboBoxText* combo_box, string quota_type); void init_spin_all(); + void format_cmd_quotas_system(struct struct_quotas& _struct_quota); + void format_cmd_quotas_ubconfig(struct struct_quotas& _struct_quota); void load_global_cfg(); void load_system_cfg(); + struct partition_cmd wrapper_settings_quotas(); void filling_device_combo_box_template(Gtk::ComboBoxText *combo_box, map_str_str &map_device); bool save_template(string section, string flag_save); void view_add_columns(Gtk::TreeView &treeView); + 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); }; diff --git a/ubl-settings-quotas.glade b/ubl-settings-quotas.glade index bcb7715..2e6b382 100644 --- a/ubl-settings-quotas.glade +++ b/ubl-settings-quotas.glade @@ -1807,6 +1807,24 @@ 4 + + + gtk-remove + True + True + True + 5 + 5 + 5 + 5 + True + + + False + True + 5 + + False @@ -1926,6 +1944,24 @@ 4 + + + gtk-remove + True + True + True + 5 + 5 + 5 + 5 + True + + + False + True + 5 + + False @@ -2261,6 +2297,12 @@ True False + 5 + 5 + 5 + 5 + 6 + 6 Device: @@ -2270,10 +2312,15 @@ - + True False - DeviceStore + 6 + 5 + 5 + 5 + 6 + 6 True @@ -2286,6 +2333,12 @@ True False start + 6 + 5 + 5 + 5 + 6 + 6 File system: 0 @@ -2295,6 +2348,23 @@ 2 + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + + + False + True + 3 + + False @@ -2306,6 +2376,12 @@ True False + 6 + 5 + 5 + 5 + 6 + 6 Disk quotas for this device: 0 @@ -2319,6 +2395,12 @@ True False + 6 + 5 + 5 + 5 + 6 + 6 Group quotas for this device: 0 @@ -2368,6 +2450,12 @@ True False + 5 + 5 + 5 + 5 + 6 + 6 Currently using: @@ -2380,6 +2468,12 @@ True False + 6 + 5 + 5 + 5 + 6 + 6 Soft limit 0 @@ -2448,6 +2542,12 @@ True False + 6 + 5 + 5 + 5 + 6 + 6 Hard limit 0 @@ -2521,6 +2621,12 @@ True False + 6 + 5 + 5 + 5 + 6 + 6 Size @@ -2559,6 +2665,12 @@ True False + 5 + 5 + 6 + 5 + 6 + 6 Currently using: @@ -2571,6 +2683,12 @@ True False + 5 + 5 + 5 + 5 + 6 + 6 Soft limit 0 @@ -2634,6 +2752,12 @@ True False + 5 + 5 + 5 + 5 + 6 + 6 Hard limit 0 @@ -2701,6 +2825,12 @@ True False + 5 + 5 + 5 + 5 + 6 + 6 Files