pull/3/head
Igor Belitskiy 2 years ago
parent 313c387145
commit 79f8a683f2

@ -519,25 +519,6 @@ void MainWindow::event() {
QuotasEditWindow->show();
}
string MainWindow::format_str_size(Gtk::SpinButton* spb, Gtk::ComboBoxText* combo_box) {
string value = "";
int num = spb->get_value();
int index = combo_box->get_active_row_number();
value = to_string(num);
if (num == 0) {
return value;
}
if (index == 1) {
value += "M";
}
else if (index == 2) {
value += "G";
}
else if (index == 3) {
value += "T";
}
return value;
}
void MainWindow::wrapper_settings_quotas_temp(string save_user_or_group) {
struct partition_cmd _struct_partition_cmd = this->wrapper_settings_quotas();
string device = _struct_partition_cmd.device;
@ -552,6 +533,7 @@ void MainWindow::wrapper_settings_quotas_temp(string save_user_or_group) {
obj_quotas_sys.format_cmd_quotas_ubconfig(_struct_quota);
}
void MainWindow::save_quotegroupSaveButton() {
if (sys_or_ubconfig == "ubconfig") {
if (save_user_or_group == "usrquota") {
@ -571,22 +553,18 @@ void MainWindow::save_quotegroupSaveButton() {
}
}
struct partition_cmd MainWindow::wrapper_settings_quotas() {
string str_parted = quotegroupDeviceCombo->get_active_text();
string value = "";
if (quotegroupSizeSoftLimitCheck->get_active()) {
value = format_str_size(quotegroupSizeSoftLimitSpin, quotegroupSizeSoftLimitCombo);
value = Utils::format_str_size(quotegroupSizeSoftLimitSpin->get_value(), quotegroupSizeSoftLimitCombo->get_active_row_number());
value += ":";
}
else {
value += "0:";
}
if (quotegroupSizeHardLimitCheck->get_active()) {
value += format_str_size(quotegroupSizeHardLimitSpin, quotegroupSizeHardLimitCombo);
value += Utils::format_str_size(quotegroupSizeHardLimitSpin->get_value(), quotegroupSizeHardLimitCombo->get_active_row_number());
value += ":";
}
else {

@ -237,7 +237,6 @@ class MainWindow : public Gtk::ApplicationWindow {
void off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type);
void wrapper_save_system_cfg();
void wrapper_save_global_cfg();
string format_str_size(Gtk::SpinButton* spb, Gtk::ComboBoxText* combo_box);
void wrapper_save_all_cfg();
void init_dict(string flag_load);
void set_data_cfg();

@ -1,6 +1,24 @@
#include "util.h"
namespace Utils {
string format_str_size(int num, int index) {
string value = "";
value = to_string(num);
if (num == 0) {
return value;
}
if (index == 1) {
value += "M";
}
else if (index == 2) {
value += "G";
}
else if (index == 3) {
value += "T";
}
return value;
}
array<vector<string>, 5> read_csv(const string& filename) {
array<vector<string>, 5> array_vectors;

@ -16,6 +16,7 @@ struct Passwd {
int uid;
};
string format_str_size(int num, int index);
std::array<std::vector<std::string>, 5> read_csv(const std::string& filename);
std::string call(std::string cmd);
vector<int> find_all(string &str_ntp, string substr);

Loading…
Cancel
Save