From 960ae5e2e66aa1d21c44611f9a7db195c1eb5a86 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 10 May 2023 10:43:55 +0600 Subject: [PATCH 01/26] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=BD=D1=83=D0=B6=D0=BD=D1=8B=D0=B9=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-diskquota.cc | 30 -- source/ubl-settings-diskquota.h | 16 - ubl-settings-diskquota.glade | 575 ------------------------------- 3 files changed, 621 deletions(-) diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index 934db65..7c93043 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -235,20 +235,6 @@ void MainWindow::lacalization() { quoteFilesHardLimitLabel->set_text(str_hard_limit); quotegroupFilesSoftLimitLabel->set_text(str_soft_limit); quotegroupFilesCurrentlyLabel->set_text(str_currently_using); - quoteuserDiskQuotasLabel->set_text(str_disk_quotas_device); - quoteuserDeviceLabel->set_text(str_device); - quoteuserGroupQuotasLabel->set_text(str_user_quotas_device); - quoteuserSizeFrameLabel->set_text(str_size); - quoteuserSizeCurrentlyLabel->set_text(str_currently_using); - quoteuserSizeSoftLimitLabel->set_text(str_soft_limit); - quoteuserSizeHardLimitLabel1->set_text(str_hard_limit); - quoteuserFileSystemLabel->set_text(str_file_system); - quoteuserFilesFrameLabel->set_text(str_files); - quoteuserFilesCurrentlyLabel->set_text(str_currently_using_space); - quoteuserFilesSoftLimitLabel->set_text(str_soft_limit); - quoteFilesHardLimitLabel1->set_text(str_hard_limit); - quoteuserFilesHarLimitLabel->set_text(str_files); - quoteuserFilesSoftLimitlabel->set_text(str_files); quotegroupFileSystemLabel->set_text(str_file_system); btnLoadGlob->set_label(load_global); btnLoadLocal->set_label(load_local); @@ -426,24 +412,8 @@ void MainWindow::get_builder() { builder->get_widget("quotegroupFilesSoftLimitLabel", quotegroupFilesSoftLimitLabel); builder->get_widget("quoteFilesHardLimitLabel", quoteFilesHardLimitLabel); builder->get_widget("quotegroupFilesHarLimitLabel", quotegroupFilesHarLimitLabel); - builder->get_widget("quoteuserDeviceLabel", quoteuserDeviceLabel); - builder->get_widget("quoteuserFileSystemLabel", quoteuserFileSystemLabel); - builder->get_widget("quoteuserDiskQuotasLabel", quoteuserDiskQuotasLabel); - builder->get_widget("quoteuserGroupQuotasLabel", quoteuserGroupQuotasLabel); - builder->get_widget("quoteuserSizeFrameLabel", quoteuserSizeFrameLabel); - builder->get_widget("quoteuserSizeCurrentlyLabel", quoteuserSizeCurrentlyLabel); - builder->get_widget("quoteuserSizeSoftLimitLabel", quoteuserSizeSoftLimitLabel); - builder->get_widget("quoteuserSizeHardLimitLabel1", quoteuserSizeHardLimitLabel1); - builder->get_widget("quoteuserFilesFrameLabel", quoteuserFilesFrameLabel); - builder->get_widget("quoteuserFilesCurrentlyLabel", quoteuserFilesCurrentlyLabel); - builder->get_widget("quoteuserFilesSoftLimitLabel", quoteuserFilesSoftLimitLabel); - builder->get_widget("quoteFilesHardLimitLabel1", quoteFilesHardLimitLabel1); - builder->get_widget("quoteuserFilesHarLimitLabel", quoteuserFilesHarLimitLabel); - builder->get_widget("quoteuserFilesSoftLimitlabel", quoteuserFilesSoftLimitlabel); builder->get_widget("QuotasEditWindow", QuotasEditWindow); - builder->get_widget("QuotasUserEditWindow", QuotasUserEditWindow); builder->get_widget("headerAboutTopic", headerAboutTopic); - builder->get_widget("lblHeadQuotasUserEditWindow", lblHeadQuotasUserEditWindow); builder->get_widget("lblHeadQuotasEditWindow", lblHeadQuotasEditWindow); builder->get_widget("lblHeadFiltersWindow", lblHeadFiltersWindow); builder->get_widget("usersDeviceCombo", usersDeviceCombo); diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 29bff7b..cc5ac49 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -277,25 +277,9 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label *quotegroupFilesSoftLimitLabel; Gtk::Label *quoteFilesHardLimitLabel; Gtk::Label *quotegroupFilesHarLimitLabel; - Gtk::Label *quoteuserDeviceLabel; - Gtk::Label *quoteuserDiskQuotasLabel; - Gtk::Label *quoteuserFileSystemLabel; - Gtk::Label *quoteuserGroupQuotasLabel; - Gtk::Label *quoteuserSizeFrameLabel; - Gtk::Label *quoteuserSizeCurrentlyLabel; - Gtk::Label *quoteuserSizeSoftLimitLabel; - Gtk::Label *quoteuserSizeHardLimitLabel1; - Gtk::Label *quoteuserFilesCurrentlyLabel; - Gtk::Label *quoteuserFilesSoftLimitLabel; - Gtk::Label *quoteFilesHardLimitLabel1; - Gtk::Label *quoteuserFilesHarLimitLabel; - Gtk::Label *quoteuserFilesFrameLabel; Gtk::Label *quotegroupSizeSoftLimitLabel; - Gtk::Label *quoteuserFilesSoftLimitlabel; - Gtk::Window *QuotasUserEditWindow; Gtk::Window *QuotasEditWindow; Gtk::Label *headerAboutTopic; - Gtk::Label *lblHeadQuotasUserEditWindow; Gtk::Label *lblHeadQuotasEditWindow; Gtk::Label *lblHeadFiltersWindow; Gtk::ComboBoxText *usersDeviceCombo; diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index c1e0c5e..0b369d1 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -3682,581 +3682,6 @@ 1 10 - - False - start - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - vertical - - - True - False - vertical - 5 - - - True - False - 5 - - - True - False - Device: - - - False - True - 0 - - - - - True - False - DeviceStore - - - True - True - 1 - - - - - True - False - start - File system: - 0 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - Disk quotas for this device: - 0 - - - False - True - 1 - - - - - True - False - User quotas for this device: - 0 - - - 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 - Currently using: - - - False - True - 0 - - - - - True - False - Soft limit - 0 - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - right - True - - - False - True - 0 - - - - - True - True - quoteuserSizeSoftLimitAdjustment - - - True - True - 1 - - - - - True - False - - Kb - Mb - Gb - Tb - - - - False - True - 2 - - - - - True - True - 2 - - - - - True - False - Hard limit - 0 - - - False - True - 3 - - - - - True - False - False - 5 - - - True - True - False - right - True - - - False - True - 0 - - - - - True - True - quoteuserSizeHardLimitAdjustment - - - True - True - 1 - - - - - True - False - - Kb - Mb - Gb - Tb - - - - False - True - 2 - - - - - True - True - 4 - - - - - - - - - True - False - 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 - Currently using: - - - False - True - 0 - - - - - True - False - Soft limit - 0 - - - False - True - 1 - - - - - True - False - 5 - - - True - True - False - right - True - - - False - True - 0 - - - - - True - True - quoteuserFilesSoftLimitAdjustment - - - True - True - 1 - - - - - True - False - files - - - False - True - 2 - - - - - True - True - 2 - - - - - True - False - Hard limit - 0 - - - False - True - 3 - - - - - True - False - 5 - - - True - True - False - right - True - - - False - True - 0 - - - - - True - True - quoteuserFilesHardLimitAdjustment - - - True - True - 1 - - - - - True - False - files - - - False - True - 2 - - - - - True - True - 4 - - - - - - - - - True - False - Files - - - - - True - True - 1 - - - - - False - True - 1 - - - - - True - False - 5 - vertical - True - - - True - False - end - 5 - True - - - gtk-cancel - True - True - True - 5 - 5 - True - - - False - True - 0 - - - - - gtk-save - True - True - True - 5 - 5 - 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 From e07e6e4de2742f846f0dfae05d6cd287b99fbe53 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 10 May 2023 11:00:21 +0600 Subject: [PATCH 02/26] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=BA=D0=BD=D0=BE=20=D1=84?= =?UTF-8?q?=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-diskquota.cc | 13 ++++--------- source/ubl-settings-diskquota.h | 5 ++--- ubl-settings-diskquota.glade | 31 +------------------------------ 3 files changed, 7 insertions(+), 42 deletions(-) diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index 7c93043..c5f36d5 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -218,12 +218,10 @@ void MainWindow::lacalization() { filtersSoftSizeFilterCheckbox->set_label(str_soft_limit_size); filtersHardSizeFilterCheckbox->set_label(str_hard_limit_size); filtersHardSizeDelayFilterCheckbox->set_label(str_deferring_hard_limit_size); - filtersHardSizeActivationFilterCheckbox->set_label(str_hard_activation_size); filtersFilesFilterCheckbox->set_label(str_files); filtersSoftFilesFilterCheckbox->set_label(str_soft_restriction_files); filtersHardFilesFilterCheckbox->set_label(str_severe_limitation_files); filtersHardFilesDelayFilterCheckbox->set_label(str_deferring_limit_files); - filtersHardFilesActivationFilterCheckbox->set_label(str_hard_limit_time); quotegroupDeviceLabel->set_text(str_device); quotegroupDiskQuotasLabel->set_text(str_disk_quotas_device); quotegroupGroupQuotasLabel->set_text(str_group_quotas_device); @@ -382,13 +380,10 @@ void MainWindow::get_builder() { builder->get_widget("filtersSoftSizeFilterCheckbox", filtersSoftSizeFilterCheckbox); builder->get_widget("filtersHardSizeFilterCheckbox", filtersHardSizeFilterCheckbox); builder->get_widget("filtersHardSizeDelayFilterCheckbox", filtersHardSizeDelayFilterCheckbox); - builder->get_widget("filtersHardSizeActivationFilterCheckbox", filtersHardSizeActivationFilterCheckbox); builder->get_widget("filtersFilesFilterCheckbox", filtersFilesFilterCheckbox); builder->get_widget("filtersSoftFilesFilterCheckbox", filtersSoftFilesFilterCheckbox); builder->get_widget("filtersHardFilesFilterCheckbox", filtersHardFilesFilterCheckbox); builder->get_widget("filtersHardFilesDelayFilterCheckbox", filtersHardFilesDelayFilterCheckbox); - builder->get_widget("filtersHardFilesActivationFilterCheckbox", filtersHardFilesActivationFilterCheckbox); - builder->get_widget("filtersHardFilesActivationFilterCheckbox", filtersHardFilesActivationFilterCheckbox); builder->get_widget("btnLoadGlob", btnLoadGlob); builder->get_widget("btnLoadLocal", btnLoadLocal); builder->get_widget("btnSynopsis", btnSynopsis); @@ -483,9 +478,9 @@ void MainWindow::event() { btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();}); chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;}); btnReadHelp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_browser)); - btnFilterGroups->signal_clicked().connect([&]() {this->groupsFilters_show();}); - btnFilterUsers->signal_clicked().connect([&]() {this->groupsFilters_show();}); - btnFilterProject->signal_clicked().connect([&]() {this->groupsFilters_show();}); + btnFilterGroups->signal_clicked().connect([&]() {this->filters_show();}); + btnFilterUsers->signal_clicked().connect([&]() {this->filters_show();}); + btnFilterProject->signal_clicked().connect([&]() {this->filters_show();}); quotegroupSaveButton->signal_clicked().connect([&]() {}); btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); @@ -651,7 +646,7 @@ struct partition_cmd MainWindow::wrapper_settings_quotas() { return _struct_partition_cmd; } -void MainWindow::groupsFilters_show() { +void MainWindow::filters_show() { FiltersWindow->show_all(); } diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index cc5ac49..82a4d95 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -259,8 +259,7 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::CheckButton *filtersFilesFilterCheckbox; Gtk::CheckButton *filtersSoftFilesFilterCheckbox; Gtk::CheckButton *filtersHardFilesFilterCheckbox; - Gtk::CheckButton *filtersHardFilesDelayFilterCheckbox; - Gtk::CheckButton *filtersHardFilesActivationFilterCheckbox; + Gtk::CheckButton *filtersHardFilesDelayFilterCheckbox; Gtk::TreeView *groupsQuotasTree; Gtk::TreeView *usersQuotasTree; Gtk::TreeView *ProjectQuotasTree; @@ -389,7 +388,7 @@ class MainWindow : public Gtk::ApplicationWindow { void entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label); void synopsis_show(); void info_status_app(string stule); - void groupsFilters_show(); + void filters_show(); void init_tree_view(); void template_open_browser(); void open_browser(); diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 0b369d1..32bb829 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -141,21 +141,7 @@ False True - 5 - - - - - Hard limit (size) activation time - True - True - False - start - True - - - False - True + end 5 @@ -234,21 +220,6 @@ 10 - - - Hard limit (file) activation time - True - True - False - start - True - - - False - True - 11 - - From 2be07da34fa96df79e7a1509700707ac99b35160 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 10 May 2023 14:03:05 +0600 Subject: [PATCH 03/26] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=83=20=D1=81=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/load.cc | 9 +- source/load.h | 1 - source/save.cc | 92 +++++---------------- source/save.h | 50 +++++------ source/ubl-settings-diskquota.cc | 138 ++++++++++--------------------- source/ubl-settings-diskquota.h | 19 +++-- ubl-settings-diskquota.glade | 117 ++++++++++++-------------- 7 files changed, 156 insertions(+), 270 deletions(-) diff --git a/source/load.cc b/source/load.cc index 200c4b3..77873dc 100644 --- a/source/load.cc +++ b/source/load.cc @@ -1,21 +1,16 @@ #include "load.h" namespace Lib_Load{ - void Load::set_sections(string sections){ - this->sections = sections; - } void Load::set_count_error(int count_error) { process.set_count_error(count_error); } string Load::get_cmd_error() { return process.get_cmd_error(); } - map& Load::get_load_data(std::map &map_temp, string str_flag_load) { - string cmd = ""; + map& Load::get_load_data(std::map &map_temp, string cmd) { string response = ""; string key = ""; string value = ""; - cmd = "ubconfig --default --source " + str_flag_load + " get " + this->sections; response = process.call_all_sections(cmd); vector vec_str_key_value = Utils::split(response, '\n'); for (const string ¶m: vec_str_key_value) { @@ -36,4 +31,4 @@ namespace Lib_Load{ return process.get_count_error(); } -} +} \ No newline at end of file diff --git a/source/load.h b/source/load.h index 26aaf96..b4d4a38 100644 --- a/source/load.h +++ b/source/load.h @@ -9,7 +9,6 @@ namespace Lib_Load{ string sections; My_Process::My_Process_call process = My_Process::My_Process_call(); public: - void set_sections(string sections); int get_count_error(); void set_count_error(int count_error); string get_cmd_error(); diff --git a/source/save.cc b/source/save.cc index 7134507..c824093 100644 --- a/source/save.cc +++ b/source/save.cc @@ -107,93 +107,45 @@ void Save::save(string sections, string str_flag_save) { } } -void Save::save_all(string sections, string str_flag_save) { +void Save::save_one_cmd(string cmd1, string cmd_remove, 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 = ""; + this->flag_no_save = true; + cmd = cmd1; + string remove = cmd_remove; for (const auto &key: *vec_param_names) { if (map_gui->find(key) != map_gui->end()) { value = (*map_gui)[key]; if (this->check_save(str_flag_save, key)) { if (value.length() != 0) { - cmd_all += " " + key + "=\"" + value + "\""; + cmd = cmd + 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 = ""; - } + remove = remove + key + " "; } + } } - } - 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 = ""; - } + if (cmd.length() != cmd1.length()) { + this->template_save(cmd); + } + if (cmd_remove.length() != remove.length()) { + this->template_save(remove); } } -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(); + +void Save::template_save(string cmd) { 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 = ""; - } + 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 b5ed023..d6c8c04 100644 --- a/source/save.h +++ b/source/save.h @@ -1,33 +1,33 @@ -#ifndef SAVE_H -#define SAVE_H +#ifndef MY_SAVE_H +#define MY_SAVE_H #include "my_process.h" -#include "project_lib.h" 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 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(); +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; + void template_save(string cmd); +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(); + + void save_one_cmd(string cmd1, string cmd_remove, string str_flag_save); + int get_count_error(); + string get_cmd_error(); + 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/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index c5f36d5..e335c66 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -30,7 +30,6 @@ void MainWindow::settings() { map_device = obj_device.get_parted(); 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->init_tree_view(); this->init_spin_all(); check_limit(quotegroupSizeSoftLimitCheck @@ -47,6 +46,17 @@ void MainWindow::settings() { ,quotegroupFilesHarLimitLabel); obj_quotas_sys.set_map_gui(map_gui_cfg); obj_quotas_ubconfig.set_map_gui(map_gui_cfg); + filtersNameFilterCheckbox->set_active(true); + filtersQuotasFilterCheckbox->set_active(true); + filtersSizeFilterCheckbox->set_active(true); + filtersSoftSizeFilterCheckbox->set_active(true); + filtersHardSizeFilterCheckbox->set_active(true); + filtersHardSizeDelayFilterCheckbox->set_active(true); + filtersFilesFilterCheckbox->set_active(true); + filtersSoftFilesFilterCheckbox->set_active(true); + filtersHardFilesFilterCheckbox->set_active(true); + filtersHardFilesDelayFilterCheckbox->set_active(true); + #ifdef WEBKIT_FOUND one = WEBKIT_WEB_VIEW( webkit_web_view_new() ); three = Glib::wrap(GTK_WIDGET(one)); @@ -187,7 +197,6 @@ void MainWindow::lacalization() { headerAboutTopic->set_label(_(app_name)); headerTopic->set_label(name_app); UsersTabLabel->set_text(str_users); - generalGroupsSizeLabel->set_text(str_excess_size_delay); generalGroupsFilesLabel->set_text(str_excess_files_delay); generalUsersSizeLabel->set_text(str_excess_size_delay); generalUsersFilesLabel->set_text(str_excess_files_delay); @@ -222,9 +231,6 @@ void MainWindow::lacalization() { filtersSoftFilesFilterCheckbox->set_label(str_soft_restriction_files); filtersHardFilesFilterCheckbox->set_label(str_severe_limitation_files); filtersHardFilesDelayFilterCheckbox->set_label(str_deferring_limit_files); - quotegroupDeviceLabel->set_text(str_device); - quotegroupDiskQuotasLabel->set_text(str_disk_quotas_device); - quotegroupGroupQuotasLabel->set_text(str_group_quotas_device); quotegroupSizeFrameLabel->set_text(str_size); quotegroupFilesFrameLabel->set_text(str_files); quotegroupSizeCurrentlyLabel->set_text(str_currently_using); @@ -233,7 +239,6 @@ void MainWindow::lacalization() { quoteFilesHardLimitLabel->set_text(str_hard_limit); quotegroupFilesSoftLimitLabel->set_text(str_soft_limit); quotegroupFilesCurrentlyLabel->set_text(str_currently_using); - quotegroupFileSystemLabel->set_text(str_file_system); btnLoadGlob->set_label(load_global); btnLoadLocal->set_label(load_local); btnAbout->set_label(str_about_1); @@ -346,7 +351,6 @@ void MainWindow::get_builder() { builder->get_widget("generalTabLabel", generalTabLabel); builder->get_widget("GroupsTabLabel", GroupsTabLabel); builder->get_widget("UsersTabLabel", UsersTabLabel); - builder->get_widget("generalGroupsSizeLabel", generalGroupsSizeLabel); builder->get_widget("generalGroupsFilesLabel", generalGroupsFilesLabel); builder->get_widget("generalUsersSizeLabel", generalUsersSizeLabel); builder->get_widget("generalUsersFilesLabel", generalUsersFilesLabel); @@ -394,10 +398,6 @@ void MainWindow::get_builder() { builder->get_widget("GroupsTabLabel", GroupsTabLabel); builder->get_widget("groupsQuotasTree", groupsQuotasTree); builder->get_widget("usersQuotasTree", usersQuotasTree); - builder->get_widget("quotegroupDeviceLabel", quotegroupDeviceLabel); - builder->get_widget("quotegroupFileSystemLabel", quotegroupFileSystemLabel); - builder->get_widget("quotegroupDiskQuotasLabel", quotegroupDiskQuotasLabel); - builder->get_widget("quotegroupGroupQuotasLabel", quotegroupGroupQuotasLabel); builder->get_widget("quotegroupSizeFrameLabel", quotegroupSizeFrameLabel); builder->get_widget("quotegroupFilesFrameLabel", quotegroupFilesFrameLabel); builder->get_widget("quotegroupSizeCurrentlyLabel", quotegroupSizeCurrentlyLabel); @@ -431,7 +431,6 @@ 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); @@ -445,7 +444,6 @@ void MainWindow::get_builder() { builder->get_widget("quotegroupFilesHardLimitSpin", quotegroupFilesHardLimitSpin); builder->get_widget("quotegroupSaveButton", quotegroupSaveButton); builder->get_widget("quotegroupCancelButton", quotegroupCancelButton); - builder->get_widget("quotegroupDeviceCombo", quotegroupDeviceCombo); builder->get_widget("GeneralQuotasTree", GeneralQuotasTree); builder->get_widget("ProjectQuotasTree", ProjectQuotasTree); builder->get_widget("ProjectTabLabel", ProjectTabLabel); @@ -471,6 +469,9 @@ void MainWindow::get_builder() { builder->get_widget("btnAddGroups", btnAddGroups); builder->get_widget("btnAddUsers", btnAddUsers); builder->get_widget("btnAddProject", btnAddProject); + builder->get_widget("btnEditProject", btnEditProject); + builder->get_widget("btnEditUsers", btnEditUsers); + builder->get_widget("btnEditGroups", btnEditGroups); } @@ -490,7 +491,6 @@ void MainWindow::event() { btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system_cfg();}); chbMangSystemFile->signal_toggled().connect([&]() {this->mode_switch_quota();}); - quotegroupDeviceCombo->signal_changed().connect([&]() {entry_combo_box_temp(quotegroupDeviceCombo, lblEditWndFsys);}); quotegroupSizeSoftLimitCheck->signal_toggled().connect([&]() { check_limit(quotegroupSizeSoftLimitCheck ,quotegroupSizeSoftLimitSpin @@ -531,8 +531,26 @@ void MainWindow::event() { btnAddGroups->signal_clicked().connect( sigc::bind, struct tv_g_u_p> (sigc::mem_fun( *this, &MainWindow::set_add_tv_g_u_p), row, list_store_groups, obj_tv_g_u_p)); - - + + filtersNameFilterCheckbox->signal_toggled().connect(sigc::mem_fun( *this, + &MainWindow::del_columns)); + // btnEditProject->signal_clicked().connect(); + // btnEditUsers->signal_clicked().connect(); + // btnEditGroups->signal_clicked().connect(); +} + +/* +void MainWindow::set_tree_view(Gtk::TreeView *tree_view, Glib::RefPtr* list_store, bool& flag_validate_del) { + if (flag_validate_del && (*list_store)->iter_is_valid(*(iter))) { + Gtk::TreeModel::Row row = *(*iter); + if (row) { + row[m_columns.name] = + } + } +} +*/ +void MainWindow::del_columns() { + //std::vector vec_columns = tree_view_select->get_columns(); } void MainWindow::remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del) { @@ -576,76 +594,6 @@ void MainWindow::mode_switch_quota() { } } -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_ubconfig.format_cmd_quotas(_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 = Utils::format_str_size(quotegroupSizeSoftLimitSpin->get_value(), quotegroupSizeSoftLimitCombo->get_active_row_number()); - value += ":"; - } - else { - value += "0:"; - } - if (quotegroupSizeHardLimitCheck->get_active()) { - value += Utils::format_str_size(quotegroupSizeHardLimitSpin->get_value(), quotegroupSizeHardLimitCombo->get_active_row_number()); - 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::filters_show() { FiltersWindow->show_all(); } @@ -707,13 +655,13 @@ void MainWindow::wrapper_save_all_cfg() { } void MainWindow::load_global_cfg() { - this->load_template(&map_global_cfg, "global"); + this->load_template(&map_global_cfg, global_load); info_warning_error(1); map_gui_cfg = map_global_cfg; } void MainWindow::load_system_cfg() { - this->load_template(&map_system_cfg, "system"); + this->load_template(&map_system_cfg, system_load); info_warning_error(0); map_gui_cfg = map_system_cfg; } @@ -802,13 +750,15 @@ void MainWindow::init_work_tv_g_u_p() { this->view_add_columns(*usersQuotasTree); } -void MainWindow::load_template(map_str_str* map_temp, string str_load) { +void MainWindow::load_template(map_str_str* map_temp, string cmd) { this->init_work_tv_g_u_p(); - this->init_dict(str_load); - string sections; - sections = "security"; - obj_load.set_sections(sections); - *map_temp = obj_load.get_load_data(*map_temp, str_load); + if (cmd.find("system") != string::npos) { + this->init_dict("system"); + } + else { + this->init_dict("global"); + } + *map_temp = obj_load.get_load_data(*map_temp, cmd); } void MainWindow::remove_line_template(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter, Gtk::TreeModel::iterator& iter_del, bool& flag_del) { diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 82a4d95..876f75b 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -139,6 +139,12 @@ #define path_resources "/usr/share/ubl-settings-diskquota" #define path_img_head_background "/usr/share/ubl-settings-diskquota/images/logo-background.png" #define no_recognized _("Argument not recognized\n") +#define global_load "ubconfig --default --source global get boot" +#define system_load "ubconfig --default --source system get boot" +#define global_save "ubconfig --target global set boot " +#define system_save "ubconfig --target system set boot " +#define global_remove "ubconfig --target global --noexecute set/remove boot " +#define system_remove "ubconfig --target system --noexecute set/remove boot " using namespace std; @@ -214,7 +220,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label *generalTabLabel; Gtk::Label *UsersTabLabel; Gtk::Label *GroupsTabLabel; - Gtk::Label *generalGroupsSizeLabel; Gtk::Label *generalGroupsFilesLabel; Gtk::Label *generalUsersSizeLabel; Gtk::Label *generalUsersFilesLabel; @@ -264,9 +269,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::TreeView *usersQuotasTree; Gtk::TreeView *ProjectQuotasTree; Gtk::TreeView *GeneralQuotasTree; - Gtk::Label *quotegroupDeviceLabel; - Gtk::Label *quotegroupFileSystemLabel; - Gtk::Label *quotegroupDiskQuotasLabel; Gtk::Label *quotegroupGroupQuotasLabel; Gtk::Label *quotegroupSizeFrameLabel; Gtk::Label *quotegroupSizeCurrentlyLabel; @@ -301,7 +303,6 @@ 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; @@ -318,7 +319,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Button *btnFilterGroups; Gtk::Button *btnFilterUsers; Gtk::Button *btnFilterProject; - Gtk::ComboBoxText *quotegroupDeviceCombo; Gtk::Label *lblHeadeWndWeb; Gtk::Label *lblwebHeaderName; @@ -335,6 +335,9 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Button* btnAddGroups; Gtk::Button* btnAddUsers; Gtk::Button* btnAddProject; + Gtk::Button* btnEditProject; + Gtk::Button* btnEditUsers; + Gtk::Button* btnEditGroups; #ifdef WEBKIT_FOUND Gtk::Window *wndWeb; Gtk::Widget *three; @@ -392,8 +395,9 @@ class MainWindow : public Gtk::ApplicationWindow { void init_tree_view(); void template_open_browser(); void open_browser(); + void del_columns(); void set_add_tv_g_u_p(Gtk::TreeModel::Row &row, Glib::RefPtr list_store, struct tv_g_u_p obj_tv_g_u_p); - void load_template(map_str_str* map_temp, string str_load); + void load_template(map_str_str* map_temp, string cmd); void info_warning_error(int mess); void off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type); void wrapper_save_system_cfg(); @@ -401,6 +405,7 @@ class MainWindow : public Gtk::ApplicationWindow { void wrapper_save_all_cfg(); void init_dict(string flag_load); void set_data_cfg(); + void set_tree_view(Gtk::TreeView *tree_view, Glib::RefPtr* list_store, bool& flag_validate_del); void mode_switch_quota(); void save_quotegroupSaveButton(); void wrapper_settings_quotas_temp(string save_user_or_group); diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 32bb829..bceb8ad 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -2991,40 +2991,28 @@ True False vertical - 5 True False - 5 - + True False - 5 - 5 - 5 - 5 - 5 - 5 Device: + 0 - False + True True 0 - + True False - 5 - 5 - 5 - 5 - 5 - 5 + label True @@ -3032,81 +3020,78 @@ 1 + + + True + True + 0 + + + + + True + False - + True False - start - 5 - 5 - 5 - 5 - 5 - 5 - File system: + Quota use status: 0 - False + True True - 2 + 0 - + True False - 5 - 5 - 5 - 5 - 5 - 5 + label - False + True True - 3 + 1 - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - Disk quotas for this device: - 0 - - - False + True True 1 - + True False - 5 - 5 - 5 - 5 - 5 - 5 - Group quotas for this device: - 0 + + + True + False + UserGropProject: + 0 + + + True + True + 0 + + + + + True + False + label + + + True + True + 1 + + False From 61ae3ae96aa3f4fb8de796061d5704f50b88a065 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 10 May 2023 15:44:59 +0600 Subject: [PATCH 04/26] =?UTF-8?q?=D0=A7=D0=B0=D1=81=D1=82=D0=B8=D1=87?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB?= =?UTF-8?q?=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=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 --- #ubl-settings-diskquota.glade# | 3867 ++++++++++++++++++++++++++++++ source/ubl-settings-diskquota.cc | 63 +- source/ubl-settings-diskquota.h | 19 +- ubl-settings-diskquota.glade | 32 +- ubl-settings-diskquota.pot | 15 + ubl-settings-diskquota_ru.po | 15 + 6 files changed, 3978 insertions(+), 33 deletions(-) create mode 100644 #ubl-settings-diskquota.glade# diff --git a/#ubl-settings-diskquota.glade# b/#ubl-settings-diskquota.glade# new file mode 100644 index 0000000..d9c3497 --- /dev/null +++ b/#ubl-settings-diskquota.glade# @@ -0,0 +1,3867 @@ + + + + + + + + + + + + False + start + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + Name + True + True + False + start + 5 + True + + + False + True + 0 + + + + + Quotas + True + True + False + start + True + + + False + True + 1 + + + + + Size + True + True + False + start + True + + + False + True + 2 + + + + + Soft limit (size) + True + True + False + start + True + + + False + True + 3 + + + + + Hard limit (size) + True + True + False + start + True + + + False + True + 4 + + + + + True + False + end + 5 + 5 + True + + + gtk-cancel + True + True + True + center + True + + + False + True + 0 + + + + + gtk-save + True + True + True + center + True + + + False + True + 1 + + + + + False + True + end + 5 + + + + + Hard limit (size) delay + True + True + False + start + True + + + False + True + 5 + + + + + Files + True + True + False + start + True + + + False + True + 7 + + + + + Soft limit (files) + True + True + False + start + True + + + False + True + 8 + + + + + Hard limit (files) + True + True + False + start + True + + + False + True + 9 + + + + + Hard limit (files) delay + True + True + False + start + True + + + False + True + 10 + + + + + + + True + False + True + + + True + False + System quotas + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-diskquota + 5 + + + + + + + + + + + + + Byte + + + Kb + + + Mb + + + Gb + + + Tb + + + + + False + False + True + center + com.ublinux.ubl-settings-diskquota + dialog + True + ubl-settings-diskquota + 1.0 + Copyright © 2022 - 2023, UBSoft LLC + Setting user quotas + https://ublinux.ru/ + Project Home Page + Это приложение распространяется без каких-либо гарантий. +Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. + UBGroup + UBGroup + com.ublinux.ubl-settings-diskquota + True + gpl-2-0 + + + True + False + vertical + 2 + + + False + end + + + False + False + 1 + + + + + + + True + False + True + + + True + False + 5 + 5 + 5 + 5 + 2 + System quotas + + + + + + + + + + True + False + + + 90 + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 69 + com.ublinux.ubl-settings-diskquota + + + False + True + 0 + + + + + True + False + + + True + False + + + True + False + vertical + + + 255 + True + False + Configuration of disk quotas parameters for system groups and users + + + + + + + + True + True + 0 + + + + + False + True + 0 + + + + + True + True + 0 + + + + + True + True + 1 + + + + + 5 + 1 + 10 + + + 23 + 1 + 10 + + + 59 + 1 + 10 + + + 100 + 1 + 10 + + + 5 + 1 + 10 + + + 23 + 1 + 10 + + + 59 + 1 + 10 + + + 100 + 1 + 10 + + + 5 + 1 + 10 + + + 23 + 1 + 10 + + + 59 + 1 + 10 + + + 100 + 1 + 10 + + + 5 + 1 + 10 + + + 23 + 1 + 10 + + + 59 + 1 + 10 + + + 100 + 1 + 10 + + + + True + False + False + False + + + True + False + 7 + 7 + Direct control of the file system + True + + + + + True + False + Help + + + + + + True + False + About + True + + + + + + True + False + + + True + False + Load from global configuration + True + + + + + + True + False + Load from local configuration + True + + + + + + True + False + + + True + False + Save to global and local configuration + True + + + + + + True + False + Save to global configuration + True + + + + + + True + False + Save to local configuration + True + + + + + + False + center + com.ublinux.ubl-settings-diskquota + center + + + True + False + vertical + + + True + False + vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 25 + 1 + + + False + True + 0 + + + + + True + False + start + 5 + 5 + 5 + 5 + 5 + 5 + + + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + + + 81 + True + False + + + True + False + start + + + -1 + + + + + False + True + 0 + + + + + False + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + True + True + vertical + + + True + True + + + True + False + vertical + + + True + True + liststore1 + + + + + + True + True + 0 + + + + + + + True + False + General settings + + + False + + + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + + + True + False + Device: + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + False + 20 + + + True + False + vertical + True + + + True + False + Excess size delay period + 0 + + + False + True + 0 + + + + + True + False + Excess files delay period + 0 + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalGroupsSizeWeeksSpin + + + False + True + 0 + + + + + True + False + weeks + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalGroupsFilesWeeksSpin + + + False + True + 0 + + + + + True + False + weeks + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalGroupsSizeDaysSpin + + + False + True + 0 + + + + + True + False + days + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalGroupsFilesDaysSpin + + + False + True + 0 + + + + + True + False + days + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalGroupsSizeHoursSpin + + + False + True + 0 + + + + + True + False + hours + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalGroupsFilesHoursSpin + + + False + True + 0 + + + + + True + False + hours + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 3 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalGroupsSizeMinutesSpin + + + False + True + 0 + + + + + True + False + minutes + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalGroupsFilesMinutesSpin + + + False + True + 0 + + + + + True + False + minutes + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 4 + + + + + False + True + 1 + + + + + True + True + liststore1 + + + + + + True + True + 2 + + + + + True + False + + + True + True + True + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-goto-first + + + False + True + 0 + + + + + True + False + 5 + 5 + Filters + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + False + + + gtk-delete + True + True + True + 5 + 5 + 5 + 5 + True + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-edit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Edit + + + False + True + 1 + + + + + + + False + True + 1 + + + + + gtk-add + True + True + True + 5 + 5 + 5 + 5 + True + + + False + True + 2 + + + + + False + True + end + 1 + + + + + False + True + 3 + + + + + 1 + + + + + True + False + Groups + + + 1 + False + + + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + + + True + False + Device: + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 20 + + + True + False + vertical + True + + + True + False + Excess size delay period + 0 + + + False + True + 0 + + + + + True + False + Excess files delay period + 0 + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeWeeksSpin + + + False + True + 0 + + + + + True + False + weeks + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalUsersFilesWeeksSpin + + + False + True + 0 + + + + + True + False + weeks + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeDaysSpin + + + False + True + 0 + + + + + True + False + days + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalUsersFilesDaysSpin + + + False + True + 0 + + + + + True + False + days + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeHoursSpin + + + False + True + 0 + + + + + True + False + hours + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalUsersFilesHourSpin + + + False + True + 0 + + + + + True + False + hours + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 3 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeMinutesSpin + + + False + True + 0 + + + + + True + False + minutes + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalUsersFilesMinuteSpin + + + False + True + 0 + + + + + True + False + minutes + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 4 + + + + + False + True + 1 + + + + + True + True + liststore1 + + + + + + True + True + 2 + + + + + True + False + + + True + True + True + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-missing-image + + + False + True + 0 + + + + + True + False + 5 + 5 + Filters + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + False + + + gtk-delete + True + True + True + 5 + 5 + 5 + 5 + True + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-edit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Edit + + + False + True + 1 + + + + + + + False + True + 1 + + + + + gtk-add + True + True + True + 5 + 5 + 5 + 5 + True + + + False + True + 2 + + + + + False + True + end + 1 + + + + + False + True + 3 + + + + + 2 + + + + + True + False + Users + + + 2 + False + + + + + True + False + vertical + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + Device: + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 20 + + + True + False + vertical + True + + + True + False + Excess size delay period + 0 + + + False + True + 0 + + + + + True + False + Excess files delay period + 0 + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeWeeksSpin + + + False + True + 0 + + + + + True + False + weeks + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalUsersFilesWeeksSpin + + + False + True + 0 + + + + + True + False + weeks + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeDaysSpin + + + False + True + 0 + + + + + True + False + days + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalUsersFilesDaysSpin + + + False + True + 0 + + + + + True + False + days + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeHoursSpin + + + False + True + 0 + + + + + True + False + hours + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalUsersFilesHourSpin + + + False + True + 0 + + + + + True + False + hours + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 3 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeMinutesSpin + + + False + True + 0 + + + + + True + False + minutes + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + 0 + generalUsersFilesMinuteSpin + + + False + True + 0 + + + + + True + False + minutes + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 4 + + + + + False + True + 1 + + + + + True + True + liststore1 + + + + + + True + True + 2 + + + + + False + True + 0 + + + + + True + False + + + True + True + True + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-missing-image + + + False + True + 0 + + + + + True + False + 5 + 5 + Filters + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + False + + + gtk-delete + True + True + True + 5 + 5 + 5 + True + + + False + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-edit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Edit + + + False + True + 1 + + + + + + + False + True + 1 + + + + + gtk-add + True + True + True + 5 + 5 + 5 + 5 + True + + + False + True + 2 + + + + + False + True + end + 1 + + + + + False + True + end + 1 + + + + + 3 + + + + + True + False + Project + + + 3 + False + + + + + True + True + 0 + + + + + False + True + 2 + + + + + True + True + 0 + + + + + + + True + False + True + + + True + False + 5 + 5 + 5 + 5 + 2 + UBConfig - Quotas + + + + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 32 + com.ublinux.ubl-settings-diskquota + + + + + True + False + + + True + True + False + True + menuLoad + + + True + False + + + True + False + Load + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + False + True + 0 + + + + + + 2 + + + + + True + False + + + True + True + False + True + menuSave + + + True + False + + + True + False + Save + + + False + True + 0 + + + + + True + False + pan-down-symbolic + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + True + True + False + True + True + menuAbout + none + + + True + False + open-menu-symbolic + + + + + False + True + 1 + + + + + + end + 3 + + + + + + + + + + + + + vertical + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1024 + 1 + 10 + + + 1024 + 1 + 10 + + + False + start + False + + + True + False + 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 + 0 + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + + + True + False + UserGropProject: + 0 + + + False + True + 0 + + + + + True + False + 5 + 5 + 0 + + + True + 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 + 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 + 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 + 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 + 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 + + + + + + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1024 + 1 + 10 + + + 1024 + 1 + 10 + + + False + start + start + False + 450 + 250 + dialog-question-symbolic + + + True + False + vertical + + + True + False + + + True + False + start + 20 + 20 + dialog-question-symbolic + 5 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + start + 10 + 5 + Would you like to read documentation in the Web? + True + 0 + + + + + + + False + True + 0 + + + + + True + False + start + start + 10 + 10 + You will be redirected to documentation website where documentation is translated and supported by community. + True + 0 + + + + True + True + 1 + + + + + Always redirect to online documentation + True + True + False + end + 10 + True + + + + False + True + 2 + + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + 30 + True + + + Cancel + True + True + True + + + + True + True + 0 + + + + + Read Online + True + True + True + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + True + False + True + + + True + False + ubl-settings-datetime + + + + + + + + True + False + 32 + dialog-question-symbolic + + + + + + + 800 + 600 + False + True + True + com.ublinux.ubl-settings-datetime + + + + + + True + False + True + + + True + False + ubl-settings-datetime + + + + + True + False + 32 + com.ublinux.ubl-settings-datetime + 5 + + + + + + diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index e335c66..3d1fa3d 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -79,7 +79,13 @@ void MainWindow::settings() { builder->get_widget("boxColor", boxWidget); HeadOverlay->add_overlay(*boxWidget); ubl_make_plugs(boxSave, boxButton, socket_ext_id_I, socket_trd_id_I); - +} + +void MainWindow::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::init_spin_all() { @@ -256,6 +262,11 @@ void MainWindow::lacalization() { chkAlwaysOpenHelp->set_label(always_redirect); lblwebHeaderName->set_label(name_app); chbMangSystemFile->set_label(str_quotas_mode); + lblSetDevice->set_text(str_device); + lblQuotasStatus->set_text(str_quota_status); + lblSetUGP->set_text(""); + this->fill_in_pow_memory(quotegroupSizeSoftLimitCombo); + this->fill_in_pow_memory(quotegroupSizeHardLimitCombo); } @@ -472,7 +483,13 @@ void MainWindow::get_builder() { builder->get_widget("btnEditProject", btnEditProject); builder->get_widget("btnEditUsers", btnEditUsers); builder->get_widget("btnEditGroups", btnEditGroups); - + builder->get_widget("lblSetDevice", lblSetDevice); + builder->get_widget("lblQuotasStatus", lblQuotasStatus); + builder->get_widget("lblSetUGP", lblSetUGP); + builder->get_widget("lblSetNameDevice", lblSetNameDevice); + builder->get_widget("lblSetQuotasStatus", lblSetQuotasStatus); + builder->get_widget("lblSetNameUGP", lblSetNameUGP); + builder->get_widget("usersProjectCombo", usersProjectCombo); } void MainWindow::event() { @@ -534,21 +551,45 @@ void MainWindow::event() { filtersNameFilterCheckbox->signal_toggled().connect(sigc::mem_fun( *this, &MainWindow::del_columns)); - // btnEditProject->signal_clicked().connect(); - // btnEditUsers->signal_clicked().connect(); - // btnEditGroups->signal_clicked().connect(); + btnEditGroups->signal_clicked().connect( + sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, + &MainWindow::edit_tree_view_G), &list_store_groups, &iter_groups, flag_validate_del_groups)); + btnEditUsers->signal_clicked().connect( + sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, + &MainWindow::edit_tree_view_U), &list_store_users, &iter_users, flag_validate_del_users)); + btnEditProject->signal_clicked().connect( + sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, + &MainWindow::edit_tree_view_P), &list_store_project, &iter_project, flag_validate_del_project)); } -/* -void MainWindow::set_tree_view(Gtk::TreeView *tree_view, Glib::RefPtr* list_store, bool& flag_validate_del) { - if (flag_validate_del && (*list_store)->iter_is_valid(*(iter))) { + +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) { - row[m_columns.name] = + if(row) { + string name = row[m_columns.name] + ""; + lblSetNameDevice->set_text(combo_box->get_active_text()); + lblSetNameUGP->set_text(name); + QuotasEditWindow->show(); } } + flag_validate = false; +} + +void MainWindow::edit_tree_view_U(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate) { + lblSetUGP->set_text(str_users); + 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_groups); + 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_projects); + set_change_gui(list_store, iter, flag_validate, usersProjectCombo); } -*/ void MainWindow::del_columns() { //std::vector vec_columns = tree_view_select->get_columns(); } diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 876f75b..e4edc1c 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -145,7 +145,11 @@ #define system_save "ubconfig --target system set boot " #define global_remove "ubconfig --target global --noexecute set/remove boot " #define system_remove "ubconfig --target system --noexecute set/remove boot " - +#define str_quota_status "Quota use status:" +#define str_prefix_KB _("Kb") +#define str_prefix_MB _("Mb") +#define str_prefix_GB _("Gb") +#define str_prefix_TB _("Tb") using namespace std; extern string version_application; @@ -286,6 +290,7 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::ComboBoxText *usersDeviceCombo; Gtk::ComboBoxText *groupsDeviceCombo; Gtk::ComboBoxText *generalDeviceCombo; + Gtk::ComboBoxText *usersProjectCombo; Gtk::Label *lblFstypeGroups; Gtk::SpinButton *generalGroupsSizeWeeksSpi; Gtk::SpinButton *generalGroupsFileWeeksSpin; @@ -338,6 +343,12 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Button* btnEditProject; Gtk::Button* btnEditUsers; Gtk::Button* btnEditGroups; + Gtk::Label* lblSetDevice; + Gtk::Label* lblQuotasStatus; + Gtk::Label* lblSetUGP; + Gtk::Label* lblSetNameDevice; + Gtk::Label* lblSetQuotasStatus; + Gtk::Label* lblSetNameUGP; #ifdef WEBKIT_FOUND Gtk::Window *wndWeb; Gtk::Widget *three; @@ -390,6 +401,7 @@ class MainWindow : public Gtk::ApplicationWindow { void init_tree_view_general(); void entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label); void synopsis_show(); + void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); void info_status_app(string stule); void filters_show(); void init_tree_view(); @@ -405,12 +417,15 @@ class MainWindow : public Gtk::ApplicationWindow { void wrapper_save_all_cfg(); void init_dict(string flag_load); void set_data_cfg(); - void set_tree_view(Gtk::TreeView *tree_view, Glib::RefPtr* list_store, bool& flag_validate_del); + void set_change_gui(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate, Gtk::ComboBoxText *combo_box); void mode_switch_quota(); 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 edit_tree_view_U(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); + void edit_tree_view_G(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); + void edit_tree_view_P(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); void format_cmd_quotas_system(struct struct_quotas& _struct_quota); void format_cmd_quotas_ubconfig(struct struct_quotas& _struct_quota); void load_global_cfg(); diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index bceb8ad..d9c3497 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -3000,19 +3000,19 @@ True False Device: - 0 - True + False True 0 - + True False - label + 5 + 5 True @@ -3039,7 +3039,7 @@ 0 - True + False True 0 @@ -3048,7 +3048,9 @@ True False - label + 5 + 5 + 0 True @@ -3075,7 +3077,7 @@ 0 - True + False True 0 @@ -3084,7 +3086,9 @@ True False - label + 5 + 5 + 0 True @@ -3207,12 +3211,6 @@ True False - - Kb - Mb - Gb - Tb - False @@ -3282,12 +3280,6 @@ True False - - Kb - Mb - Gb - Tb - False diff --git a/ubl-settings-diskquota.pot b/ubl-settings-diskquota.pot index 54d8ef3..f05bc83 100644 --- a/ubl-settings-diskquota.pot +++ b/ubl-settings-diskquota.pot @@ -17,6 +17,21 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "Kb" +msgstr "" + +msgid "Mb" +msgstr "" + +msgid "Gb" +msgstr "" + +msgid "Tb" +msgstr "" + +msgid "Quota use status:" +msgstr "" + #: source/ubl-settings-diskquota.cc:224 source/ubl-settings-diskquota.cc:154 #: source/ubl-settings-diskquota.cc:144 msgid "About" diff --git a/ubl-settings-diskquota_ru.po b/ubl-settings-diskquota_ru.po index 8b9b0ac..eb421b8 100644 --- a/ubl-settings-diskquota_ru.po +++ b/ubl-settings-diskquota_ru.po @@ -17,6 +17,21 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "Kb" +msgstr "Кб" + +msgid "Mb" +msgstr "Мб" + +msgid "Gb" +msgstr "Гб" + +msgid "Tb" +msgstr "Тб" + +msgid "Quota use status:" +msgstr "Статус использования квот" + msgid "Would you like to read documentation in the Web?" msgstr "Вы хотите прочитать справку в Сети?" From 9e87bd429e4e36b32dae606074bf7008ce865c24 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 11 May 2023 10:21:05 +0600 Subject: [PATCH 05/26] fix --- #ubl-settings-diskquota.glade# | 2 +- source/ubl-settings-diskquota.cc | 13 ++++++++----- source/ubl-settings-diskquota.h | 8 ++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/#ubl-settings-diskquota.glade# b/#ubl-settings-diskquota.glade# index d9c3497..fbde303 100644 --- a/#ubl-settings-diskquota.glade# +++ b/#ubl-settings-diskquota.glade# @@ -24,7 +24,7 @@ 5 vertical - + Name True True diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index 3d1fa3d..4eecfcb 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -30,6 +30,7 @@ void MainWindow::settings() { map_device = obj_device.get_parted(); this->filling_device_combo_box_template(groupsDeviceCombo, map_device); this->filling_device_combo_box_template(usersDeviceCombo, map_device); + this->filling_device_combo_box_template(usersProjectCombo, map_device); this->init_tree_view(); this->init_spin_all(); check_limit(quotegroupSizeSoftLimitCheck @@ -176,7 +177,7 @@ void MainWindow::init_tree_view_general() { } void MainWindow::view_add_columns(Gtk::TreeView &treeView) { - treeView.append_column(str_name, m_columns.name); + treeView.append_column_editable(str_name, m_columns.name); treeView.append_column_editable(str_quotas, m_columns.quotas); treeView.append_column(str_size, m_columns.size); treeView.append_column(str_tw_soft_limit, m_columns.soft_limit_size); @@ -265,6 +266,7 @@ void MainWindow::lacalization() { lblSetDevice->set_text(str_device); lblQuotasStatus->set_text(str_quota_status); lblSetUGP->set_text(""); + lblQuotasStatus->set_text(_("Quota use status:")); this->fill_in_pow_memory(quotegroupSizeSoftLimitCombo); this->fill_in_pow_memory(quotegroupSizeHardLimitCombo); @@ -639,6 +641,11 @@ void MainWindow::filters_show() { FiltersWindow->show_all(); } +void MainWindow::set_data_cfg() { + // TODO: + // Написать функцию +} + 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()); @@ -707,10 +714,6 @@ void MainWindow::load_system_cfg() { map_gui_cfg = map_system_cfg; } -void MainWindow::set_data_cfg() { - // TODO: - // Написать функцию -} void MainWindow::wrapper_save_global_cfg() { this->set_data_cfg(); if (this->save_template("boot", "global")) { diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index e4edc1c..8fb3938 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -139,10 +139,10 @@ #define path_resources "/usr/share/ubl-settings-diskquota" #define path_img_head_background "/usr/share/ubl-settings-diskquota/images/logo-background.png" #define no_recognized _("Argument not recognized\n") -#define global_load "ubconfig --default --source global get boot" -#define system_load "ubconfig --default --source system get boot" -#define global_save "ubconfig --target global set boot " -#define system_save "ubconfig --target system set boot " +#define global_load "ubconfig --default --source global --noexecute get boot" +#define system_load "ubconfig --default --source system --noexecute get boot" +#define global_save "ubconfig --target global --noexecute set boot " +#define system_save "ubconfig --target system --noexecute set boot " #define global_remove "ubconfig --target global --noexecute set/remove boot " #define system_remove "ubconfig --target system --noexecute set/remove boot " #define str_quota_status "Quota use status:" From f5f4809531198e7a0f52276fd35a82e80f97a0b8 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 11 May 2023 11:08:39 +0600 Subject: [PATCH 06/26] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=B9=20=D0=B8=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- #ubl-settings-diskquota.glade# | 3867 ------------------------------ source/ubl-settings-diskquota.cc | 81 +- source/ubl-settings-diskquota.h | 31 +- source/util.cc | 79 + source/util.h | 4 + ubl-settings-diskquota.glade | 489 ++-- ubl-settings-diskquota.pot | 9 + ubl-settings-diskquota_ru.po | 11 +- 8 files changed, 402 insertions(+), 4169 deletions(-) delete mode 100644 #ubl-settings-diskquota.glade# diff --git a/#ubl-settings-diskquota.glade# b/#ubl-settings-diskquota.glade# deleted file mode 100644 index fbde303..0000000 --- a/#ubl-settings-diskquota.glade# +++ /dev/null @@ -1,3867 +0,0 @@ - - - - - - - - - - - - False - start - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - vertical - - - Name - True - True - False - start - 5 - True - - - False - True - 0 - - - - - Quotas - True - True - False - start - True - - - False - True - 1 - - - - - Size - True - True - False - start - True - - - False - True - 2 - - - - - Soft limit (size) - True - True - False - start - True - - - False - True - 3 - - - - - Hard limit (size) - True - True - False - start - True - - - False - True - 4 - - - - - True - False - end - 5 - 5 - True - - - gtk-cancel - True - True - True - center - True - - - False - True - 0 - - - - - gtk-save - True - True - True - center - True - - - False - True - 1 - - - - - False - True - end - 5 - - - - - Hard limit (size) delay - True - True - False - start - True - - - False - True - 5 - - - - - Files - True - True - False - start - True - - - False - True - 7 - - - - - Soft limit (files) - True - True - False - start - True - - - False - True - 8 - - - - - Hard limit (files) - True - True - False - start - True - - - False - True - 9 - - - - - Hard limit (files) delay - True - True - False - start - True - - - False - True - 10 - - - - - - - True - False - True - - - True - False - System quotas - - - - - - - - True - False - 32 - com.ublinux.ubl-settings-diskquota - 5 - - - - - - - - - - - - - Byte - - - Kb - - - Mb - - - Gb - - - Tb - - - - - False - False - True - center - com.ublinux.ubl-settings-diskquota - dialog - True - ubl-settings-diskquota - 1.0 - Copyright © 2022 - 2023, UBSoft LLC - Setting user quotas - https://ublinux.ru/ - Project Home Page - Это приложение распространяется без каких-либо гарантий. -Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. - UBGroup - UBGroup - com.ublinux.ubl-settings-diskquota - True - gpl-2-0 - - - True - False - vertical - 2 - - - False - end - - - False - False - 1 - - - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 2 - System quotas - - - - - - - - - - True - False - - - 90 - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 69 - com.ublinux.ubl-settings-diskquota - - - False - True - 0 - - - - - True - False - - - True - False - - - True - False - vertical - - - 255 - True - False - Configuration of disk quotas parameters for system groups and users - - - - - - - - True - True - 0 - - - - - False - True - 0 - - - - - True - True - 0 - - - - - True - True - 1 - - - - - 5 - 1 - 10 - - - 23 - 1 - 10 - - - 59 - 1 - 10 - - - 100 - 1 - 10 - - - 5 - 1 - 10 - - - 23 - 1 - 10 - - - 59 - 1 - 10 - - - 100 - 1 - 10 - - - 5 - 1 - 10 - - - 23 - 1 - 10 - - - 59 - 1 - 10 - - - 100 - 1 - 10 - - - 5 - 1 - 10 - - - 23 - 1 - 10 - - - 59 - 1 - 10 - - - 100 - 1 - 10 - - - - True - False - False - False - - - True - False - 7 - 7 - Direct control of the file system - True - - - - - True - False - Help - - - - - - True - False - About - True - - - - - - True - False - - - True - False - Load from global configuration - True - - - - - - True - False - Load from local configuration - True - - - - - - True - False - - - True - False - Save to global and local configuration - True - - - - - - True - False - Save to global configuration - True - - - - - - True - False - Save to local configuration - True - - - - - - False - center - com.ublinux.ubl-settings-diskquota - center - - - True - False - vertical - - - True - False - vertical - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 25 - 1 - - - False - True - 0 - - - - - True - False - start - 5 - 5 - 5 - 5 - 5 - 5 - - - - - - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - - - 81 - True - False - - - True - False - start - - - -1 - - - - - False - True - 0 - - - - - False - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - True - True - vertical - - - True - True - - - True - False - vertical - - - True - True - liststore1 - - - - - - True - True - 0 - - - - - - - True - False - General settings - - - False - - - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - - - True - False - Device: - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - False - 20 - - - True - False - vertical - True - - - True - False - Excess size delay period - 0 - - - False - True - 0 - - - - - True - False - Excess files delay period - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalGroupsSizeWeeksSpin - - - False - True - 0 - - - - - True - False - weeks - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalGroupsFilesWeeksSpin - - - False - True - 0 - - - - - True - False - weeks - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalGroupsSizeDaysSpin - - - False - True - 0 - - - - - True - False - days - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalGroupsFilesDaysSpin - - - False - True - 0 - - - - - True - False - days - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalGroupsSizeHoursSpin - - - False - True - 0 - - - - - True - False - hours - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalGroupsFilesHoursSpin - - - False - True - 0 - - - - - True - False - hours - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalGroupsSizeMinutesSpin - - - False - True - 0 - - - - - True - False - minutes - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalGroupsFilesMinutesSpin - - - False - True - 0 - - - - - True - False - minutes - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 4 - - - - - False - True - 1 - - - - - True - True - liststore1 - - - - - - True - True - 2 - - - - - True - False - - - True - True - True - 5 - 5 - 5 - 5 - - - True - False - - - True - False - 5 - 5 - gtk-goto-first - - - False - True - 0 - - - - - True - False - 5 - 5 - Filters - - - False - True - 1 - - - - - - - False - True - 0 - - - - - True - False - - - gtk-delete - True - True - True - 5 - 5 - 5 - 5 - True - - - False - True - 0 - - - - - True - True - True - 5 - 5 - 5 - 5 - - - True - False - - - True - False - 5 - 5 - gtk-edit - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - Edit - - - False - True - 1 - - - - - - - False - True - 1 - - - - - gtk-add - True - True - True - 5 - 5 - 5 - 5 - True - - - False - True - 2 - - - - - False - True - end - 1 - - - - - False - True - 3 - - - - - 1 - - - - - True - False - Groups - - - 1 - False - - - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - - - True - False - Device: - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - 20 - - - True - False - vertical - True - - - True - False - Excess size delay period - 0 - - - False - True - 0 - - - - - True - False - Excess files delay period - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalUsersSizeWeeksSpin - - - False - True - 0 - - - - - True - False - weeks - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalUsersFilesWeeksSpin - - - False - True - 0 - - - - - True - False - weeks - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalUsersSizeDaysSpin - - - False - True - 0 - - - - - True - False - days - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalUsersFilesDaysSpin - - - False - True - 0 - - - - - True - False - days - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalUsersSizeHoursSpin - - - False - True - 0 - - - - - True - False - hours - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalUsersFilesHourSpin - - - False - True - 0 - - - - - True - False - hours - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalUsersSizeMinutesSpin - - - False - True - 0 - - - - - True - False - minutes - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalUsersFilesMinuteSpin - - - False - True - 0 - - - - - True - False - minutes - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 4 - - - - - False - True - 1 - - - - - True - True - liststore1 - - - - - - True - True - 2 - - - - - True - False - - - True - True - True - 5 - 5 - 5 - 5 - - - True - False - - - True - False - 5 - 5 - gtk-missing-image - - - False - True - 0 - - - - - True - False - 5 - 5 - Filters - - - False - True - 1 - - - - - - - False - True - 0 - - - - - True - False - - - gtk-delete - True - True - True - 5 - 5 - 5 - 5 - True - - - False - True - 0 - - - - - True - True - True - 5 - 5 - 5 - 5 - - - True - False - - - True - False - 5 - 5 - gtk-edit - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - Edit - - - False - True - 1 - - - - - - - False - True - 1 - - - - - gtk-add - True - True - True - 5 - 5 - 5 - 5 - True - - - False - True - 2 - - - - - False - True - end - 1 - - - - - False - True - 3 - - - - - 2 - - - - - True - False - Users - - - 2 - False - - - - - True - False - vertical - - - True - False - vertical - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - Device: - - - False - True - 0 - - - - - True - False - - - True - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - - - False - True - 2 - - - - - False - True - 0 - - - - - True - False - 20 - - - True - False - vertical - True - - - True - False - Excess size delay period - 0 - - - False - True - 0 - - - - - True - False - Excess files delay period - 0 - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalUsersSizeWeeksSpin - - - False - True - 0 - - - - - True - False - weeks - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalUsersFilesWeeksSpin - - - False - True - 0 - - - - - True - False - weeks - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 1 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalUsersSizeDaysSpin - - - False - True - 0 - - - - - True - False - days - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalUsersFilesDaysSpin - - - False - True - 0 - - - - - True - False - days - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 2 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalUsersSizeHoursSpin - - - False - True - 0 - - - - - True - False - hours - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalUsersFilesHourSpin - - - False - True - 0 - - - - - True - False - hours - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 3 - - - - - True - False - vertical - 5 - - - True - False - 5 - - - True - True - 0 - generalUsersSizeMinutesSpin - - - False - True - 0 - - - - - True - False - minutes - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - 0 - generalUsersFilesMinuteSpin - - - False - True - 0 - - - - - True - False - minutes - - - False - True - 1 - - - - - False - True - 1 - - - - - False - True - 4 - - - - - False - True - 1 - - - - - True - True - liststore1 - - - - - - True - True - 2 - - - - - False - True - 0 - - - - - True - False - - - True - True - True - 5 - 5 - 5 - 5 - - - True - False - - - True - False - 5 - 5 - gtk-missing-image - - - False - True - 0 - - - - - True - False - 5 - 5 - Filters - - - False - True - 1 - - - - - - - False - True - 0 - - - - - True - False - - - gtk-delete - True - True - True - 5 - 5 - 5 - True - - - False - True - 0 - - - - - True - True - True - 5 - 5 - 5 - 5 - - - True - False - - - True - False - 5 - 5 - gtk-edit - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - Edit - - - False - True - 1 - - - - - - - False - True - 1 - - - - - gtk-add - True - True - True - 5 - 5 - 5 - 5 - True - - - False - True - 2 - - - - - False - True - end - 1 - - - - - False - True - end - 1 - - - - - 3 - - - - - True - False - Project - - - 3 - False - - - - - True - True - 0 - - - - - False - True - 2 - - - - - True - True - 0 - - - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 2 - UBConfig - Quotas - - - - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 32 - com.ublinux.ubl-settings-diskquota - - - - - True - False - - - True - True - False - True - menuLoad - - - True - False - - - True - False - Load - - - False - True - 0 - - - - - True - False - pan-down-symbolic - - - False - True - 1 - - - - - - - False - True - 0 - - - - - - 2 - - - - - True - False - - - True - True - False - True - menuSave - - - True - False - - - True - False - Save - - - False - True - 0 - - - - - True - False - pan-down-symbolic - - - False - True - 1 - - - - - - - False - True - 0 - - - - - True - True - True - False - True - True - menuAbout - none - - - True - False - open-menu-symbolic - - - - - False - True - 1 - - - - - - end - 3 - - - - - - - - - - - - - vertical - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1000000 - 1 - 10 - - - 1000000 - 1 - 10 - - - 1024 - 1 - 10 - - - 1024 - 1 - 10 - - - False - start - False - - - True - False - 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 - 0 - - - True - True - 1 - - - - - True - True - 1 - - - - - True - False - - - True - False - UserGropProject: - 0 - - - False - True - 0 - - - - - True - False - 5 - 5 - 0 - - - True - 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 - 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 - 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 - 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 - 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 - - - - - - - 1000000 - 1 - 10 - - - 1000000 - 1 - 10 - - - 1024 - 1 - 10 - - - 1024 - 1 - 10 - - - False - start - start - False - 450 - 250 - dialog-question-symbolic - - - True - False - vertical - - - True - False - - - True - False - start - 20 - 20 - dialog-question-symbolic - 5 - - - False - True - 0 - - - - - True - False - vertical - - - True - False - start - 10 - 5 - Would you like to read documentation in the Web? - True - 0 - - - - - - - False - True - 0 - - - - - True - False - start - start - 10 - 10 - You will be redirected to documentation website where documentation is translated and supported by community. - True - 0 - - - - True - True - 1 - - - - - Always redirect to online documentation - True - True - False - end - 10 - True - - - - False - True - 2 - - - - - - True - True - 1 - - - - - - True - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 30 - True - - - Cancel - True - True - True - - - - True - True - 0 - - - - - Read Online - True - True - True - - - - True - True - 1 - - - - - False - True - 1 - - - - - - - True - False - True - - - True - False - ubl-settings-datetime - - - - - - - - True - False - 32 - dialog-question-symbolic - - - - - - - 800 - 600 - False - True - True - com.ublinux.ubl-settings-datetime - - - - - - True - False - True - - - True - False - ubl-settings-datetime - - - - - True - False - 32 - com.ublinux.ubl-settings-datetime - 5 - - - - - - diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index 4eecfcb..b6034c5 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -47,16 +47,16 @@ void MainWindow::settings() { ,quotegroupFilesHarLimitLabel); obj_quotas_sys.set_map_gui(map_gui_cfg); obj_quotas_ubconfig.set_map_gui(map_gui_cfg); - filtersNameFilterCheckbox->set_active(true); - filtersQuotasFilterCheckbox->set_active(true); - filtersSizeFilterCheckbox->set_active(true); - filtersSoftSizeFilterCheckbox->set_active(true); - filtersHardSizeFilterCheckbox->set_active(true); - filtersHardSizeDelayFilterCheckbox->set_active(true); - filtersFilesFilterCheckbox->set_active(true); - filtersSoftFilesFilterCheckbox->set_active(true); - filtersHardFilesFilterCheckbox->set_active(true); - filtersHardFilesDelayFilterCheckbox->set_active(true); + chbFilterName->set_active(true); + chbFilterQuotas->set_active(true); + chbFilterSize->set_active(true); + chbFilterSoftLimitSize->set_active(true); + chbFilterHardLimitSize->set_active(true); + chbFilterHardLimitSizeDelay->set_active(true); + chbFilterFiles->set_active(true); + chbFilterSoftLimitFile->set_active(true); + chbFilterHardLimitFile->set_active(true); + chbFilterHardLimitFileDelay->set_active(true); #ifdef WEBKIT_FOUND one = WEBKIT_WEB_VIEW( webkit_web_view_new() ); @@ -228,16 +228,16 @@ void MainWindow::lacalization() { groupsDeviceLabel->set_label(str_device); usersDeviceLabel->set_label(str_device); headLabel->set_label(str_lb_head); - filtersNameFilterCheckbox->set_label(str_name); - filtersQuotasFilterCheckbox->set_label(str_quotas); - filtersSizeFilterCheckbox->set_label(str_size); - filtersSoftSizeFilterCheckbox->set_label(str_soft_limit_size); - filtersHardSizeFilterCheckbox->set_label(str_hard_limit_size); - filtersHardSizeDelayFilterCheckbox->set_label(str_deferring_hard_limit_size); - filtersFilesFilterCheckbox->set_label(str_files); - filtersSoftFilesFilterCheckbox->set_label(str_soft_restriction_files); - filtersHardFilesFilterCheckbox->set_label(str_severe_limitation_files); - filtersHardFilesDelayFilterCheckbox->set_label(str_deferring_limit_files); + 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); quotegroupSizeFrameLabel->set_text(str_size); quotegroupFilesFrameLabel->set_text(str_files); quotegroupSizeCurrentlyLabel->set_text(str_currently_using); @@ -253,7 +253,7 @@ void MainWindow::lacalization() { btnSaveLocalGlob->set_label(save_all); btnSaveGlob->set_label(save_global); btnSaveLocal->set_label(save_local); - lblHeadFiltersWindow->set_label(str_filters); + lblFiltersHead->set_label(str_filters); ProjectTabLabel->set_label(str_projects); usersProjectLabel->set_text(str_device); lblhelpHeader->set_text(read_documentation_web); @@ -266,7 +266,6 @@ void MainWindow::lacalization() { lblSetDevice->set_text(str_device); lblQuotasStatus->set_text(str_quota_status); lblSetUGP->set_text(""); - lblQuotasStatus->set_text(_("Quota use status:")); this->fill_in_pow_memory(quotegroupSizeSoftLimitCombo); this->fill_in_pow_memory(quotegroupSizeHardLimitCombo); @@ -390,17 +389,17 @@ void MainWindow::get_builder() { builder->get_widget("groupsDeviceLabel", groupsDeviceLabel); builder->get_widget("usersDeviceLabel", usersDeviceLabel); builder->get_widget("headLabel", headLabel); - builder->get_widget("FiltersWindow", FiltersWindow); - builder->get_widget("filtersNameFilterCheckbox", filtersNameFilterCheckbox); - builder->get_widget("filtersQuotasFilterCheckbox", filtersQuotasFilterCheckbox); - builder->get_widget("filtersSizeFilterCheckbox", filtersSizeFilterCheckbox); - builder->get_widget("filtersSoftSizeFilterCheckbox", filtersSoftSizeFilterCheckbox); - builder->get_widget("filtersHardSizeFilterCheckbox", filtersHardSizeFilterCheckbox); - builder->get_widget("filtersHardSizeDelayFilterCheckbox", filtersHardSizeDelayFilterCheckbox); - builder->get_widget("filtersFilesFilterCheckbox", filtersFilesFilterCheckbox); - builder->get_widget("filtersSoftFilesFilterCheckbox", filtersSoftFilesFilterCheckbox); - builder->get_widget("filtersHardFilesFilterCheckbox", filtersHardFilesFilterCheckbox); - builder->get_widget("filtersHardFilesDelayFilterCheckbox", filtersHardFilesDelayFilterCheckbox); + 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("btnLoadGlob", btnLoadGlob); builder->get_widget("btnLoadLocal", btnLoadLocal); builder->get_widget("btnSynopsis", btnSynopsis); @@ -423,7 +422,7 @@ void MainWindow::get_builder() { builder->get_widget("QuotasEditWindow", QuotasEditWindow); builder->get_widget("headerAboutTopic", headerAboutTopic); builder->get_widget("lblHeadQuotasEditWindow", lblHeadQuotasEditWindow); - builder->get_widget("lblHeadFiltersWindow", lblHeadFiltersWindow); + builder->get_widget("lblFiltersHead", lblFiltersHead); builder->get_widget("usersDeviceCombo", usersDeviceCombo); builder->get_widget("GroupsTabLabel", GroupsTabLabel); builder->get_widget("generalTabLabel", generalTabLabel); @@ -490,7 +489,7 @@ void MainWindow::get_builder() { builder->get_widget("lblSetUGP", lblSetUGP); builder->get_widget("lblSetNameDevice", lblSetNameDevice); builder->get_widget("lblSetQuotasStatus", lblSetQuotasStatus); - builder->get_widget("lblSetNameUGP", lblSetNameUGP); + builder->get_widget("cmbSetNameUGP", cmbSetNameUGP); builder->get_widget("usersProjectCombo", usersProjectCombo); } @@ -551,7 +550,7 @@ void MainWindow::event() { sigc::bind, struct tv_g_u_p> (sigc::mem_fun( *this, &MainWindow::set_add_tv_g_u_p), row, list_store_groups, obj_tv_g_u_p)); - filtersNameFilterCheckbox->signal_toggled().connect(sigc::mem_fun( *this, + chbFilterName->signal_toggled().connect(sigc::mem_fun( *this, &MainWindow::del_columns)); btnEditGroups->signal_clicked().connect( sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, @@ -571,7 +570,7 @@ void MainWindow::set_change_gui(Glib::RefPtr* list_store, const if(row) { string name = row[m_columns.name] + ""; lblSetNameDevice->set_text(combo_box->get_active_text()); - lblSetNameUGP->set_text(name); + cmbSetNameUGP->set_active_text(name); QuotasEditWindow->show(); } } @@ -579,17 +578,17 @@ void MainWindow::set_change_gui(Glib::RefPtr* list_store, const } void MainWindow::edit_tree_view_U(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate) { - lblSetUGP->set_text(str_users); + 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_groups); + 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_projects); + lblSetUGP->set_text(str_project_1); set_change_gui(list_store, iter, flag_validate, usersProjectCombo); } void MainWindow::del_columns() { @@ -638,7 +637,7 @@ void MainWindow::mode_switch_quota() { } void MainWindow::filters_show() { - FiltersWindow->show_all(); + wndFilters->show_all(); } void MainWindow::set_data_cfg() { diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 8fb3938..5856c81 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -80,7 +80,6 @@ #define str_currently_using _("Currently using:") #define str_currently_using_space _("Currently using: ") #define str_filters _("Filters") -#define str_projects _("Projects") #define str_quotas _("Quotas") #define str_help_h _("GTK settings disk quota for UBLinux\n" \ "\n" \ @@ -96,6 +95,10 @@ #define str_version _("ubl-settings-diskquota version: ") #define str_user _("User") #define str_group _("Group") +#define str_projects _("Projects") +#define str_user_1 _("User:") +#define str_group_1 _("Group:") +#define str_project_1 _("Projects:") #define str_device_project _("Device\nProject") #define str_quota _("Quota type") #define str_status _("Status") @@ -257,18 +260,18 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label *groupsDeviceLabel; Gtk::Label *usersDeviceLabel; Gtk::Label *headLabel; - Gtk::Window *FiltersWindow; - Gtk::CheckButton *filtersNameFilterCheckbox; - Gtk::CheckButton *filtersQuotasFilterCheckbox; - Gtk::CheckButton *filtersSizeFilterCheckbox; - Gtk::CheckButton *filtersSoftSizeFilterCheckbox; - Gtk::CheckButton *filtersHardSizeFilterCheckbox; - Gtk::CheckButton *filtersHardSizeDelayFilterCheckbox; + 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 *filtersFilesFilterCheckbox; - Gtk::CheckButton *filtersSoftFilesFilterCheckbox; - Gtk::CheckButton *filtersHardFilesFilterCheckbox; - Gtk::CheckButton *filtersHardFilesDelayFilterCheckbox; + Gtk::CheckButton *chbFilterFiles; + Gtk::CheckButton *chbFilterSoftLimitFile; + Gtk::CheckButton *chbFilterHardLimitFile; + Gtk::CheckButton *chbFilterHardLimitFileDelay; Gtk::TreeView *groupsQuotasTree; Gtk::TreeView *usersQuotasTree; Gtk::TreeView *ProjectQuotasTree; @@ -286,7 +289,7 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Window *QuotasEditWindow; Gtk::Label *headerAboutTopic; Gtk::Label *lblHeadQuotasEditWindow; - Gtk::Label *lblHeadFiltersWindow; + Gtk::Label *lblFiltersHead; Gtk::ComboBoxText *usersDeviceCombo; Gtk::ComboBoxText *groupsDeviceCombo; Gtk::ComboBoxText *generalDeviceCombo; @@ -348,7 +351,7 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label* lblSetUGP; Gtk::Label* lblSetNameDevice; Gtk::Label* lblSetQuotasStatus; - Gtk::Label* lblSetNameUGP; + Gtk::ComboBoxText* cmbSetNameUGP; #ifdef WEBKIT_FOUND Gtk::Window *wndWeb; Gtk::Widget *three; diff --git a/source/util.cc b/source/util.cc index dcbdc95..34f622b 100644 --- a/source/util.cc +++ b/source/util.cc @@ -146,4 +146,83 @@ string file_read(string filename) { } return buffer; } + +unsigned short read_uid_min_max(string filename, string search) { + std::string line; + int uid = 0; + string remove_tab = "\t"; + string remove_space = " "; + std::ifstream in(filename); // окрываем файл для чтения + if (in.is_open()){ + while (getline(in, line)){ + try{ + if (line.find(search) != string::npos && (line.find("SYS_"+search) == string::npos)) { + Utils::str_remove(line, search); + Utils::str_remove(line, remove_space); + Utils::str_remove(line, remove_tab); + uid = atoi(line.c_str()); + } + } + catch (int x) { + if (search == "UID_MIN"){ + uid = 1000; + } + else{ + uid = 65534; + } + + } + + } + } + else{ + if (search == "UID_MIN") { + uid = 1000; + } + else{ + uid = 65534; + } + } + in.close(); + return uid; + +} + +vector pars_users() { + unsigned short uid_min = Utils::read_uid_min_max(file_source_login_min_max, "UID_MIN"); + unsigned short uid_max = Utils::read_uid_min_max(file_source_login_min_max, "UID_MAX"); + vector vec_user; + while (true) { + errno = 0; + passwd* entry = getpwent(); + if (!entry) { + if (errno) { + break; + } + break; + } + if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) { + vec_user.push_back(entry->pw_name); + } + } + endpwent(); + return vec_user; +} +vector pars_group() { + vector vec_group; + while (true) { + errno = 0; // so we can distinguish errors from no more entries + passwd* entry = getpwent(); + if (!entry) { + if (errno) { + std::cerr << "Error reading password database\n"; + break; + } + break; + } + vec_group.push_back(entry->pw_name); + } + endpwent(); + return vec_group; +} } \ No newline at end of file diff --git a/source/util.h b/source/util.h index 90aebad..8afa931 100644 --- a/source/util.h +++ b/source/util.h @@ -5,6 +5,7 @@ using namespace std; namespace Utils { +#define file_source_login_min_max "/etc/login.defs" template struct Result{ Type response; @@ -26,5 +27,8 @@ std::vector split(std::string text, char delim); vector pars_users(); int synopsis_show(string str_link); string file_read(string filename); +unsigned short read_uid_min_max(string filename, string search); +vector pars_users(); +vector pars_group(); } #endif \ No newline at end of file diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index d9c3497..db1973c 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -8,247 +8,6 @@ - - False - start - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - vertical - - - Name - True - True - False - start - 5 - True - - - False - True - 0 - - - - - Quotas - True - True - False - start - True - - - False - True - 1 - - - - - Size - True - True - False - start - True - - - False - True - 2 - - - - - Soft limit (size) - True - True - False - start - True - - - False - True - 3 - - - - - Hard limit (size) - True - True - False - start - True - - - False - True - 4 - - - - - True - False - end - 5 - 5 - True - - - gtk-cancel - True - True - True - center - True - - - False - True - 0 - - - - - gtk-save - True - True - True - center - True - - - False - True - 1 - - - - - False - True - end - 5 - - - - - Hard limit (size) delay - True - True - False - start - True - - - False - True - 5 - - - - - Files - True - True - False - start - True - - - False - True - 7 - - - - - Soft limit (files) - True - True - False - start - True - - - False - True - 8 - - - - - Hard limit (files) - True - True - False - start - True - - - False - True - 9 - - - - - Hard limit (files) delay - True - True - False - start - True - - - False - True - 10 - - - - - - - True - False - True - - - True - False - System quotas - - - - - - - - True - False - 32 - com.ublinux.ubl-settings-diskquota - 5 - - - - - @@ -3083,15 +2842,12 @@ - + True False - 5 - 5 - 0 - True + False True 1 @@ -3630,6 +3386,247 @@ 1 10 + + False + start + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + Name + True + True + False + start + 5 + True + + + False + True + 0 + + + + + Quotas + True + True + False + start + True + + + False + True + 1 + + + + + Size + True + True + False + start + True + + + False + True + 2 + + + + + Soft limit (size) + True + True + False + start + True + + + False + True + 3 + + + + + Hard limit (size) + True + True + False + start + True + + + False + True + 4 + + + + + True + False + end + 5 + 5 + True + + + gtk-cancel + True + True + True + center + True + + + False + True + 0 + + + + + gtk-save + True + True + True + center + True + + + False + True + 1 + + + + + False + True + end + 5 + + + + + Hard limit (size) delay + True + True + False + start + True + + + False + True + 5 + + + + + Files + True + True + False + start + True + + + False + True + 7 + + + + + Soft limit (files) + True + True + False + start + True + + + False + True + 8 + + + + + Hard limit (files) + True + True + False + start + True + + + False + True + 9 + + + + + Hard limit (files) delay + True + True + False + start + True + + + False + True + 10 + + + + + + + True + False + True + + + True + False + System quotas + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-diskquota + 5 + + + + + False start diff --git a/ubl-settings-diskquota.pot b/ubl-settings-diskquota.pot index f05bc83..97c1636 100644 --- a/ubl-settings-diskquota.pot +++ b/ubl-settings-diskquota.pot @@ -17,6 +17,15 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "User:" +msgstr "" + +msgid "Group:" +msgstr "" + +msgid "Projects:" +msgstr "" + msgid "Kb" msgstr "" diff --git a/ubl-settings-diskquota_ru.po b/ubl-settings-diskquota_ru.po index eb421b8..a8618fc 100644 --- a/ubl-settings-diskquota_ru.po +++ b/ubl-settings-diskquota_ru.po @@ -30,7 +30,7 @@ msgid "Tb" msgstr "Тб" msgid "Quota use status:" -msgstr "Статус использования квот" +msgstr "Статус использования квот:" msgid "Would you like to read documentation in the Web?" msgstr "Вы хотите прочитать справку в Сети?" @@ -163,6 +163,15 @@ msgstr "Пользователь" msgid "Group" msgstr "Группа" +msgid "User:" +msgstr "Пользователь:" + +msgid "Group:" +msgstr "Группа:" + +msgid "Projects:" +msgstr "Проект:" + msgid "Quota type" msgstr "Тип квот" From aa5e8a51c5d03caf9b6c5ceb1d4ef1ca6ffdc8d6 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 11 May 2023 11:55:59 +0600 Subject: [PATCH 07/26] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=B5=D1=81=20=D1=84?= =?UTF-8?q?=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D1=8B=20=D0=B2=20=D0=BE=D1=82?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-diskquota.cc | 49 +----------- source/ubl-settings-diskquota.h | 14 +--- source/view_filters.cc | 125 +++++++++++++++++++++++++++++++ source/view_filters.h | 48 ++++++++++++ ubl-settings-diskquota.glade | 4 +- 5 files changed, 177 insertions(+), 63 deletions(-) create mode 100644 source/view_filters.cc create mode 100644 source/view_filters.h diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index b6034c5..ba1d46b 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -47,17 +47,6 @@ void MainWindow::settings() { ,quotegroupFilesHarLimitLabel); obj_quotas_sys.set_map_gui(map_gui_cfg); obj_quotas_ubconfig.set_map_gui(map_gui_cfg); - chbFilterName->set_active(true); - chbFilterQuotas->set_active(true); - chbFilterSize->set_active(true); - chbFilterSoftLimitSize->set_active(true); - chbFilterHardLimitSize->set_active(true); - chbFilterHardLimitSizeDelay->set_active(true); - chbFilterFiles->set_active(true); - chbFilterSoftLimitFile->set_active(true); - chbFilterHardLimitFile->set_active(true); - chbFilterHardLimitFileDelay->set_active(true); - #ifdef WEBKIT_FOUND one = WEBKIT_WEB_VIEW( webkit_web_view_new() ); three = Glib::wrap(GTK_WIDGET(one)); @@ -228,16 +217,6 @@ void MainWindow::lacalization() { groupsDeviceLabel->set_label(str_device); usersDeviceLabel->set_label(str_device); headLabel->set_label(str_lb_head); - 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); quotegroupSizeFrameLabel->set_text(str_size); quotegroupFilesFrameLabel->set_text(str_files); quotegroupSizeCurrentlyLabel->set_text(str_currently_using); @@ -253,7 +232,6 @@ void MainWindow::lacalization() { btnSaveLocalGlob->set_label(save_all); btnSaveGlob->set_label(save_global); btnSaveLocal->set_label(save_local); - lblFiltersHead->set_label(str_filters); ProjectTabLabel->set_label(str_projects); usersProjectLabel->set_text(str_device); lblhelpHeader->set_text(read_documentation_web); @@ -385,21 +363,10 @@ void MainWindow::get_builder() { builder->get_widget("lblLoad", lblLoad); builder->get_widget("lblSave", lblSave); builder->get_widget("btnSettings", btnSettings); - builder->get_widget("btnSettings", btnSettings); builder->get_widget("groupsDeviceLabel", groupsDeviceLabel); builder->get_widget("usersDeviceLabel", usersDeviceLabel); builder->get_widget("headLabel", headLabel); - 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("btnLoadGlob", btnLoadGlob); builder->get_widget("btnLoadLocal", btnLoadLocal); builder->get_widget("btnSynopsis", btnSynopsis); @@ -422,7 +389,6 @@ void MainWindow::get_builder() { builder->get_widget("QuotasEditWindow", QuotasEditWindow); builder->get_widget("headerAboutTopic", headerAboutTopic); builder->get_widget("lblHeadQuotasEditWindow", lblHeadQuotasEditWindow); - builder->get_widget("lblFiltersHead", lblFiltersHead); builder->get_widget("usersDeviceCombo", usersDeviceCombo); builder->get_widget("GroupsTabLabel", GroupsTabLabel); builder->get_widget("generalTabLabel", generalTabLabel); @@ -549,18 +515,6 @@ void MainWindow::event() { btnAddGroups->signal_clicked().connect( sigc::bind, struct tv_g_u_p> (sigc::mem_fun( *this, &MainWindow::set_add_tv_g_u_p), row, list_store_groups, obj_tv_g_u_p)); - - chbFilterName->signal_toggled().connect(sigc::mem_fun( *this, - &MainWindow::del_columns)); - btnEditGroups->signal_clicked().connect( - sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, - &MainWindow::edit_tree_view_G), &list_store_groups, &iter_groups, flag_validate_del_groups)); - btnEditUsers->signal_clicked().connect( - sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, - &MainWindow::edit_tree_view_U), &list_store_users, &iter_users, flag_validate_del_users)); - btnEditProject->signal_clicked().connect( - sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, - &MainWindow::edit_tree_view_P), &list_store_project, &iter_project, flag_validate_del_project)); } @@ -637,7 +591,6 @@ void MainWindow::mode_switch_quota() { } void MainWindow::filters_show() { - wndFilters->show_all(); } void MainWindow::set_data_cfg() { diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 5856c81..3b34e49 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -260,18 +260,7 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label *groupsDeviceLabel; Gtk::Label *usersDeviceLabel; Gtk::Label *headLabel; - 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::TreeView *groupsQuotasTree; Gtk::TreeView *usersQuotasTree; Gtk::TreeView *ProjectQuotasTree; @@ -289,7 +278,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Window *QuotasEditWindow; Gtk::Label *headerAboutTopic; Gtk::Label *lblHeadQuotasEditWindow; - Gtk::Label *lblFiltersHead; Gtk::ComboBoxText *usersDeviceCombo; Gtk::ComboBoxText *groupsDeviceCombo; Gtk::ComboBoxText *generalDeviceCombo; diff --git a/source/view_filters.cc b/source/view_filters.cc new file mode 100644 index 0000000..8d87019 --- /dev/null +++ b/source/view_filters.cc @@ -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 (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterName)); + chbFilterQuotas->signal_toggled().connect( + sigc::bind (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterQuotas)); + chbFilterSize->signal_toggled().connect( + sigc::bind (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterSize)); + chbFilterSoftLimitSize->signal_toggled().connect( + sigc::bind (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterSoftLimitSize)); + chbFilterHardLimitSize->signal_toggled().connect( + sigc::bind (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterHardLimitSize)); + chbFilterHardLimitSizeDelay->signal_toggled().connect( + sigc::bind (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterHardLimitSizeDelay)); + chbFilterFiles->signal_toggled().connect( + sigc::bind (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterFiles)); + chbFilterSoftLimitFile->signal_toggled().connect( + sigc::bind (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterSoftLimitFile)); + chbFilterHardLimitFile->signal_toggled().connect( + sigc::bind (sigc::mem_fun(*this, + &MainWindow::set_map_flag), chbFilterHardLimitFile)); + chbFilterHardLimitFileDelay->signal_toggled().connect( + sigc::bind (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 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; + } +} \ No newline at end of file diff --git a/source/view_filters.h b/source/view_filters.h new file mode 100644 index 0000000..c6c2514 --- /dev/null +++ b/source/view_filters.h @@ -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 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 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 get_filters() +}; + + diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index db1973c..f487184 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -2842,7 +2842,7 @@ - + True False @@ -3486,7 +3486,7 @@ 5 True - + gtk-cancel True True From 111a7927cd1657a284847d5b618e974a4c388996 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 11 May 2023 12:26:02 +0600 Subject: [PATCH 08/26] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=B5=D1=81=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D1=83=20=D1=81=20=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=B5=D1=80=D0=BE=D0=BC=20=D0=B2=20=D0=BE=D1=82?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/project_lib.h | 1 + source/ubl-settings-diskquota.cc | 62 +---------------------- source/ubl-settings-diskquota.h | 19 +------ source/view_filters.h | 6 ++- source/view_open_browser.cc | 86 ++++++++++++++++++++++++++++++++ source/view_open_browser.h | 34 +++++++++++++ ubl-settings-diskquota.glade | 2 +- 7 files changed, 129 insertions(+), 81 deletions(-) create mode 100644 source/view_open_browser.cc create mode 100644 source/view_open_browser.h diff --git a/source/project_lib.h b/source/project_lib.h index bc0b1d2..79c5c4d 100644 --- a/source/project_lib.h +++ b/source/project_lib.h @@ -23,4 +23,5 @@ #include #include #include "ubl-util-standard.c" +#include "ubl-settings-diskquota-cm.h" #endif \ No newline at end of file diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index ba1d46b..e21f793 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -47,11 +47,7 @@ void MainWindow::settings() { ,quotegroupFilesHarLimitLabel); obj_quotas_sys.set_map_gui(map_gui_cfg); obj_quotas_ubconfig.set_map_gui(map_gui_cfg); - #ifdef WEBKIT_FOUND - one = WEBKIT_WEB_VIEW( webkit_web_view_new() ); - three = Glib::wrap(GTK_WIDGET(one)); - wndWeb->add(*three); - #endif + if (geteuid() == 0) { this->load_system_cfg(); this->load_global_cfg(); @@ -234,12 +230,6 @@ void MainWindow::lacalization() { btnSaveLocal->set_label(save_local); ProjectTabLabel->set_label(str_projects); usersProjectLabel->set_text(str_device); - lblhelpHeader->set_text(read_documentation_web); - lblhelpText->set_text(redirected_documentation); - btnReadHelp->set_label(read_online); - btnCancelHelp->set_label(cancel); - chkAlwaysOpenHelp->set_label(always_redirect); - lblwebHeaderName->set_label(name_app); chbMangSystemFile->set_label(str_quotas_mode); lblSetDevice->set_text(str_device); lblQuotasStatus->set_text(str_quota_status); @@ -366,7 +356,6 @@ void MainWindow::get_builder() { builder->get_widget("groupsDeviceLabel", groupsDeviceLabel); builder->get_widget("usersDeviceLabel", usersDeviceLabel); builder->get_widget("headLabel", headLabel); - builder->get_widget("btnLoadGlob", btnLoadGlob); builder->get_widget("btnLoadLocal", btnLoadLocal); builder->get_widget("btnSynopsis", btnSynopsis); @@ -429,17 +418,6 @@ void MainWindow::get_builder() { builder->get_widget("btnFilterProject", btnFilterProject); builder->get_widget("btnFilterUsers", btnFilterUsers); builder->get_widget("btnFilterGroups", btnFilterGroups); - #ifdef WEBKIT_FOUND - builder->get_widget("wndWeb", wndWeb); - #endif - builder->get_widget("lblHeadeWndWeb", lblHeadeWndWeb); - builder->get_widget("lblwebHeaderName", lblwebHeaderName); - builder->get_widget("lblhelpText", lblhelpText); - builder->get_widget("lblhelpHeader", lblhelpHeader); - builder->get_widget("chkAlwaysOpenHelp", chkAlwaysOpenHelp); - builder->get_widget("btnReadHelp", btnReadHelp); - builder->get_widget("btnCancelHelp", btnCancelHelp); - builder->get_widget("wndShowWeb", wndShowWeb); builder->get_widget("chbMangSystemFile", chbMangSystemFile); builder->get_widget("btnDelGroups", btnDelGroups); builder->get_widget("btnDelProject", btnDelProject); @@ -460,16 +438,13 @@ void MainWindow::get_builder() { } void MainWindow::event() { - btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();}); - chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;}); - btnReadHelp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_browser)); btnFilterGroups->signal_clicked().connect([&]() {this->filters_show();}); btnFilterUsers->signal_clicked().connect([&]() {this->filters_show();}); btnFilterProject->signal_clicked().connect([&]() {this->filters_show();}); quotegroupSaveButton->signal_clicked().connect([&]() {}); btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); - btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); + //btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all_cfg();}); btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); @@ -678,39 +653,6 @@ void MainWindow::wrapper_save_global_cfg() { } -void MainWindow::synopsis_show() { - if (flag_open_browser == true) { - this->open_browser(); - } - else { - wndShowWeb->show_all(); - } - -} - -void MainWindow::open_browser() { - #ifdef WEBKIT_FOUND - webkit_web_view_load_uri(one, link_doc); - wndWeb->show_all(); - #else - this->template_open_browser(); - #endif -} - -void MainWindow::template_open_browser() { - string cmd = cmd_xdg + string(_(link_doc)) + " &"; - string buf = ""; - if (geteuid() == 0) { - string response_user = getlogin(); - int size_s = std::snprintf(nullptr, 0, cmd_execute, response_user.c_str(), cmd.c_str()) + 1; - auto size = static_cast(size_s); - std::unique_ptr buf(new char[ size ]); - std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() ); - cmd = std::string( buf.get(), buf.get() + size - 1 ); - } - obj_process_system.call(cmd, ""); -} - void MainWindow::wrapper_save_system_cfg() { this->set_data_cfg(); if (this->save_template("boot", "system")) { diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 3b34e49..3851143 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -10,7 +10,7 @@ #include "system_quotas.h" #include "ubconfig_quotas.h" #include -#include "ubl-settings-diskquota-cm.h" + #ifdef WEBKIT_FOUND #include #endif @@ -131,10 +131,6 @@ #define icon_checked "com.ublinux.ubl-settings-diskquota.checked" #define icon_warning "com.ublinux.ubl-settings-diskquota.warning" -#define link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota" -#define cmd_xdg "xdg-open " -#define cmd_execute "su -l %s -c \" DISPLAY=$DISPLAY %s \"" - #define path_app "/usr/bin/" #define path_glade "/usr/share/ubl-settings-diskquota/ui/ubl-settings-diskquota.glade" #define path_css "/usr/share/ubl-settings-diskquota/css/ubl-settings-diskquota.css" @@ -315,15 +311,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Button *btnFilterGroups; Gtk::Button *btnFilterUsers; Gtk::Button *btnFilterProject; - Gtk::Label *lblHeadeWndWeb; - - Gtk::Label *lblwebHeaderName; - Gtk::Label *lblhelpText; - Gtk::Label *lblhelpHeader; - Gtk::CheckButton *chkAlwaysOpenHelp; - Gtk::Button *btnReadHelp; - Gtk::Button *btnCancelHelp; - Gtk::Window *wndShowWeb; Gtk::CheckMenuItem *chbMangSystemFile; Gtk::Button* btnDelGroups; Gtk::Button* btnDelProject; @@ -363,7 +350,6 @@ class MainWindow : public Gtk::ApplicationWindow { string save_user_or_group; string sys_or_ubconfig; string hw_or_sw = ""; - bool flag_open_browser = false; string mode_quota = "ubconfig"; Glib::RefPtr list_store_groups; Glib::RefPtr list_store_users; @@ -391,13 +377,10 @@ class MainWindow : public Gtk::ApplicationWindow { void remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del); void init_tree_view_general(); void entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label); - void synopsis_show(); void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); void info_status_app(string stule); void filters_show(); void init_tree_view(); - void template_open_browser(); - void open_browser(); void del_columns(); void set_add_tv_g_u_p(Gtk::TreeModel::Row &row, Glib::RefPtr list_store, struct tv_g_u_p obj_tv_g_u_p); void load_template(map_str_str* map_temp, string cmd); diff --git a/source/view_filters.h b/source/view_filters.h index c6c2514..83be054 100644 --- a/source/view_filters.h +++ b/source/view_filters.h @@ -12,8 +12,10 @@ class view_filters { private: - Glib::RefPtr const& builder; string path_glade; + std::map map_filters_flag; +private: + Glib::RefPtr const& builder; Gtk::Window *wndFilters; Gtk::CheckButton *chbFilterName; Gtk::CheckButton *chbFilterQuotas; @@ -29,7 +31,6 @@ private: Gtk::Label *lblFiltersHead; Gtk::Button *btnFiltersSave; Gtk::Button *btnFiltersCancel; - std::map map_filters_flag; public: view_filters(/* args */); ~view_filters(); @@ -38,6 +39,7 @@ public: void get_builder(); void settings(); void show(); +private: void set_map_flag(Gtk::CheckButton* check_button); void save(); void cancel(); diff --git a/source/view_open_browser.cc b/source/view_open_browser.cc new file mode 100644 index 0000000..c891653 --- /dev/null +++ b/source/view_open_browser.cc @@ -0,0 +1,86 @@ +#include "view_open_browser.h" + +view_open_browser::view_open_browser(/* args */) { + builder = Gtk::Builder::create_from_file(path_glade); + this->settings(); +} + +view_open_browser::~view_open_browser() { +} + +void settings() { + this->get_builder(); + #ifdef WEBKIT_FOUND + one = WEBKIT_WEB_VIEW( webkit_web_view_new() ); + three = Glib::wrap(GTK_WIDGET(one)); + wndWeb->add(*three); + #endif + this->lacalization(); + this->event(); +} + +void view_open_browser::show() { + wndShowWeb->show(); +} +void view_open_browser::get_builder() { + #ifdef WEBKIT_FOUND + builder->get_widget("wndWeb", wndWeb); + #endif + builder->get_widget("lblHeadeWndWeb", lblHeadeWndWeb); + builder->get_widget("lblwebHeaderName", lblwebHeaderName); + builder->get_widget("lblhelpText", lblhelpText); + builder->get_widget("lblhelpHeader", lblhelpHeader); + builder->get_widget("chkAlwaysOpenHelp", chkAlwaysOpenHelp); + builder->get_widget("btnReadHelp", btnReadHelp); + builder->get_widget("btnCancelHelp", btnCancelHelp); + builder->get_widget("wndShowWeb", wndShowWeb); + +} +void view_open_browser::lacalization() { + lblwebHeaderName->set_label(name_app); + lblhelpText->set_text(redirected_documentation); + btnReadHelp->set_label(read_online); + btnCancelHelp->set_label(cancel); + chkAlwaysOpenHelp->set_label(always_redirect); + lblhelpHeader->set_text(read_documentation_web); +} + +void view_open_browser::event() { + btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();}); + chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;}); + btnReadHelp->signal_clicked().connect(sigc::mem_fun(*this, &view_open_browser::open_browser)); +} + +void view_open_browser::show() { + if (flag_open_browser == true) { + this->open_browser(); + } + else { + wndShowWeb->show_all(); + } +} + +void view_open_browser::open_browser() { + #ifdef WEBKIT_FOUND + webkit_web_view_load_uri(one, link_doc); + wndWeb->show_all(); + #else + if (this->template_open_browser() != 0) { + + } + #endif +} + +int view_open_browser::template_open_browser() { + string cmd = cmd_xdg + string(_(link_doc)) + " &"; + string buf = ""; + if (geteuid() == 0) { + string response_user = getlogin(); + int size_s = std::snprintf(nullptr, 0, cmd_execute, response_user.c_str(), cmd.c_str()) + 1; + auto size = static_cast(size_s); + std::unique_ptr buf(new char[ size ]); + std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() ); + cmd = std::string( buf.get(), buf.get() + size - 1 ); + } + return system(cmd); +} \ No newline at end of file diff --git a/source/view_open_browser.h b/source/view_open_browser.h new file mode 100644 index 0000000..59f986c --- /dev/null +++ b/source/view_open_browser.h @@ -0,0 +1,34 @@ +#include "project_lib.h" + +#define link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota" +#define cmd_xdg "xdg-open " +#define cmd_execute "su -l %s -c \" DISPLAY=$DISPLAY %s \"" + +class view_open_browser +{ +private: + string path_glade; + bool flag_open_browser = false; +private: + Glib::RefPtr const& builder; + Gtk::Button *btnReadHelp; + Gtk::Button *btnCancelHelp; + Gtk::Window *wndShowWeb; + Gtk::CheckButton *chkAlwaysOpenHelp; + Gtk::Label *lblwebHeaderName; + Gtk::Label *lblhelpText; + Gtk::Label *lblhelpHeader; + Gtk::Label *lblHeadeWndWeb; +public: + view_open_browser(/* args */); + ~view_open_browser(); + void lacalization(); + void event(); + void get_builder(); + void settings(); + void show(); + void synopsis_show(); +private: + int template_open_browser(); + void open_browser(); +}; \ No newline at end of file diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index f487184..9ecaebd 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -2842,7 +2842,7 @@ - + True False From b6fb6f97566f415ca026b4618da411780f110228 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 11 May 2023 12:47:56 +0600 Subject: [PATCH 09/26] =?UTF-8?q?=D0=9E=D0=BA=D0=BD=D0=BE=20"=D0=9E=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D0=B5"=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=20=D0=B2=20=D0=BE=D1=82=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-diskquota.cc | 16 +---------- source/ubl-settings-diskquota.h | 7 ----- source/view_about.cc | 48 ++++++++++++++++++++++++++++++++ source/view_about.h | 29 +++++++++++++++++++ source/view_filters.h | 1 + source/view_open_browser.h | 1 + 6 files changed, 80 insertions(+), 22 deletions(-) create mode 100644 source/view_about.cc create mode 100644 source/view_about.h diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index e21f793..14a36ee 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -26,7 +26,6 @@ void MainWindow::settings() { this->lacalization(); this->add_CSS(); this->flag_block_gui(); - btnBoxAboutDialog->set_visible(false); map_device = obj_device.get_parted(); this->filling_device_combo_box_template(groupsDeviceCombo, map_device); this->filling_device_combo_box_template(usersDeviceCombo, map_device); @@ -175,18 +174,8 @@ void MainWindow::view_add_columns(Gtk::TreeView &treeView) { } void MainWindow::lacalization() { - time_t now = time(0); - tm *ltm = localtime(&now); - unsigned int year = 1900 + ltm->tm_year; - string str_authors = string(copyright) + to_string(year); - aboutWindows->set_copyright(str_authors); - aboutWindows->set_comments(str_setting_user); - aboutWindows->set_website(website); - aboutWindows->set_version(_(version_application.c_str())); - aboutWindows->set_website_label(project_Home_page); generalTabLabel->set_text(str_general_settings); GroupsTabLabel->set_text(str_groups); - headerAboutTopic->set_label(_(app_name)); headerTopic->set_label(name_app); UsersTabLabel->set_text(str_users); generalGroupsFilesLabel->set_text(str_excess_files_delay); @@ -316,13 +305,11 @@ void MainWindow::get_builder() { builder->get_widget("headerTopic", headerTopic); builder->get_widget("boxButton", boxButton); builder->get_widget("boxSave", boxSave); - builder->get_widget("aboutWindows", aboutWindows); builder->get_widget("HeadOverlay", HeadOverlay); builder->get_widget("headerBar", headerBar); builder->get_widget("boxFuncs", boxFuncs); builder->get_widget("btnLoad", btnLoad); builder->get_widget("btnSave", btnSave); - builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog); builder->get_widget("HeadBackgroundImage", HeadBackgroundImage); builder->get_widget("imgInfo", imgInfo); builder->get_widget("lblWarning", lblWarning); @@ -376,7 +363,6 @@ void MainWindow::get_builder() { builder->get_widget("quoteFilesHardLimitLabel", quoteFilesHardLimitLabel); builder->get_widget("quotegroupFilesHarLimitLabel", quotegroupFilesHarLimitLabel); builder->get_widget("QuotasEditWindow", QuotasEditWindow); - builder->get_widget("headerAboutTopic", headerAboutTopic); builder->get_widget("lblHeadQuotasEditWindow", lblHeadQuotasEditWindow); builder->get_widget("usersDeviceCombo", usersDeviceCombo); builder->get_widget("GroupsTabLabel", GroupsTabLabel); @@ -445,7 +431,7 @@ void MainWindow::event() { btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); //btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); - btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); + //btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all_cfg();}); btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system_cfg();}); diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 3851143..79ccadf 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -15,10 +15,7 @@ #include #endif -#define copyright _("Copyright © UBSoft LLC, 2022 - ") #define name_app _("ubl-settings-diskquota") -#define website _("https://wiki.ublinux.com") -#define project_Home_page _("Project Home Page") #define configuring_system_boot _("Configuring system boot parameters") #define system_boot _("System boot") #define str_about _("About ubl-settings-diskquota") @@ -66,7 +63,6 @@ #define str_hours _("hours") #define str_minutes _("minutes") #define str_device _("Device:") -#define str_setting_user _("Setting user quotas") #define str_users _("Users") #define str_groups _("Groups") #define str_files _("files") @@ -206,7 +202,6 @@ class MainWindow : public Gtk::ApplicationWindow { int error; }; Gtk::Label *headerTopic; - Gtk::AboutDialog *aboutWindows; Gtk::Overlay *HeadOverlay; Gtk::HeaderBar *headerBar; Gtk::Box *boxSave; @@ -215,7 +210,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::MenuButton *btnSave; Gtk::MenuButton *btnLoad; Gtk::MenuButton *btnSettings; - Gtk::ButtonBox *btnBoxAboutDialog; Gtk::Image *HeadBackgroundImage; Gtk::Image *imgInfo; Gtk::Box *boxInfoError; @@ -272,7 +266,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label *quotegroupFilesHarLimitLabel; Gtk::Label *quotegroupSizeSoftLimitLabel; Gtk::Window *QuotasEditWindow; - Gtk::Label *headerAboutTopic; Gtk::Label *lblHeadQuotasEditWindow; Gtk::ComboBoxText *usersDeviceCombo; Gtk::ComboBoxText *groupsDeviceCombo; diff --git a/source/view_about.cc b/source/view_about.cc new file mode 100644 index 0000000..e483e4d --- /dev/null +++ b/source/view_about.cc @@ -0,0 +1,48 @@ +#include "view_about.h" + + + +view_about::view_about(/* args */) { + builder = Gtk::Builder::create_from_file(path_glade); + this->settings(); +} + +view_about::~view_about() { +} + +void view_about::lacalization() { + time_t now = time(0); + tm *ltm = localtime(&now); + unsigned int year = 1900 + ltm->tm_year; + string str_authors = string(copyright) + to_string(year); + aboutWindows->set_copyright(str_authors); + aboutWindows->set_comments(str_setting_user); + aboutWindows->set_website(website); + aboutWindows->set_version(_(version_application.c_str())); + aboutWindows->set_website_label(project_Home_page); + headerAboutTopic->set_label(_(app_name)); +} + +void view_about::set_name(string app_name) { + app_name = app_name; +} + +void view_about::set_version(string version_application) { + version_application = version_application; +} + +void view_about::get_builder() { + builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog); + builder->get_widget("aboutWindows", aboutWindows); + builder->get_widget("headerAboutTopic", headerAboutTopic); +} + +void view_about::settings() { + this->get_builder(); + this->lacalization(); + btnBoxAboutDialog->set_visible(false); +} + +void view_filters::set_path_glade(string path_glade) { + this->path_glade = path_glade; +} \ No newline at end of file diff --git a/source/view_about.h b/source/view_about.h new file mode 100644 index 0000000..c80ff40 --- /dev/null +++ b/source/view_about.h @@ -0,0 +1,29 @@ +#include "project_lib.h" +#define copyright _("Copyright © UBSoft LLC, 2022 - ") +#define str_setting_user _("Setting user quotas") +#define website _("https://wiki.ublinux.com") +#define project_Home_page _("Project Home Page") +class view_about +{ +private: + string path_glade; + string version_application; + string app_name; + +private: + Glib::RefPtr const& builder; + Gtk::AboutDialog *aboutWindows; + Gtk::Label *headerAboutTopic; + Gtk::ButtonBox *btnBoxAboutDialog; +public: + view_about(/* args */); + ~view_about(); + void lacalization(); + void event(); + void get_builder(); + void settings(); + void show(); + void set_path_glade(string path_glade); + void set_name(string app_name); + void set_version(string version_application); +}; \ No newline at end of file diff --git a/source/view_filters.h b/source/view_filters.h index 83be054..cf4c75f 100644 --- a/source/view_filters.h +++ b/source/view_filters.h @@ -39,6 +39,7 @@ public: void get_builder(); void settings(); void show(); + void set_path_glade(string path_glade) private: void set_map_flag(Gtk::CheckButton* check_button); void save(); diff --git a/source/view_open_browser.h b/source/view_open_browser.h index 59f986c..5081290 100644 --- a/source/view_open_browser.h +++ b/source/view_open_browser.h @@ -28,6 +28,7 @@ public: void settings(); void show(); void synopsis_show(); + void set_path_glade(string path_glade); private: int template_open_browser(); void open_browser(); From 784c87fa8f827a5f71f8be2a8e9710907c028c30 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 11 May 2023 14:32:32 +0600 Subject: [PATCH 10/26] =?UTF-8?q?=D0=9E=D0=BA=D0=BD=D0=BE=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BA=20=D0=B2=D1=8B=D0=BD=D0=B5?= =?UTF-8?q?=D1=81=D0=B5=D0=BD=D0=BE=20=D0=B2=20=D0=BE=D1=82=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-diskquota.cc | 123 ++---------------------- source/ubl-settings-diskquota.h | 48 ++-------- source/view_about.cc | 3 + source/view_about.h | 5 +- source/view_filters.h | 3 + source/view_open_browser.cc | 4 + source/view_open_browser.h | 6 +- source/view_set_user_group.cc | 157 +++++++++++++++++++++++++++++++ source/view_set_user_group.h | 71 ++++++++++++++ 9 files changed, 259 insertions(+), 161 deletions(-) create mode 100644 source/view_set_user_group.cc create mode 100644 source/view_set_user_group.h diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index 14a36ee..e86f23d 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -32,18 +32,7 @@ void MainWindow::settings() { this->filling_device_combo_box_template(usersProjectCombo, map_device); 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); obj_quotas_ubconfig.set_map_gui(map_gui_cfg); @@ -66,13 +55,6 @@ void MainWindow::settings() { ubl_make_plugs(boxSave, boxButton, socket_ext_id_I, socket_trd_id_I); } -void MainWindow::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::init_spin_all() { generalGroupsSizeWeeksSpi->set_range(0, 52); generalGroupsSizeWeeksSpi->set_increments(1.0, 1.0); @@ -202,14 +184,7 @@ void MainWindow::lacalization() { groupsDeviceLabel->set_label(str_device); usersDeviceLabel->set_label(str_device); headLabel->set_label(str_lb_head); - quotegroupSizeFrameLabel->set_text(str_size); - quotegroupFilesFrameLabel->set_text(str_files); - quotegroupSizeCurrentlyLabel->set_text(str_currently_using); - quotegroupSizeSoftLimitLabel->set_text(str_soft_limit); - quoteSizeHardLimitLabel->set_text(str_hard_limit); - quoteFilesHardLimitLabel->set_text(str_hard_limit); - quotegroupFilesSoftLimitLabel->set_text(str_soft_limit); - quotegroupFilesCurrentlyLabel->set_text(str_currently_using); + btnLoadGlob->set_label(load_global); btnLoadLocal->set_label(load_local); btnAbout->set_label(str_about_1); @@ -220,11 +195,6 @@ void MainWindow::lacalization() { ProjectTabLabel->set_label(str_projects); usersProjectLabel->set_text(str_device); chbMangSystemFile->set_label(str_quotas_mode); - lblSetDevice->set_text(str_device); - lblQuotasStatus->set_text(str_quota_status); - lblSetUGP->set_text(""); - this->fill_in_pow_memory(quotegroupSizeSoftLimitCombo); - this->fill_in_pow_memory(quotegroupSizeHardLimitCombo); } @@ -353,17 +323,7 @@ void MainWindow::get_builder() { builder->get_widget("GroupsTabLabel", GroupsTabLabel); builder->get_widget("groupsQuotasTree", groupsQuotasTree); builder->get_widget("usersQuotasTree", usersQuotasTree); - builder->get_widget("quotegroupSizeFrameLabel", quotegroupSizeFrameLabel); - builder->get_widget("quotegroupFilesFrameLabel", quotegroupFilesFrameLabel); - builder->get_widget("quotegroupSizeCurrentlyLabel", quotegroupSizeCurrentlyLabel); - builder->get_widget("quotegroupFilesCurrentlyLabel", quotegroupFilesCurrentlyLabel); - builder->get_widget("quotegroupSizeSoftLimitLabel", quotegroupSizeSoftLimitLabel); - builder->get_widget("quoteSizeHardLimitLabel", quoteSizeHardLimitLabel); - builder->get_widget("quotegroupFilesSoftLimitLabel", quotegroupFilesSoftLimitLabel); - builder->get_widget("quoteFilesHardLimitLabel", quoteFilesHardLimitLabel); - builder->get_widget("quotegroupFilesHarLimitLabel", quotegroupFilesHarLimitLabel); - builder->get_widget("QuotasEditWindow", QuotasEditWindow); - builder->get_widget("lblHeadQuotasEditWindow", lblHeadQuotasEditWindow); + builder->get_widget("usersDeviceCombo", usersDeviceCombo); builder->get_widget("GroupsTabLabel", GroupsTabLabel); builder->get_widget("generalTabLabel", generalTabLabel); @@ -384,19 +344,7 @@ void MainWindow::get_builder() { builder->get_widget("generalUsersFilesHoursSpin", generalUsersFilesHoursSpin); builder->get_widget("generalUsersSizeMinuteSpin", generalUsersSizeMinuteSpin); builder->get_widget("generalUsersFilesMinutesSpin", generalUsersFilesMinutesSpin); - 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("GeneralQuotasTree", GeneralQuotasTree); builder->get_widget("ProjectQuotasTree", ProjectQuotasTree); builder->get_widget("ProjectTabLabel", ProjectTabLabel); @@ -414,12 +362,7 @@ void MainWindow::get_builder() { builder->get_widget("btnEditProject", btnEditProject); builder->get_widget("btnEditUsers", btnEditUsers); builder->get_widget("btnEditGroups", btnEditGroups); - builder->get_widget("lblSetDevice", lblSetDevice); - builder->get_widget("lblQuotasStatus", lblQuotasStatus); - builder->get_widget("lblSetUGP", lblSetUGP); - builder->get_widget("lblSetNameDevice", lblSetNameDevice); - builder->get_widget("lblSetQuotasStatus", lblSetQuotasStatus); - builder->get_widget("cmbSetNameUGP", cmbSetNameUGP); + builder->get_widget("usersProjectCombo", usersProjectCombo); } @@ -427,7 +370,7 @@ void MainWindow::event() { btnFilterGroups->signal_clicked().connect([&]() {this->filters_show();}); btnFilterUsers->signal_clicked().connect([&]() {this->filters_show();}); btnFilterProject->signal_clicked().connect([&]() {this->filters_show();}); - quotegroupSaveButton->signal_clicked().connect([&]() {}); + btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); //btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); @@ -436,27 +379,7 @@ void MainWindow::event() { btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system_cfg();}); chbMangSystemFile->signal_toggled().connect([&]() {this->mode_switch_quota();}); - 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(); btnDelGroups->signal_clicked().connect( sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, @@ -479,33 +402,9 @@ void MainWindow::event() { } -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; -} -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::del_columns() { //std::vector vec_columns = tree_view_select->get_columns(); } @@ -559,14 +458,6 @@ void MainWindow::set_data_cfg() { // Написать функцию } -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(); diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 79ccadf..7a5a588 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -140,11 +140,6 @@ #define system_save "ubconfig --target system --noexecute set boot " #define global_remove "ubconfig --target global --noexecute set/remove boot " #define system_remove "ubconfig --target system --noexecute set/remove boot " -#define str_quota_status "Quota use status:" -#define str_prefix_KB _("Kb") -#define str_prefix_MB _("Mb") -#define str_prefix_GB _("Gb") -#define str_prefix_TB _("Tb") using namespace std; extern string version_application; @@ -256,17 +251,8 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::TreeView *ProjectQuotasTree; Gtk::TreeView *GeneralQuotasTree; Gtk::Label *quotegroupGroupQuotasLabel; - Gtk::Label *quotegroupSizeFrameLabel; - Gtk::Label *quotegroupSizeCurrentlyLabel; - Gtk::Label *quoteSizeHardLimitLabel; - Gtk::Label *quotegroupFilesFrameLabel; - Gtk::Label *quotegroupFilesCurrentlyLabel; - Gtk::Label *quotegroupFilesSoftLimitLabel; - Gtk::Label *quoteFilesHardLimitLabel; - Gtk::Label *quotegroupFilesHarLimitLabel; - Gtk::Label *quotegroupSizeSoftLimitLabel; - Gtk::Window *QuotasEditWindow; - Gtk::Label *lblHeadQuotasEditWindow; + + Gtk::ComboBoxText *usersDeviceCombo; Gtk::ComboBoxText *groupsDeviceCombo; Gtk::ComboBoxText *generalDeviceCombo; @@ -288,19 +274,8 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::SpinButton *generalUsersFilesHoursSpin; Gtk::SpinButton *generalUsersSizeMinuteSpin; Gtk::SpinButton *generalUsersFilesMinutesSpin; - 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::Button *btnFilterGroups; Gtk::Button *btnFilterUsers; Gtk::Button *btnFilterProject; @@ -314,12 +289,8 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Button* btnEditProject; Gtk::Button* btnEditUsers; Gtk::Button* btnEditGroups; - Gtk::Label* lblSetDevice; - Gtk::Label* lblQuotasStatus; - Gtk::Label* lblSetUGP; - Gtk::Label* lblSetNameDevice; - Gtk::Label* lblSetQuotasStatus; - Gtk::ComboBoxText* cmbSetNameUGP; + + #ifdef WEBKIT_FOUND Gtk::Window *wndWeb; Gtk::Widget *three; @@ -370,7 +341,6 @@ class MainWindow : public Gtk::ApplicationWindow { void remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del); void init_tree_view_general(); void entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label); - void fill_in_pow_memory(Gtk::ComboBoxText *cb_text); void info_status_app(string stule); void filters_show(); void init_tree_view(); @@ -384,15 +354,11 @@ class MainWindow : public Gtk::ApplicationWindow { void wrapper_save_all_cfg(); void init_dict(string flag_load); void set_data_cfg(); - void set_change_gui(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate, Gtk::ComboBoxText *combo_box); void mode_switch_quota(); 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 edit_tree_view_U(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); - void edit_tree_view_G(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); - void edit_tree_view_P(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); void format_cmd_quotas_system(struct struct_quotas& _struct_quota); void format_cmd_quotas_ubconfig(struct struct_quotas& _struct_quota); void load_global_cfg(); @@ -401,8 +367,6 @@ class MainWindow : public Gtk::ApplicationWindow { 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/source/view_about.cc b/source/view_about.cc index e483e4d..97d23c9 100644 --- a/source/view_about.cc +++ b/source/view_about.cc @@ -31,6 +31,9 @@ void view_about::set_version(string version_application) { version_application = version_application; } +void view_about::show() { + aboutWindows->show(); +} void view_about::get_builder() { builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog); builder->get_widget("aboutWindows", aboutWindows); diff --git a/source/view_about.h b/source/view_about.h index c80ff40..f64ce41 100644 --- a/source/view_about.h +++ b/source/view_about.h @@ -1,3 +1,5 @@ +#ifndef VIEW_ABOUT_H +#define VIEW_ABOUT_H #include "project_lib.h" #define copyright _("Copyright © UBSoft LLC, 2022 - ") #define str_setting_user _("Setting user quotas") @@ -26,4 +28,5 @@ public: void set_path_glade(string path_glade); void set_name(string app_name); void set_version(string version_application); -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/source/view_filters.h b/source/view_filters.h index cf4c75f..2d3fd16 100644 --- a/source/view_filters.h +++ b/source/view_filters.h @@ -1,3 +1,5 @@ +#ifndef VIEW_FILTERS_H +#define VIEW_FILTERS_H #include "project_lib.h" #define str_name _("Name") @@ -47,5 +49,6 @@ private: void set_map_flag_false(); map get_filters() }; +#endif diff --git a/source/view_open_browser.cc b/source/view_open_browser.cc index c891653..d39caa4 100644 --- a/source/view_open_browser.cc +++ b/source/view_open_browser.cc @@ -83,4 +83,8 @@ int view_open_browser::template_open_browser() { cmd = std::string( buf.get(), buf.get() + size - 1 ); } return system(cmd); +} + +void view_filters::set_path_glade(string path_glade) { + this->path_glade = path_glade; } \ No newline at end of file diff --git a/source/view_open_browser.h b/source/view_open_browser.h index 5081290..393bf5b 100644 --- a/source/view_open_browser.h +++ b/source/view_open_browser.h @@ -1,3 +1,5 @@ +#ifndef VIEW_OPEN_BROWSER_H +#define VIEW_OPEN_BROWSER_H #include "project_lib.h" #define link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota" @@ -27,9 +29,9 @@ public: void get_builder(); void settings(); void show(); - void synopsis_show(); void set_path_glade(string path_glade); private: int template_open_browser(); void open_browser(); -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/source/view_set_user_group.cc b/source/view_set_user_group.cc new file mode 100644 index 0000000..9785589 --- /dev/null +++ b/source/view_set_user_group.cc @@ -0,0 +1,157 @@ +#include "view_set_user_group.h" + + +view_set_user_group::view_set_user_group(/* args */) { + builder = Gtk::Builder::create_from_file(path_glade); + this->settings(); +} + +view_set_user_group::~view_set_user_group() { +} + +void view_set_user_group::settings() { + this->get_builder(); + this->lacalization(); + check_limit(quotegroupSizeSoftLimitCheck + ,quotegroupSizeSoftLimitSpin + ,quotegroupSizeSoftLimitCombo); + check_limit(quotegroupSizeHardLimitCheck + ,quotegroupSizeHardLimitSpin + ,quotegroupSizeHardLimitCombo); + check_limit(quotegroupFilesSoftLimitCheck + ,quotegroupFilesSoftLimitSpin + ,quotegroupFilesSoftLimitlabel); + check_limit(quotegroupFilesHardLimitCheck + ,quotegroupFilesHardLimitSpin + ,quotegroupFilesHarLimitLabel); + this->event(); +} + +void view_set_user_group::event() { + quotegroupCancelButton->signal_clicked().connect([&]() {QuotasEditWindow->hide();}); + quotegroupSaveButton->signal_clicked().connect([&]() {}); + 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); + }); + +} + +void view_set_user_group::get_builder() { + builder->get_widget("lblSetDevice", lblSetDevice); + builder->get_widget("lblQuotasStatus", lblQuotasStatus); + builder->get_widget("lblSetUGP", lblSetUGP); + builder->get_widget("lblSetNameDevice", lblSetNameDevice); + builder->get_widget("lblSetQuotasStatus", lblSetQuotasStatus); + builder->get_widget("cmbSetNameUGP", cmbSetNameUGP); + builder->get_widget("quotegroupSizeFrameLabel", quotegroupSizeFrameLabel); + builder->get_widget("quotegroupFilesFrameLabel", quotegroupFilesFrameLabel); + builder->get_widget("quotegroupSizeCurrentlyLabel", quotegroupSizeCurrentlyLabel); + builder->get_widget("quotegroupFilesCurrentlyLabel", quotegroupFilesCurrentlyLabel); + builder->get_widget("quotegroupSizeSoftLimitLabel", quotegroupSizeSoftLimitLabel); + builder->get_widget("quoteSizeHardLimitLabel", quoteSizeHardLimitLabel); + builder->get_widget("quotegroupFilesSoftLimitLabel", quotegroupFilesSoftLimitLabel); + builder->get_widget("quoteFilesHardLimitLabel", quoteFilesHardLimitLabel); + builder->get_widget("quotegroupFilesHarLimitLabel", quotegroupFilesHarLimitLabel); + builder->get_widget("QuotasEditWindow", QuotasEditWindow); + builder->get_widget("lblHeadQuotasEditWindow", lblHeadQuotasEditWindow); + builder->get_widget("quotegroupCancelButton", quotegroupCancelButton); + builder->get_widget("quotegroupSaveButton", quotegroupSaveButton); + builder->get_widget("quotegroupSizeSoftLimitSpin", quotegroupSizeSoftLimitSpin); + builder->get_widget("quotegroupSizeHardLimitSpin", quotegroupSizeHardLimitSpin); + builder->get_widget("quotegroupFilesSoftLimitSpin", quotegroupFilesSoftLimitSpin); + builder->get_widget("quotegroupFilesHardLimitSpin", quotegroupFilesHardLimitSpin); + builder->get_widget("quotegroupFilesSoftLimitlabel", quotegroupFilesSoftLimitlabel); + builder->get_widget("quotegroupSizeSoftLimitCombo", quotegroupSizeSoftLimitCombo); + builder->get_widget("quotegroupSizeHardLimitCombo", quotegroupSizeHardLimitCombo); + builder->get_widget("quotegroupSizeSoftLimitCheck", quotegroupSizeSoftLimitCheck); + builder->get_widget("quotegroupSizeHardLimitCheck", quotegroupSizeHardLimitCheck); + builder->get_widget("quotegroupFilesSoftLimitCheck", quotegroupFilesSoftLimitCheck); + builder->get_widget("quotegroupFilesHardLimitCheck", quotegroupFilesHardLimitCheck); + +} + +void view_set_user_group::show() { + QuotasEditWindow->show(); +} + +void lacalization() { + lblSetDevice->set_text(str_device); + lblQuotasStatus->set_text(str_quota_status); + // lblSetUGP->set_text(""); + quotegroupSizeFrameLabel->set_text(str_size); + quotegroupFilesFrameLabel->set_text(str_files); + quotegroupSizeCurrentlyLabel->set_text(str_currently_using); + quotegroupSizeSoftLimitLabel->set_text(str_soft_limit); + quoteSizeHardLimitLabel->set_text(str_hard_limit); + quoteFilesHardLimitLabel->set_text(str_hard_limit); + quotegroupFilesSoftLimitLabel->set_text(str_soft_limit); + quotegroupFilesCurrentlyLabel->set_text(str_currently_using); + this->fill_in_pow_memory(quotegroupSizeSoftLimitCombo); + this->fill_in_pow_memory(quotegroupSizeHardLimitCombo); + +} + +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 view_set_user_group::set_path_glade(string path_glade) { + this->path_glade = path_glade; +} + +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) { + 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 diff --git a/source/view_set_user_group.h b/source/view_set_user_group.h new file mode 100644 index 0000000..f8728d6 --- /dev/null +++ b/source/view_set_user_group.h @@ -0,0 +1,71 @@ +#ifndef VIEW_SET_USER_GROUP_H +#define VIEW_SET_USER_GROUP_H +#include "project_lib.h" +#define str_device _("Device:") +#define str_quota_status _("Quota use status:") +#define str_size _("Size") +#define str_files _("files") +#define str_currently_using _("Currently using:") +#define str_soft_limit _("Soft limit") +#define str_hard_limit _("Hard limit") +#define str_hard_limit _("Hard limit") +#define str_prefix_KB _("Kb") +#define str_prefix_MB _("Mb") +#define str_prefix_GB _("Gb") +#define str_prefix_TB _("Tb") +class view_set_user_group +{ +private: + string path_glade; +private: + Glib::RefPtr const& builder; + Gtk::Label* lblSetDevice; + Gtk::Label* lblQuotasStatus; + Gtk::Label* lblSetUGP; + Gtk::Label* lblSetNameDevice; + Gtk::Label* lblSetQuotasStatus; + Gtk::ComboBoxText* cmbSetNameUGP; + Gtk::Label *quotegroupSizeFrameLabel; + Gtk::Label *quotegroupSizeCurrentlyLabel; + Gtk::Label *quoteSizeHardLimitLabel; + Gtk::Label *quotegroupFilesFrameLabel; + Gtk::Label *quotegroupFilesCurrentlyLabel; + Gtk::Label *quotegroupFilesSoftLimitLabel; + Gtk::Label *quoteFilesHardLimitLabel; + Gtk::Label *quotegroupFilesHarLimitLabel; + Gtk::Label *quotegroupSizeSoftLimitLabel; + Gtk::Window *QuotasEditWindow; + Gtk::Label *lblHeadQuotasEditWindow; + Gtk::Button *quotegroupCancelButton; + Gtk::Button *quotegroupSaveButton; + Gtk::SpinButton *quotegroupSizeSoftLimitSpin; + Gtk::SpinButton *quotegroupSizeHardLimitSpin; + Gtk::SpinButton *quotegroupFilesSoftLimitSpin; + Gtk::SpinButton *quotegroupFilesHardLimitSpin; + Gtk::Label *quotegroupFilesSoftLimitlabel; + Gtk::ComboBoxText *quotegroupSizeSoftLimitCombo; + Gtk::ComboBoxText *quotegroupSizeHardLimitCombo; + Gtk::CheckButton *quotegroupSizeSoftLimitCheck; + Gtk::CheckButton *quotegroupSizeHardLimitCheck; + Gtk::CheckButton *quotegroupFilesSoftLimitCheck; + Gtk::CheckButton *quotegroupFilesHardLimitCheck; +public: + view_set_user_group(/* args */); + ~view_set_user_group(); + void lacalization(); + void event(); + void get_builder(); + void settings(); + void show(); + void set_path_glade(string path_glade); +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); + 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 edit_tree_view_U(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); + void edit_tree_view_G(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); + void edit_tree_view_P(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate); +}; + +#endif \ No newline at end of file From be172479ac8aa0c086d26cf9b4d490fd9b1be076 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 11 May 2023 15:27:42 +0600 Subject: [PATCH 11/26] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=20=D0=B7=D0=B0=D0=B3=D1=80?= =?UTF-8?q?=D1=83=D0=B7=D0=BA=D0=B0=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B2=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-diskquota.cc | 259 +++++++------------------------ source/ubl-settings-diskquota.h | 45 +----- source/view_open_browser.h | 5 + source/wrapper_load_save.cc | 119 ++++++++++++++ source/wrapper_load_save.h | 54 +++++++ 5 files changed, 244 insertions(+), 238 deletions(-) create mode 100644 source/wrapper_load_save.cc create mode 100644 source/wrapper_load_save.h diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index e86f23d..bd4a7d1 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -32,13 +32,7 @@ void MainWindow::settings() { this->filling_device_combo_box_template(usersProjectCombo, map_device); this->init_tree_view(); this->init_spin_all(); - - obj_quotas_sys.set_map_gui(map_gui_cfg); - obj_quotas_ubconfig.set_map_gui(map_gui_cfg); - if (geteuid() == 0) { - this->load_system_cfg(); - this->load_global_cfg(); this->event(); } else { @@ -59,63 +53,48 @@ void MainWindow::init_spin_all() { generalGroupsSizeWeeksSpi->set_range(0, 52); generalGroupsSizeWeeksSpi->set_increments(1.0, 1.0); generalGroupsSizeWeeksSpi->set_value(0); - generalGroupsFileWeeksSpin->set_range(0, 52); generalGroupsFileWeeksSpin->set_increments(1.0, 1.0); generalGroupsFileWeeksSpin->set_value(0); - generalUsersSizWeeksSpin->set_range(0, 52); generalUsersSizWeeksSpin->set_increments(1.0, 1.0); generalUsersSizWeeksSpin->set_value(0); - generalUsersFileWeeksSpin->set_range(0, 52); generalUsersFileWeeksSpin->set_increments(1.0, 1.0); generalUsersFileWeeksSpin->set_value(0); - generalGroupsSizeDaySpin->set_range(0, 31); generalGroupsSizeDaySpin->set_increments(1.0, 1.0); generalGroupsSizeDaySpin->set_value(0); - generalGroupsFilesDaySpin->set_range(0, 31); generalGroupsFilesDaySpin->set_increments(1.0, 1.0); generalGroupsFilesDaySpin->set_value(0); - generalUsersSizeDaySpin->set_range(0, 31); generalUsersSizeDaySpin->set_increments(1.0, 1.0); generalUsersSizeDaySpin->set_value(0); - generalUsersFilesDaySpin->set_range(0, 31); generalUsersFilesDaySpin->set_increments(1.0, 1.0); generalUsersFilesDaySpin->set_value(0); - generalGroupsSizeHourSpin->set_range(0, 23); generalGroupsSizeHourSpin->set_increments(1.0, 1.0); generalGroupsSizeHourSpin->set_value(0); - generalGroupsFilesHourSpin->set_range(0, 23); generalGroupsFilesHourSpin->set_increments(1.0, 1.0); generalGroupsFilesHourSpin->set_value(0); - generalUsersSizeHourSpin->set_range(0, 23); generalUsersSizeHourSpin->set_increments(1.0, 1.0); generalUsersSizeHourSpin->set_value(0); - generalUsersFilesHoursSpin->set_range(0, 23); generalUsersFilesHoursSpin->set_increments(1.0, 1.0); generalUsersFilesHoursSpin->set_value(0); - generalGroupsSizeMinuteSpin->set_range(0, 59); generalGroupsSizeMinuteSpin->set_increments(1.0, 1.0); generalGroupsSizeMinuteSpin->set_value(0); - generalGroupsFilesMinuteSpin->set_range(0, 59); generalGroupsFilesMinuteSpin->set_increments(1.0, 1.0); generalGroupsFilesMinuteSpin->set_value(0); - generalUsersSizeMinuteSpin->set_range(0, 59); generalUsersSizeMinuteSpin->set_increments(1.0, 1.0); generalUsersSizeMinuteSpin->set_value(0); - generalUsersFilesMinutesSpin->set_range(0, 59); generalUsersFilesMinutesSpin->set_increments(1.0, 1.0); generalUsersFilesMinutesSpin->set_value(0); @@ -184,7 +163,6 @@ void MainWindow::lacalization() { groupsDeviceLabel->set_label(str_device); usersDeviceLabel->set_label(str_device); headLabel->set_label(str_lb_head); - btnLoadGlob->set_label(load_global); btnLoadLocal->set_label(load_local); btnAbout->set_label(str_about_1); @@ -198,6 +176,57 @@ void MainWindow::lacalization() { } +void MainWindow::info_warning_error(int mess, int error_save, int error_load) { + if (error_save > 0 || error_load > 0) { + info_status_app(info_box_error_css); + imgInfo->set_from_icon_name(icon_warning, Gtk::ICON_SIZE_MENU); + string mess_error = ""; + if (mess == 0) { + mess_error = string(local_read_error) + str_cmd_error; + lblWarning->set_text(mess_error); + } + else if (mess == 1) { + mess_error = string(global_read_error) + str_cmd_error; + lblWarning->set_text(mess_error); + } + else if (mess == 2) { + mess_error = string(local_write_error) + str_cmd_error; + lblWarning->set_text(mess_error); + } + else if (mess == 3) { + mess_error = string(global_write_error) + str_cmd_error; + lblWarning->set_text(mess_error); + } + else if (mess == 4) { + mess_error = string(error_save_all) + str_cmd_error; + lblWarning->set_text(mess_error); + } + str_cmd_error = ""; + } + else { + info_status_app(info_box_ok_css); + imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU); + if (mess == 0) { + lblWarning->set_text(local_load_ok); + } + else if (mess == 1) { + lblWarning->set_text(global_load_ok); + } + else if (mess == 2) { + lblWarning->set_text(local_ok_written); + } + else if (mess == 3) { + lblWarning->set_text(global_ok_written); + } + else if (mess == 4) { + lblWarning->set_text(successfully_save_all); + } + else if (mess == 5) { + lblWarning->set_text(nothing_save); + } + } +} + void MainWindow::filling_device_combo_box_template(Gtk::ComboBoxText *combo_box, map_str_str &map_device) { if (map_device.size() != 0) { for (const auto &device : map_device) { @@ -230,12 +259,14 @@ void MainWindow::flag_block_gui() { } } +/* void MainWindow::entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label) { string text = combo_box->get_active_text(); if (map_device.find(text) != map_device.end()){ label->set_text(map_device[text]); } } +*/ void MainWindow::add_CSS() { Glib::RefPtr cssProvider = Gtk::CssProvider::create(); @@ -255,21 +286,6 @@ void MainWindow::add_CSS() { headLabel_css->add_class("textHead"); } -/* -void init_treeview_user() { - -} - -void MainWindow::view_add_data(Gtk::TreeModel::Row &row, Glib::RefPtr list_store_m , std::array, 5> &arr_view , size_t index) { - row = *(list_store_m->append()); - bool flag_chb = false; - string name = arr_view[0][index]; - row[m_columns.check_button] = flag_chb; - row[m_columns.name] = _(name.c_str()); - row[m_columns.description] = _(arr_view[1][index].c_str()); -} -*/ - void MainWindow::get_builder() { builder->set_translation_domain(path_app); builder->get_widget("headerTopic", headerTopic); @@ -323,7 +339,6 @@ void MainWindow::get_builder() { builder->get_widget("GroupsTabLabel", GroupsTabLabel); builder->get_widget("groupsQuotasTree", groupsQuotasTree); builder->get_widget("usersQuotasTree", usersQuotasTree); - builder->get_widget("usersDeviceCombo", usersDeviceCombo); builder->get_widget("GroupsTabLabel", GroupsTabLabel); builder->get_widget("generalTabLabel", generalTabLabel); @@ -344,7 +359,6 @@ void MainWindow::get_builder() { builder->get_widget("generalUsersFilesHoursSpin", generalUsersFilesHoursSpin); builder->get_widget("generalUsersSizeMinuteSpin", generalUsersSizeMinuteSpin); builder->get_widget("generalUsersFilesMinutesSpin", generalUsersFilesMinutesSpin); - builder->get_widget("GeneralQuotasTree", GeneralQuotasTree); builder->get_widget("ProjectQuotasTree", ProjectQuotasTree); builder->get_widget("ProjectTabLabel", ProjectTabLabel); @@ -362,7 +376,6 @@ void MainWindow::get_builder() { builder->get_widget("btnEditProject", btnEditProject); builder->get_widget("btnEditUsers", btnEditUsers); builder->get_widget("btnEditGroups", btnEditGroups); - builder->get_widget("usersProjectCombo", usersProjectCombo); } @@ -370,17 +383,14 @@ void MainWindow::event() { btnFilterGroups->signal_clicked().connect([&]() {this->filters_show();}); btnFilterUsers->signal_clicked().connect([&]() {this->filters_show();}); btnFilterProject->signal_clicked().connect([&]() {this->filters_show();}); - - btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); - btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); + //btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); + //btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); //btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); //btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); - btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all_cfg();}); - btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); - btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system_cfg();}); + //btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all_cfg();}); + //btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); + //btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system_cfg();}); chbMangSystemFile->signal_toggled().connect([&]() {this->mode_switch_quota();}); - - // QuotasEditWindow->show(); btnDelGroups->signal_clicked().connect( sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, &MainWindow::remove_template), &list_store_groups, &iter_groups, flag_validate_del_groups)); @@ -401,14 +411,6 @@ void MainWindow::event() { &MainWindow::set_add_tv_g_u_p), row, list_store_groups, obj_tv_g_u_p)); } - - - - -void MainWindow::del_columns() { - //std::vector vec_columns = tree_view_select->get_columns(); -} - void MainWindow::remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del) { if (flag_validate_del && (*list_store)->iter_is_valid(*(iter))) { Gtk::TreeModel::Row row = *(*iter); @@ -453,11 +455,6 @@ void MainWindow::mode_switch_quota() { void MainWindow::filters_show() { } -void MainWindow::set_data_cfg() { - // TODO: - // Написать функцию -} - void MainWindow::info_status_app(string stule) { Glib::RefPtr boxInfo = boxInfoError->get_style_context(); @@ -466,81 +463,6 @@ void MainWindow::info_status_app(string stule) { boxInfo->add_class(stule); } -void MainWindow::init_dict(string flag_load) { - std::map map_gui_cfg_n; - map_gui_cfg_n[""] = ""; - - map_gui_cfg = map_gui_cfg_n; - if (flag_load == "global") { - map_global_cfg = map_gui_cfg_n; - } - else if (flag_load == "system") { - map_system_cfg = map_gui_cfg_n; - } -} - -bool MainWindow::save_template(string section, string flag_save) { - bool flag_no_save = true; - obj_save.set_data_local(map_system_cfg); - obj_save.set_data_global(map_global_cfg); - obj_save.set_data_gui(map_gui_cfg); - obj_save.set_vec_params(vec_param_names); - obj_save.save(section, flag_save); - vector obj_vec_error = obj_save.get_error(); - flag_no_save = obj_save.get_state_save(); - return flag_no_save; -} - -void MainWindow::wrapper_save_all_cfg() { - this->set_data_cfg(); - bool _flag_save_global = this->save_template("boot", "global");; - bool _flag_save_local = this->save_template("boot", "system"); - if (_flag_save_global && _flag_save_local) { - this->info_warning_error(5); - } - else { - info_warning_error(4); - } - map_global_cfg = map_gui_cfg; - map_system_cfg = map_gui_cfg; - -} - -void MainWindow::load_global_cfg() { - this->load_template(&map_global_cfg, global_load); - info_warning_error(1); - map_gui_cfg = map_global_cfg; -} - -void MainWindow::load_system_cfg() { - this->load_template(&map_system_cfg, system_load); - info_warning_error(0); - map_gui_cfg = map_system_cfg; -} - -void MainWindow::wrapper_save_global_cfg() { - this->set_data_cfg(); - if (this->save_template("boot", "global")) { - this->info_warning_error(5); - } - else { - info_warning_error(3); - } - map_global_cfg = map_gui_cfg; - -} - -void MainWindow::wrapper_save_system_cfg() { - this->set_data_cfg(); - if (this->save_template("boot", "system")) { - this->info_warning_error(5); - } - else { - info_warning_error(2); - } - map_system_cfg = map_gui_cfg; -} - void MainWindow::init_work_tv_g_u_p() { groupsQuotasTree->remove_all_columns(); ProjectQuotasTree->remove_all_columns(); @@ -565,81 +487,16 @@ void MainWindow::init_work_tv_g_u_p() { this->view_add_columns(*usersQuotasTree); } -void MainWindow::load_template(map_str_str* map_temp, string cmd) { - this->init_work_tv_g_u_p(); - if (cmd.find("system") != string::npos) { - this->init_dict("system"); - } - else { - this->init_dict("global"); - } - *map_temp = obj_load.get_load_data(*map_temp, cmd); -} - void MainWindow::remove_line_template(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter, Gtk::TreeModel::iterator& iter_del, bool& flag_del) { iter_del = iter; flag_del = true; } -void MainWindow::info_warning_error(int mess) { - if (obj_load.get_count_error() > 0 || obj_save.get_count_error() > 0) { - info_status_app(info_box_error_css); - imgInfo->set_from_icon_name(icon_warning, Gtk::ICON_SIZE_MENU); - string mess_error = ""; - if (mess == 0) { - mess_error = string(local_read_error) + str_cmd_error; - lblWarning->set_text(mess_error); - } - else if (mess == 1) { - mess_error = string(global_read_error) + str_cmd_error; - lblWarning->set_text(mess_error); - } - else if (mess == 2) { - mess_error = string(local_write_error) + str_cmd_error; - lblWarning->set_text(mess_error); - } - else if (mess == 3) { - mess_error = string(global_write_error) + str_cmd_error; - lblWarning->set_text(mess_error); - } - else if (mess == 4) { - mess_error = string(error_save_all) + str_cmd_error; - lblWarning->set_text(mess_error); - } - str_cmd_error = ""; - obj_load.set_count_error(0); - obj_save.set_count_error(0); - } - else { - info_status_app(info_box_ok_css); - imgInfo->set_from_icon_name(icon_checked, Gtk::ICON_SIZE_MENU); - if (mess == 0) { - lblWarning->set_text(local_load_ok); - } - else if (mess == 1) { - lblWarning->set_text(global_load_ok); - } - else if (mess == 2) { - lblWarning->set_text(local_ok_written); - } - else if (mess == 3) { - lblWarning->set_text(global_ok_written); - } - else if (mess == 4) { - lblWarning->set_text(successfully_save_all); - } - else if (mess == 5) { - lblWarning->set_text(nothing_save); - } - } -} - MainWindow::~MainWindow() {} void help() { string version = string(str_version) + version_application + "\n"; cout << version.c_str(); cout << str_help_h; - } diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index 7a5a588..9262d17 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -2,9 +2,7 @@ #define UBL_SETTINGS_QUOTAS_H #include "util.h" -#include "load.h" -#include "save.h" -#include "my_process.h" + #include "my_type.h" #include "my_device.h" #include "system_quotas.h" @@ -134,12 +132,7 @@ #define path_resources "/usr/share/ubl-settings-diskquota" #define path_img_head_background "/usr/share/ubl-settings-diskquota/images/logo-background.png" #define no_recognized _("Argument not recognized\n") -#define global_load "ubconfig --default --source global --noexecute get boot" -#define system_load "ubconfig --default --source system --noexecute get boot" -#define global_save "ubconfig --target global --noexecute set boot " -#define system_save "ubconfig --target system --noexecute set boot " -#define global_remove "ubconfig --target global --noexecute set/remove boot " -#define system_remove "ubconfig --target system --noexecute set/remove boot " + using namespace std; extern string version_application; @@ -289,25 +282,14 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Button* btnEditProject; Gtk::Button* btnEditUsers; Gtk::Button* btnEditGroups; - - - #ifdef WEBKIT_FOUND - Gtk::Window *wndWeb; - Gtk::Widget *three; - WebKitWebView *one; - #endif 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(); - Quotas_ubconfig::Quotas_ubconfig obj_quotas_ubconfig = Quotas_ubconfig::Quotas_ubconfig(); - 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; map_str_str map_global_cfg; map_str_str map_system_cfg; + 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(); vector vec_param_names; map_str_str map_device; string str_cmd_error; @@ -336,6 +318,7 @@ class MainWindow : public Gtk::ApplicationWindow { void add_CSS(); void get_builder(); void event(); + void info_warning_error(int mess, int error_save, int error_load); void init_work_tv_g_u_p(); void remove_line_template(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter, Gtk::TreeModel::iterator& iter_del, bool& flag_del); void remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del); @@ -346,29 +329,17 @@ class MainWindow : public Gtk::ApplicationWindow { void init_tree_view(); void del_columns(); void set_add_tv_g_u_p(Gtk::TreeModel::Row &row, Glib::RefPtr list_store, struct tv_g_u_p obj_tv_g_u_p); - void load_template(map_str_str* map_temp, string cmd); - 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(); - void wrapper_save_all_cfg(); - void init_dict(string flag_load); - void set_data_cfg(); void mode_switch_quota(); void save_quotegroupSaveButton(); + void filling_device_combo_box_template(Gtk::ComboBoxText *combo_box, map_str_str &map_device); 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 view_add_columns(Gtk::TreeView &treeView); 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 help(); diff --git a/source/view_open_browser.h b/source/view_open_browser.h index 393bf5b..2611b47 100644 --- a/source/view_open_browser.h +++ b/source/view_open_browser.h @@ -21,6 +21,11 @@ private: Gtk::Label *lblhelpText; Gtk::Label *lblhelpHeader; Gtk::Label *lblHeadeWndWeb; + #ifdef WEBKIT_FOUND + Gtk::Window *wndWeb; + Gtk::Widget *three; + WebKitWebView *one; + #endif public: view_open_browser(/* args */); ~view_open_browser(); diff --git a/source/wrapper_load_save.cc b/source/wrapper_load_save.cc new file mode 100644 index 0000000..c8dc36d --- /dev/null +++ b/source/wrapper_load_save.cc @@ -0,0 +1,119 @@ +#include "wrapper_load_save.h" + + + +wrapper_load::wrapper_load(/* args */) { + obj_quotas_sys.set_map_gui(map_gui_cfg); + obj_quotas_ubconfig.set_map_gui(map_gui_cfg); +} + +wrapper_load::~wrapper_load() +{ +} + +void wrapper_load::load_global_cfg() { + this->load_template(&map_global_cfg, global_load); + info_warning_error(1); + map_gui_cfg = map_global_cfg; +} + +void wrapper_load::load_system_cfg() { + this->load_template(&map_system_cfg, system_load); + info_warning_error(0); + map_gui_cfg = map_system_cfg; +} + +void wrapper_load::set_void_work_tv_g_u_p(void (*init_work_tv_g_u_p)()) { + this->init_work_tv_g_u_p = init_work_tv_g_u_p; +} +void wrapper_load::set_void_info_warning_error(void (*info_warning_error)(int, int, int)) { + this->info_warning_error = info_warning_error; +} + +void wrapper_load::load_template(map_str_str* map_temp, string cmd) { + this->init_work_tv_g_u_p(); + if (cmd.find("system") != string::npos) { + this->init_dict("system"); + } + else { + this->init_dict("global"); + } + *map_temp = obj_load.get_load_data(*map_temp, cmd); +} + +void wrapper_load::wrapper_save_global_cfg() { + this->set_data_cfg(); + if (this->save_template("boot", "global")) { + this->info_warning_error(5); + } + else { + info_warning_error(3); + } + map_global_cfg = map_gui_cfg; + +} + +void wrapper_load::wrapper_save_system_cfg() { + this->set_data_cfg(); + if (this->save_template("boot", "system")) { + this->info_warning_error(5); + } + else { + info_warning_error(2); + } + map_system_cfg = map_gui_cfg; +} + + +void wrapper_load::wrapper_save_all_cfg() { + this->set_data_cfg(); + bool _flag_save_global = this->save_template("boot", "global");; + bool _flag_save_local = this->save_template("boot", "system"); + if (_flag_save_global && _flag_save_local) { + this->info_warning_error(5, ); + } + else { + info_warning_error(4); + } + map_global_cfg = map_gui_cfg; + map_system_cfg = map_gui_cfg; + +} + +void wrapper_load::wrapper_info_warning_error(int mess) { + this->info_warning_error(mess, obj_load.get_count_error(), obj_save.get_count_error()); + obj_load.set_count_error(0); + obj_save.set_count_error(0); + +} + + +bool wrapper_load::save_template(string section, string flag_save) { + bool flag_no_save = true; + obj_save.set_data_local(map_system_cfg); + obj_save.set_data_global(map_global_cfg); + obj_save.set_data_gui(map_gui_cfg); + obj_save.set_vec_params(vec_param_names); + obj_save.save(section, flag_save); + vector obj_vec_error = obj_save.get_error(); + flag_no_save = obj_save.get_state_save(); + return flag_no_save; +} + +void wrapper_load::init_dict(string flag_load) { + std::map map_gui_cfg_n; + map_gui_cfg_n[""] = ""; + + map_gui_cfg = map_gui_cfg_n; + if (flag_load == "global") { + map_global_cfg = map_gui_cfg_n; + } + else if (flag_load == "system") { + map_system_cfg = map_gui_cfg_n; + } +} + +void wrapper_load::set_data_cfg() { + // TODO: + // Написать функцию +} \ No newline at end of file diff --git a/source/wrapper_load_save.h b/source/wrapper_load_save.h new file mode 100644 index 0000000..4ff82de --- /dev/null +++ b/source/wrapper_load_save.h @@ -0,0 +1,54 @@ +#ifndef WRAPPER_LOAD_H +#define WRAPPER_LOAD_H +#include "my_type.h" +#include "project_lib.h" +#include "load.h" +#include "save.h" +#include "my_process.h" +#include "util.h" +#define global_load "ubconfig --default --source global get boot" +#define system_load "ubconfig --default --source system get boot" +#define global_save "ubconfig --target global --noexecute set boot " +#define system_save "ubconfig --target system set boot " +#define all_save "ubconfig set boot " +#define all_remove "ubconfig set/remove boot " +#define global_remove "ubconfig --target global --noexecute set/remove boot " +#define system_remove "ubconfig --target system --noexecute set/remove boot " + + + +class wrapper_load { +private: + string str_cmd_error; + void (*init_work_tv_g_u_p)(); + void (*info_warning_error)(int, int, int) +private: + map_str_str map_gui_cfg; + map_str_str map_global_cfg; + map_str_str map_system_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(); + Lib_save::Save obj_save = Lib_save::Save(); + Lib_Load::Load obj_load = Lib_Load::Load(); +public: + wrapper_load(/* args */); + ~wrapper_load(); + void load_global_cfg(); + void load_system_cfg(); + void wrapper_save_system_cfg(); + void wrapper_save_global_cfg(); + void wrapper_save_all_cfg(); + void wrapper_info_warning_error(int mess); + void set_void_work_tv_g_u_p(void (*init_work_tv_g_u_p)()); + void set_void_info_warning_error(void (*info_warning_error)(int, int, int)); +private: + void load_template(map_str_str* map_temp, string cmd); + void info_warning_error(int mess); + void init_dict(string flag_load); + void set_data_cfg(); + bool save_template(string section, string flag_save); + +}; + + +#endif \ No newline at end of file From a0256505e8f970dd63a45df8182fa27c54ef4fe7 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 11 May 2023 17:11:20 +0600 Subject: [PATCH 12/26] =?UTF-8?q?=D0=A4=D0=B0=D0=B9=D0=BB=D1=8B=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=BF=D0=BE=20=D0=BF=D0=B0=D0=BF=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 45 +++++++++++---------- source/main.cc | 2 +- source/model/CmakeLists.txt | 19 +++++++++ source/{ => model}/load.cc | 0 source/{ => model}/load.h | 0 source/{ => model}/my_device.cc | 0 source/{ => model}/my_device.h | 4 +- source/{ => model}/my_process.cc | 0 source/{ => model}/my_process.h | 0 source/{ => model}/save.cc | 0 source/{ => model}/save.h | 0 source/{ => model}/system_quotas.cc | 1 - source/{ => model}/system_quotas.h | 4 +- source/{ => model}/ubconfig_quotas.cc | 0 source/{ => model}/ubconfig_quotas.h | 4 +- source/{ => model}/util.cc | 0 source/{ => model}/util.h | 2 +- source/{ => model}/wrapper_load_save.cc | 0 source/{ => model}/wrapper_load_save.h | 4 +- source/project_lib.h | 2 +- source/view/CmakeLists.txt | 16 ++++++++ source/{ => view}/my_plug.cc | 0 source/{ => view}/my_plug.h | 3 +- source/{ => view}/ubl-settings-diskquota.cc | 8 ++-- source/{ => view}/ubl-settings-diskquota.h | 15 +++---- source/{ => view}/ubl-util-standard.c | 0 source/{ => view}/ubl-util-standard.h | 0 source/{ => view}/view_about.cc | 0 source/{ => view}/view_about.h | 2 +- source/{ => view}/view_filters.cc | 0 source/{ => view}/view_filters.h | 2 +- source/{ => view}/view_open_browser.cc | 0 source/{ => view}/view_open_browser.h | 2 +- source/{ => view}/view_set_user_group.cc | 0 source/{ => view}/view_set_user_group.h | 2 +- 35 files changed, 85 insertions(+), 52 deletions(-) create mode 100644 source/model/CmakeLists.txt rename source/{ => model}/load.cc (100%) rename source/{ => model}/load.h (100%) rename source/{ => model}/my_device.cc (100%) rename source/{ => model}/my_device.h (85%) rename source/{ => model}/my_process.cc (100%) rename source/{ => model}/my_process.h (100%) rename source/{ => model}/save.cc (100%) rename source/{ => model}/save.h (100%) rename source/{ => model}/system_quotas.cc (99%) rename source/{ => model}/system_quotas.h (95%) rename source/{ => model}/ubconfig_quotas.cc (100%) rename source/{ => model}/ubconfig_quotas.h (92%) rename source/{ => model}/util.cc (100%) rename source/{ => model}/util.h (96%) rename source/{ => model}/wrapper_load_save.cc (100%) rename source/{ => model}/wrapper_load_save.h (96%) create mode 100644 source/view/CmakeLists.txt rename source/{ => view}/my_plug.cc (100%) rename source/{ => view}/my_plug.h (93%) rename source/{ => view}/ubl-settings-diskquota.cc (98%) rename source/{ => view}/ubl-settings-diskquota.h (97%) rename source/{ => view}/ubl-util-standard.c (100%) rename source/{ => view}/ubl-util-standard.h (100%) rename source/{ => view}/view_about.cc (100%) rename source/{ => view}/view_about.h (95%) rename source/{ => view}/view_filters.cc (100%) rename source/{ => view}/view_filters.h (98%) rename source/{ => view}/view_open_browser.cc (100%) rename source/{ => view}/view_open_browser.h (97%) rename source/{ => view}/view_set_user_group.cc (100%) rename source/{ => view}/view_set_user_group.h (98%) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0caeeb7..d4a9320 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,13 +1,14 @@ cmake_minimum_required(VERSION 3.7) +find_package(PkgConfig REQUIRED) project(ubl-settings-diskquota) -find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED gtkmm-3.0) include_directories(${GTK_INCLUDE_DIRS}) link_directories(${GTK_LIBRARY_DIRS}) add_definitions(${GTK_CFLAGS_OTHER}) + find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0) option(WEBKIT_FOUND "No" OFF) @@ -30,29 +31,29 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin set(SOURCE_FILES ubl-settings-diskquota-cm.h - ubl-settings-diskquota.h - ubl-settings-diskquota.cc - ubconfig_quotas.h - ubconfig_quotas.cc - system_quotas.h - system_quotas.cc - my_device.h - my_device.cc + view/ubl-settings-diskquota.h + view/ubl-settings-diskquota.cc + model/ubconfig_quotas.cc + model/ubconfig_quotas.h + model/system_quotas.h + model/system_quotas.cc + model/my_device.h + model/my_device.cc project_lib.h my_type.h - save.h - save.cc - load.h - load.cc - my_process.h - my_process.cc - util.h - util.cc - my_plug.h - my_plug.cc - ubl-util-standard.h - ubl-util-standard.c - main.cc) + model/save.h + model/save.cc + model/load.h + model/load.cc + model/my_process.h + model/my_process.cc + model/util.h + model/util.cc + view/my_plug.h + view/my_plug.cc + view/ubl-util-standard.h + view/ubl-util-standard.c + main.cc) set(LIBRARIES ${GTK_LIBRARIES} diff --git a/source/main.cc b/source/main.cc index 85d79f4..0511543 100644 --- a/source/main.cc +++ b/source/main.cc @@ -1,4 +1,4 @@ -#include "my_plug.h" +#include "view/my_plug.h" void pars_flag(int index_start, int argc, char* argv[]); diff --git a/source/model/CmakeLists.txt b/source/model/CmakeLists.txt new file mode 100644 index 0000000..4f88ba8 --- /dev/null +++ b/source/model/CmakeLists.txt @@ -0,0 +1,19 @@ +add_library(model +load.cc +load.h +my_device.cc +my_device.h +my_process.cc +my_process.h +save.cc +save.h +system_quotas.cc +system_quotas.h +ubconfig_quotas.cc +ubconfig_quotas.h +util.cc +util.h +wrapper_load_save.cc +wrapper_load_save.h +) +target_include_directories(model PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git a/source/load.cc b/source/model/load.cc similarity index 100% rename from source/load.cc rename to source/model/load.cc diff --git a/source/load.h b/source/model/load.h similarity index 100% rename from source/load.h rename to source/model/load.h diff --git a/source/my_device.cc b/source/model/my_device.cc similarity index 100% rename from source/my_device.cc rename to source/model/my_device.cc diff --git a/source/my_device.h b/source/model/my_device.h similarity index 85% rename from source/my_device.h rename to source/model/my_device.h index 1db5317..a4cf9db 100644 --- a/source/my_device.h +++ b/source/model/my_device.h @@ -1,10 +1,10 @@ #ifndef MY_DEVICE_H #define MY_DEVICE_H -#include "project_lib.h" +#include "../project_lib.h" #include "my_process.h" #include "util.h" -#include "my_type.h" +#include "../my_type.h" namespace Devices { diff --git a/source/my_process.cc b/source/model/my_process.cc similarity index 100% rename from source/my_process.cc rename to source/model/my_process.cc diff --git a/source/my_process.h b/source/model/my_process.h similarity index 100% rename from source/my_process.h rename to source/model/my_process.h diff --git a/source/save.cc b/source/model/save.cc similarity index 100% rename from source/save.cc rename to source/model/save.cc diff --git a/source/save.h b/source/model/save.h similarity index 100% rename from source/save.h rename to source/model/save.h diff --git a/source/system_quotas.cc b/source/model/system_quotas.cc similarity index 99% rename from source/system_quotas.cc rename to source/model/system_quotas.cc index c92f609..254de2f 100644 --- a/source/system_quotas.cc +++ b/source/model/system_quotas.cc @@ -1,5 +1,4 @@ #include "system_quotas.h" -#include "my_type.h" namespace Quotas_sys { diff --git a/source/system_quotas.h b/source/model/system_quotas.h similarity index 95% rename from source/system_quotas.h rename to source/model/system_quotas.h index fd25abc..a6cc631 100644 --- a/source/system_quotas.h +++ b/source/model/system_quotas.h @@ -1,7 +1,7 @@ #ifndef SYSTEM_CMD_QUOTAS #define SYSTEM_CMD_QUOTAS -#include "project_lib.h" -#include "my_type.h" +#include "../project_lib.h" +#include "../my_type.h" #include "my_process.h" #include "util.h" diff --git a/source/ubconfig_quotas.cc b/source/model/ubconfig_quotas.cc similarity index 100% rename from source/ubconfig_quotas.cc rename to source/model/ubconfig_quotas.cc diff --git a/source/ubconfig_quotas.h b/source/model/ubconfig_quotas.h similarity index 92% rename from source/ubconfig_quotas.h rename to source/model/ubconfig_quotas.h index f9a0d4d..26124d3 100644 --- a/source/ubconfig_quotas.h +++ b/source/model/ubconfig_quotas.h @@ -1,8 +1,8 @@ #ifndef UBCONFIG_QUOTAS #define UBCONFIG_QUOTAS -#include "project_lib.h" -#include "my_type.h" +#include "../project_lib.h" +#include "../my_type.h" #include "my_process.h" #include "util.h" diff --git a/source/util.cc b/source/model/util.cc similarity index 100% rename from source/util.cc rename to source/model/util.cc diff --git a/source/util.h b/source/model/util.h similarity index 96% rename from source/util.h rename to source/model/util.h index 8afa931..faaee62 100644 --- a/source/util.h +++ b/source/model/util.h @@ -1,6 +1,6 @@ #ifndef UTIL_H #define UTIL_H -#include "project_lib.h" +#include "../project_lib.h" using namespace std; diff --git a/source/wrapper_load_save.cc b/source/model/wrapper_load_save.cc similarity index 100% rename from source/wrapper_load_save.cc rename to source/model/wrapper_load_save.cc diff --git a/source/wrapper_load_save.h b/source/model/wrapper_load_save.h similarity index 96% rename from source/wrapper_load_save.h rename to source/model/wrapper_load_save.h index 4ff82de..7f6a338 100644 --- a/source/wrapper_load_save.h +++ b/source/model/wrapper_load_save.h @@ -1,7 +1,7 @@ #ifndef WRAPPER_LOAD_H #define WRAPPER_LOAD_H -#include "my_type.h" -#include "project_lib.h" +#include "../my_type.h" +#include "../project_lib.h" #include "load.h" #include "save.h" #include "my_process.h" diff --git a/source/project_lib.h b/source/project_lib.h index 79c5c4d..51b5258 100644 --- a/source/project_lib.h +++ b/source/project_lib.h @@ -22,6 +22,6 @@ #include #include #include -#include "ubl-util-standard.c" + #include "ubl-settings-diskquota-cm.h" #endif \ No newline at end of file diff --git a/source/view/CmakeLists.txt b/source/view/CmakeLists.txt new file mode 100644 index 0000000..c755b28 --- /dev/null +++ b/source/view/CmakeLists.txt @@ -0,0 +1,16 @@ +add_library(view +my_plug.cc +my_plug.h +ubl-settings-diskquota.h +ubl-settings-diskquota.cc +ubl-util-standard.h +view_about.cc +view_about.h +view_filters.h +view_filters.cc +view_open_browser.h +view_open_browser.cc +view_set_user_group.h +view_set_user_group.cc +) +target_include_directories(view PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git a/source/my_plug.cc b/source/view/my_plug.cc similarity index 100% rename from source/my_plug.cc rename to source/view/my_plug.cc diff --git a/source/my_plug.h b/source/view/my_plug.h similarity index 93% rename from source/my_plug.h rename to source/view/my_plug.h index 5d9a3d1..46cb259 100644 --- a/source/my_plug.h +++ b/source/view/my_plug.h @@ -1,6 +1,7 @@ -#include "project_lib.h" +#include "../project_lib.h" #include "ubl-settings-diskquota.h" + class CmdArgParser : public Glib::OptionGroup { public: CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help); diff --git a/source/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc similarity index 98% rename from source/ubl-settings-diskquota.cc rename to source/view/ubl-settings-diskquota.cc index bd4a7d1..4dc87a6 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -26,10 +26,10 @@ void MainWindow::settings() { this->lacalization(); this->add_CSS(); this->flag_block_gui(); - map_device = obj_device.get_parted(); - this->filling_device_combo_box_template(groupsDeviceCombo, map_device); - this->filling_device_combo_box_template(usersDeviceCombo, map_device); - this->filling_device_combo_box_template(usersProjectCombo, map_device); + //map_device = obj_device.get_parted(); + //this->filling_device_combo_box_template(groupsDeviceCombo, map_device); + //this->filling_device_combo_box_template(usersDeviceCombo, map_device); + //this->filling_device_combo_box_template(usersProjectCombo, map_device); this->init_tree_view(); this->init_spin_all(); if (geteuid() == 0) { diff --git a/source/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h similarity index 97% rename from source/ubl-settings-diskquota.h rename to source/view/ubl-settings-diskquota.h index 9262d17..dd56ce9 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -1,14 +1,11 @@ #ifndef UBL_SETTINGS_QUOTAS_H #define UBL_SETTINGS_QUOTAS_H -#include "util.h" -#include "my_type.h" -#include "my_device.h" -#include "system_quotas.h" -#include "ubconfig_quotas.h" #include - +#include "../project_lib.h" +#include "../my_type.h" +#include "ubl-util-standard.c" #ifdef WEBKIT_FOUND #include #endif @@ -287,9 +284,9 @@ class MainWindow : public Gtk::ApplicationWindow { map_str_str map_gui_cfg; map_str_str map_global_cfg; map_str_str map_system_cfg; - 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(); + //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(); vector vec_param_names; map_str_str map_device; string str_cmd_error; diff --git a/source/ubl-util-standard.c b/source/view/ubl-util-standard.c similarity index 100% rename from source/ubl-util-standard.c rename to source/view/ubl-util-standard.c diff --git a/source/ubl-util-standard.h b/source/view/ubl-util-standard.h similarity index 100% rename from source/ubl-util-standard.h rename to source/view/ubl-util-standard.h diff --git a/source/view_about.cc b/source/view/view_about.cc similarity index 100% rename from source/view_about.cc rename to source/view/view_about.cc diff --git a/source/view_about.h b/source/view/view_about.h similarity index 95% rename from source/view_about.h rename to source/view/view_about.h index f64ce41..87ef742 100644 --- a/source/view_about.h +++ b/source/view/view_about.h @@ -1,6 +1,6 @@ #ifndef VIEW_ABOUT_H #define VIEW_ABOUT_H -#include "project_lib.h" +#include "../project_lib.h" #define copyright _("Copyright © UBSoft LLC, 2022 - ") #define str_setting_user _("Setting user quotas") #define website _("https://wiki.ublinux.com") diff --git a/source/view_filters.cc b/source/view/view_filters.cc similarity index 100% rename from source/view_filters.cc rename to source/view/view_filters.cc diff --git a/source/view_filters.h b/source/view/view_filters.h similarity index 98% rename from source/view_filters.h rename to source/view/view_filters.h index 2d3fd16..e161c20 100644 --- a/source/view_filters.h +++ b/source/view/view_filters.h @@ -1,6 +1,6 @@ #ifndef VIEW_FILTERS_H #define VIEW_FILTERS_H -#include "project_lib.h" +#include "../project_lib.h" #define str_name _("Name") #define str_size _("Size") diff --git a/source/view_open_browser.cc b/source/view/view_open_browser.cc similarity index 100% rename from source/view_open_browser.cc rename to source/view/view_open_browser.cc diff --git a/source/view_open_browser.h b/source/view/view_open_browser.h similarity index 97% rename from source/view_open_browser.h rename to source/view/view_open_browser.h index 2611b47..4966887 100644 --- a/source/view_open_browser.h +++ b/source/view/view_open_browser.h @@ -1,6 +1,6 @@ #ifndef VIEW_OPEN_BROWSER_H #define VIEW_OPEN_BROWSER_H -#include "project_lib.h" +#include "../project_lib.h" #define link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota" #define cmd_xdg "xdg-open " diff --git a/source/view_set_user_group.cc b/source/view/view_set_user_group.cc similarity index 100% rename from source/view_set_user_group.cc rename to source/view/view_set_user_group.cc diff --git a/source/view_set_user_group.h b/source/view/view_set_user_group.h similarity index 98% rename from source/view_set_user_group.h rename to source/view/view_set_user_group.h index f8728d6..7644a47 100644 --- a/source/view_set_user_group.h +++ b/source/view/view_set_user_group.h @@ -1,6 +1,6 @@ #ifndef VIEW_SET_USER_GROUP_H #define VIEW_SET_USER_GROUP_H -#include "project_lib.h" +#include "../project_lib.h" #define str_device _("Device:") #define str_quota_status _("Quota use status:") #define str_size _("Size") From f0575d8bd5b457a94fb9d87e5451fa4afb94cc28 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Mon, 15 May 2023 11:39:29 +0600 Subject: [PATCH 13/26] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82?= =?UTF-8?q?=D1=83=D1=80=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 28 ++++++++++---------- source/model/CmakeLists.txt | 19 ------------- source/view/CmakeLists.txt | 16 ----------- source/{ => view}/model/load.cc | 0 source/{ => view}/model/load.h | 0 source/{ => view}/model/my_device.cc | 0 source/{ => view}/model/my_device.h | 4 +-- source/{ => view}/model/my_process.cc | 0 source/{ => view}/model/my_process.h | 0 source/{ => view}/model/save.cc | 0 source/{ => view}/model/save.h | 0 source/{ => view}/model/system_quotas.cc | 0 source/{ => view}/model/system_quotas.h | 4 +-- source/{ => view}/model/ubconfig_quotas.cc | 0 source/{ => view}/model/ubconfig_quotas.h | 4 +-- source/{ => view}/model/util.cc | 0 source/{ => view}/model/util.h | 2 +- source/{ => view}/model/wrapper_load_save.cc | 0 source/{ => view}/model/wrapper_load_save.h | 4 +-- 19 files changed, 23 insertions(+), 58 deletions(-) delete mode 100644 source/model/CmakeLists.txt delete mode 100644 source/view/CmakeLists.txt rename source/{ => view}/model/load.cc (100%) rename source/{ => view}/model/load.h (100%) rename source/{ => view}/model/my_device.cc (100%) rename source/{ => view}/model/my_device.h (84%) rename source/{ => view}/model/my_process.cc (100%) rename source/{ => view}/model/my_process.h (100%) rename source/{ => view}/model/save.cc (100%) rename source/{ => view}/model/save.h (100%) rename source/{ => view}/model/system_quotas.cc (100%) rename source/{ => view}/model/system_quotas.h (95%) rename source/{ => view}/model/ubconfig_quotas.cc (100%) rename source/{ => view}/model/ubconfig_quotas.h (91%) rename source/{ => view}/model/util.cc (100%) rename source/{ => view}/model/util.h (96%) rename source/{ => view}/model/wrapper_load_save.cc (100%) rename source/{ => view}/model/wrapper_load_save.h (96%) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index d4a9320..73820da 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -33,22 +33,22 @@ set(SOURCE_FILES ubl-settings-diskquota-cm.h view/ubl-settings-diskquota.h view/ubl-settings-diskquota.cc - model/ubconfig_quotas.cc - model/ubconfig_quotas.h - model/system_quotas.h - model/system_quotas.cc - model/my_device.h - model/my_device.cc + view/model/ubconfig_quotas.cc + view/model/ubconfig_quotas.h + view/model/system_quotas.h + view/model/system_quotas.cc + view/model/my_device.h + view/model/my_device.cc project_lib.h my_type.h - model/save.h - model/save.cc - model/load.h - model/load.cc - model/my_process.h - model/my_process.cc - model/util.h - model/util.cc + view/model/save.h + view/model/save.cc + view/model/load.h + view/model/load.cc + view/model/my_process.h + view/model/my_process.cc + view/model/util.h + view/model/util.cc view/my_plug.h view/my_plug.cc view/ubl-util-standard.h diff --git a/source/model/CmakeLists.txt b/source/model/CmakeLists.txt deleted file mode 100644 index 4f88ba8..0000000 --- a/source/model/CmakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -add_library(model -load.cc -load.h -my_device.cc -my_device.h -my_process.cc -my_process.h -save.cc -save.h -system_quotas.cc -system_quotas.h -ubconfig_quotas.cc -ubconfig_quotas.h -util.cc -util.h -wrapper_load_save.cc -wrapper_load_save.h -) -target_include_directories(model PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git a/source/view/CmakeLists.txt b/source/view/CmakeLists.txt deleted file mode 100644 index c755b28..0000000 --- a/source/view/CmakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_library(view -my_plug.cc -my_plug.h -ubl-settings-diskquota.h -ubl-settings-diskquota.cc -ubl-util-standard.h -view_about.cc -view_about.h -view_filters.h -view_filters.cc -view_open_browser.h -view_open_browser.cc -view_set_user_group.h -view_set_user_group.cc -) -target_include_directories(view PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git a/source/model/load.cc b/source/view/model/load.cc similarity index 100% rename from source/model/load.cc rename to source/view/model/load.cc diff --git a/source/model/load.h b/source/view/model/load.h similarity index 100% rename from source/model/load.h rename to source/view/model/load.h diff --git a/source/model/my_device.cc b/source/view/model/my_device.cc similarity index 100% rename from source/model/my_device.cc rename to source/view/model/my_device.cc diff --git a/source/model/my_device.h b/source/view/model/my_device.h similarity index 84% rename from source/model/my_device.h rename to source/view/model/my_device.h index a4cf9db..73b0e76 100644 --- a/source/model/my_device.h +++ b/source/view/model/my_device.h @@ -1,10 +1,10 @@ #ifndef MY_DEVICE_H #define MY_DEVICE_H -#include "../project_lib.h" +#include "../../project_lib.h" #include "my_process.h" #include "util.h" -#include "../my_type.h" +#include "../../my_type.h" namespace Devices { diff --git a/source/model/my_process.cc b/source/view/model/my_process.cc similarity index 100% rename from source/model/my_process.cc rename to source/view/model/my_process.cc diff --git a/source/model/my_process.h b/source/view/model/my_process.h similarity index 100% rename from source/model/my_process.h rename to source/view/model/my_process.h diff --git a/source/model/save.cc b/source/view/model/save.cc similarity index 100% rename from source/model/save.cc rename to source/view/model/save.cc diff --git a/source/model/save.h b/source/view/model/save.h similarity index 100% rename from source/model/save.h rename to source/view/model/save.h diff --git a/source/model/system_quotas.cc b/source/view/model/system_quotas.cc similarity index 100% rename from source/model/system_quotas.cc rename to source/view/model/system_quotas.cc diff --git a/source/model/system_quotas.h b/source/view/model/system_quotas.h similarity index 95% rename from source/model/system_quotas.h rename to source/view/model/system_quotas.h index a6cc631..65b2b5e 100644 --- a/source/model/system_quotas.h +++ b/source/view/model/system_quotas.h @@ -1,7 +1,7 @@ #ifndef SYSTEM_CMD_QUOTAS #define SYSTEM_CMD_QUOTAS -#include "../project_lib.h" -#include "../my_type.h" +#include "../../project_lib.h" +#include "../../my_type.h" #include "my_process.h" #include "util.h" diff --git a/source/model/ubconfig_quotas.cc b/source/view/model/ubconfig_quotas.cc similarity index 100% rename from source/model/ubconfig_quotas.cc rename to source/view/model/ubconfig_quotas.cc diff --git a/source/model/ubconfig_quotas.h b/source/view/model/ubconfig_quotas.h similarity index 91% rename from source/model/ubconfig_quotas.h rename to source/view/model/ubconfig_quotas.h index 26124d3..8ace1ad 100644 --- a/source/model/ubconfig_quotas.h +++ b/source/view/model/ubconfig_quotas.h @@ -1,8 +1,8 @@ #ifndef UBCONFIG_QUOTAS #define UBCONFIG_QUOTAS -#include "../project_lib.h" -#include "../my_type.h" +#include "../../project_lib.h" +#include "../../my_type.h" #include "my_process.h" #include "util.h" diff --git a/source/model/util.cc b/source/view/model/util.cc similarity index 100% rename from source/model/util.cc rename to source/view/model/util.cc diff --git a/source/model/util.h b/source/view/model/util.h similarity index 96% rename from source/model/util.h rename to source/view/model/util.h index faaee62..5f2fa9d 100644 --- a/source/model/util.h +++ b/source/view/model/util.h @@ -1,6 +1,6 @@ #ifndef UTIL_H #define UTIL_H -#include "../project_lib.h" +#include "../../project_lib.h" using namespace std; diff --git a/source/model/wrapper_load_save.cc b/source/view/model/wrapper_load_save.cc similarity index 100% rename from source/model/wrapper_load_save.cc rename to source/view/model/wrapper_load_save.cc diff --git a/source/model/wrapper_load_save.h b/source/view/model/wrapper_load_save.h similarity index 96% rename from source/model/wrapper_load_save.h rename to source/view/model/wrapper_load_save.h index 7f6a338..a2db82c 100644 --- a/source/model/wrapper_load_save.h +++ b/source/view/model/wrapper_load_save.h @@ -1,7 +1,7 @@ #ifndef WRAPPER_LOAD_H #define WRAPPER_LOAD_H -#include "../my_type.h" -#include "../project_lib.h" +#include "../../my_type.h" +#include "../../project_lib.h" #include "load.h" #include "save.h" #include "my_process.h" From e693a544c6b6757abab8799e4420045f30afd27b Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Mon, 15 May 2023 17:53:12 +0600 Subject: [PATCH 14/26] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.?= =?UTF-8?q?0=20beta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 19 ++- source/controler.cc | 46 ------- source/controler.h | 19 --- source/{view/my_plug.cc => controller.cc} | 33 ++++- source/controller.h | 46 +++++++ source/main.cc | 7 +- source/project_lib.h | 2 +- source/var.h | 161 ++++++++++++++++++++++ source/view/model/wrapper_load_save.cc | 94 +++++++------ source/view/model/wrapper_load_save.h | 33 ++--- source/view/my_plug.h | 21 --- source/view/ubl-settings-diskquota.cc | 53 ++++--- source/view/ubl-settings-diskquota.h | 148 +++----------------- source/view/view_about.cc | 22 ++- source/view/view_about.h | 25 ++-- source/view/view_filters.cc | 28 ++-- source/view/view_filters.h | 19 +-- source/view/view_open_browser.cc | 69 ++++++---- source/view/view_open_browser.h | 34 +++-- source/view/view_set_user_group.cc | 4 - source/view/view_set_user_group.h | 17 +-- 21 files changed, 480 insertions(+), 420 deletions(-) delete mode 100644 source/controler.cc delete mode 100644 source/controler.h rename source/{view/my_plug.cc => controller.cc} (63%) create mode 100644 source/controller.h create mode 100644 source/var.h delete mode 100644 source/view/my_plug.h diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 73820da..2f1ce76 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -30,7 +30,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin -fstack-clash-protection -fcf-protection -g") set(SOURCE_FILES - ubl-settings-diskquota-cm.h view/ubl-settings-diskquota.h view/ubl-settings-diskquota.cc view/model/ubconfig_quotas.cc @@ -39,8 +38,6 @@ set(SOURCE_FILES view/model/system_quotas.cc view/model/my_device.h view/model/my_device.cc - project_lib.h - my_type.h view/model/save.h view/model/save.cc view/model/load.h @@ -49,11 +46,21 @@ set(SOURCE_FILES view/model/my_process.cc view/model/util.h view/model/util.cc - view/my_plug.h - view/my_plug.cc view/ubl-util-standard.h view/ubl-util-standard.c - main.cc) + view/model/wrapper_load_save.cc + view/model/wrapper_load_save.h + ubl-settings-diskquota-cm.h + view/view_open_browser.cc + view/view_open_browser.h + view/view_about.h + view/view_about.cc + controller.cc + controller.h + main.cc + var.h + project_lib.h + my_type.h) set(LIBRARIES ${GTK_LIBRARIES} diff --git a/source/controler.cc b/source/controler.cc deleted file mode 100644 index 38f889a..0000000 --- a/source/controler.cc +++ /dev/null @@ -1,46 +0,0 @@ -#include "controler.h" -Back_Back::Back_Back() {} -void Back_Back::set_mode(string flag_mode) { - this->flag_mode = flag_mode; -} - -void Back_Back::set_partition(string partition) { - this->partition = partition; -} - -void Back_Back::set_sys_flag(string sys_flag) { - this->sys_flag = sys_flag; -} - -bool Back_Back::wrapper_off_quotas(string quotas_type) { - bool flag_status = false; - quotas_type = this->handler_quotas_type(quotas_type); - if (flag_mode == "system") { - string cmd_hw = ""; - string cmd_sw = ""; - flag_status = obj_quotas_sys.off_quota(partition, cmd_hw, cmd_sw); - } - else if (flag_mode == "ubconfig") { - flag_status = obj_quotas_ubconfig.off_quota(partition, quotas_type, "disable"); - } - return flag_status; -} -bool Back_Back::wrapper_on_quotas(string quotas_type) { - bool flag_status = false; - quotas_type = this->handler_quotas_type(quotas_type); - if (flag_mode == "system") { - string cmd_hw = ""; - string cmd_sw = ""; - flag_status = obj_quotas_sys.on_quota_hw(partition, cmd_hw, cmd_sw); - flag_status = obj_quotas_sys.wrapper_on_quotas(partition, quotas_type); - } - else if (flag_mode == "ubconfig") { - flag_status = obj_quotas_sys.wrapper_on_quotas(partition, quotas_type, "enable"); - flag_status = obj_quotas_ubconfig.format_cmd_quotas(); - } - return flag_status; -} - -string Back_Back::handler_quotas_type(string quotas_type) { - return quotas_type; -} \ No newline at end of file diff --git a/source/controler.h b/source/controler.h deleted file mode 100644 index 263493c..0000000 --- a/source/controler.h +++ /dev/null @@ -1,19 +0,0 @@ -#include "system_quotas.h" -#include "ubconfig_quotas.h" - -class Back_Back{ - public: - string flag_mode; - string partition; - string sys_flag; - Quotas_sys::Quotas_sys obj_quotas_sys = Quotas_sys::Quotas_sys(); - Quotas_ubconfig::Quotas_ubconfig obj_quotas_ubconfig = Quotas_ubconfig::Quotas_ubconfig(); - public: - Back_Back(); - void set_mode(string flag_mode); - void set_partition(string partition); - void set_sys_flag(string sys_flag); - bool wrapper_off_quotas(string quotas_type); - string handler_quotas_type(string quotas_type); - bool wrapper_on_quotas(string quotas_type); -}; \ No newline at end of file diff --git a/source/view/my_plug.cc b/source/controller.cc similarity index 63% rename from source/view/my_plug.cc rename to source/controller.cc index 6294ab4..7d3ca02 100644 --- a/source/view/my_plug.cc +++ b/source/controller.cc @@ -1,8 +1,29 @@ -#ifndef MY_PLUG_H -#define MY_PLUG_H +#include "controller.h" -#include "my_plug.h" +int socket_ext_id_I = 0; +int socket_trd_id_I = 0; +Controller::Controller(BaseObjectType* obj, Glib::RefPtr const& builder) + :Gtk::ApplicationWindow(obj), builder{builder} { + this->builder = builder; + this->settings(); +} + +Controller::Controller(Glib::RefPtr const& builder) { + this->builder = builder; + this->settings(); +} + +Controller::~Controller() +{ +} + +void Controller::settings() { + obj_open_browser->set_obj_about(obj_view_about); + obj_main_window = new MainWindow(builder, obj_open_browser, &socket_ext_id_I, &socket_trd_id_I); + obj_main_window->set_obj_wrapper_load(obj_wrapper_load_save); + obj_open_browser->settings(); +} CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help) : Glib::OptionGroup{p_name, p_description, p_help} { @@ -22,17 +43,17 @@ CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_descr add_entry(socketExtId, socket_ext_id_I); add_entry(socketTrdId, socket_trd_id_I); } + ::Window CmdArgParser::GetSocketID() const{ return m_socketID; } SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr builder) :Gtk::Plug{p_socketID} { - MainWindow* wnd = nullptr; + Controller* wnd = nullptr; builder->get_widget_derived("window", wnd); builder->get_widget("plugBox", plugBox); plugBox->get_parent()->remove(*plugBox); add(*plugBox); show_all_children(); -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/source/controller.h b/source/controller.h new file mode 100644 index 0000000..4f02c82 --- /dev/null +++ b/source/controller.h @@ -0,0 +1,46 @@ +#ifndef CONTROLLER_H +#define CONTROLLER_H +#include "view/view_open_browser.h" +#include "view/view_about.h" +#include "view/ubl-settings-diskquota.h" +#include "view/model/wrapper_load_save.h" + +extern int socket_ext_id_I; +extern int socket_trd_id_I; + +class Controller : public Gtk::ApplicationWindow +{ +private: + Glib::RefPtr builder; +public: + Controller(/* args */); + ~Controller(); + void settings(); + View_open_browser* obj_open_browser = new View_open_browser(); + View_about* obj_view_about = new View_about(); + MainWindow* obj_main_window; + Wrapper_load_save *obj_wrapper_load_save = new Wrapper_load_save(); + Controller(BaseObjectType* obj, Glib::RefPtr const& builder); + Controller(Glib::RefPtr const& builder); + + +}; + +class CmdArgParser : public Glib::OptionGroup { +public: + CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help); + ::Window GetSocketID() const; +private: + int m_socketID = 0; + +}; +class SettingsPlug : public Gtk::Plug{ +public: + Gtk::Window *window; + SettingsPlug(::Window p_socketID, Glib::RefPtr builder); + +private: + Gtk::Widget *plugBox; + Gtk::Widget *parent; +}; +#endif \ No newline at end of file diff --git a/source/main.cc b/source/main.cc index 0511543..17f2eee 100644 --- a/source/main.cc +++ b/source/main.cc @@ -1,4 +1,5 @@ -#include "view/my_plug.h" +#include "controller.h" +#include "var.h" void pars_flag(int index_start, int argc, char* argv[]); @@ -44,14 +45,14 @@ int main(int argc, char** argv) { auto app = Gtk::Application::create(len_argv, argv, "org.gtkmm.example.plug"); auto builder = Gtk::Builder::create_from_file(path_glade); pars_flag(1, argc, argv); - MainWindow* wnd = nullptr; + Controller* wnd = nullptr; builder->get_widget_derived("MainWindow", wnd); auto r = app->run(*wnd); delete wnd; return r; } - } + void pars_flag(int index_start, int argc, char* argv[]) { string str_argv = ""; for (int i = index_start; i #include #include - #include "ubl-settings-diskquota-cm.h" + #endif \ No newline at end of file diff --git a/source/var.h b/source/var.h new file mode 100644 index 0000000..d917069 --- /dev/null +++ b/source/var.h @@ -0,0 +1,161 @@ +#ifndef VAE_H +#define VAE_H +#include "project_lib.h" + +#define name_app _("ubl-settings-diskquota") +#define configuring_system_boot _("Configuring system boot parameters") +#define system_boot _("System boot") +#define str_about _("About ubl-settings-diskquota") +#define command_line_parameters _("Command line parameters:") +#define load_default _("Load default:") +#define seconds _("seconds") +#define download_menu _("Download menu") +#define terminal_for_input _("Terminal for input") +#define terminal_for_output _("Terminal for output") +#define boot_selection_menu_timer _("Boot selection menu timer") +#define str_help _("Help") +#define str_about_1 _("About") +#define str_save_local _("Save") +#define str_load_local _("Load") +#define save_all _("Save in global and local configuration") +#define save_local _("Save in local configuration") +#define save_global _("Save in global configuration") +#define load_global _("Load global configuration") +#define load_local _("Load local configuration") +#define read_online _("Read online") +#define cancel _("Cancel") +#define always_redirect _("Always redirect") +#define boot_screen_display_mode _("Boot screen display mode:") +#define no_loading_animation _("No loading animation, full log") +#define boot_menu_user_name _("Boot menu user name:") +#define boot_menu_user_password _("Boot menu user password:") +#define last_successful_upload _("Last successful upload") +#define read_documentation_web _("Would you like to read documentation in the Web?") +#define redirected_documentation _("You will be redirected to documentation site, where user help pages are ""translated and supported by community.") +#define local_read_error _("Local configuration reading error") +#define global_read_error _("Global configuration read error") +#define local_write_error _("Local configuration write error") +#define global_write_error _("Global configuration write error") +#define error_save_all _("Error saved local and global configuration") +#define local_load_ok _("Local configuration downloaded successfully") +#define global_load_ok _("Global configuration downloaded successfully") +#define local_ok_written _("Local configuration successfully written") +#define global_ok_written _("Global configuration successfully written") +#define successfully_save_all _("Successfully saved local and global configuration") +#define nothing_save _("Nothing to save!") +#define program_as_root _("The program must be run as root") + +#define str_weeks _("weeks") +#define str_days _("days") +#define str_hours _("hours") +#define str_minutes _("minutes") +#define str_device _("Device:") +#define str_users _("Users") +#define str_groups _("Groups") +#define str_files _("files") +#define str_hard_limit _("Hard limit") +#define str_file_system _("File system:") +#define str_name _("Name") +#define str_size _("Size") +#define str_quotas_mode _("Direct control of the file system") +#define str_lb_head _("Configuration of disk quotas parameters for system groups and users") +#define str_soft_limit _("Soft limit") +#define str_currently_using _("Currently using:") +#define str_currently_using_space _("Currently using: ") +#define str_filters _("Filters") +#define str_quotas _("Quotas") +#define str_help_h _("GTK settings disk quota for UBLinux\n" \ + "\n" \ + "Usage: ubl-settings-diskquota [OPTIONS...]\n" \ + "Options:\n" \ + " -h, --help\t Show this help\n" \ + " -V, --version\t Show package version\n" \ + " --lock-help Lock utility help\n" \ + " --lock-save Lock saving local and global configuration\n" \ + " --lock-save-local Lock save global configuration\n" \ + " --lock-save-global Lock load global configuration\n" \ + " --lock-load-global Lock load global configuration\n") + +#define str_user _("User") +#define str_group _("Group") +#define str_projects _("Projects") +#define str_user_1 _("User:") +#define str_group_1 _("Group:") +#define str_project_1 _("Projects:") +#define str_device_project _("Device\nProject") +#define str_quota _("Quota type") +#define str_status _("Status") +#define str_excess_size_delay _("Excess size delay period") +#define str_excess_files_delay _("Excess files delay period") +#define str_disk_quotas_device _("Disk quotas for this device:") +#define str_user_quotas_device _("User quotas for this device: ") + +#define str_soft_limit_size _("Soft limit (size)") +#define str_tw_soft_limit _("Soft limit\n(size)") +#define str_hard_limit_size _("Hard limit (size)") +#define str_deferring_hard_limit_size _("Deferring a hard limit (size)") +#define str_hard_activation_size _("Hard limit activation time (size)") +#define str_hard_limit_time _("Hard limit (file) activation time") +#define str_group_quotas_device _("Group quotas for this device:") +#define str_general_settings _("General settings") + +#define str_tw_severe_limitation _("Severe\nlimitation\n(size)") +#define str_tw_general_deferring_size _("Deferring\n(size)") +#define str_tw_general_deferring_files _("Deferring\n(files)") +#define str_tw_deferring_size _("Deferring\na hard\nlimit\n(files)") +#define str_tw_deferring_files _("Deferring\na hard\nlimit\n(files)") +#define str_tw_soft_limit_files _("Soft limit\n(files)") +#define str_tw_severe_limitation_files _("Severe\nlimitation\n(files)") +#define str_soft_restriction_files _("Soft Restriction (files)") +#define str_severe_limitation_files _("Severe limitation (files)") +#define str_deferring_limit_files _("Deferring a hard limit (files)") +#define info_box_ok_css "boxInfoMessOK" +#define info_box_error_css "boxInfoMessError" +#define icon_checked "com.ublinux.ubl-settings-diskquota.checked" +#define icon_warning "com.ublinux.ubl-settings-diskquota.warning" + +#define str_version _("ubl-settings-diskquota version: ") +#define path_app "/usr/bin/" +#define path_glade "/usr/share/ubl-settings-diskquota/ui/ubl-settings-diskquota.glade" +#define path_css "/usr/share/ubl-settings-diskquota/css/ubl-settings-diskquota.css" +#define app_name "ubl-settings-diskquota" +#define path_resources "/usr/share/ubl-settings-diskquota" +#define path_img_head_background "/usr/share/ubl-settings-diskquota/images/logo-background.png" +#define no_recognized _("Argument not recognized\n") + +#define str_device _("Device:") +#define str_quota_status _("Quota use status:") +#define str_size _("Size") +#define str_files _("files") +#define str_currently_using _("Currently using:") +#define str_soft_limit _("Soft limit") +#define str_hard_limit _("Hard limit") +#define str_hard_limit _("Hard limit") +#define str_prefix_KB _("Kb") +#define str_prefix_MB _("Mb") +#define str_prefix_GB _("Gb") +#define str_prefix_TB _("Tb") + +#define const_link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota" +#define cmd_xdg "xdg-open " +#define cmd_execute "su -l %s -c \" DISPLAY=$DISPLAY %s \"" + + +#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 copyright _("Copyright © UBSoft LLC, 2022 - ") +#define str_setting_user _("Setting user quotas") +#define website _("https://wiki.ublinux.com") +#define project_Home_page _("Project Home Page") + + + + +#endif \ No newline at end of file diff --git a/source/view/model/wrapper_load_save.cc b/source/view/model/wrapper_load_save.cc index c8dc36d..3b03caa 100644 --- a/source/view/model/wrapper_load_save.cc +++ b/source/view/model/wrapper_load_save.cc @@ -2,36 +2,46 @@ -wrapper_load::wrapper_load(/* args */) { - obj_quotas_sys.set_map_gui(map_gui_cfg); - obj_quotas_ubconfig.set_map_gui(map_gui_cfg); +Wrapper_load_save::Wrapper_load_save(/* args */) { + //obj_quotas_sys.set_map_gui(map_gui_cfg); + //obj_quotas_ubconfig.set_map_gui(map_gui_cfg); } -wrapper_load::~wrapper_load() +Wrapper_load_save::~Wrapper_load_save() { } -void wrapper_load::load_global_cfg() { +void Wrapper_load_save::set_map_gui(map_str_str &map_gui_cfg) { + this->map_gui_cfg = map_gui_cfg; +} + +void Wrapper_load_save::set_map_global(map_str_str &map_global_cfg) { + this->map_global_cfg = map_global_cfg; +} + +void Wrapper_load_save::set_map_local(map_str_str &map_system_cfg) { + this->map_system_cfg = map_system_cfg; +} + +void Wrapper_load_save::set_vec_key(vector vec_param_names) { + this->vec_param_names = vec_param_names; +} + +bool Wrapper_load_save::load_global_cfg() { this->load_template(&map_global_cfg, global_load); - info_warning_error(1); map_gui_cfg = map_global_cfg; + return 1; + } -void wrapper_load::load_system_cfg() { +bool Wrapper_load_save::load_system_cfg() { this->load_template(&map_system_cfg, system_load); - info_warning_error(0); map_gui_cfg = map_system_cfg; + return 0; + } -void wrapper_load::set_void_work_tv_g_u_p(void (*init_work_tv_g_u_p)()) { - this->init_work_tv_g_u_p = init_work_tv_g_u_p; -} -void wrapper_load::set_void_info_warning_error(void (*info_warning_error)(int, int, int)) { - this->info_warning_error = info_warning_error; -} - -void wrapper_load::load_template(map_str_str* map_temp, string cmd) { - this->init_work_tv_g_u_p(); +void Wrapper_load_save::load_template(map_str_str* map_temp, string cmd) { if (cmd.find("system") != string::npos) { this->init_dict("system"); } @@ -41,54 +51,58 @@ void wrapper_load::load_template(map_str_str* map_temp, string cmd) { *map_temp = obj_load.get_load_data(*map_temp, cmd); } -void wrapper_load::wrapper_save_global_cfg() { +bool Wrapper_load_save::wrapper_save_global_cfg() { this->set_data_cfg(); if (this->save_template("boot", "global")) { - this->info_warning_error(5); + map_global_cfg = map_gui_cfg; + return 5; } else { - info_warning_error(3); + map_global_cfg = map_gui_cfg; + return 3; } - map_global_cfg = map_gui_cfg; - } -void wrapper_load::wrapper_save_system_cfg() { +bool Wrapper_load_save::wrapper_save_system_cfg() { this->set_data_cfg(); if (this->save_template("boot", "system")) { - this->info_warning_error(5); + map_system_cfg = map_gui_cfg; + return 5; } else { - info_warning_error(2); + map_system_cfg = map_gui_cfg; + return 2; } - map_system_cfg = map_gui_cfg; + } -void wrapper_load::wrapper_save_all_cfg() { +bool Wrapper_load_save::wrapper_save_all_cfg() { this->set_data_cfg(); bool _flag_save_global = this->save_template("boot", "global");; bool _flag_save_local = this->save_template("boot", "system"); if (_flag_save_global && _flag_save_local) { - this->info_warning_error(5, ); + map_global_cfg = map_gui_cfg; + map_system_cfg = map_gui_cfg; + return 5; } else { - info_warning_error(4); + map_global_cfg = map_gui_cfg; + map_system_cfg = map_gui_cfg; + return 4; } - map_global_cfg = map_gui_cfg; - map_system_cfg = map_gui_cfg; + } -void wrapper_load::wrapper_info_warning_error(int mess) { - this->info_warning_error(mess, obj_load.get_count_error(), obj_save.get_count_error()); - obj_load.set_count_error(0); - obj_save.set_count_error(0); - +int Wrapper_load_save::get_error_load() { + return obj_load.get_count_error(); +} +int Wrapper_load_save::get_error_save() { + return obj_save.get_count_error(); } - -bool wrapper_load::save_template(string section, string flag_save) { +bool Wrapper_load_save::save_template(string section, string flag_save) { bool flag_no_save = true; obj_save.set_data_local(map_system_cfg); obj_save.set_data_global(map_global_cfg); @@ -100,7 +114,7 @@ bool wrapper_load::save_template(string section, string flag_save) { return flag_no_save; } -void wrapper_load::init_dict(string flag_load) { +void Wrapper_load_save::init_dict(string flag_load) { std::map map_gui_cfg_n; map_gui_cfg_n[""] = ""; @@ -113,7 +127,7 @@ void wrapper_load::init_dict(string flag_load) { } } -void wrapper_load::set_data_cfg() { +void Wrapper_load_save::set_data_cfg() { // TODO: // Написать функцию } \ No newline at end of file diff --git a/source/view/model/wrapper_load_save.h b/source/view/model/wrapper_load_save.h index a2db82c..210dc10 100644 --- a/source/view/model/wrapper_load_save.h +++ b/source/view/model/wrapper_load_save.h @@ -1,5 +1,5 @@ -#ifndef WRAPPER_LOAD_H -#define WRAPPER_LOAD_H +#ifndef WRAPPER_LOAD_SAVE_H +#define WRAPPER_LOAD_SAVE_H #include "../../my_type.h" #include "../../project_lib.h" #include "load.h" @@ -17,33 +17,34 @@ -class wrapper_load { +class Wrapper_load_save { private: string str_cmd_error; - void (*init_work_tv_g_u_p)(); - void (*info_warning_error)(int, int, int) private: map_str_str map_gui_cfg; map_str_str map_global_cfg; map_str_str map_system_cfg; + vector vec_param_names; 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(); Lib_save::Save obj_save = Lib_save::Save(); Lib_Load::Load obj_load = Lib_Load::Load(); public: - wrapper_load(/* args */); - ~wrapper_load(); - void load_global_cfg(); - void load_system_cfg(); - void wrapper_save_system_cfg(); - void wrapper_save_global_cfg(); - void wrapper_save_all_cfg(); - void wrapper_info_warning_error(int mess); - void set_void_work_tv_g_u_p(void (*init_work_tv_g_u_p)()); - void set_void_info_warning_error(void (*info_warning_error)(int, int, int)); + Wrapper_load_save(/* args */); + ~Wrapper_load_save(); + bool load_global_cfg(); + bool load_system_cfg(); + bool wrapper_save_system_cfg(); + bool wrapper_save_global_cfg(); + bool wrapper_save_all_cfg(); + int get_error_load(); + int get_error_save(); + void set_map_gui(map_str_str &map_gui_cfg); + void set_map_global(map_str_str &map_global_cfg); + void set_map_local(map_str_str &map_system_cfg); + void set_vec_key(vector vec_param_names); private: void load_template(map_str_str* map_temp, string cmd); - void info_warning_error(int mess); void init_dict(string flag_load); void set_data_cfg(); bool save_template(string section, string flag_save); diff --git a/source/view/my_plug.h b/source/view/my_plug.h deleted file mode 100644 index 46cb259..0000000 --- a/source/view/my_plug.h +++ /dev/null @@ -1,21 +0,0 @@ -#include "../project_lib.h" -#include "ubl-settings-diskquota.h" - - -class CmdArgParser : public Glib::OptionGroup { -public: - CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help); - ::Window GetSocketID() const; -private: - int m_socketID = 0; - -}; -class SettingsPlug : public Gtk::Plug{ -public: - Gtk::Window *window; - SettingsPlug(::Window p_socketID, Glib::RefPtr builder); - -private: - Gtk::Widget *plugBox; - Gtk::Widget *parent; -}; \ No newline at end of file diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index 4dc87a6..e085a29 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -1,8 +1,7 @@ +#ifndef UBL_SETTINGS_DISKQUOTA_H +#define UBL_SETTINGS_DISKQUOTA_H #include "ubl-settings-diskquota.h" -using namespace std; -int socket_ext_id_I = 0; -int socket_trd_id_I = 0; bool flag_save = false; bool flag_save_local = false; bool flag_save_global = false; @@ -10,14 +9,11 @@ bool flag_load_global = false; bool flag_lock_help = false; string version_application = "1.0"; -MainWindow::MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder) - : Gtk::ApplicationWindow(obj), builder{builder} { - this->builder = builder; - this->settings(); -} - -MainWindow::MainWindow(Glib::RefPtr const& builder) { - this->builder = builder; +MainWindow::MainWindow(Glib::RefPtr builder, View_open_browser* obj_open_browser, int* socket_ext_id_I, int* socket_trd_id_I) { + this->builder = builder; + this->socket_ext_id_I = socket_ext_id_I; + this->socket_trd_id_I = socket_trd_id_I; + this->set_obj_browser(obj_open_browser); this->settings(); } @@ -26,10 +22,6 @@ void MainWindow::settings() { this->lacalization(); this->add_CSS(); this->flag_block_gui(); - //map_device = obj_device.get_parted(); - //this->filling_device_combo_box_template(groupsDeviceCombo, map_device); - //this->filling_device_combo_box_template(usersDeviceCombo, map_device); - //this->filling_device_combo_box_template(usersProjectCombo, map_device); this->init_tree_view(); this->init_spin_all(); if (geteuid() == 0) { @@ -46,7 +38,16 @@ void MainWindow::settings() { Gtk::Widget *boxWidget; builder->get_widget("boxColor", boxWidget); HeadOverlay->add_overlay(*boxWidget); - ubl_make_plugs(boxSave, boxButton, socket_ext_id_I, socket_trd_id_I); + ubl_make_plugs(boxSave, boxButton, (*socket_ext_id_I), (*socket_trd_id_I)); +} + +void MainWindow::set_obj_wrapper_load(Wrapper_load_save* obj_wrapper_load) { + this->obj_wrapper_load = obj_wrapper_load; +} + +void MainWindow::set_obj_browser(View_open_browser* obj_open_browser) { + this->obj_open_browser = obj_open_browser; + obj_open_browser->get_about()->set_version(version_application); } void MainWindow::init_spin_all() { @@ -279,7 +280,7 @@ void MainWindow::add_CSS() { Glib::RefPtr boxButton_css = boxButton->get_style_context(); Glib::RefPtr boxSave_css = boxSave->get_style_context(); Glib::RefPtr headerBar_css = headerBar->get_style_context(); - if (socket_trd_id_I == 0 && socket_ext_id_I == 0){ + if ((*socket_trd_id_I) == 0 && (*socket_ext_id_I) == 0){ boxButton_css->add_class("bkim_no_plug"); boxSave_css->add_class("bkim_no_plug"); } @@ -379,14 +380,18 @@ void MainWindow::get_builder() { builder->get_widget("usersProjectCombo", usersProjectCombo); } +void MainWindow::open_browser() { + obj_open_browser->open_help(); +} + void MainWindow::event() { btnFilterGroups->signal_clicked().connect([&]() {this->filters_show();}); btnFilterUsers->signal_clicked().connect([&]() {this->filters_show();}); btnFilterProject->signal_clicked().connect([&]() {this->filters_show();}); //btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); //btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); - //btnSynopsis->signal_activate().connect([&]() {this->synopsis_show();}); - //btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); + btnSynopsis->signal_activate().connect([&]() {this->open_browser();}); + btnAbout->signal_activate().connect([&]() {obj_open_browser->get_about()->aboutWindows->show();}); //btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all_cfg();}); //btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); //btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system_cfg();}); @@ -416,7 +421,7 @@ void MainWindow::remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::Row row = *(*iter); if(row) { string name = row[m_columns.name] + ""; - // TODO: + // TODO: : check string key = "GRUB_PASSWORD[" + name + "]"; map_gui_cfg[key] = ""; } @@ -444,6 +449,7 @@ void MainWindow::set_add_tv_g_u_p(Gtk::TreeModel::Row &row, Glib::RefPtrget_active()) { mode_quota = "filesystem"; } @@ -464,6 +470,7 @@ void MainWindow::info_status_app(string stule) { } void MainWindow::init_work_tv_g_u_p() { + // Todo: remove groupsQuotasTree->remove_all_columns(); ProjectQuotasTree->remove_all_columns(); usersQuotasTree->remove_all_columns(); @@ -492,11 +499,13 @@ void MainWindow::remove_line_template(const Gtk::TreeModel::Path&, const Gtk::Tr flag_del = true; } -MainWindow::~MainWindow() {} - void help() { string version = string(str_version) + version_application + "\n"; cout << version.c_str(); cout << str_help_h; } +MainWindow::~MainWindow() {} + +#endif + diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index dd56ce9..29ca407 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -1,146 +1,27 @@ #ifndef UBL_SETTINGS_QUOTAS_H #define UBL_SETTINGS_QUOTAS_H - #include +#include "view_open_browser.h" #include "../project_lib.h" #include "../my_type.h" #include "ubl-util-standard.c" -#ifdef WEBKIT_FOUND -#include -#endif - -#define name_app _("ubl-settings-diskquota") -#define configuring_system_boot _("Configuring system boot parameters") -#define system_boot _("System boot") -#define str_about _("About ubl-settings-diskquota") -#define command_line_parameters _("Command line parameters:") -#define load_default _("Load default:") -#define seconds _("seconds") -#define download_menu _("Download menu") -#define terminal_for_input _("Terminal for input") -#define terminal_for_output _("Terminal for output") -#define boot_selection_menu_timer _("Boot selection menu timer") -#define str_help _("Help") -#define str_about_1 _("About") -#define str_save_local _("Save") -#define str_load_local _("Load") -#define save_all _("Save in global and local configuration") -#define save_local _("Save in local configuration") -#define save_global _("Save in global configuration") -#define load_global _("Load global configuration") -#define load_local _("Load local configuration") -#define read_online _("Read online") -#define cancel _("Cancel") -#define always_redirect _("Always redirect") -#define boot_screen_display_mode _("Boot screen display mode:") -#define no_loading_animation _("No loading animation, full log") -#define boot_menu_user_name _("Boot menu user name:") -#define boot_menu_user_password _("Boot menu user password:") -#define last_successful_upload _("Last successful upload") -#define read_documentation_web _("Would you like to read documentation in the Web?") -#define redirected_documentation _("You will be redirected to documentation site, where user help pages are ""translated and supported by community.") -#define local_read_error _("Local configuration reading error") -#define global_read_error _("Global configuration read error") -#define local_write_error _("Local configuration write error") -#define global_write_error _("Global configuration write error") -#define error_save_all _("Error saved local and global configuration") -#define local_load_ok _("Local configuration downloaded successfully") -#define global_load_ok _("Global configuration downloaded successfully") -#define local_ok_written _("Local configuration successfully written") -#define global_ok_written _("Global configuration successfully written") -#define successfully_save_all _("Successfully saved local and global configuration") -#define nothing_save _("Nothing to save!") -#define program_as_root _("The program must be run as root") - -#define str_weeks _("weeks") -#define str_days _("days") -#define str_hours _("hours") -#define str_minutes _("minutes") -#define str_device _("Device:") -#define str_users _("Users") -#define str_groups _("Groups") -#define str_files _("files") -#define str_hard_limit _("Hard limit") -#define str_file_system _("File system:") -#define str_name _("Name") -#define str_size _("Size") -#define str_quotas_mode _("Direct control of the file system") -#define str_lb_head _("Configuration of disk quotas parameters for system groups and users") -#define str_soft_limit _("Soft limit") -#define str_currently_using _("Currently using:") -#define str_currently_using_space _("Currently using: ") -#define str_filters _("Filters") -#define str_quotas _("Quotas") -#define str_help_h _("GTK settings disk quota for UBLinux\n" \ - "\n" \ - "Usage: ubl-settings-diskquota [OPTIONS...]\n" \ - "Options:\n" \ - " -h, --help\t Show this help\n" \ - " -V, --version\t Show package version\n" \ - " --lock-help Lock utility help\n" \ - " --lock-save Lock saving local and global configuration\n" \ - " --lock-save-local Lock save global configuration\n" \ - " --lock-save-global Lock load global configuration\n" \ - " --lock-load-global Lock load global configuration\n") -#define str_version _("ubl-settings-diskquota version: ") -#define str_user _("User") -#define str_group _("Group") -#define str_projects _("Projects") -#define str_user_1 _("User:") -#define str_group_1 _("Group:") -#define str_project_1 _("Projects:") -#define str_device_project _("Device\nProject") -#define str_quota _("Quota type") -#define str_status _("Status") -#define str_excess_size_delay _("Excess size delay period") -#define str_excess_files_delay _("Excess files delay period") -#define str_disk_quotas_device _("Disk quotas for this device:") -#define str_user_quotas_device _("User quotas for this device: ") - -#define str_soft_limit_size _("Soft limit (size)") -#define str_tw_soft_limit _("Soft limit\n(size)") -#define str_hard_limit_size _("Hard limit (size)") -#define str_deferring_hard_limit_size _("Deferring a hard limit (size)") -#define str_hard_activation_size _("Hard limit activation time (size)") -#define str_hard_limit_time _("Hard limit (file) activation time") -#define str_group_quotas_device _("Group quotas for this device:") -#define str_general_settings _("General settings") - -#define str_tw_severe_limitation _("Severe\nlimitation\n(size)") -#define str_tw_general_deferring_size _("Deferring\n(size)") -#define str_tw_general_deferring_files _("Deferring\n(files)") -#define str_tw_deferring_size _("Deferring\na hard\nlimit\n(files)") -#define str_tw_deferring_files _("Deferring\na hard\nlimit\n(files)") -#define str_tw_soft_limit_files _("Soft limit\n(files)") -#define str_tw_severe_limitation_files _("Severe\nlimitation\n(files)") -#define str_soft_restriction_files _("Soft Restriction (files)") -#define str_severe_limitation_files _("Severe limitation (files)") -#define str_deferring_limit_files _("Deferring a hard limit (files)") -#define info_box_ok_css "boxInfoMessOK" -#define info_box_error_css "boxInfoMessError" -#define icon_checked "com.ublinux.ubl-settings-diskquota.checked" -#define icon_warning "com.ublinux.ubl-settings-diskquota.warning" - -#define path_app "/usr/bin/" -#define path_glade "/usr/share/ubl-settings-diskquota/ui/ubl-settings-diskquota.glade" -#define path_css "/usr/share/ubl-settings-diskquota/css/ubl-settings-diskquota.css" -#define app_name "ubl-settings-diskquota" -#define path_resources "/usr/share/ubl-settings-diskquota" -#define path_img_head_background "/usr/share/ubl-settings-diskquota/images/logo-background.png" -#define no_recognized _("Argument not recognized\n") +#include "../var.h" +#include "model/wrapper_load_save.h" using namespace std; + extern string version_application; extern bool flag_save; extern bool flag_save_local; extern bool flag_save_global; extern bool flag_load_global; extern bool flag_lock_help; -extern int socket_ext_id_I; -extern int socket_trd_id_I; -class MainWindow : public Gtk::ApplicationWindow { + + + +class MainWindow { public: class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: @@ -284,6 +165,7 @@ class MainWindow : public Gtk::ApplicationWindow { map_str_str map_gui_cfg; map_str_str map_global_cfg; map_str_str map_system_cfg; + Wrapper_load_save* obj_wrapper_load = 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(); @@ -304,10 +186,13 @@ class MainWindow : public Gtk::ApplicationWindow { bool flag_validate_del_users = false; bool flag_validate_del_project = false; Gtk::TreeModel::Row row; + int* socket_ext_id_I = NULL; + int* socket_trd_id_I = NULL; + View_open_browser* obj_open_browser; const struct tv_g_u_p obj_tv_g_u_p {"", "", "", "", "", "", "", "", "",""}; public: - MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder); - MainWindow(Glib::RefPtr const& builder); + // MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder); + MainWindow(Glib::RefPtr builder, View_open_browser* obj_open_browser, int* socket_ext_id_I, int* socket_trd_id_I); ~MainWindow(); void settings(); void flag_block_gui(); @@ -315,6 +200,7 @@ class MainWindow : public Gtk::ApplicationWindow { void add_CSS(); void get_builder(); void event(); + void open_browser(); void info_warning_error(int mess, int error_save, int error_load); void init_work_tv_g_u_p(); void remove_line_template(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter, Gtk::TreeModel::iterator& iter_del, bool& flag_del); @@ -323,8 +209,10 @@ class MainWindow : public Gtk::ApplicationWindow { void entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label); void info_status_app(string stule); void filters_show(); + void set_obj_wrapper_load(Wrapper_load_save* obj_wrapper_load); 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::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(); @@ -338,6 +226,6 @@ class MainWindow : public Gtk::ApplicationWindow { void format_cmd_quotas_ubconfig(struct struct_quotas& _struct_quota); struct partition_cmd wrapper_settings_quotas(); }; - +void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); void help(); #endif diff --git a/source/view/view_about.cc b/source/view/view_about.cc index 97d23c9..23e00bb 100644 --- a/source/view/view_about.cc +++ b/source/view/view_about.cc @@ -2,15 +2,15 @@ -view_about::view_about(/* args */) { +View_about::View_about() { builder = Gtk::Builder::create_from_file(path_glade); this->settings(); } -view_about::~view_about() { +View_about::~View_about() { } -void view_about::lacalization() { +void View_about::lacalization() { time_t now = time(0); tm *ltm = localtime(&now); unsigned int year = 1900 + ltm->tm_year; @@ -23,29 +23,25 @@ void view_about::lacalization() { headerAboutTopic->set_label(_(app_name)); } -void view_about::set_name(string app_name) { - app_name = app_name; -} - -void view_about::set_version(string version_application) { +void View_about::set_version(string version_application) { version_application = version_application; } -void view_about::show() { +void View_about::show() { aboutWindows->show(); } -void view_about::get_builder() { +void View_about::get_builder() { builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog); builder->get_widget("aboutWindows", aboutWindows); builder->get_widget("headerAboutTopic", headerAboutTopic); } -void view_about::settings() { +void View_about::settings() { this->get_builder(); this->lacalization(); btnBoxAboutDialog->set_visible(false); } -void view_filters::set_path_glade(string path_glade) { - this->path_glade = path_glade; +View_about* View_about::get_self() { + return this; } \ No newline at end of file diff --git a/source/view/view_about.h b/source/view/view_about.h index 87ef742..c3b44ff 100644 --- a/source/view/view_about.h +++ b/source/view/view_about.h @@ -1,32 +1,29 @@ #ifndef VIEW_ABOUT_H #define VIEW_ABOUT_H #include "../project_lib.h" -#define copyright _("Copyright © UBSoft LLC, 2022 - ") -#define str_setting_user _("Setting user quotas") -#define website _("https://wiki.ublinux.com") -#define project_Home_page _("Project Home Page") -class view_about +#include "model/util.h" +#include "../var.h" + +class View_about { private: - string path_glade; string version_application; - string app_name; - private: - Glib::RefPtr const& builder; - Gtk::AboutDialog *aboutWindows; + Glib::RefPtr builder; Gtk::Label *headerAboutTopic; Gtk::ButtonBox *btnBoxAboutDialog; public: - view_about(/* args */); - ~view_about(); + Gtk::AboutDialog *aboutWindows; +public: + View_about(); + ~View_about(); void lacalization(); void event(); + View_about* get_self(); void get_builder(); void settings(); void show(); - void set_path_glade(string path_glade); - void set_name(string app_name); + void set_path_glade(string str_path_glade); void set_version(string version_application); }; #endif \ No newline at end of file diff --git a/source/view/view_filters.cc b/source/view/view_filters.cc index 8d87019..bd29f58 100644 --- a/source/view/view_filters.cc +++ b/source/view/view_filters.cc @@ -1,15 +1,15 @@ -#include "view_filters.h" +#include "View_filters.h" -view_filters::view_filters(/* args */){ +View_filters::View_filters(/* args */){ builder = Gtk::Builder::create_from_file(path_glade); this->settings(); } -view_filters::~view_filters() +View_filters::~View_filters() { } -void view_filters::settings() { +void View_filters::settings() { this->get_builder(); this->lacalization(); this->set_map_flag(chbFilterName); @@ -25,11 +25,11 @@ void view_filters::settings() { this->event(); } -void view_filters::set_path_glade(string path_glade) { +void View_filters::set_path_glade(string path_glade) { this->path_glade = path_glade; } -void view_filters::get_builder() { +void View_filters::get_builder() { builder->get_widget("wndFilters", wndFilters); builder->get_widget("chbFilterName", chbFilterName); builder->get_widget("chbFilterQuotas", chbFilterQuotas); @@ -47,12 +47,12 @@ void view_filters::get_builder() { lblFiltersHead->set_label(str_filters); } -void view_filters::show() { +void View_filters::show() { this->set_map_flag_false(); wndFilters->show(); } -void view_filters::lacalization() { +void View_filters::lacalization() { chbFilterName->set_label(str_name); chbFilterQuotas->set_label(str_quotas); chbFilterSize->set_label(str_size); @@ -65,7 +65,7 @@ void view_filters::lacalization() { chbFilterHardLimitFileDelay->set_label(str_deferring_limit_files); } -void view_filters::event() { +void View_filters::event() { chbFilterName->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, &MainWindow::set_map_flag), chbFilterName)); @@ -102,23 +102,23 @@ void view_filters::event() { &MainWindow::cancel)); } -void view_filters::set_map_flag(Gtk::CheckButton* check_button) { +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() { +void View_filters::save() { wndFilters->hide(); } -void view_filters::cancel() { +void View_filters::cancel() { wndFilters->hide(); } -map view_filters::get_filters() { +map View_filters::get_filters() { return map_filters_flag; } -void view_filters::set_map_flag_false() { +void View_filters::set_map_flag_false() { for (auto& [key: value]: map_filters_flag) { map_filters_flag[key] = false; } diff --git a/source/view/view_filters.h b/source/view/view_filters.h index e161c20..79085c3 100644 --- a/source/view/view_filters.h +++ b/source/view/view_filters.h @@ -1,20 +1,11 @@ #ifndef VIEW_FILTERS_H #define VIEW_FILTERS_H #include "../project_lib.h" +#include "../var.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 +class View_filters { private: - string path_glade; std::map map_filters_flag; private: Glib::RefPtr const& builder; @@ -34,14 +25,14 @@ private: Gtk::Button *btnFiltersSave; Gtk::Button *btnFiltersCancel; public: - view_filters(/* args */); - ~view_filters(); + View_filters(/* args */); + ~View_filters(); void lacalization(); void event(); void get_builder(); void settings(); void show(); - void set_path_glade(string path_glade) + void set_path_glade(string str_path_glade) private: void set_map_flag(Gtk::CheckButton* check_button); void save(); diff --git a/source/view/view_open_browser.cc b/source/view/view_open_browser.cc index d39caa4..53b840c 100644 --- a/source/view/view_open_browser.cc +++ b/source/view/view_open_browser.cc @@ -1,14 +1,25 @@ #include "view_open_browser.h" -view_open_browser::view_open_browser(/* args */) { + +View_open_browser* obj_open_browser; +View_about* obj_about; + +void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data) { + if (self && user_data) {} + obj_open_browser->global_lick_doc = link; + obj_about->aboutWindows->hide(); + obj_open_browser->temp_help_show(); +} + +View_open_browser::View_open_browser(/* args */) { builder = Gtk::Builder::create_from_file(path_glade); - this->settings(); } -view_open_browser::~view_open_browser() { +View_open_browser::~View_open_browser() { } -void settings() { +void View_open_browser::settings() { + obj_open_browser = this; this->get_builder(); #ifdef WEBKIT_FOUND one = WEBKIT_WEB_VIEW( webkit_web_view_new() ); @@ -19,10 +30,15 @@ void settings() { this->event(); } -void view_open_browser::show() { - wndShowWeb->show(); +void View_open_browser::set_obj_about(View_about* obj_view_about) { + this->obj_view_about = obj_view_about; + obj_about = obj_view_about; } -void view_open_browser::get_builder() { + +void View_open_browser::show() { + this->wndShowWeb->show(); +} +void View_open_browser::get_builder() { #ifdef WEBKIT_FOUND builder->get_widget("wndWeb", wndWeb); #endif @@ -36,7 +52,7 @@ void view_open_browser::get_builder() { builder->get_widget("wndShowWeb", wndShowWeb); } -void view_open_browser::lacalization() { +void View_open_browser::lacalization() { lblwebHeaderName->set_label(name_app); lblhelpText->set_text(redirected_documentation); btnReadHelp->set_label(read_online); @@ -45,13 +61,14 @@ void view_open_browser::lacalization() { lblhelpHeader->set_text(read_documentation_web); } -void view_open_browser::event() { +void View_open_browser::event() { + g_signal_connect(G_OBJECT(obj_view_about->aboutWindows->gobj()), "activate-link", G_CALLBACK(wrapper_help_show), NULL); btnCancelHelp->signal_clicked().connect([&]() {wndShowWeb->hide();}); chkAlwaysOpenHelp->signal_toggled().connect([&]() {flag_open_browser = true;}); - btnReadHelp->signal_clicked().connect(sigc::mem_fun(*this, &view_open_browser::open_browser)); + btnReadHelp->signal_clicked().connect(sigc::mem_fun(*this, &View_open_browser::open_browser)); } -void view_open_browser::show() { +void View_open_browser::temp_help_show() { if (flag_open_browser == true) { this->open_browser(); } @@ -60,31 +77,35 @@ void view_open_browser::show() { } } -void view_open_browser::open_browser() { +void View_open_browser::open_browser() { #ifdef WEBKIT_FOUND - webkit_web_view_load_uri(one, link_doc); + webkit_web_view_load_uri(one, _(global_lick_doc.c_str())); wndWeb->show_all(); #else - if (this->template_open_browser() != 0) { - - } + this->template_open_browser(global_lick_doc); #endif + this->wndShowWeb->hide(); } -int view_open_browser::template_open_browser() { - string cmd = cmd_xdg + string(_(link_doc)) + " &"; +int View_open_browser::template_open_browser(string str_link_doc) { + string cmd = cmd_xdg + string(_(str_link_doc.c_str())) + " &"; string buf = ""; if (geteuid() == 0) { string response_user = getlogin(); int size_s = std::snprintf(nullptr, 0, cmd_execute, response_user.c_str(), cmd.c_str()) + 1; auto size = static_cast(size_s); std::unique_ptr buf(new char[ size ]); - std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() ); - cmd = std::string( buf.get(), buf.get() + size - 1 ); + std::snprintf(buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str()); + cmd = string(buf.get(), buf.get() + size - 1); } - return system(cmd); + return system(cmd.c_str()); + +} +void View_open_browser::open_help() { + global_lick_doc = const_link_doc; + temp_help_show(); } -void view_filters::set_path_glade(string path_glade) { - this->path_glade = path_glade; -} \ No newline at end of file +View_about* View_open_browser::get_about() { + return obj_view_about; +} diff --git a/source/view/view_open_browser.h b/source/view/view_open_browser.h index 4966887..84e081a 100644 --- a/source/view/view_open_browser.h +++ b/source/view/view_open_browser.h @@ -1,42 +1,50 @@ #ifndef VIEW_OPEN_BROWSER_H #define VIEW_OPEN_BROWSER_H -#include "../project_lib.h" -#define link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-diskquota" -#define cmd_xdg "xdg-open " -#define cmd_execute "su -l %s -c \" DISPLAY=$DISPLAY %s \"" +#include "../project_lib.h" +#include "view_about.h" +#ifdef WEBKIT_FOUND +#include +#endif +#include "../var.h" -class view_open_browser -{ +class View_open_browser { private: - string path_glade; bool flag_open_browser = false; + View_about* obj_view_about; private: - Glib::RefPtr const& builder; + Glib::RefPtr builder; Gtk::Button *btnReadHelp; Gtk::Button *btnCancelHelp; - Gtk::Window *wndShowWeb; Gtk::CheckButton *chkAlwaysOpenHelp; Gtk::Label *lblwebHeaderName; Gtk::Label *lblhelpText; Gtk::Label *lblhelpHeader; Gtk::Label *lblHeadeWndWeb; +public: + string global_lick_doc; + Gtk::Window *wndShowWeb; #ifdef WEBKIT_FOUND Gtk::Window *wndWeb; Gtk::Widget *three; WebKitWebView *one; #endif public: - view_open_browser(/* args */); - ~view_open_browser(); + View_open_browser(/* args */); + ~View_open_browser(); void lacalization(); void event(); void get_builder(); void settings(); void show(); - void set_path_glade(string path_glade); + void open_help(); + void temp_help_show(); + void set_path_glade(string str_path_glade); + void set_obj_about(View_about* View_about); + View_about* get_about(); private: - int template_open_browser(); + int template_open_browser(string str_link_doc); void open_browser(); }; +void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); #endif \ No newline at end of file diff --git a/source/view/view_set_user_group.cc b/source/view/view_set_user_group.cc index 9785589..342b2ce 100644 --- a/source/view/view_set_user_group.cc +++ b/source/view/view_set_user_group.cc @@ -117,10 +117,6 @@ void MainWindow::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *sp combo_box->set_sensitive(check_button->get_active()); } -void view_set_user_group::set_path_glade(string path_glade) { - this->path_glade = path_glade; -} - 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); diff --git a/source/view/view_set_user_group.h b/source/view/view_set_user_group.h index 7644a47..fa025d4 100644 --- a/source/view/view_set_user_group.h +++ b/source/view/view_set_user_group.h @@ -1,22 +1,11 @@ #ifndef VIEW_SET_USER_GROUP_H #define VIEW_SET_USER_GROUP_H #include "../project_lib.h" -#define str_device _("Device:") -#define str_quota_status _("Quota use status:") -#define str_size _("Size") -#define str_files _("files") -#define str_currently_using _("Currently using:") -#define str_soft_limit _("Soft limit") -#define str_hard_limit _("Hard limit") -#define str_hard_limit _("Hard limit") -#define str_prefix_KB _("Kb") -#define str_prefix_MB _("Mb") -#define str_prefix_GB _("Gb") -#define str_prefix_TB _("Tb") +#include "../var.h" class view_set_user_group { private: - string path_glade; + string str_path_glade; private: Glib::RefPtr const& builder; Gtk::Label* lblSetDevice; @@ -57,7 +46,7 @@ public: void get_builder(); void settings(); void show(); - void set_path_glade(string path_glade); + void set_path_glade(string str_path_glade); 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); From 0ffda64c44b76cba7b433b2b5b6d85b34e734b80 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Mon, 15 May 2023 17:59:51 +0600 Subject: [PATCH 15/26] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ubl-settings-diskquota.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/ubl-settings-diskquota.css b/ubl-settings-diskquota.css index ee3ba98..34c1572 100644 --- a/ubl-settings-diskquota.css +++ b/ubl-settings-diskquota.css @@ -11,9 +11,6 @@ .bannerbackground { background-color: #404040; } -.textHead{ - text-shadow: 1px 1px #ffffff; -} .view_app { background-color: @theme_bg_color; } From b4b9b967a698645d86f640be0e3b2a5e7c68dd27 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 16 May 2023 10:45:41 +0600 Subject: [PATCH 16/26] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20?= =?UTF-8?q?=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B8=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D1=83=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/controller.cc | 6 +- source/controller.h | 4 ++ source/view/model/wrapper_load_save.cc | 54 +++++++++--------- source/view/model/wrapper_load_save.h | 22 ++++---- source/view/ubl-settings-diskquota.cc | 77 ++++++++++++++++++++++---- source/view/ubl-settings-diskquota.h | 18 ++++-- 6 files changed, 125 insertions(+), 56 deletions(-) diff --git a/source/controller.cc b/source/controller.cc index 7d3ca02..047e97d 100644 --- a/source/controller.cc +++ b/source/controller.cc @@ -21,8 +21,12 @@ Controller::~Controller() void Controller::settings() { obj_open_browser->set_obj_about(obj_view_about); obj_main_window = new MainWindow(builder, obj_open_browser, &socket_ext_id_I, &socket_trd_id_I); - obj_main_window->set_obj_wrapper_load(obj_wrapper_load_save); + obj_main_window->set_obj_wrapper_load_save(obj_wrapper_load_save); obj_open_browser->settings(); + obj_main_window->set_map_gui(&map_gui_cfg); + obj_main_window->set_map_global(&map_global_cfg); + obj_main_window->set_map_local(&map_system_cfg); + obj_main_window->settings(); } CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help) diff --git a/source/controller.h b/source/controller.h index 4f02c82..e0d9854 100644 --- a/source/controller.h +++ b/source/controller.h @@ -1,5 +1,6 @@ #ifndef CONTROLLER_H #define CONTROLLER_H +#include "my_type.h" #include "view/view_open_browser.h" #include "view/view_about.h" #include "view/ubl-settings-diskquota.h" @@ -12,6 +13,9 @@ class Controller : public Gtk::ApplicationWindow { private: Glib::RefPtr builder; + map_str_str map_gui_cfg; + map_str_str map_global_cfg; + map_str_str map_system_cfg; public: Controller(/* args */); ~Controller(); diff --git a/source/view/model/wrapper_load_save.cc b/source/view/model/wrapper_load_save.cc index 3b03caa..5988735 100644 --- a/source/view/model/wrapper_load_save.cc +++ b/source/view/model/wrapper_load_save.cc @@ -11,15 +11,15 @@ Wrapper_load_save::~Wrapper_load_save() { } -void Wrapper_load_save::set_map_gui(map_str_str &map_gui_cfg) { +void Wrapper_load_save::set_map_gui(map_str_str* map_gui_cfg) { this->map_gui_cfg = map_gui_cfg; } -void Wrapper_load_save::set_map_global(map_str_str &map_global_cfg) { +void Wrapper_load_save::set_map_global(map_str_str* map_global_cfg) { this->map_global_cfg = map_global_cfg; } -void Wrapper_load_save::set_map_local(map_str_str &map_system_cfg) { +void Wrapper_load_save::set_map_local(map_str_str* map_system_cfg) { this->map_system_cfg = map_system_cfg; } @@ -27,16 +27,16 @@ void Wrapper_load_save::set_vec_key(vector vec_param_names) { this->vec_param_names = vec_param_names; } -bool Wrapper_load_save::load_global_cfg() { - this->load_template(&map_global_cfg, global_load); - map_gui_cfg = map_global_cfg; +int Wrapper_load_save::load_global_cfg() { + this->load_template(map_global_cfg, global_load); + *map_gui_cfg = *map_global_cfg; return 1; } -bool Wrapper_load_save::load_system_cfg() { - this->load_template(&map_system_cfg, system_load); - map_gui_cfg = map_system_cfg; +int Wrapper_load_save::load_system_cfg() { + this->load_template(map_system_cfg, system_load); + *map_gui_cfg = *map_system_cfg; return 0; } @@ -51,44 +51,44 @@ void Wrapper_load_save::load_template(map_str_str* map_temp, string cmd) { *map_temp = obj_load.get_load_data(*map_temp, cmd); } -bool Wrapper_load_save::wrapper_save_global_cfg() { +int Wrapper_load_save::wrapper_save_global_cfg() { this->set_data_cfg(); if (this->save_template("boot", "global")) { - map_global_cfg = map_gui_cfg; + *map_global_cfg = *map_gui_cfg; return 5; } else { - map_global_cfg = map_gui_cfg; + *map_global_cfg = *map_gui_cfg; return 3; } } -bool Wrapper_load_save::wrapper_save_system_cfg() { +int Wrapper_load_save::wrapper_save_system_cfg() { this->set_data_cfg(); if (this->save_template("boot", "system")) { - map_system_cfg = map_gui_cfg; + *map_system_cfg = *map_gui_cfg; return 5; } else { - map_system_cfg = map_gui_cfg; + *map_system_cfg = *map_gui_cfg; return 2; } } -bool Wrapper_load_save::wrapper_save_all_cfg() { +int Wrapper_load_save::wrapper_save_all_cfg() { this->set_data_cfg(); bool _flag_save_global = this->save_template("boot", "global");; bool _flag_save_local = this->save_template("boot", "system"); if (_flag_save_global && _flag_save_local) { - map_global_cfg = map_gui_cfg; - map_system_cfg = map_gui_cfg; + *map_global_cfg = *map_gui_cfg; + *map_system_cfg = *map_gui_cfg; return 5; } else { - map_global_cfg = map_gui_cfg; - map_system_cfg = map_gui_cfg; + *map_global_cfg = *map_gui_cfg; + *map_system_cfg = *map_gui_cfg; return 4; } @@ -104,9 +104,9 @@ int Wrapper_load_save::get_error_save() { bool Wrapper_load_save::save_template(string section, string flag_save) { bool flag_no_save = true; - obj_save.set_data_local(map_system_cfg); - obj_save.set_data_global(map_global_cfg); - obj_save.set_data_gui(map_gui_cfg); + obj_save.set_data_local(*map_system_cfg); + obj_save.set_data_global(*map_global_cfg); + obj_save.set_data_gui(*map_gui_cfg); obj_save.set_vec_params(vec_param_names); obj_save.save(section, flag_save); vector obj_vec_error = obj_save.get_error(); @@ -115,15 +115,15 @@ bool Wrapper_load_save::save_template(string section, string flag_save) { } void Wrapper_load_save::init_dict(string flag_load) { - std::map map_gui_cfg_n; + map_str_str map_gui_cfg_n; map_gui_cfg_n[""] = ""; - map_gui_cfg = map_gui_cfg_n; + *map_gui_cfg = map_gui_cfg_n; if (flag_load == "global") { - map_global_cfg = map_gui_cfg_n; + *map_global_cfg = *map_gui_cfg; } else if (flag_load == "system") { - map_system_cfg = map_gui_cfg_n; + *map_system_cfg = *map_gui_cfg; } } diff --git a/source/view/model/wrapper_load_save.h b/source/view/model/wrapper_load_save.h index 210dc10..5562ff4 100644 --- a/source/view/model/wrapper_load_save.h +++ b/source/view/model/wrapper_load_save.h @@ -21,9 +21,9 @@ class Wrapper_load_save { private: string str_cmd_error; private: - map_str_str map_gui_cfg; - map_str_str map_global_cfg; - map_str_str map_system_cfg; + map_str_str* map_gui_cfg = NULL; + map_str_str* map_global_cfg = NULL; + map_str_str* map_system_cfg = NULL; vector vec_param_names; 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(); @@ -32,16 +32,16 @@ private: public: Wrapper_load_save(/* args */); ~Wrapper_load_save(); - bool load_global_cfg(); - bool load_system_cfg(); - bool wrapper_save_system_cfg(); - bool wrapper_save_global_cfg(); - bool wrapper_save_all_cfg(); + int load_global_cfg(); + int load_system_cfg(); + int wrapper_save_system_cfg(); + int wrapper_save_global_cfg(); + int wrapper_save_all_cfg(); int get_error_load(); int get_error_save(); - void set_map_gui(map_str_str &map_gui_cfg); - void set_map_global(map_str_str &map_global_cfg); - void set_map_local(map_str_str &map_system_cfg); + void set_map_gui(map_str_str* map_gui_cfg); + void set_map_global(map_str_str* map_global_cfg); + void set_map_local(map_str_str* map_system_cfg); void set_vec_key(vector vec_param_names); private: void load_template(map_str_str* map_temp, string cmd); diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index e085a29..a5c9952 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -14,7 +14,26 @@ MainWindow::MainWindow(Glib::RefPtr builder, View_open_browser* ob this->socket_ext_id_I = socket_ext_id_I; this->socket_trd_id_I = socket_trd_id_I; this->set_obj_browser(obj_open_browser); - this->settings(); + // this->settings(); +} + +void MainWindow::set_map_gui(map_str_str* map_gui_cfg) { + this->map_gui_cfg = map_gui_cfg; + obj_wrapper_load_save->set_map_gui(map_gui_cfg); +} + +void MainWindow::set_map_global(map_str_str* map_global_cfg) { + this->map_global_cfg = map_global_cfg; + obj_wrapper_load_save->set_map_global(map_global_cfg); +} + +void MainWindow::set_map_local(map_str_str* map_system_cfg) { + this->map_system_cfg = map_system_cfg; + obj_wrapper_load_save->set_map_local(map_system_cfg); +} + +void MainWindow::set_obj_wrapper_load_save(Wrapper_load_save* obj_wrapper_load_save) { + this->obj_wrapper_load_save = obj_wrapper_load_save; } void MainWindow::settings() { @@ -25,6 +44,8 @@ void MainWindow::settings() { this->init_tree_view(); this->init_spin_all(); if (geteuid() == 0) { + this->wrapper_load_system(); + this->wrapper_load_global(); this->event(); } else { @@ -41,9 +62,7 @@ void MainWindow::settings() { ubl_make_plugs(boxSave, boxButton, (*socket_ext_id_I), (*socket_trd_id_I)); } -void MainWindow::set_obj_wrapper_load(Wrapper_load_save* obj_wrapper_load) { - this->obj_wrapper_load = obj_wrapper_load; -} + void MainWindow::set_obj_browser(View_open_browser* obj_open_browser) { this->obj_open_browser = obj_open_browser; @@ -384,17 +403,51 @@ void MainWindow::open_browser() { obj_open_browser->open_help(); } +void MainWindow::wrapper_save_system() { + int id_mess = obj_wrapper_load_save->wrapper_save_system_cfg(); + int error_save = obj_wrapper_load_save->get_error_save(); + int error_load = obj_wrapper_load_save->get_error_load(); + this->info_warning_error(id_mess, error_save, error_load); +} +void MainWindow::wrapper_save_global() { + int id_mess = obj_wrapper_load_save->wrapper_save_global_cfg(); + int error_save = obj_wrapper_load_save->get_error_save(); + int error_load = obj_wrapper_load_save->get_error_load(); + this->info_warning_error(id_mess, error_save, error_load); +} + +void MainWindow::wrapper_save_all() { + int id_mess = obj_wrapper_load_save->wrapper_save_all_cfg(); + int error_save = obj_wrapper_load_save->get_error_save(); + int error_load = obj_wrapper_load_save->get_error_load(); + this->info_warning_error(id_mess, error_save, error_load); +} + +void MainWindow::wrapper_load_system() { + int id_mess = obj_wrapper_load_save->load_system_cfg(); + int error_save = obj_wrapper_load_save->get_error_save(); + int error_load = obj_wrapper_load_save->get_error_load(); + this->info_warning_error(id_mess, error_save, error_load); +} + +void MainWindow::wrapper_load_global() { + int id_mess = obj_wrapper_load_save->load_global_cfg(); + int error_save = obj_wrapper_load_save->get_error_save(); + int error_load = obj_wrapper_load_save->get_error_load(); + this->info_warning_error(id_mess, error_save, error_load); +} + void MainWindow::event() { btnFilterGroups->signal_clicked().connect([&]() {this->filters_show();}); btnFilterUsers->signal_clicked().connect([&]() {this->filters_show();}); btnFilterProject->signal_clicked().connect([&]() {this->filters_show();}); - //btnLoadGlob->signal_activate().connect([&]() {this->load_global_cfg();}); - //btnLoadLocal->signal_activate().connect([&]() {this->load_system_cfg();}); btnSynopsis->signal_activate().connect([&]() {this->open_browser();}); btnAbout->signal_activate().connect([&]() {obj_open_browser->get_about()->aboutWindows->show();}); - //btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all_cfg();}); - //btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global_cfg();}); - //btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system_cfg();}); + btnSaveLocalGlob->signal_activate().connect([&]() {this->wrapper_save_all();}); + btnSaveGlob->signal_activate().connect([&]() {this->wrapper_save_global();}); + btnSaveLocal->signal_activate().connect([&]() {this->wrapper_save_system();}); + btnLoadGlob->signal_activate().connect([&]() {this->wrapper_load_global();}); + btnLoadLocal->signal_activate().connect([&]() {this->wrapper_load_system();}); chbMangSystemFile->signal_toggled().connect([&]() {this->mode_switch_quota();}); btnDelGroups->signal_clicked().connect( sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, @@ -420,10 +473,10 @@ void MainWindow::remove_template(Glib::RefPtr* list_store, const if (flag_validate_del && (*list_store)->iter_is_valid(*(iter))) { Gtk::TreeModel::Row row = *(*iter); if(row) { - string name = row[m_columns.name] + ""; + // string name = row[m_columns.name] + ""; // TODO: : check - string key = "GRUB_PASSWORD[" + name + "]"; - map_gui_cfg[key] = ""; + // string key = "GRUB_PASSWORD[" + name + "]"; + // map_gui_cfg[key] = ""; } (*list_store)->erase((*iter)); flag_validate_del = false; diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index 29ca407..67deb20 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -162,10 +162,10 @@ class MainWindow { Gtk::Button* btnEditGroups; public: - map_str_str map_gui_cfg; - map_str_str map_global_cfg; - map_str_str map_system_cfg; - Wrapper_load_save* obj_wrapper_load = NULL; + map_str_str* map_gui_cfg = NULL; + map_str_str* map_global_cfg = NULL; + map_str_str* map_system_cfg = NULL; + Wrapper_load_save* obj_wrapper_load_save = 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(); @@ -209,7 +209,7 @@ class MainWindow { void entry_combo_box_temp(Gtk::ComboBoxText *combo_box, Gtk::Label *label); void info_status_app(string stule); void filters_show(); - void set_obj_wrapper_load(Wrapper_load_save* obj_wrapper_load); + void set_obj_wrapper_load_save(Wrapper_load_save* obj_wrapper_load_save); void init_tree_view(); void del_columns(); void set_obj_browser(View_open_browser* obj_open_browser); @@ -225,6 +225,14 @@ class MainWindow { void format_cmd_quotas_system(struct struct_quotas& _struct_quota); void format_cmd_quotas_ubconfig(struct struct_quotas& _struct_quota); struct partition_cmd wrapper_settings_quotas(); + void set_map_gui(map_str_str* map_gui_cfg); + void set_map_global(map_str_str* map_global_cfg); + void set_map_local(map_str_str* map_system_cfg); + void wrapper_load_system(); + void wrapper_load_global(); + void wrapper_save_all(); + void wrapper_save_system(); + void wrapper_save_global(); }; void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); void help(); From 72c9bfb841ce7f5d0b606284dda0b5d57a9aaf8a Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 16 May 2023 11:53:08 +0600 Subject: [PATCH 17/26] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 8 +- source/controller.cc | 1 + source/controller.h | 2 + source/view/model/system_quotas.cc | 262 -------------------------- source/view/model/system_quotas.h | 35 ---- source/view/model/ubconfig_quota.cc | 39 ++++ source/view/model/ubconfig_quota.h | 58 ++++++ source/view/model/ubconfig_quotas.cc | 27 --- source/view/model/ubconfig_quotas.h | 25 --- source/view/ubl-settings-diskquota.cc | 5 + source/view/ubl-settings-diskquota.h | 3 + source/view/view_filters.cc | 36 ++-- source/view/view_filters.h | 13 +- 13 files changed, 135 insertions(+), 379 deletions(-) delete mode 100644 source/view/model/system_quotas.cc delete mode 100644 source/view/model/system_quotas.h create mode 100644 source/view/model/ubconfig_quota.cc create mode 100644 source/view/model/ubconfig_quota.h delete mode 100644 source/view/model/ubconfig_quotas.cc delete mode 100644 source/view/model/ubconfig_quotas.h diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 2f1ce76..87f1658 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -30,12 +30,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin -fstack-clash-protection -fcf-protection -g") set(SOURCE_FILES + view/view_filters.cc + view/view_filters.h view/ubl-settings-diskquota.h view/ubl-settings-diskquota.cc - view/model/ubconfig_quotas.cc - view/model/ubconfig_quotas.h - view/model/system_quotas.h - view/model/system_quotas.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 diff --git a/source/controller.cc b/source/controller.cc index 047e97d..20015bf 100644 --- a/source/controller.cc +++ b/source/controller.cc @@ -26,6 +26,7 @@ void Controller::settings() { obj_main_window->set_map_gui(&map_gui_cfg); 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->settings(); } diff --git a/source/controller.h b/source/controller.h index e0d9854..5df2011 100644 --- a/source/controller.h +++ b/source/controller.h @@ -5,6 +5,7 @@ #include "view/view_about.h" #include "view/ubl-settings-diskquota.h" #include "view/model/wrapper_load_save.h" +#include "view/view_filters.h" extern int socket_ext_id_I; extern int socket_trd_id_I; @@ -24,6 +25,7 @@ public: View_about* obj_view_about = new View_about(); MainWindow* obj_main_window; Wrapper_load_save *obj_wrapper_load_save = new Wrapper_load_save(); + View_filters obj_view_filters = View_filters(); Controller(BaseObjectType* obj, Glib::RefPtr const& builder); Controller(Glib::RefPtr const& builder); diff --git a/source/view/model/system_quotas.cc b/source/view/model/system_quotas.cc deleted file mode 100644 index 254de2f..0000000 --- a/source/view/model/system_quotas.cc +++ /dev/null @@ -1,262 +0,0 @@ -#include "system_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::set_map_device(map_str_str &map_device) { - this->map_device = &map_device; - this->check_partition_mount(); -} - -void Quotas_sys::set_map_gui(map_str_str &map_gui) { - map_gui_cfg = &map_gui; -} - -void Quotas_sys::check_partition_mount() { - string key = ""; - string response = Utils::file_read("/proc/mounts"); - for (const auto& iter: (*map_device)) { - key = iter.first; - if (response.find(key) != string::npos) { - disk_mount[key] = true; - } - } -} - -string Quotas_sys::wrapper_hw_sw(string partition) { - - if ((*map_device).find(partition) != (*map_device).end()) { - string fsystem = (*map_device)[partition]; - if ((*map_device).find(fsystem) != (*map_device).end()) { - return map_hw_or_sw[fsystem]; - } - } - return ""; - -} - -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::wrapper_on_quotas(string partition, string flag_mode) { - // Todo - // Добавить выключение квот в зависимости от диска - cout << partition << "" << flag_mode << endl; - if (disk_mount.find(partition) == disk_mount.end()) { - - } - else { - - } - return true; - } - -bool Quotas_sys::on_quota_hw(string partition, string cmd_hw, string cmd_sw) { - /* - Включить квоты, только для HW ext2,3,4: - Если ФС, уже существует и без HW атрибут квот ext2,3,4 - Раздел должен быть отмонтирован - */ - if (this->wrapper_hw_sw(partition) == "hw") { - obj_process_system.call(cmd_hw, ""); - obj_process_system.call("ubconfig set config SERVICESSTART+=,quotaon.service", ""); - return true; - } - else if (this->wrapper_hw_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) { - /* - Включить квоты, только для SW, другие ФС и сетевые NFS: - У этого исполнения квот отсутствуют проектные квоты prjquota - Раздел должен быть примонтирован - */ - 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; -} - -bool Quotas_sys::off_quota(string partition, string quota_hw, string quota_sw) { - string cmd = ""; - if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) { - if (this->wrapper_hw_sw(partition) == "hw") { - cmd = quota_hw + " " + partition; - obj_process_system.call(cmd, ""); - return true; - } - else if (this->wrapper_hw_sw(partition) == "sw") { - cmd = quota_sw + " " + partition; - obj_process_system.call(cmd, ""); - return true; - } - } - return false; - -} - -vector Quotas_sys::pars_data(string cmd) { - string start_pars = "------\n"; - string response = obj_process_call.call_all_sections(cmd); - size_t index_start = response.find(start_pars); - string line_pars = ""; - struct data_all_quotas struct_data; - vector vec_struct_data; - int index = 0; - int old_index = index; - if (index_start != string::npos) { - response = response.substr(index_start+start_pars.length(), response.length()); - vector vec_index_sep = Utils::find_all(response, "\n"); - for (size_t i = 0; i < vec_index_sep.size(); i++) { - old_index = index; - index = vec_index_sep[i]; - if (index-1 == old_index) { - break; - } - line_pars = response.substr(old_index, index); - struct_data = part_quotas_line(line_pars); - vec_struct_data.push_back(struct_data); - } - } - return vec_struct_data; -} - -struct data_all_quotas Quotas_sys::part_quotas_line(string line) { - struct data_all_quotas struct_data; - vector vec_index_sep = Utils::find_all(line, " "); - int old_index = 0; - string buff = ""; - int index_data = 0; - for (int& index: vec_index_sep) { - if ((index - old_index) >= 2) { - buff = line.substr(old_index, index - old_index); - cout << buff << endl; - if (index_data == 0) { - struct_data.username = buff; - } - else if (index_data == 1) { - struct_data.status = buff; - } - else if (index_data == 2) { - struct_data.block_used = buff; - } - else if (index_data == 3) { - struct_data.block_soft = buff; - } - else if (index_data == 4) { - struct_data.block_hard = buff; - } - else if (index_data == 5) { - struct_data.block_grace = buff; - } - else if (index_data == 6) { - struct_data.file_used = buff; - } - else if (index_data == 7) { - struct_data.file_soft = buff; - } - else if (index_data == 8) { - struct_data.file_hard = buff; - } - else if (index == 9) { - struct_data.file_grace = buff; - } - index_data += 1; - } - old_index = index; - } - if (index_data != 0) {struct_data.is_validate = true; } - else {struct_data.is_validate = false; } - return struct_data; -} - -} \ No newline at end of file diff --git a/source/view/model/system_quotas.h b/source/view/model/system_quotas.h deleted file mode 100644 index 65b2b5e..0000000 --- a/source/view/model/system_quotas.h +++ /dev/null @@ -1,35 +0,0 @@ -#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_device; - map_str_str* map_gui_cfg; - map disk_mount; - 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 check_partition_mount(); - void format_cmd_quotas_system(struct struct_quotas& _struct_quota); - bool off_quota(string partition, string quota_hw, string quota_sw); - 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); - vector pars_data(string cmd); - void set_map_device(map_str_str &map_device); - string wrapper_hw_sw(string partition); - bool wrapper_on_quotas(string partition, string flag_mode); - protected: - struct data_all_quotas part_quotas_line(string line); -}; -} -#endif \ No newline at end of file diff --git a/source/view/model/ubconfig_quota.cc b/source/view/model/ubconfig_quota.cc new file mode 100644 index 0000000..653ff88 --- /dev/null +++ b/source/view/model/ubconfig_quota.cc @@ -0,0 +1,39 @@ +#include "ubconfig_quota.h" + + + +Ubconfig_quota::Ubconfig_quota(/* args */) +{ +} + +Ubconfig_quota::~Ubconfig_quota() +{ +} + +void Ubconfig_quota::set_map_global(map_str_str* map_global_cfg) { + this->map_global_cfg = map_global_cfg; +} + +void Ubconfig_quota::set_map_local(map_str_str* map_system_cfg) { + this->map_system_cfg = map_system_cfg; +} + +void Ubconfig_quota::remove_key_to_vec(string key) { + cout << key << endl; +} + +void Ubconfig_quota::add_key_to_vec(string key) { + cout << key << endl; +} + +void Ubconfig_quota::set_vec_key(vector* vec_param_names) { + this->vec_param_names = vec_param_names; +} + +void Ubconfig_quota::format_data() { + +} + + + + diff --git a/source/view/model/ubconfig_quota.h b/source/view/model/ubconfig_quota.h new file mode 100644 index 0000000..08d63ce --- /dev/null +++ b/source/view/model/ubconfig_quota.h @@ -0,0 +1,58 @@ +#ifndef UBCONFIG_QUOTAS_H +#define UBCONFIG_QUOTAS_H + +#include "../../my_type.h" +#include "../../project_lib.h" + +class Ubconfig_quota +{ +private: + map_str_str* map_gui_cfg = NULL; + map_str_str* map_global_cfg = NULL; + map_str_str* map_system_cfg = NULL; + vector* vec_param_names = NULL; + struct Size { + int size_0; + int size_1; + int size_2; + int size_3; + int size_4; + int size_5; + }; + struct User { + bool active; + string device; + vector users; + struct Size obj_size; + }; + struct Group { + bool active; + string device; + vector groups; + struct Size obj_size; + }; + struct Prjquota { + bool active; + string device; + vector prjquota_name; + struct Size obj_size; + }; + struct Quotas { + struct User obj_user; + struct Group obj_group; + struct Prjquota obj_prjquota; + }; +public: + Ubconfig_quota(/* args */); + ~Ubconfig_quota(); + void set_map_gui(map_str_str* map_gui_cfg); + void set_map_global(map_str_str* map_global_cfg); + void set_map_local(map_str_str* map_system_cfg); + void set_vec_key(vector* vec_param_names); + void remove_key_to_vec(string key); + void add_key_to_vec(string key); + void format_data(); + +}; + +#endif \ No newline at end of file diff --git a/source/view/model/ubconfig_quotas.cc b/source/view/model/ubconfig_quotas.cc deleted file mode 100644 index 88bcb30..0000000 --- a/source/view/model/ubconfig_quotas.cc +++ /dev/null @@ -1,27 +0,0 @@ -#include "ubconfig_quotas.h" - -namespace Quotas_ubconfig { - -void Quotas_ubconfig::format_cmd_quotas(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; -} - -bool Quotas_ubconfig::off_quota(string partition, string quota_type, string state) { - string key = "DISK_QUOTA[" + quota_type + ":" + partition + "]"; - string value = "disable"; - (*map_gui_cfg)[key] = state; - return true; -} -void Quotas_ubconfig::set_map_gui(map_str_str &map_gui) { - map_gui_cfg = &map_gui; -} -Quotas_ubconfig::Quotas_ubconfig() { - map_hw_or_sw["ext2"] = "hw"; - map_hw_or_sw["ext3"] = "hw"; - map_hw_or_sw["nfs"] = "sw"; - map_hw_or_sw["NFS"] = "sw"; -} -} \ No newline at end of file diff --git a/source/view/model/ubconfig_quotas.h b/source/view/model/ubconfig_quotas.h deleted file mode 100644 index 8ace1ad..0000000 --- a/source/view/model/ubconfig_quotas.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef UBCONFIG_QUOTAS -#define UBCONFIG_QUOTAS - -#include "../../project_lib.h" -#include "../../my_type.h" -#include "my_process.h" -#include "util.h" - -namespace Quotas_ubconfig { - - -class Quotas_ubconfig{ - 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(); - Quotas_ubconfig(); - bool off_quota(string partition, string quota_type, string state); - void format_cmd_quotas(struct struct_quotas& _struct_quota); - void set_map_gui(map_str_str &map_gui); -}; -} -#endif diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index a5c9952..50026f2 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -36,6 +36,10 @@ void MainWindow::set_obj_wrapper_load_save(Wrapper_load_save* obj_wrapper_load_s this->obj_wrapper_load_save = obj_wrapper_load_save; } +void MainWindow::set_obj_view_filters(View_filters* obj_view_filters) { + this->obj_view_filters = obj_view_filters; +} + void MainWindow::settings() { this->get_builder(); this->lacalization(); @@ -512,6 +516,7 @@ void MainWindow::mode_switch_quota() { } void MainWindow::filters_show() { + obj_view_filters->show(); } diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index 67deb20..6319693 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -8,6 +8,7 @@ #include "ubl-util-standard.c" #include "../var.h" #include "model/wrapper_load_save.h" +#include "view_filters.h" using namespace std; @@ -166,6 +167,7 @@ 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_filters* obj_view_filters = 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(); @@ -233,6 +235,7 @@ class MainWindow { void wrapper_save_all(); void wrapper_save_system(); void wrapper_save_global(); + void set_obj_view_filters(View_filters* obj_view_filters); }; void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); void help(); diff --git a/source/view/view_filters.cc b/source/view/view_filters.cc index bd29f58..c26ecc2 100644 --- a/source/view/view_filters.cc +++ b/source/view/view_filters.cc @@ -1,4 +1,4 @@ -#include "View_filters.h" +#include "view_filters.h" View_filters::View_filters(/* args */){ builder = Gtk::Builder::create_from_file(path_glade); @@ -25,10 +25,6 @@ void View_filters::settings() { 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); @@ -68,49 +64,49 @@ void View_filters::lacalization() { void View_filters::event() { chbFilterName->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterName)); + &View_filters::set_map_flag), chbFilterName)); chbFilterQuotas->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterQuotas)); + &View_filters::set_map_flag), chbFilterQuotas)); chbFilterSize->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterSize)); + &View_filters::set_map_flag), chbFilterSize)); chbFilterSoftLimitSize->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterSoftLimitSize)); + &View_filters::set_map_flag), chbFilterSoftLimitSize)); chbFilterHardLimitSize->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterHardLimitSize)); + &View_filters::set_map_flag), chbFilterHardLimitSize)); chbFilterHardLimitSizeDelay->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterHardLimitSizeDelay)); + &View_filters::set_map_flag), chbFilterHardLimitSizeDelay)); chbFilterFiles->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterFiles)); + &View_filters::set_map_flag), chbFilterFiles)); chbFilterSoftLimitFile->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterSoftLimitFile)); + &View_filters::set_map_flag), chbFilterSoftLimitFile)); chbFilterHardLimitFile->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterHardLimitFile)); + &View_filters::set_map_flag), chbFilterHardLimitFile)); chbFilterHardLimitFileDelay->signal_toggled().connect( sigc::bind (sigc::mem_fun(*this, - &MainWindow::set_map_flag), chbFilterHardLimitFileDelay)); + &View_filters::set_map_flag), chbFilterHardLimitFileDelay)); btnFiltersSave->signal_clicked().connect(sigc::mem_fun(*this, - &MainWindow::save)); + &View_filters::btn_save)); btnFiltersCancel->signal_clicked().connect(sigc::mem_fun(*this, - &MainWindow::cancel)); + &View_filters::btn_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() { +void View_filters::btn_save() { wndFilters->hide(); } -void View_filters::cancel() { +void View_filters::btn_cancel() { wndFilters->hide(); } @@ -119,7 +115,7 @@ map View_filters::get_filters() { } void View_filters::set_map_flag_false() { - for (auto& [key: value]: map_filters_flag) { + for (auto& [key, value]: map_filters_flag) { map_filters_flag[key] = false; } } \ No newline at end of file diff --git a/source/view/view_filters.h b/source/view/view_filters.h index 79085c3..58a026b 100644 --- a/source/view/view_filters.h +++ b/source/view/view_filters.h @@ -3,12 +3,14 @@ #include "../project_lib.h" #include "../var.h" +using namespace std; + class View_filters { private: - std::map map_filters_flag; + map map_filters_flag; private: - Glib::RefPtr const& builder; + Glib::RefPtr builder; Gtk::Window *wndFilters; Gtk::CheckButton *chbFilterName; Gtk::CheckButton *chbFilterQuotas; @@ -32,13 +34,12 @@ public: void get_builder(); void settings(); void show(); - void set_path_glade(string str_path_glade) private: void set_map_flag(Gtk::CheckButton* check_button); - void save(); - void cancel(); + void btn_save(); + void btn_cancel(); void set_map_flag_false(); - map get_filters() + map get_filters(); }; #endif From 33473a28daef1cd4c3566245e5a7f53a257eea1c Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 16 May 2023 12:30:22 +0600 Subject: [PATCH 18/26] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B8=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=B2=D0=BE=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/view/ubl-settings-diskquota.cc | 55 ++++++++++++++++++--------- source/view/ubl-settings-diskquota.h | 3 +- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index 50026f2..cb06244 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -432,6 +432,7 @@ void MainWindow::wrapper_load_system() { int error_save = obj_wrapper_load_save->get_error_save(); int error_load = obj_wrapper_load_save->get_error_load(); this->info_warning_error(id_mess, error_save, error_load); + this->init_work_tv_g_u_p(); } void MainWindow::wrapper_load_global() { @@ -439,6 +440,7 @@ void MainWindow::wrapper_load_global() { int error_save = obj_wrapper_load_save->get_error_save(); int error_load = obj_wrapper_load_save->get_error_load(); this->info_warning_error(id_mess, error_save, error_load); + this->init_work_tv_g_u_p(); } void MainWindow::event() { @@ -463,14 +465,14 @@ 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), 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),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), 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),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), 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),groupsQuotasTree, row, list_store_groups, obj_tv_g_u_p)); } void MainWindow::remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del) { @@ -491,18 +493,20 @@ void MainWindow::remove_template(Glib::RefPtr* list_store, const flag_validate_del = false; } -void MainWindow::set_add_tv_g_u_p(Gtk::TreeModel::Row &row, Glib::RefPtr list_store, struct tv_g_u_p obj_tv_g_u_p) { - row = *(list_store->append()); - row[m_columns.name] = obj_tv_g_u_p.name; - row[m_columns.quotas] = obj_tv_g_u_p.quotas; - row[m_columns.size] = obj_tv_g_u_p.size; - row[m_columns.soft_limit_size] = obj_tv_g_u_p.soft_limit_size; - row[m_columns.hard_limit_size] = obj_tv_g_u_p.hard_limit_size; - row[m_columns.deferring_size] = obj_tv_g_u_p.deferring_size; - row[m_columns.files] = obj_tv_g_u_p.files; - 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; +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) { + if (this->check_space(tree_view)) { + row = *(list_store->append()); + row[m_columns.name] = obj_tv_g_u_p.name; + row[m_columns.quotas] = obj_tv_g_u_p.quotas; + row[m_columns.size] = obj_tv_g_u_p.size; + row[m_columns.soft_limit_size] = obj_tv_g_u_p.soft_limit_size; + row[m_columns.hard_limit_size] = obj_tv_g_u_p.hard_limit_size; + row[m_columns.deferring_size] = obj_tv_g_u_p.deferring_size; + row[m_columns.files] = obj_tv_g_u_p.files; + 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; + } } void MainWindow::mode_switch_quota() { @@ -519,6 +523,21 @@ void MainWindow::filters_show() { obj_view_filters->show(); } +bool MainWindow::check_space(Gtk::TreeView* tree_view) { + Glib::RefPtr tree_view_model = tree_view->get_model(); + Gtk::TreeModel::Children children = tree_view_model->children(); + string name = ""; + string quotas = ""; + for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) { + Gtk::TreeModel::Row row = *iter; + name = row[m_columns.name] + ""; + quotas = row[m_columns.quotas] + ""; + if (name.length() == 0 || quotas.length() == 0) { + return false; + } + } + return true; +} void MainWindow::info_status_app(string stule) { Glib::RefPtr boxInfo = boxInfoError->get_style_context(); diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index 6319693..3a9a0d2 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -215,7 +215,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::TreeModel::Row &row, Glib::RefPtr list_store, struct tv_g_u_p obj_tv_g_u_p); + 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 off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type); void mode_switch_quota(); void save_quotegroupSaveButton(); @@ -236,6 +236,7 @@ class MainWindow { void wrapper_save_system(); void wrapper_save_global(); void set_obj_view_filters(View_filters* obj_view_filters); + bool check_space(Gtk::TreeView* tree_view); }; void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); void help(); From 6454a5c0e74c364905e34792365b7075053ab83a Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 16 May 2023 16:50:56 +0600 Subject: [PATCH 19/26] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=BA=D0=BD=D0=BE=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=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 From f1546a8fdc3a864fd1002d82a1310b585a008cb3 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 16 May 2023 17:56:31 +0600 Subject: [PATCH 20/26] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=BA=D0=BD=D0=BE=20=D1=81=D0=BE?= =?UTF-8?q?=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B5?= =?UTF-8?q?=D0=BA=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 4 + source/controller.cc | 1 + source/controller.h | 2 + source/view/ubl-settings-diskquota.cc | 7 +- source/view/ubl-settings-diskquota.h | 3 + source/view/view_edit_project.cc | 102 +++++++++++++++++++++----- source/view/view_edit_project.h | 47 ++++++++++-- source/view/view_edit_user_group.cc | 13 +++- ubl-settings-diskquota.glade | 64 +++++++++++++++- 9 files changed, 212 insertions(+), 31 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 041d209..844ac8b 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -30,6 +30,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin -fstack-clash-protection -fcf-protection -g") set(SOURCE_FILES + view/view_edit_project.cc + view/view_edit_project.h + view/view_edit_user_group.h + view/view_edit_user_group.cc view/view_add_user_group.h view/view_add_user_group.cc view/view_edit_user_group.cc diff --git a/source/controller.cc b/source/controller.cc index 8cf9572..f9f37c0 100644 --- a/source/controller.cc +++ b/source/controller.cc @@ -29,6 +29,7 @@ void Controller::settings() { 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->set_obj_view_edit_project(&obj_view_edit_project); obj_main_window->settings(); } diff --git a/source/controller.h b/source/controller.h index a4f4466..ef10985 100644 --- a/source/controller.h +++ b/source/controller.h @@ -8,6 +8,7 @@ #include "view/view_filters.h" #include "view/view_add_user_group.h" #include "view/view_edit_user_group.h" +#include "view/view_edit_project.h" extern int socket_ext_id_I; extern int socket_trd_id_I; @@ -30,6 +31,7 @@ public: 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(); + View_edit_project obj_view_edit_project = View_edit_project(); Controller(BaseObjectType* obj, Glib::RefPtr const& builder); Controller(Glib::RefPtr const& builder); diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index 37f868c..c14bbaa 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -47,6 +47,9 @@ void MainWindow::set_obj_view_add(View_add_user_group* 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::set_obj_view_edit_project(View_edit_project* obj_view_edit_project) { + this->obj_view_edit_project = obj_view_edit_project; +} void MainWindow::settings() { this->get_builder(); @@ -478,9 +481,7 @@ void MainWindow::event() { btnDelProject->signal_clicked().connect( 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), str_projects, ProjectQuotasTree, row, list_store_project, obj_tv_g_u_p)); + btnAddProject->signal_clicked().connect([&]() {this->obj_view_edit_project->show();}); btnAddUsers->signal_clicked().connect( 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)); diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index e107f6d..e48dca7 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -11,6 +11,7 @@ #include "view_filters.h" #include "view_add_user_group.h" #include "view_edit_user_group.h" +#include "view_edit_project.h" using namespace std; @@ -172,6 +173,7 @@ class MainWindow { View_edit_user_group* obj_view_edit = NULL; View_filters* obj_view_filters = NULL; View_add_user_group* obj_view_add = NULL; + View_edit_project* obj_view_edit_project = 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(); @@ -245,6 +247,7 @@ class MainWindow { 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 set_obj_view_edit_project(View_edit_project* obj_view_edit_project); }; void wrapper_help_show(GtkWidget *self, char* link, gpointer user_data); void help(); diff --git a/source/view/view_edit_project.cc b/source/view/view_edit_project.cc index 2e9c7ff..c7a2a7f 100644 --- a/source/view/view_edit_project.cc +++ b/source/view/view_edit_project.cc @@ -1,52 +1,114 @@ -#include "view_edit_user_group.h" +#include "view_edit_project.h" -View_edit_user_group::View_edit_user_group(/* args */) { +View_edit_project::View_edit_project(/* args */) { builder = Gtk::Builder::create_from_file(path_glade); - this->settings(); + this->setting(); } -View_edit_user_group::~View_edit_user_group() +View_edit_project::~View_edit_project() { } -void View_edit_user_group::setting() { +void View_edit_project::setting() { this->get_builder(); this->lacalization(); - + check_limit(quotegroupSizeSoftLimitCheckProject + ,quotegroupSizeSoftLimitSpinProject + ,quotegroupSizeSoftLimitComboProject); + check_limit(quotegroupSizeHardLimitCheckProject + ,quotegroupSizeHardLimitSpin1 + ,quotegroupSizeHardLimitComboProject); + check_limit(quotegroupFilesSoftLimitCheckProject + ,quotegroupFilesSoftLimitSpinProject + ,quotegroupFilesSoftLimitlabelProject); + check_limit(quotegroupFilesHardLimitCheckProject + ,quotegroupFilesHardLimitSpinProject + ,quotegroupFilesHarLimitLabelProject); this->event(); } -void View_edit_user_group::event() { - +void View_edit_project::event() { + quotegroupSizeSoftLimitCheckProject->signal_toggled().connect([&]() { + check_limit(quotegroupSizeSoftLimitCheckProject + ,quotegroupSizeSoftLimitSpinProject + ,quotegroupSizeSoftLimitComboProject); + }); + quotegroupSizeHardLimitCheckProject->signal_toggled().connect([&]() { + check_limit(quotegroupSizeHardLimitCheckProject + ,quotegroupSizeHardLimitSpin1 + ,quotegroupSizeHardLimitComboProject); + }); + quotegroupFilesSoftLimitCheckProject->signal_toggled().connect([&]() { + check_limit(quotegroupFilesSoftLimitCheckProject + ,quotegroupFilesSoftLimitSpinProject + ,quotegroupFilesSoftLimitlabelProject); + }); + quotegroupFilesHardLimitCheckProject->signal_toggled().connect([&]() { + check_limit(quotegroupFilesHardLimitCheckProject + ,quotegroupFilesHardLimitSpinProject + ,quotegroupFilesHarLimitLabelProject); + }); } -void View_edit_user_group::show() { - +void View_edit_project::show() { + wndQuotasAddProject->show(); } -void View_edit_user_group::get_builder() { - +void View_edit_project::get_builder() { + builder->get_widget("wndQuotasAddProject", wndQuotasAddProject); + builder->get_widget("quotegroupSizeFrameLabelProject", quotegroupSizeFrameLabelProject); + builder->get_widget("quotegroupFilesFrameLabelProject", quotegroupFilesFrameLabelProject); + builder->get_widget("quotegroupSizeCurrentlyLabelProject", quotegroupSizeCurrentlyLabelProject); + builder->get_widget("quotegroupFilesCurrentlyLabelProject", quotegroupFilesCurrentlyLabelProject); + builder->get_widget("quotegroupSizeSoftLimitLabelProject", quotegroupSizeSoftLimitLabelProject); + builder->get_widget("quotegroupFilesSoftLimitLabelProject", quotegroupFilesSoftLimitLabelProject); + builder->get_widget("quoteSizeHardLimitLabelProject", quoteSizeHardLimitLabelProject); + builder->get_widget("quoteFilesHardLimitLabelProject", quoteFilesHardLimitLabelProject); + builder->get_widget("quotegroupFilesSoftLimitlabelProject", quotegroupFilesSoftLimitlabelProject); + builder->get_widget("quotegroupFilesHarLimitLabelProject", quotegroupFilesHarLimitLabelProject); + builder->get_widget("quotegroupCancelButtonAdd", quotegroupCancelButtonAdd); + builder->get_widget("quotegroupSaveButtonAdd", quotegroupSaveButtonAdd); + builder->get_widget("lblDeviceProject", lblDeviceProject); + builder->get_widget("lblStatusQuotaProject", lblStatusQuotaProject); + builder->get_widget("lblCatalogProject", lblCatalogProject); + builder->get_widget("lblProjectId", lblProjectId); + builder->get_widget("lblProjectName", lblProjectName); + builder->get_widget("btnReviewProject", btnReviewProject); + builder->get_widget("btnGenerateProject", btnGenerateProject); + builder->get_widget("chbAuto", chbAuto); + builder->get_widget("entryCatalogProject", entryCatalogProject); + builder->get_widget("entryProjectId", entryProjectId); + builder->get_widget("entryProjectName", entryProjectName); + builder->get_widget("quotegroupSizeSoftLimitCheckProject", quotegroupSizeSoftLimitCheckProject); + builder->get_widget("quotegroupSizeHardLimitCheckProject", quotegroupSizeHardLimitCheckProject); + builder->get_widget("quotegroupFilesSoftLimitCheckProject", quotegroupFilesSoftLimitCheckProject); + builder->get_widget("quotegroupFilesHardLimitCheckProject", quotegroupFilesHardLimitCheckProject); + builder->get_widget("quotegroupSizeSoftLimitSpinProject", quotegroupSizeSoftLimitSpinProject); + builder->get_widget("quotegroupSizeHardLimitSpin1", quotegroupSizeHardLimitSpin1); + builder->get_widget("quotegroupFilesSoftLimitSpinProject", quotegroupFilesSoftLimitSpinProject); + builder->get_widget("quotegroupFilesHardLimitSpinProject", quotegroupFilesHardLimitSpinProject); + builder->get_widget("quotegroupSizeSoftLimitComboProject", quotegroupSizeSoftLimitComboProject); + builder->get_widget("quotegroupSizeHardLimitComboProject", quotegroupSizeHardLimitComboProject); } -void View_edit_user_group::lacalization(); +void View_edit_project::lacalization() { + this->fill_in_pow_memory(quotegroupSizeSoftLimitComboProject); + this->fill_in_pow_memory(quotegroupSizeHardLimitComboProject); +} -void View_edit_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box) { +void View_edit_project::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) { +void View_edit_project::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) { +void View_edit_project::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 index 880dc90..5c70640 100644 --- a/source/view/view_edit_project.h +++ b/source/view/view_edit_project.h @@ -1,22 +1,57 @@ -#ifndef VIEW_ADD_USER_GROUP_H -#define VIEW_ADD_USER_GROUP_H +#ifndef VIEW_EDIT_PROJECT_H +#define VIEW_EDIT_PROJECT_H #include "../project_lib.h" #include "../var.h" -class View_edit_user_group +class View_edit_project { private: Glib::RefPtr builder; + Gtk::Window* wndQuotasAddProject; + Gtk::Label* quotegroupSizeFrameLabelProject; + Gtk::Label* quotegroupFilesFrameLabelProject; + Gtk::Label* quotegroupSizeCurrentlyLabelProject; + Gtk::Label* quotegroupFilesCurrentlyLabelProject; + Gtk::Label* quotegroupSizeSoftLimitLabelProject; + Gtk::Label* quotegroupFilesSoftLimitLabelProject; + Gtk::Label* quoteSizeHardLimitLabelProject; + Gtk::Label* quoteFilesHardLimitLabelProject; + Gtk::Label* quotegroupFilesSoftLimitlabelProject; + Gtk::Label* quotegroupFilesHarLimitLabelProject; + Gtk::Label* lblDeviceProject; + Gtk::Label* lblStatusQuotaProject; + Gtk::Label* lblCatalogProject; + Gtk::Label* lblProjectId; + Gtk::Label* lblProjectName; + Gtk::Button* quotegroupCancelButtonAdd; + Gtk::Button* quotegroupSaveButtonAdd; + Gtk::Button* btnReviewProject; + Gtk::Button* btnGenerateProject; + Gtk::Entry* entryCatalogProject; + Gtk::Entry* entryProjectId; + Gtk::Entry* entryProjectName; + Gtk::CheckButton* chbAuto; + Gtk::CheckButton* quotegroupSizeSoftLimitCheckProject; + Gtk::CheckButton* quotegroupSizeHardLimitCheckProject; + Gtk::CheckButton* quotegroupFilesSoftLimitCheckProject; + Gtk::CheckButton* quotegroupFilesHardLimitCheckProject; + Gtk::SpinButton* quotegroupSizeSoftLimitSpinProject; + Gtk::SpinButton* quotegroupSizeHardLimitSpin1; + Gtk::SpinButton* quotegroupFilesSoftLimitSpinProject; + Gtk::SpinButton* quotegroupFilesHardLimitSpinProject; + Gtk::ComboBoxText* quotegroupSizeSoftLimitComboProject; + Gtk::ComboBoxText* quotegroupSizeHardLimitComboProject; + public: - View_edit_user_group(/* args */); - ~View_edit_user_group(); + View_edit_project(/* args */); + ~View_edit_project(); void setting(); + void lacalization(); 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); }; diff --git a/source/view/view_edit_user_group.cc b/source/view/view_edit_user_group.cc index 87bc1dd..f1fe001 100644 --- a/source/view/view_edit_user_group.cc +++ b/source/view/view_edit_user_group.cc @@ -12,7 +12,18 @@ View_edit_user_group::~View_edit_user_group() void View_edit_user_group::setting() { this->get_builder(); this->lacalization(); - + check_limit(quotegroupSizeSoftLimitCheckUser + ,quotegroupSizeSoftLimitSpinUser + ,quotegroupSizeSoftLimitComboUser); + check_limit(quotegroupSizeHardLimitCheckUser + ,quotegroupSizeHardLimitSpinUser + ,quotegroupSizeHardLimitComboUser); + check_limit(quotegroupFilesSoftLimitCheckUser + ,quotegroupFilesSoftLimitSpinUser + ,quotegroupFilesSoftLimitlabelUser); + check_limit(quotegroupFilesHardLimitCheckUser + ,quotegroupFilesHardLimitSpinUser + ,quotegroupFilesHarLimitLabelUser); this->event(); } diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 4529d4b..331b53c 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -3393,6 +3393,68 @@ 1 10 + + False + Please select File + True + center + 500 + 400 + True + com.ublinux.ublexec + dialog + True + True + + + False + vertical + 2 + + + False + end + + + gtk-cancel + True + True + True + True + + + True + True + 0 + + + + + gtk-ok + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + + + + False start @@ -3851,7 +3913,7 @@ - + Auto True True From 4fbfe1621143a838d59b56c2ed97d686fea4a727 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 17 May 2023 10:57:53 +0600 Subject: [PATCH 21/26] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D0=BA=D0=BD=D0=BE=20=D1=80=D0=B5=D0=B4=D0=B0?= =?UTF-8?q?=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- source/CMakeLists.txt | 2 + source/controller.cc | 1 + source/controller.h | 2 + source/var.h | 3 +- source/view/ubl-settings-diskquota.cc | 15 +- source/view/ubl-settings-diskquota.h | 6 +- source/view/view_add_project.cc | 119 +++- source/view/view_add_project.h | 49 +- source/view/view_edit_project.cc | 152 +++-- source/view/view_edit_project.h | 71 ++- ubl-settings-diskquota.glade | 830 +++++++++++++------------- ubl-settings-diskquota.pot | 18 + ubl-settings-diskquota_ru.po | 22 +- 14 files changed, 741 insertions(+), 551 deletions(-) diff --git a/Makefile b/Makefile index c4c4362..32f1d4e 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ all: init build init: @echo "Initialize ..."; \ - sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ubl-settings-diskquota.cc; \ + sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/view/ubl-settings-diskquota.cc; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 844ac8b..4b3ebc2 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -32,6 +32,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin set(SOURCE_FILES view/view_edit_project.cc view/view_edit_project.h + view/view_add_project.cc + view/view_add_project.h view/view_edit_user_group.h view/view_edit_user_group.cc view/view_add_user_group.h diff --git a/source/controller.cc b/source/controller.cc index f9f37c0..81040e4 100644 --- a/source/controller.cc +++ b/source/controller.cc @@ -29,6 +29,7 @@ void Controller::settings() { 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->set_obj_view_add_project(&obj_view_add_project); obj_main_window->set_obj_view_edit_project(&obj_view_edit_project); obj_main_window->settings(); } diff --git a/source/controller.h b/source/controller.h index ef10985..96b6b6f 100644 --- a/source/controller.h +++ b/source/controller.h @@ -9,6 +9,7 @@ #include "view/view_add_user_group.h" #include "view/view_edit_user_group.h" #include "view/view_edit_project.h" +#include "view/view_add_project.h" extern int socket_ext_id_I; extern int socket_trd_id_I; @@ -32,6 +33,7 @@ public: View_add_user_group obj_view_add = View_add_user_group(); View_edit_user_group obj_view_edit = View_edit_user_group(); View_edit_project obj_view_edit_project = View_edit_project(); + View_add_project obj_view_add_project = View_add_project(); Controller(BaseObjectType* obj, Glib::RefPtr const& builder); Controller(Glib::RefPtr const& builder); diff --git a/source/var.h b/source/var.h index d917069..0c4104a 100644 --- a/source/var.h +++ b/source/var.h @@ -1,7 +1,8 @@ #ifndef VAE_H #define VAE_H #include "project_lib.h" - +using namespace std; +extern string version_application; #define name_app _("ubl-settings-diskquota") #define configuring_system_boot _("Configuring system boot parameters") #define system_boot _("System boot") diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index c14bbaa..ebdcda9 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -2,12 +2,12 @@ #define UBL_SETTINGS_DISKQUOTA_H #include "ubl-settings-diskquota.h" +string version_application = "1.6"; bool flag_save = false; bool flag_save_local = false; bool flag_save_global = false; bool flag_load_global = false; bool flag_lock_help = false; -string version_application = "1.0"; MainWindow::MainWindow(Glib::RefPtr builder, View_open_browser* obj_open_browser, int* socket_ext_id_I, int* socket_trd_id_I) { this->builder = builder; @@ -47,6 +47,9 @@ void MainWindow::set_obj_view_add(View_add_user_group* 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::set_obj_view_add_project(View_add_project* obj_view_add_project) { + this->obj_view_add_project = obj_view_add_project; +} void MainWindow::set_obj_view_edit_project(View_edit_project* obj_view_edit_project) { this->obj_view_edit_project = obj_view_edit_project; } @@ -469,8 +472,7 @@ void MainWindow::event() { &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)); + btnEditProject->signal_clicked().connect([&]() {this->edit_quota_project_show();}); chbMangSystemFile->signal_toggled().connect([&]() {this->mode_switch_quota();}); btnDelGroups->signal_clicked().connect( sigc::bind*, const Gtk::TreeModel::iterator*, bool&> (sigc::mem_fun( *this, @@ -481,7 +483,7 @@ void MainWindow::event() { btnDelProject->signal_clicked().connect( 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([&]() {this->obj_view_edit_project->show();}); + btnAddProject->signal_clicked().connect([&]() {this->obj_view_add_project->show();}); btnAddUsers->signal_clicked().connect( 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)); @@ -499,7 +501,10 @@ void MainWindow::edit_quota_show(string name) { obj_view_edit->set_label_type_quota(name); obj_view_edit->show(); } - +void MainWindow::edit_quota_project_show() { + cout << obj_view_edit_project << endl; + obj_view_edit_project->show(); +} void MainWindow::remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del) { if (flag_validate_del && (*list_store)->iter_is_valid(*(iter))) { Gtk::TreeModel::Row row = *(*iter); diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index e48dca7..dbe9d8c 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -11,12 +11,13 @@ #include "view_filters.h" #include "view_add_user_group.h" #include "view_edit_user_group.h" +#include "view_add_project.h" #include "view_edit_project.h" using namespace std; -extern string version_application; + extern bool flag_save; extern bool flag_save_local; extern bool flag_save_global; @@ -173,6 +174,7 @@ class MainWindow { View_edit_user_group* obj_view_edit = NULL; View_filters* obj_view_filters = NULL; View_add_user_group* obj_view_add = NULL; + View_add_project* obj_view_add_project = NULL; View_edit_project* obj_view_edit_project = NULL; //Devices::Parted obj_device = Devices::Parted(); //Quotas_sys::Quotas_sys obj_quotas_sys = Quotas_sys::Quotas_sys(); @@ -247,7 +249,9 @@ class MainWindow { 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 set_obj_view_add_project(View_add_project* obj_view_add_project); void set_obj_view_edit_project(View_edit_project* obj_view_edit_project); + void edit_quota_project_show(); }; 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 index 2e9c7ff..d0cdb4b 100644 --- a/source/view/view_add_project.cc +++ b/source/view/view_add_project.cc @@ -1,52 +1,135 @@ -#include "view_edit_user_group.h" +#include "view_add_project.h" -View_edit_user_group::View_edit_user_group(/* args */) { +View_add_project::View_add_project(/* args */) { builder = Gtk::Builder::create_from_file(path_glade); - this->settings(); + this->setting(); } -View_edit_user_group::~View_edit_user_group() +View_add_project::~View_add_project() { } -void View_edit_user_group::setting() { +void View_add_project::setting() { this->get_builder(); this->lacalization(); - + check_limit(quotegroupSizeSoftLimitCheckProject + ,quotegroupSizeSoftLimitSpinProject + ,quotegroupSizeSoftLimitComboProject); + check_limit(quotegroupSizeHardLimitCheckProject + ,quotegroupSizeHardLimitSpin1 + ,quotegroupSizeHardLimitComboProject); + check_limit(quotegroupFilesSoftLimitCheckProject + ,quotegroupFilesSoftLimitSpinProject + ,quotegroupFilesSoftLimitlabelProject); + check_limit(quotegroupFilesHardLimitCheckProject + ,quotegroupFilesHardLimitSpinProject + ,quotegroupFilesHarLimitLabelProject); this->event(); } -void View_edit_user_group::event() { - +void View_add_project::event() { + quotegroupSizeSoftLimitCheckProject->signal_toggled().connect([&]() { + check_limit(quotegroupSizeSoftLimitCheckProject + ,quotegroupSizeSoftLimitSpinProject + ,quotegroupSizeSoftLimitComboProject); + }); + quotegroupSizeHardLimitCheckProject->signal_toggled().connect([&]() { + check_limit(quotegroupSizeHardLimitCheckProject + ,quotegroupSizeHardLimitSpin1 + ,quotegroupSizeHardLimitComboProject); + }); + quotegroupFilesSoftLimitCheckProject->signal_toggled().connect([&]() { + check_limit(quotegroupFilesSoftLimitCheckProject + ,quotegroupFilesSoftLimitSpinProject + ,quotegroupFilesSoftLimitlabelProject); + }); + quotegroupFilesHardLimitCheckProject->signal_toggled().connect([&]() { + check_limit(quotegroupFilesHardLimitCheckProject + ,quotegroupFilesHardLimitSpinProject + ,quotegroupFilesHarLimitLabelProject); + }); + quotegroupCancelButtonAdd->signal_clicked().connect([&]() {this->close_wnd();}); + quotegroupSaveButtonAdd->signal_clicked().connect([&]() {this->save();}); } -void View_edit_user_group::show() { +void View_add_project::close_wnd() { + wndQuotasAddProject->hide(); +} +void View_add_project::save() { + wndQuotasAddProject->hide(); } -void View_edit_user_group::get_builder() { +void View_add_project::show() { + wndQuotasAddProject->show(); +} +void View_add_project::get_builder() { + builder->get_widget("wndQuotasAddProject", wndQuotasAddProject); + builder->get_widget("quotegroupSizeFrameLabelProject", quotegroupSizeFrameLabelProject); + builder->get_widget("quotegroupFilesFrameLabelProject", quotegroupFilesFrameLabelProject); + builder->get_widget("quotegroupSizeCurrentlyLabelProject", quotegroupSizeCurrentlyLabelProject); + builder->get_widget("quotegroupFilesCurrentlyLabelProject", quotegroupFilesCurrentlyLabelProject); + builder->get_widget("quotegroupSizeSoftLimitLabelProject", quotegroupSizeSoftLimitLabelProject); + builder->get_widget("quotegroupFilesSoftLimitLabelProject", quotegroupFilesSoftLimitLabelProject); + builder->get_widget("quoteSizeHardLimitLabelProject", quoteSizeHardLimitLabelProject); + builder->get_widget("quoteFilesHardLimitLabelProject", quoteFilesHardLimitLabelProject); + builder->get_widget("quotegroupFilesSoftLimitlabelProject", quotegroupFilesSoftLimitlabelProject); + builder->get_widget("quotegroupFilesHarLimitLabelProject", quotegroupFilesHarLimitLabelProject); + builder->get_widget("quotegroupCancelButtonAdd", quotegroupCancelButtonAdd); + builder->get_widget("quotegroupSaveButtonAdd", quotegroupSaveButtonAdd); + builder->get_widget("lblDeviceProject", lblDeviceProject); + builder->get_widget("lblStatusQuotaProject", lblStatusQuotaProject); + builder->get_widget("lblCatalogProject", lblCatalogProject); + builder->get_widget("lblProjectId", lblProjectId); + builder->get_widget("lblProjectName", lblProjectName); + builder->get_widget("btnReviewProject", btnReviewProject); + builder->get_widget("btnGenerateProject", btnGenerateProject); + builder->get_widget("chbAuto", chbAuto); + builder->get_widget("entryCatalogProject", entryCatalogProject); + builder->get_widget("entryProjectId", entryProjectId); + builder->get_widget("entryProjectName", entryProjectName); + builder->get_widget("quotegroupSizeSoftLimitCheckProject", quotegroupSizeSoftLimitCheckProject); + builder->get_widget("quotegroupSizeHardLimitCheckProject", quotegroupSizeHardLimitCheckProject); + builder->get_widget("quotegroupFilesSoftLimitCheckProject", quotegroupFilesSoftLimitCheckProject); + builder->get_widget("quotegroupFilesHardLimitCheckProject", quotegroupFilesHardLimitCheckProject); + builder->get_widget("quotegroupSizeSoftLimitSpinProject", quotegroupSizeSoftLimitSpinProject); + builder->get_widget("quotegroupSizeHardLimitSpin1", quotegroupSizeHardLimitSpin1); + builder->get_widget("quotegroupFilesSoftLimitSpinProject", quotegroupFilesSoftLimitSpinProject); + builder->get_widget("quotegroupFilesHardLimitSpinProject", quotegroupFilesHardLimitSpinProject); + builder->get_widget("quotegroupSizeSoftLimitComboProject", quotegroupSizeSoftLimitComboProject); + builder->get_widget("quotegroupSizeHardLimitComboProject", quotegroupSizeHardLimitComboProject); } -void View_edit_user_group::lacalization(); +void View_add_project::lacalization() { + this->fill_in_pow_memory(quotegroupSizeSoftLimitComboProject); + this->fill_in_pow_memory(quotegroupSizeHardLimitComboProject); + lblDeviceProject->set_text(str_device); + lblStatusQuotaProject->set_text(str_quota_status); + // lblSetUGP->set_text(""); + quotegroupSizeFrameLabelProject->set_text(str_size); + quotegroupFilesFrameLabelProject->set_text(str_files); + quotegroupSizeCurrentlyLabelProject->set_text(str_currently_using); + quotegroupFilesCurrentlyLabelProject->set_text(str_currently_using); + quotegroupSizeSoftLimitLabelProject->set_text(str_soft_limit); + quotegroupFilesSoftLimitLabelProject->set_text(str_soft_limit); + quoteSizeHardLimitLabelProject->set_text(str_hard_limit); + quoteFilesHardLimitLabelProject->set_text(str_hard_limit); +} -void View_edit_user_group::check_limit(Gtk::CheckButton *check_button, Gtk::SpinButton *spin, Gtk::ComboBoxText *combo_box) { +void View_add_project::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) { +void View_add_project::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) { +void View_add_project::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 index 880dc90..9d35eb6 100644 --- a/source/view/view_add_project.h +++ b/source/view/view_add_project.h @@ -1,22 +1,59 @@ -#ifndef VIEW_ADD_USER_GROUP_H -#define VIEW_ADD_USER_GROUP_H +#ifndef VIEW_ADD_PROJECT_H +#define VIEW_ADD_PROJECT_H #include "../project_lib.h" #include "../var.h" -class View_edit_user_group +class View_add_project { private: Glib::RefPtr builder; + Gtk::Window* wndQuotasAddProject; + Gtk::Label* quotegroupSizeFrameLabelProject; + Gtk::Label* quotegroupFilesFrameLabelProject; + Gtk::Label* quotegroupSizeCurrentlyLabelProject; + Gtk::Label* quotegroupFilesCurrentlyLabelProject; + Gtk::Label* quotegroupSizeSoftLimitLabelProject; + Gtk::Label* quotegroupFilesSoftLimitLabelProject; + Gtk::Label* quoteSizeHardLimitLabelProject; + Gtk::Label* quoteFilesHardLimitLabelProject; + Gtk::Label* quotegroupFilesSoftLimitlabelProject; + Gtk::Label* quotegroupFilesHarLimitLabelProject; + Gtk::Label* lblDeviceProject; + Gtk::Label* lblStatusQuotaProject; + Gtk::Label* lblCatalogProject; + Gtk::Label* lblProjectId; + Gtk::Label* lblProjectName; + Gtk::Button* quotegroupCancelButtonAdd; + Gtk::Button* quotegroupSaveButtonAdd; + Gtk::Button* btnReviewProject; + Gtk::Button* btnGenerateProject; + Gtk::Entry* entryCatalogProject; + Gtk::Entry* entryProjectId; + Gtk::Entry* entryProjectName; + Gtk::CheckButton* chbAuto; + Gtk::CheckButton* quotegroupSizeSoftLimitCheckProject; + Gtk::CheckButton* quotegroupSizeHardLimitCheckProject; + Gtk::CheckButton* quotegroupFilesSoftLimitCheckProject; + Gtk::CheckButton* quotegroupFilesHardLimitCheckProject; + Gtk::SpinButton* quotegroupSizeSoftLimitSpinProject; + Gtk::SpinButton* quotegroupSizeHardLimitSpin1; + Gtk::SpinButton* quotegroupFilesSoftLimitSpinProject; + Gtk::SpinButton* quotegroupFilesHardLimitSpinProject; + Gtk::ComboBoxText* quotegroupSizeSoftLimitComboProject; + Gtk::ComboBoxText* quotegroupSizeHardLimitComboProject; + public: - View_edit_user_group(/* args */); - ~View_edit_user_group(); + View_add_project(/* args */); + ~View_add_project(); void setting(); + void lacalization(); void event(); void show(); + void close_wnd(); + void save(); 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); }; diff --git a/source/view/view_edit_project.cc b/source/view/view_edit_project.cc index c7a2a7f..8e96f95 100644 --- a/source/view/view_edit_project.cc +++ b/source/view/view_edit_project.cc @@ -12,88 +12,108 @@ View_edit_project::~View_edit_project() void View_edit_project::setting() { this->get_builder(); this->lacalization(); - check_limit(quotegroupSizeSoftLimitCheckProject - ,quotegroupSizeSoftLimitSpinProject - ,quotegroupSizeSoftLimitComboProject); - check_limit(quotegroupSizeHardLimitCheckProject - ,quotegroupSizeHardLimitSpin1 - ,quotegroupSizeHardLimitComboProject); - check_limit(quotegroupFilesSoftLimitCheckProject - ,quotegroupFilesSoftLimitSpinProject - ,quotegroupFilesSoftLimitlabelProject); - check_limit(quotegroupFilesHardLimitCheckProject - ,quotegroupFilesHardLimitSpinProject - ,quotegroupFilesHarLimitLabelProject); + check_limit(quoteSizeSoftLimitCheckProjectEdit + ,quoteSizeSoftLimitSpinProjectEdit + ,quoteSizeSoftLimitComboProjectEdit); + check_limit(quoteSizeHardLimitCheckProjectEdit + ,quoteSizeHardLimitSpinEdit + ,quoteSizeHardLimitComboProjectEdit); + check_limit(quoteFilesSoftLimitCheckProjectEdit + ,quoteFilesSoftLimitSpinProjectEdit + ,quoteFilesProjectEdit); + check_limit(quoteFilesHardLimitCheckProjectEdit + ,quoteFilesHardLimitSpinProjectEdit + ,quoteFiles1ProjectEdit); this->event(); } void View_edit_project::event() { - quotegroupSizeSoftLimitCheckProject->signal_toggled().connect([&]() { - check_limit(quotegroupSizeSoftLimitCheckProject - ,quotegroupSizeSoftLimitSpinProject - ,quotegroupSizeSoftLimitComboProject); + quoteCancelButtonEdit->signal_clicked().connect([&]() {this->close_wnd();}); + quoteSaveButtonEdit->signal_clicked().connect([&]() {this->save();}); + quoteSizeSoftLimitCheckProjectEdit->signal_toggled().connect([&]() { + check_limit(quoteSizeSoftLimitCheckProjectEdit + ,quoteSizeSoftLimitSpinProjectEdit + ,quoteSizeSoftLimitComboProjectEdit); }); - quotegroupSizeHardLimitCheckProject->signal_toggled().connect([&]() { - check_limit(quotegroupSizeHardLimitCheckProject - ,quotegroupSizeHardLimitSpin1 - ,quotegroupSizeHardLimitComboProject); + quoteSizeHardLimitCheckProjectEdit->signal_toggled().connect([&]() { + check_limit(quoteSizeHardLimitCheckProjectEdit + ,quoteSizeHardLimitSpinEdit + ,quoteSizeHardLimitComboProjectEdit); }); - quotegroupFilesSoftLimitCheckProject->signal_toggled().connect([&]() { - check_limit(quotegroupFilesSoftLimitCheckProject - ,quotegroupFilesSoftLimitSpinProject - ,quotegroupFilesSoftLimitlabelProject); + quoteFilesSoftLimitCheckProjectEdit->signal_toggled().connect([&]() { + check_limit(quoteFilesSoftLimitCheckProjectEdit + ,quoteFilesSoftLimitSpinProjectEdit + ,quoteFilesProjectEdit); }); - quotegroupFilesHardLimitCheckProject->signal_toggled().connect([&]() { - check_limit(quotegroupFilesHardLimitCheckProject - ,quotegroupFilesHardLimitSpinProject - ,quotegroupFilesHarLimitLabelProject); + quoteFilesSoftLimitCheckProjectEdit->signal_toggled().connect([&]() { + check_limit(quoteFilesSoftLimitCheckProjectEdit + ,quoteFilesHardLimitSpinProjectEdit + ,quoteFiles1ProjectEdit); }); } +void View_edit_project::close_wnd() { + wndQuotasEditProject->hide(); +} + +void View_edit_project::save() { + wndQuotasEditProject->hide(); +} + void View_edit_project::show() { - wndQuotasAddProject->show(); + wndQuotasEditProject->show(); } void View_edit_project::get_builder() { - builder->get_widget("wndQuotasAddProject", wndQuotasAddProject); - builder->get_widget("quotegroupSizeFrameLabelProject", quotegroupSizeFrameLabelProject); - builder->get_widget("quotegroupFilesFrameLabelProject", quotegroupFilesFrameLabelProject); - builder->get_widget("quotegroupSizeCurrentlyLabelProject", quotegroupSizeCurrentlyLabelProject); - builder->get_widget("quotegroupFilesCurrentlyLabelProject", quotegroupFilesCurrentlyLabelProject); - builder->get_widget("quotegroupSizeSoftLimitLabelProject", quotegroupSizeSoftLimitLabelProject); - builder->get_widget("quotegroupFilesSoftLimitLabelProject", quotegroupFilesSoftLimitLabelProject); - builder->get_widget("quoteSizeHardLimitLabelProject", quoteSizeHardLimitLabelProject); - builder->get_widget("quoteFilesHardLimitLabelProject", quoteFilesHardLimitLabelProject); - builder->get_widget("quotegroupFilesSoftLimitlabelProject", quotegroupFilesSoftLimitlabelProject); - builder->get_widget("quotegroupFilesHarLimitLabelProject", quotegroupFilesHarLimitLabelProject); - builder->get_widget("quotegroupCancelButtonAdd", quotegroupCancelButtonAdd); - builder->get_widget("quotegroupSaveButtonAdd", quotegroupSaveButtonAdd); - builder->get_widget("lblDeviceProject", lblDeviceProject); - builder->get_widget("lblStatusQuotaProject", lblStatusQuotaProject); - builder->get_widget("lblCatalogProject", lblCatalogProject); - builder->get_widget("lblProjectId", lblProjectId); - builder->get_widget("lblProjectName", lblProjectName); - builder->get_widget("btnReviewProject", btnReviewProject); - builder->get_widget("btnGenerateProject", btnGenerateProject); - builder->get_widget("chbAuto", chbAuto); - builder->get_widget("entryCatalogProject", entryCatalogProject); - builder->get_widget("entryProjectId", entryProjectId); - builder->get_widget("entryProjectName", entryProjectName); - builder->get_widget("quotegroupSizeSoftLimitCheckProject", quotegroupSizeSoftLimitCheckProject); - builder->get_widget("quotegroupSizeHardLimitCheckProject", quotegroupSizeHardLimitCheckProject); - builder->get_widget("quotegroupFilesSoftLimitCheckProject", quotegroupFilesSoftLimitCheckProject); - builder->get_widget("quotegroupFilesHardLimitCheckProject", quotegroupFilesHardLimitCheckProject); - builder->get_widget("quotegroupSizeSoftLimitSpinProject", quotegroupSizeSoftLimitSpinProject); - builder->get_widget("quotegroupSizeHardLimitSpin1", quotegroupSizeHardLimitSpin1); - builder->get_widget("quotegroupFilesSoftLimitSpinProject", quotegroupFilesSoftLimitSpinProject); - builder->get_widget("quotegroupFilesHardLimitSpinProject", quotegroupFilesHardLimitSpinProject); - builder->get_widget("quotegroupSizeSoftLimitComboProject", quotegroupSizeSoftLimitComboProject); - builder->get_widget("quotegroupSizeHardLimitComboProject", quotegroupSizeHardLimitComboProject); + builder->get_widget("lblDeviceProjectEdit", lblDeviceProjectEdit); + builder->get_widget("lblEditDeviceProjectValue", lblEditDeviceProjectValue); + builder->get_widget("lblStatusQuotaProjectEdit", lblStatusQuotaProjectEdit); + builder->get_widget("lblStatusQuotaProjectValueEdit", lblStatusQuotaProjectValueEdit); + builder->get_widget("lblCatalogProjectEdit", lblCatalogProjectEdit); + builder->get_widget("lblCatalogProjectEdit", lblCatalogProjectEdit); + builder->get_widget("lblProjectIdEdit", lblProjectIdEdit); + builder->get_widget("lblProjectIdValueEdit", lblProjectIdValueEdit); + builder->get_widget("lblProjectNameEdit", lblProjectNameEdit); + builder->get_widget("entryProjectNameEditValue", entryProjectNameEditValue); + builder->get_widget("quoteSizeFrameLabelProjectEdit", quoteSizeFrameLabelProjectEdit); + builder->get_widget("quoteSizeCurrentlyLabelProjectEdit", quoteSizeCurrentlyLabelProjectEdit); + builder->get_widget("quoteSizeSoftLimitLabelProjectEdit", quoteSizeSoftLimitLabelProjectEdit); + builder->get_widget("quoteSizeSoftLimitCheckProjectEdit", quoteSizeSoftLimitCheckProjectEdit); + builder->get_widget("quoteSizeSoftLimitSpinProjectEdit", quoteSizeSoftLimitSpinProjectEdit); + builder->get_widget("quoteSizeSoftLimitComboProjectEdit", quoteSizeSoftLimitComboProjectEdit); + builder->get_widget("quoteSizeHardLimitLabelProjectEdit", quoteSizeHardLimitLabelProjectEdit); + builder->get_widget("quoteSizeHardLimitCheckProjectEdit", quoteSizeHardLimitCheckProjectEdit); + builder->get_widget("quoteSizeHardLimitSpinEdit", quoteSizeHardLimitSpinEdit); + builder->get_widget("quoteSizeHardLimitComboProjectEdit", quoteSizeHardLimitComboProjectEdit); + builder->get_widget("quoteFilesFrameLabelProjectEdit", quoteFilesFrameLabelProjectEdit); + builder->get_widget("quoteFilesCurrentlyLabelProjectEdit", quoteFilesCurrentlyLabelProjectEdit); + builder->get_widget("quoteFilesSoftLimitLabelProjectEdit", quoteFilesSoftLimitLabelProjectEdit); + builder->get_widget("quoteFilesSoftLimitCheckProjectEdit", quoteFilesSoftLimitCheckProjectEdit); + builder->get_widget("quoteFilesSoftLimitSpinProjectEdit", quoteFilesSoftLimitSpinProjectEdit); + builder->get_widget("quoteFilesHardLimitCheckProjectEdit", quoteFilesHardLimitCheckProjectEdit); + builder->get_widget("quoteFilesHardLimitSpinProjectEdit", quoteFilesHardLimitSpinProjectEdit); + builder->get_widget("quoteCancelButtonEdit", quoteCancelButtonEdit); + builder->get_widget("quoteSaveButtonEdit", quoteSaveButtonEdit); + builder->get_widget("quoteFilesProjectEdit", quoteFilesProjectEdit); + builder->get_widget("quoteFiles1ProjectEdit", quoteFiles1ProjectEdit); + builder->get_widget("wndQuotasEditProject", wndQuotasEditProject); + builder->get_widget("quoteFilesHardLimitLabelProject1", quoteFilesHardLimitLabelProject1); } void View_edit_project::lacalization() { - this->fill_in_pow_memory(quotegroupSizeSoftLimitComboProject); - this->fill_in_pow_memory(quotegroupSizeHardLimitComboProject); + lblDeviceProjectEdit->set_text(str_device); + lblStatusQuotaProjectEdit->set_text(str_quota_status); + // lblSetUGP->set_text(""); + quoteSizeFrameLabelProjectEdit->set_text(str_size); + quoteFilesFrameLabelProjectEdit->set_text(str_files); + quoteSizeCurrentlyLabelProjectEdit->set_text(str_currently_using); + quoteFilesCurrentlyLabelProjectEdit->set_text(str_currently_using); + quoteSizeSoftLimitLabelProjectEdit->set_text(str_soft_limit); + quoteFilesSoftLimitLabelProjectEdit->set_text(str_soft_limit); + quoteSizeHardLimitLabelProjectEdit->set_text(str_hard_limit); + quoteFilesHardLimitLabelProject1->set_text(str_hard_limit); + this->fill_in_pow_memory(quoteSizeSoftLimitComboProjectEdit); + this->fill_in_pow_memory(quoteSizeHardLimitComboProjectEdit); } @@ -111,4 +131,4 @@ void View_edit_project::fill_in_pow_memory(Gtk::ComboBoxText *cb_text) { cb_text->append(str_prefix_MB); cb_text->append(str_prefix_GB); cb_text->append(str_prefix_TB); -} +} \ No newline at end of file diff --git a/source/view/view_edit_project.h b/source/view/view_edit_project.h index 5c70640..d7977e1 100644 --- a/source/view/view_edit_project.h +++ b/source/view/view_edit_project.h @@ -6,52 +6,51 @@ class View_edit_project { private: Glib::RefPtr builder; - Gtk::Window* wndQuotasAddProject; - Gtk::Label* quotegroupSizeFrameLabelProject; - Gtk::Label* quotegroupFilesFrameLabelProject; - Gtk::Label* quotegroupSizeCurrentlyLabelProject; - Gtk::Label* quotegroupFilesCurrentlyLabelProject; - Gtk::Label* quotegroupSizeSoftLimitLabelProject; - Gtk::Label* quotegroupFilesSoftLimitLabelProject; - Gtk::Label* quoteSizeHardLimitLabelProject; - Gtk::Label* quoteFilesHardLimitLabelProject; - Gtk::Label* quotegroupFilesSoftLimitlabelProject; - Gtk::Label* quotegroupFilesHarLimitLabelProject; - Gtk::Label* lblDeviceProject; - Gtk::Label* lblStatusQuotaProject; - Gtk::Label* lblCatalogProject; - Gtk::Label* lblProjectId; - Gtk::Label* lblProjectName; - Gtk::Button* quotegroupCancelButtonAdd; - Gtk::Button* quotegroupSaveButtonAdd; - Gtk::Button* btnReviewProject; - Gtk::Button* btnGenerateProject; - Gtk::Entry* entryCatalogProject; - Gtk::Entry* entryProjectId; - Gtk::Entry* entryProjectName; - Gtk::CheckButton* chbAuto; - Gtk::CheckButton* quotegroupSizeSoftLimitCheckProject; - Gtk::CheckButton* quotegroupSizeHardLimitCheckProject; - Gtk::CheckButton* quotegroupFilesSoftLimitCheckProject; - Gtk::CheckButton* quotegroupFilesHardLimitCheckProject; - Gtk::SpinButton* quotegroupSizeSoftLimitSpinProject; - Gtk::SpinButton* quotegroupSizeHardLimitSpin1; - Gtk::SpinButton* quotegroupFilesSoftLimitSpinProject; - Gtk::SpinButton* quotegroupFilesHardLimitSpinProject; - Gtk::ComboBoxText* quotegroupSizeSoftLimitComboProject; - Gtk::ComboBoxText* quotegroupSizeHardLimitComboProject; - + Gtk::Window* wndQuotasEditProject; + Gtk::Label* lblDeviceProjectEdit; + Gtk::Label* lblEditDeviceProjectValue; + Gtk::Label* lblStatusQuotaProjectEdit; + Gtk::Label* lblStatusQuotaProjectValueEdit; + Gtk::Label* lblCatalogProjectEdit; + Gtk::Label* lblProjectIdEdit; + Gtk::Label* lblProjectIdValueEdit; + Gtk::Label* lblProjectNameEdit; + Gtk::Label* quoteSizeFrameLabelProjectEdit; + Gtk::Label* quoteFilesFrameLabelProjectEdit; + Gtk::Label* quoteSizeCurrentlyLabelProjectEdit; + Gtk::Label* quoteSizeSoftLimitLabelProjectEdit; + Gtk::Label* quoteSizeHardLimitLabelProjectEdit; + Gtk::Label* quoteFilesCurrentlyLabelProjectEdit; + Gtk::Label* quoteFilesSoftLimitLabelProjectEdit; + Gtk::Label* quoteFilesHardLimitLabelProject1; + Gtk::Label* quoteFilesProjectEdit; + Gtk::Label* quoteFiles1ProjectEdit; + Gtk::CheckButton* quoteSizeSoftLimitCheckProjectEdit; + Gtk::CheckButton* quoteSizeHardLimitCheckProjectEdit; + Gtk::CheckButton* quoteFilesSoftLimitCheckProjectEdit; + Gtk::CheckButton* quoteFilesHardLimitCheckProjectEdit; + Gtk::SpinButton* quoteSizeSoftLimitSpinProjectEdit; + Gtk::SpinButton* quoteSizeHardLimitSpinEdit; + Gtk::SpinButton* quoteFilesSoftLimitSpinProjectEdit; + Gtk::SpinButton* quoteFilesHardLimitSpinProjectEdit; + Gtk::ComboBoxText* quoteSizeSoftLimitComboProjectEdit; + Gtk::ComboBoxText* quoteSizeHardLimitComboProjectEdit; + Gtk::Button* quoteSaveButtonEdit; + Gtk::Button* quoteCancelButtonEdit; + Gtk::Entry* entryProjectNameEditValue; public: View_edit_project(/* args */); ~View_edit_project(); void setting(); - void lacalization(); void event(); void show(); void get_builder(); + void lacalization(); 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 close_wnd(); + void save(); }; diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 331b53c..2245f35 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -354,6 +354,8 @@ + 800 + 400 False center com.ublinux.ubl-settings-diskquota @@ -3373,89 +3375,7 @@ - - 1000000 - 1 - 10 - - - 1000000 - 1 - 10 - - - 1024 - 1 - 10 - - - 1024 - 1 - 10 - - - False - Please select File - True - center - 500 - 400 - True - com.ublinux.ublexec - dialog - True - True - - - False - vertical - 2 - - - False - end - - - gtk-cancel - True - True - True - True - - - True - True - 0 - - - - - gtk-ok - True - True - True - True - - - True - True - 1 - - - - - False - False - 0 - - - - - - - - - + False start False @@ -3470,332 +3390,91 @@ 5 5 vertical - - - Name - True - True - False - start - 5 - True - - - False - True - 0 - - - - - Quotas - True - True - False - start - True - - - False - True - 1 - - - - - Size - True - True - False - start - True - - - False - True - 2 - - - - - Soft limit (size) - True - True - False - start - True - - - False - True - 3 - - - - - Hard limit (size) - True - True - False - start - True - - - False - True - 4 - - True False - end - 5 - 5 - True + vertical - - gtk-cancel + True - True - True - center - True + False + + + True + False + 5 + 5 + 5 + 5 + Device: + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 1 + + - False + True True 0 - - gtk-save + True - True - True - center - True + False + + + True + False + 5 + 5 + 5 + 5 + Status of quota use + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + + + False + True + 1 + + - False - True - 1 - - - - - False - True - end - 5 - - - - - Hard limit (size) delay - True - True - False - start - True - - - False - True - 5 - - - - - Files - True - True - False - start - True - - - False - True - 7 - - - - - Soft limit (files) - True - True - False - start - True - - - False - True - 8 - - - - - Hard limit (files) - True - True - False - start - True - - - False - True - 9 - - - - - Hard limit (files) delay - True - True - False - start - True - - - False - True - 10 - - - - - - - True - False - True - - - True - False - System 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 - 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 True 1 @@ -4642,7 +4321,7 @@ True False 5 - 5 + 6 5 5 Catalog @@ -4788,7 +4467,7 @@ False vertical - + True False 5 @@ -4806,7 +4485,7 @@ - + True False 5 @@ -4830,7 +4509,7 @@ False 5 - + True True False @@ -4844,7 +4523,7 @@ - + True True 0 @@ -4857,7 +4536,7 @@ - + True False @@ -4900,7 +4579,7 @@ False 5 - + True True False @@ -4914,7 +4593,7 @@ - + True True 0 @@ -4927,7 +4606,7 @@ - + True False @@ -4949,7 +4628,7 @@ - + True False 5 @@ -4993,7 +4672,7 @@ False vertical - + True False 5 @@ -5011,7 +4690,7 @@ - + True False 5 @@ -5035,7 +4714,7 @@ False 5 - + True True False @@ -5049,7 +4728,7 @@ - + True True 0 @@ -5062,7 +4741,7 @@ - + True False files @@ -5105,7 +4784,7 @@ False 5 - + True True False @@ -5119,7 +4798,7 @@ - + True True 0 @@ -5132,7 +4811,7 @@ - + True False files @@ -5155,7 +4834,7 @@ - + True False 5 @@ -5196,7 +4875,7 @@ 5 True - + gtk-cancel True True @@ -5210,7 +4889,7 @@ - + gtk-save True True @@ -5908,6 +5587,329 @@ + + 1000000 + 1 + 10 + + + 1000000 + 1 + 10 + + + 1024 + 1 + 10 + + + 1024 + 1 + 10 + + + False + Please select File + True + center + 500 + 400 + True + com.ublinux.ublexec + dialog + True + True + + + False + vertical + 2 + + + False + end + + + gtk-cancel + True + True + True + True + + + True + True + 0 + + + + + gtk-ok + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + + + + + + False + start + False + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + Name + True + True + False + start + 5 + True + + + False + True + 0 + + + + + Quotas + True + True + False + start + True + + + False + True + 1 + + + + + Size + True + True + False + start + True + + + False + True + 2 + + + + + Soft limit (size) + True + True + False + start + True + + + False + True + 3 + + + + + Hard limit (size) + True + True + False + start + True + + + False + True + 4 + + + + + True + False + end + 5 + 5 + True + + + gtk-cancel + True + True + True + center + True + + + False + True + 0 + + + + + gtk-save + True + True + True + center + True + + + False + True + 1 + + + + + False + True + end + 5 + + + + + Hard limit (size) delay + True + True + False + start + True + + + False + True + 5 + + + + + Files + True + True + False + start + True + + + False + True + 7 + + + + + Soft limit (files) + True + True + False + start + True + + + False + True + 8 + + + + + Hard limit (files) + True + True + False + start + True + + + False + True + 9 + + + + + Hard limit (files) delay + True + True + False + start + True + + + False + True + 10 + + + + + + + True + False + True + + + True + False + System quotas + + + + + + + + True + False + 32 + com.ublinux.ubl-settings-diskquota + 5 + + + + + False start diff --git a/ubl-settings-diskquota.pot b/ubl-settings-diskquota.pot index 97c1636..2d39ce6 100644 --- a/ubl-settings-diskquota.pot +++ b/ubl-settings-diskquota.pot @@ -17,6 +17,24 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "Project ID" +msgstr "" + +msgid "Catalog" +msgstr "" + +msgid "Project Name" +msgstr "" + +msgid "Auto" +msgstr "" + +msgid "Review" +msgstr "" + +msgid "Generate" +msgstr "" + msgid "User:" msgstr "" diff --git a/ubl-settings-diskquota_ru.po b/ubl-settings-diskquota_ru.po index a8618fc..bc8114d 100644 --- a/ubl-settings-diskquota_ru.po +++ b/ubl-settings-diskquota_ru.po @@ -157,6 +157,24 @@ msgstr "Отсрочка жесткого ограничения (объём)" msgid "Device:" msgstr "Устройство:" +msgid "Project ID" +msgstr "ID проекта" + +msgid "Catalog" +msgstr "Каталог" + +msgid "Project Name" +msgstr "Имя проекта" + +msgid "Auto" +msgstr "Авто" + +msgid "Review" +msgstr "Обзор" + +msgid "Generate" +msgstr "Сгенерировать" + msgid "User" msgstr "Пользователь" @@ -644,9 +662,7 @@ msgstr "Мягкое лимит (файлы)" #: source/ubl-settings-quotas.cc:150 source/ubl-settings-quotas.cc:155 #, fuzzy msgid "Soft limit" -msgstr "" -"Мягкий лимит\n" -"(объём)" +msgstr "Мягкий лимит" #: source/ubl-settings-quotas.cc:322 source/ubl-settings-quotas.cc:326 #: source/ubl-settings-quotas.cc:318 source/ubl-settings-quotas.cc:265 From 9f6e332c957df68ddd78003751f05c268b079a50 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 17 May 2023 12:16:02 +0600 Subject: [PATCH 22/26] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/view/ubl-settings-diskquota.cc | 1 - ubl-settings-diskquota.glade | 532 ++++++++++++++++++++++++-- ubl-settings-diskquota.pot | 12 + ubl-settings-diskquota_ru.po | 12 + 4 files changed, 531 insertions(+), 26 deletions(-) diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index ebdcda9..82bef69 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -502,7 +502,6 @@ void MainWindow::edit_quota_show(string name) { obj_view_edit->show(); } void MainWindow::edit_quota_project_show() { - cout << obj_view_edit_project << endl; obj_view_edit_project->show(); } void MainWindow::remove_template(Glib::RefPtr* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate_del) { diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 2245f35..439c982 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -355,7 +355,7 @@ 800 - 400 + 500 False center com.ublinux.ubl-settings-diskquota @@ -520,6 +520,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Device: @@ -566,7 +572,7 @@ True False False - 20 + 5 True @@ -577,6 +583,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Excess size delay period 0 @@ -590,6 +602,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Excess files delay period 0 @@ -634,6 +652,9 @@ True False + 5 + 5 + 5 weeks @@ -671,6 +692,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 weeks @@ -721,6 +748,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 days @@ -758,6 +791,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 days @@ -808,6 +847,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 hours @@ -845,6 +890,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 hours @@ -895,6 +946,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 minutes @@ -932,6 +989,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 minutes @@ -989,6 +1052,8 @@ 5 5 5 + 5 + 5 True @@ -1044,6 +1109,8 @@ 5 5 5 + 5 + 5 True @@ -1061,6 +1128,8 @@ 5 5 5 + 5 + 5 True @@ -1114,6 +1183,8 @@ 5 5 5 + 5 + 5 True @@ -1170,6 +1241,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Device: @@ -1215,7 +1292,7 @@ True False - 20 + 5 True @@ -1226,6 +1303,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Excess size delay period 0 @@ -1239,6 +1322,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Excess files delay period 0 @@ -1283,6 +1372,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 weeks @@ -1320,6 +1415,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 weeks @@ -1370,6 +1471,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 days @@ -1407,6 +1514,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 days @@ -1457,6 +1570,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 hours @@ -1494,6 +1613,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 hours @@ -1544,6 +1669,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 minutes @@ -1581,6 +1712,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 minutes @@ -1638,6 +1775,8 @@ 5 5 5 + 5 + 5 True @@ -1693,6 +1832,8 @@ 5 5 5 + 5 + 5 True @@ -1710,6 +1851,8 @@ 5 5 5 + 5 + 5 True @@ -1763,6 +1906,8 @@ 5 5 5 + 5 + 5 True @@ -1872,7 +2017,7 @@ True False - 20 + 5 True @@ -1883,6 +2028,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Excess size delay period 0 @@ -1896,6 +2047,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Excess files delay period 0 @@ -1940,6 +2097,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 weeks @@ -1977,6 +2140,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 weeks @@ -2027,6 +2196,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 days @@ -2064,6 +2239,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 days @@ -2114,6 +2295,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 hours @@ -2151,6 +2338,10 @@ True False + 5 + 5 + 5 + 5 hours @@ -2201,6 +2392,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 minutes @@ -2238,6 +2435,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 minutes @@ -2302,6 +2505,8 @@ 5 5 5 + 5 + 5 True @@ -2353,9 +2558,12 @@ True True True + 5 5 5 5 + 5 + 5 True @@ -2373,6 +2581,8 @@ 5 5 5 + 5 + 5 True @@ -2426,6 +2636,8 @@ 5 5 5 + 5 + 5 True @@ -2761,6 +2973,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Device: @@ -2797,6 +3015,9 @@ True False + 5 + 5 + 5 Quota use status: 0 @@ -2837,6 +3058,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 UserGropProject: 0 @@ -2951,6 +3178,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -2976,6 +3207,10 @@ True False + 5 + 5 + 5 + 5 False @@ -3020,6 +3255,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -3045,6 +3284,10 @@ True False + 5 + 5 + 5 + 5 False @@ -3179,6 +3422,10 @@ True False + 5 + 5 + 5 + 5 files @@ -3248,6 +3495,9 @@ True False + 5 + 5 + 5 files @@ -3298,7 +3548,6 @@ True False - 5 vertical True @@ -3314,6 +3563,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -3328,6 +3583,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -3360,7 +3621,10 @@ True False - UBConfig - Quotas + Settings disk quotas - Addition + + + @@ -3407,6 +3671,8 @@ 5 5 5 + 5 + 5 Device: @@ -3449,6 +3715,8 @@ 5 5 5 + 5 + 5 Status of quota use @@ -3491,7 +3759,10 @@ 5 5 5 + 5 + 5 Catalog + 0 False @@ -3507,6 +3778,8 @@ 5 5 5 + 5 + 5 True @@ -3523,10 +3796,18 @@ 5 5 5 + 5 + 5 True False + 5 + 5 + 5 + 5 + 5 + 5 True @@ -3543,10 +3824,6 @@ True False - 5 - 5 - 5 - 5 Review @@ -3559,7 +3836,7 @@ - True + False True 2 @@ -3583,6 +3860,8 @@ 5 5 5 + 5 + 5 Project ID @@ -3601,6 +3880,8 @@ 5 5 5 + 5 + 5 True @@ -3617,6 +3898,8 @@ 5 5 5 + 5 + 5 True @@ -3634,9 +3917,11 @@ 5 5 5 + 5 + 5 - True + False True 3 @@ -3660,6 +3945,8 @@ 5 5 5 + 5 + 5 Project Name @@ -3773,6 +4060,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -3799,6 +4090,10 @@ True False + 5 + 5 + 5 + 5 False @@ -3843,6 +4138,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -3869,6 +4168,10 @@ True False + 5 + 5 + 5 + 5 False @@ -3978,6 +4281,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -4004,6 +4311,10 @@ True False + 5 + 5 + 5 + 5 files @@ -4048,6 +4359,11 @@ True True False + 5 + 5 + 5 + 5 + 5 right True @@ -4074,6 +4390,10 @@ True False + 5 + 5 + 5 + 5 files @@ -4124,7 +4444,6 @@ True False - 5 vertical True @@ -4140,6 +4459,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -4154,6 +4479,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -4186,7 +4517,10 @@ True False - UBConfig - Quotas + Settings disk quotas - Addition + + + @@ -4208,6 +4542,12 @@ + + + + + + False start @@ -4240,6 +4580,8 @@ 5 5 5 + 5 + 5 Device: @@ -4282,6 +4624,8 @@ 5 5 5 + 5 + 5 Status of quota use @@ -4321,9 +4665,11 @@ True False 5 - 6 + 5 5 5 + 5 + 5 Catalog @@ -4362,6 +4708,8 @@ 5 5 5 + 5 + 5 Project ID @@ -4400,6 +4748,8 @@ 5 5 5 + 5 + 5 Project Name @@ -4416,6 +4766,8 @@ 5 5 5 + 5 + 5 True @@ -4513,6 +4865,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -4539,6 +4895,10 @@ True False + 5 + 5 + 5 + 5 False @@ -4583,6 +4943,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -4609,6 +4973,10 @@ True False + 5 + 5 + 5 + 5 False @@ -4718,6 +5086,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -4744,6 +5116,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 files @@ -4788,6 +5166,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -4814,6 +5196,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 files @@ -4864,7 +5252,6 @@ True False - 5 vertical True @@ -4880,6 +5267,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -4894,6 +5287,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -4923,10 +5322,13 @@ True False - + True False - UBConfig - Quotas + Settings disk quotas - Editing + + + @@ -4969,6 +5371,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Device: @@ -5005,6 +5413,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Quota use status: 0 @@ -5045,6 +5459,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 UserGropProject: 0 @@ -5159,6 +5579,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -5185,6 +5609,10 @@ True False + 5 + 5 + 5 + 5 False @@ -5229,6 +5657,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -5255,6 +5687,10 @@ True False + 5 + 5 + 5 + 5 False @@ -5364,6 +5800,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -5390,6 +5830,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 files @@ -5434,6 +5880,10 @@ True True False + 5 + 5 + 5 + 5 right True @@ -5460,6 +5910,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 files @@ -5510,7 +5966,6 @@ True False - 5 vertical True @@ -5526,6 +5981,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -5540,6 +6001,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -5572,7 +6039,10 @@ True False - UBConfig - Quotas + Settings disk quotas - Editing + + + @@ -5634,6 +6104,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -5648,6 +6124,12 @@ True True True + 5 + 5 + 5 + 5 + 5 + 5 True @@ -5892,7 +6374,7 @@ True False - System quotas + Filters @@ -6093,7 +6575,7 @@ True False - ubl-settings-datetime + ubl-settings-diskquota @@ -6116,7 +6598,7 @@ False True True - com.ublinux.ubl-settings-datetime + com.ublinux.ubl-settings-diskquota @@ -6129,7 +6611,7 @@ True False - ubl-settings-datetime + ubl-settings-diskquota @@ -6137,7 +6619,7 @@ True False 32 - com.ublinux.ubl-settings-datetime + com.ublinux.ubl-settings-diskquota 5 diff --git a/ubl-settings-diskquota.pot b/ubl-settings-diskquota.pot index 2d39ce6..62b8561 100644 --- a/ubl-settings-diskquota.pot +++ b/ubl-settings-diskquota.pot @@ -17,6 +17,18 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "ubl-settings-diskquota" +msgstr "" + +msgid "Settings disk quotas - Addition" +msgstr "" + +msgid "Settings disk quotas - Editing" +msgstr "" + +msgid "Edit" +msgstr "" + msgid "Project ID" msgstr "" diff --git a/ubl-settings-diskquota_ru.po b/ubl-settings-diskquota_ru.po index bc8114d..2880c76 100644 --- a/ubl-settings-diskquota_ru.po +++ b/ubl-settings-diskquota_ru.po @@ -17,6 +17,18 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "ubl-settings-diskquota" +msgstr "Дисковые квоты" + +msgid "Settings disk quotas - Addition" +msgstr "Настройка дисковых квот - Добавление" + +msgid "Settings disk quotas - Editing" +msgstr "Настройка дисковых квот - Редактирование" + +msgid "Edit" +msgstr "Редактировать" + msgid "Kb" msgstr "Кб" From e85b866f74e614d8cd769ab967ac71be61fdbc03 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 17 May 2023 12:53:33 +0600 Subject: [PATCH 23/26] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ubl-settings-diskquota.glade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 439c982..aca41b9 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -135,7 +135,7 @@ 255 True False - Configuration of disk quotas parameters for system groups and users + Setting user quotas @@ -2715,7 +2715,7 @@ 5 5 2 - UBConfig - Quotas + ubl-settings-diskquota From 208060bb7b6411ea3d8e073871a37ffc59fdea62 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 17 May 2023 14:48:46 +0600 Subject: [PATCH 24/26] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BE=D1=82=D1=81=D1=82=D1=83=D0=BF=20=D0=B2=20?= =?UTF-8?q?=D0=B4=D0=BE=D1=87=D0=B5=D1=80=D0=BD=D0=B5=D0=BC=20=D0=BE=D0=BA?= =?UTF-8?q?=D0=BD=D0=B5,=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BE=D0=BA?= =?UTF-8?q?=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/controller.h | 1 - source/main.cc | 2 +- source/view/ubl-settings-diskquota.cc | 9 +- source/view/ubl-settings-diskquota.h | 4 +- ubl-settings-diskquota.glade | 886 +++++++++++++------------- 5 files changed, 447 insertions(+), 455 deletions(-) diff --git a/source/controller.h b/source/controller.h index 96b6b6f..b452ee4 100644 --- a/source/controller.h +++ b/source/controller.h @@ -22,7 +22,6 @@ private: map_str_str map_global_cfg; map_str_str map_system_cfg; public: - Controller(/* args */); ~Controller(); void settings(); View_open_browser* obj_open_browser = new View_open_browser(); diff --git a/source/main.cc b/source/main.cc index 17f2eee..ed6277b 100644 --- a/source/main.cc +++ b/source/main.cc @@ -46,7 +46,7 @@ int main(int argc, char** argv) { auto builder = Gtk::Builder::create_from_file(path_glade); pars_flag(1, argc, argv); Controller* wnd = nullptr; - builder->get_widget_derived("MainWindow", wnd); + builder->get_widget_derived("window", wnd); auto r = app->run(*wnd); delete wnd; return r; diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index 82bef69..20e5195 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -57,6 +57,10 @@ void MainWindow::set_obj_view_edit_project(View_edit_project* obj_view_edit_proj void MainWindow::settings() { this->get_builder(); this->lacalization(); + Gtk::Widget *boxWidget; + builder->get_widget("boxColor", boxWidget); + HeadOverlay->add_overlay(*boxWidget); + ubl_make_plugs(boxSave, boxButton, (*socket_ext_id_I), (*socket_trd_id_I)); this->add_CSS(); this->flag_block_gui(); this->init_tree_view(); @@ -74,10 +78,7 @@ void MainWindow::settings() { info_status_app(info_box_error_css); lblWarning->set_text(program_as_root); } - Gtk::Widget *boxWidget; - builder->get_widget("boxColor", boxWidget); - HeadOverlay->add_overlay(*boxWidget); - ubl_make_plugs(boxSave, boxButton, (*socket_ext_id_I), (*socket_trd_id_I)); + } diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index dbe9d8c..25ad831 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -75,8 +75,8 @@ class MainWindow { Gtk::Label *headerTopic; Gtk::Overlay *HeadOverlay; Gtk::HeaderBar *headerBar; - Gtk::Box *boxSave; - Gtk::Box *boxButton; + Gtk::Widget *boxSave; + Gtk::Widget *boxButton; Gtk::Box *boxFuncs; Gtk::MenuButton *btnSave; Gtk::MenuButton *btnLoad; diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index aca41b9..55ccfe9 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -85,7 +85,7 @@ 5 5 2 - System quotas + ubl-settings-diskquota @@ -353,7 +353,7 @@ - + 800 500 False @@ -653,6 +653,9 @@ True False 5 + 5 + 5 + 5 5 5 weeks @@ -1614,9 +1617,7 @@ True False 5 - 5 5 - 5 5 5 hours @@ -1934,7 +1935,6 @@ 2 - False @@ -1957,22 +1957,130 @@ True False - vertical + 5 + 5 + 5 + 5 + 5 + 5 - + + True + False + Device: + + + False + True + 0 + + + + + True + False + + + True + True + 1 + + + + True False 5 5 5 5 + + + False + True + 2 + + + + + False + True + 1 + + + + + True + False + + + True + True + True + 5 + 5 + 5 + 5 5 - 5 + 5 - + True False - Device: + + + True + False + 5 + 5 + gtk-missing-image + + + False + True + 0 + + + + + True + False + 5 + 5 + Filters + + + False + True + 1 + + + + + + + False + True + 0 + + + + + True + False + + + gtk-delete + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True False @@ -1981,29 +2089,144 @@ - + + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + + + True + False + 5 + 5 + gtk-edit + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + Edit + + + False + True + 1 + + + + + + + False + True + 1 + + + + + gtk-add + True + True + True + 5 + 5 + 5 + 5 + 5 + 5 + True + + + False + True + 2 + + + + + False + True + end + 1 + + + + + False + True + end + 1 + + + + + True + False + 5 + + + True + False + 5 + 5 + vertical + True + + True False + 5 + 5 + 5 + 5 + 5 + 5 + Excess size delay period + 0 - True + False True - 1 + 0 - + True False 5 5 5 5 + 5 + 5 + Excess files delay period + 0 False True - 2 + 1 @@ -2014,28 +2237,24 @@ - + True False + 5 + 5 + vertical 5 - + True False - vertical - True + 5 - + True - False - 5 - 5 - 5 - 5 - 5 - 5 - Excess size delay period - 0 + True + 0 + generalUsersSizeWeeksSpin False @@ -2044,7 +2263,7 @@ - + True False 5 @@ -2053,8 +2272,7 @@ 5 5 5 - Excess files delay period - 0 + weeks False @@ -2070,47 +2288,16 @@ - + True False - vertical 5 - + True - False - 5 - - - True - True - 0 - generalUsersSizeWeeksSpin - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - weeks - - - False - True - 1 - - + True + 0 + generalUsersFilesWeeksSpin False @@ -2119,41 +2306,16 @@ - + True False - 5 - - - True - True - 0 - generalUsersFilesWeeksSpin - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - weeks - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + weeks False @@ -2168,48 +2330,32 @@ 1 + + + False + True + 1 + + + + + True + False + 5 + 5 + vertical + 5 - + True False - vertical 5 - + True - False - 5 - - - True - True - 0 - generalUsersSizeDaysSpin - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - days - - - False - True - 1 - - + True + 0 + generalUsersSizeDaysSpin False @@ -2218,41 +2364,16 @@ - + True False - 5 - - - True - True - 0 - generalUsersFilesDaysSpin - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - days - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + days False @@ -2264,51 +2385,20 @@ False True - 2 + 0 - + True False - vertical 5 - + True - False - 5 - - - True - True - 0 - generalUsersSizeHoursSpin - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - hours - - - False - True - 1 - - + True + 0 + generalUsersFilesDaysSpin False @@ -2317,39 +2407,74 @@ - + True False - 5 - - - True - True - 0 - generalUsersFilesHourSpin - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - hours - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + days + + + False + True + 1 + + + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + True + 0 + generalUsersSizeHoursSpin + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + hours False @@ -2361,51 +2486,20 @@ False True - 3 + 0 - + True False - vertical 5 - + True - False - 5 - - - True - True - 0 - generalUsersSizeMinutesSpin - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - minutes - - - False - True - 1 - - + True + 0 + generalUsersFilesHourSpin False @@ -2414,41 +2508,14 @@ - + True False - 5 - - - True - True - 0 - generalUsersFilesMinuteSpin - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - minutes - - - False - True - 1 - - + 5 + 5 + 5 + 5 + hours False @@ -2460,64 +2527,35 @@ False True - 4 + 1 False True - 1 - - - - - True - True - liststore1 - - - - - - True - True - 2 + 3 - - - False - True - 0 - - - - - True - False - + True - True - True - 5 + False 5 - 5 5 - 5 - 5 + vertical + 5 - + True False + 5 - + True - False - 5 - 5 - gtk-missing-image + True + 0 + generalUsersSizeMinutesSpin False @@ -2526,12 +2564,16 @@ - + True False 5 + 5 5 - Filters + 5 + 5 + 5 + minutes False @@ -2540,32 +2582,6 @@ - - - - False - True - 0 - - - - - True - False - - - gtk-delete - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - False True @@ -2573,51 +2589,40 @@ - + True - True - True - 5 - 5 - 5 - 5 - 5 - 5 + False + 5 - + + True + True + 0 + generalUsersFilesMinuteSpin + + + False + True + 0 + + + + True False - - - True - False - 5 - 5 - gtk-edit - - - False - True - 0 - - - - - True - False - 5 - 5 - 5 - 5 - Edit - - - False - True - 1 - - + 5 + 5 + 5 + 5 + 5 + 5 + minutes + + False + True + 1 + @@ -2626,40 +2631,30 @@ 1 - - - gtk-add - True - True - True - 5 - 5 - 5 - 5 - 5 - 5 - True - - - False - True - 2 - - False True - end - 1 + 4 False True - end - 1 + 3 + + + + + True + True + liststore1 + + + True + True + 4 @@ -3802,12 +3797,6 @@ True False - 5 - 5 - 5 - 5 - 5 - 5 True @@ -3863,6 +3852,7 @@ 5 5 Project ID + 0 False @@ -4543,8 +4533,10 @@ + True + From e63408a3ef8023588547cfaa13adbca19dcdf14b Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 18 May 2023 09:35:53 +0600 Subject: [PATCH 25/26] fix --- source/var.h | 2 +- source/view/ubl-settings-diskquota.cc | 18 ++++ source/view/ubl-settings-diskquota.h | 15 +++ ubl-settings-diskquota.glade | 149 ++++++++++++++++++-------- ubl-settings-diskquota_ru.po | 4 +- 5 files changed, 141 insertions(+), 47 deletions(-) diff --git a/source/var.h b/source/var.h index 0c4104a..63dc0f2 100644 --- a/source/var.h +++ b/source/var.h @@ -59,7 +59,7 @@ extern string version_application; #define str_name _("Name") #define str_size _("Size") #define str_quotas_mode _("Direct control of the file system") -#define str_lb_head _("Configuration of disk quotas parameters for system groups and users") +#define str_lb_head _("Setting user quotas") #define str_soft_limit _("Soft limit") #define str_currently_using _("Currently using:") #define str_currently_using_space _("Currently using: ") diff --git a/source/view/ubl-settings-diskquota.cc b/source/view/ubl-settings-diskquota.cc index 20e5195..47b4373 100755 --- a/source/view/ubl-settings-diskquota.cc +++ b/source/view/ubl-settings-diskquota.cc @@ -416,6 +416,19 @@ void MainWindow::get_builder() { builder->get_widget("btnEditUsers", btnEditUsers); builder->get_widget("btnEditGroups", btnEditGroups); builder->get_widget("usersProjectCombo", usersProjectCombo); + builder->get_widget("boxResize", boxResize); + builder->get_widget("boxGroupsWeeks", boxGroupsWeeks); + builder->get_widget("boxGroupsDays", boxGroupsDays); + builder->get_widget("boxGroupsHours", boxGroupsHours); + builder->get_widget("boxGroupsMinutes", boxGroupsMinutes); + builder->get_widget("boxUsersWeeks", boxUsersWeeks); + builder->get_widget("boxUsersDays", boxUsersDays); + builder->get_widget("boxUsersHours", boxUsersHours); + builder->get_widget("boxUsersMinutes", boxUsersMinutes); + builder->get_widget("boxProjectWeeks", boxProjectWeeks); + builder->get_widget("boxProjectDays", boxProjectDays); + builder->get_widget("boxProjectHours", boxProjectHours); + builder->get_widget("boxProjectMinutes", boxProjectMinutes); } void MainWindow::open_browser() { @@ -459,6 +472,7 @@ void MainWindow::wrapper_load_global() { } void MainWindow::event() { + boxResize->signal_check_resize().connect(sigc::mem_fun(*this, &MainWindow::resize_widget)); btnFilterGroups->signal_clicked().connect([&]() {this->filters_show();}); btnFilterUsers->signal_clicked().connect([&]() {this->filters_show();}); btnFilterProject->signal_clicked().connect([&]() {this->filters_show();}); @@ -493,6 +507,10 @@ void MainWindow::event() { &MainWindow::set_add_tv_g_u_p), str_groups, groupsQuotasTree, row, list_store_groups, obj_tv_g_u_p)); } +void MainWindow::resize_widget() { + // boxGroupsWeeks = boxGroupsWeeks(Gtk::ORIENTATION_HORIZONTAL); +} + void MainWindow::add_quota_show(string name) { obj_view_add->set_label_type_quota(name); obj_view_add->show(); diff --git a/source/view/ubl-settings-diskquota.h b/source/view/ubl-settings-diskquota.h index 25ad831..76f9e9e 100644 --- a/source/view/ubl-settings-diskquota.h +++ b/source/view/ubl-settings-diskquota.h @@ -78,6 +78,7 @@ class MainWindow { Gtk::Widget *boxSave; Gtk::Widget *boxButton; Gtk::Box *boxFuncs; + Gtk::Box* boxResize; Gtk::MenuButton *btnSave; Gtk::MenuButton *btnLoad; Gtk::MenuButton *btnSettings; @@ -166,6 +167,19 @@ class MainWindow { Gtk::Button* btnEditUsers; Gtk::Button* btnEditGroups; + Gtk::Box* boxGroupsWeeks; + Gtk::Box* boxGroupsDays; + Gtk::Box* boxGroupsHours; + Gtk::Box* boxGroupsMinutes; + Gtk::Box* boxUsersWeeks; + Gtk::Box* boxUsersDays; + Gtk::Box* boxUsersHours; + Gtk::Box* boxUsersMinutes; + Gtk::Box* boxProjectWeeks; + Gtk::Box* boxProjectDays; + Gtk::Box* boxProjectHours; + Gtk::Box* boxProjectMinutes; + public: map_str_str* map_gui_cfg = NULL; map_str_str* map_global_cfg = NULL; @@ -208,6 +222,7 @@ class MainWindow { void flag_block_gui(); void lacalization(); void add_CSS(); + void resize_widget(); void get_builder(); void event(); void open_browser(); diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 55ccfe9..a28b8ad 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -366,7 +366,7 @@ False vertical - + True False vertical @@ -477,16 +477,30 @@ False vertical - + + 300 True True - liststore1 - - + in + + + True + False + + + True + True + liststore1 + + + + + + - True + False True 0 @@ -512,6 +526,8 @@ True False + 5 + 5 5 5 5 @@ -625,7 +641,7 @@ - + True False vertical @@ -724,7 +740,7 @@ - + True False vertical @@ -823,7 +839,7 @@ - + True False vertical @@ -922,7 +938,7 @@ - + True False vertical @@ -1028,16 +1044,30 @@ - + + 100 True True - liststore1 - - + in + + + True + False + + + True + True + liststore1 + + + + + + - True + False True 2 @@ -1208,6 +1238,7 @@ False True + end 3 @@ -1236,6 +1267,8 @@ True False + 5 + 5 5 5 5 @@ -1348,7 +1381,7 @@ - + True False vertical @@ -1447,7 +1480,7 @@ - + True False vertical @@ -1546,7 +1579,7 @@ - + True False vertical @@ -1643,7 +1676,7 @@ - + True False vertical @@ -1749,16 +1782,30 @@ - + + 100 True True - liststore1 - - + in + + + True + False + + + True + True + liststore1 + + + + + + - True + False True 2 @@ -1929,6 +1976,7 @@ False True + end 3 @@ -1967,6 +2015,12 @@ True False + 5 + 5 + 5 + 5 + 5 + 5 Device: @@ -2005,7 +2059,7 @@ False True - 1 + 0 @@ -2187,8 +2241,6 @@ True False - 5 - 5 vertical True @@ -2237,11 +2289,9 @@ - + True False - 5 - 5 vertical 5 @@ -2338,11 +2388,9 @@ - + True False - 5 - 5 vertical 5 @@ -2439,11 +2487,9 @@ - + True False - 5 - 5 vertical 5 @@ -2538,11 +2584,9 @@ - + True False - 5 - 5 vertical 5 @@ -2642,19 +2686,36 @@ False True - 3 + 1 - + + 100 True True - liststore1 + in + + + True + False + + + True + True + liststore1 + + + + + + + - True + False True - 4 + 3 diff --git a/ubl-settings-diskquota_ru.po b/ubl-settings-diskquota_ru.po index 2880c76..1b3f8cc 100644 --- a/ubl-settings-diskquota_ru.po +++ b/ubl-settings-diskquota_ru.po @@ -4,7 +4,7 @@ # UBLinux Team , 2022 # #, fuzzy -msgid "" +msgid "test" msgstr "" "Project-Id-Version: ublexec 1.0\n" "Report-Msgid-Bugs-To: \n" @@ -15,7 +15,7 @@ msgstr "" "Language: Russian\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" +"Content-Transfer-Encoding: 8bit" msgid "ubl-settings-diskquota" msgstr "Дисковые квоты" From b01f278bc26a3fd988b643cccfe35502b5d3142a Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 18 May 2023 11:46:52 +0600 Subject: [PATCH 26/26] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=20?= =?UTF-8?q?=D0=BE=D0=BA=D0=BD=D0=B0=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=20=D0=B1=D1=80=D0=B0=D1=83=D0=B7=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/var.h | 2 +- ubl-settings-diskquota.glade | 3 ++- ubl-settings-diskquota.pot | 5 +++++ ubl-settings-diskquota_ru.po | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/var.h b/source/var.h index 63dc0f2..570313e 100644 --- a/source/var.h +++ b/source/var.h @@ -32,7 +32,7 @@ extern string version_application; #define boot_menu_user_password _("Boot menu user password:") #define last_successful_upload _("Last successful upload") #define read_documentation_web _("Would you like to read documentation in the Web?") -#define redirected_documentation _("You will be redirected to documentation site, where user help pages are ""translated and supported by community.") +#define redirected_documentation _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.") #define local_read_error _("Local configuration reading error") #define global_read_error _("Global configuration read error") #define local_write_error _("Local configuration write error") diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index a28b8ad..f284723 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -6514,7 +6514,8 @@ start 10 10 - You will be redirected to documentation website where documentation is translated and supported by community. + You will be redirected to documentation website where documentation is +translated and supported by community. True 0