You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
6.8 KiB
153 lines
6.8 KiB
#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 MainWindow::edit_tree_view_U(Glib::RefPtr<Gtk::ListStore>* 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<Gtk::ListStore>* 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<Gtk::ListStore>* 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<Gtk::ListStore>* 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;
|
|
} |