parent
b6fb6f9756
commit
784c87fa8f
@ -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<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;
|
||||||
|
}
|
@ -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<Gtk::Builder> 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<Gtk::ListStore>* 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<Gtk::ListStore>* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate);
|
||||||
|
void edit_tree_view_G(Glib::RefPtr<Gtk::ListStore>* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate);
|
||||||
|
void edit_tree_view_P(Glib::RefPtr<Gtk::ListStore>* list_store, const Gtk::TreeModel::iterator* iter, bool& flag_validate);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in new issue