Начата работа по окну редактирования

pull/34/head
Igor Belitskiy 3 years ago
parent 95198f87d3
commit dd63a66c2f

@ -61,6 +61,77 @@ int MainWindow::check_root() {
return 0;
}
// =================================================================
View_edit_add_table::View_edit_add_table() {
builder = Gtk::Builder::create_from_file(path_glade);
this->settings();
}
void View_edit_add_table::settings() {
this->get_builder();
this->localization();
this->event();
}
void View_edit_add_table::event() {
btnCancel->signal_clicked().connect([&]() {cancel();});
btnSave->signal_clicked().connect([&]() {save();});
}
void View_edit_add_table::localization() {
}
void View_edit_add_table::get_builder() {
builder->get_widget("wndQuotasAddProject", wndQuotasAddProject);
builder->get_widget("btnCancel", btnCancel);
builder->get_widget("btnSave", btnSave);
builder->get_widget("chkAddEdit", chkAddEdit);
builder->get_widget("entryCol1", entryCol1);
builder->get_widget("entryCol2", entryCol2);
builder->get_widget("lblAddEditTitle", lblAddEditTitle);
builder->get_widget("lblAddEditCheckBox", lblAddEditCheckBox);
builder->get_widget("lblAddEditCol1", lblAddEditCol1);
builder->get_widget("lblAddEditCol2", lblAddEditCol2);
builder->get_widget("lblAddEdittTableName", lblAddEdittTableName);
}
void View_edit_add_table::cancel() {
wndQuotasAddProject->hide();
flag_save = false;
}
void View_edit_add_table::save() {
wndQuotasAddProject->hide();
flag_save = true;
}
struct Data View_edit_add_table::get_data() {
if (flag_save == true) {
return new_data;
}
return old_data;
}
void Data View_edit_add_table::show() {
flag_save = false;
wndQuotasAddProject->show();
}
void View_edit_add_table::set_data(bool check, string colmn1, string colmn2) {
old_data.check = check;
old_data.colmn1 = colmn1;
old_data.colomn2 = colomn2;
}
void View_edit_add_table::show_edit() {
this->show();
}
void View_edit_add_table::show_add() {
this->show();
}
// =================================================================
MainWindow::MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder)
: Gtk::ApplicationWindow(obj), builder{builder} {
this->builder = builder;
@ -70,6 +141,8 @@ MainWindow::MainWindow(Glib::RefPtr<Gtk::Builder> const& builder) {
this->builder = builder;
}
void MainWindow::settings() {
obj_main = this;
map_cmd_error[""] = "";
@ -487,6 +560,10 @@ void MainWindow::get_builder() {
builder->get_widget("btnRemoveUser", btnRemoveUser);
builder->get_widget("btnAddMusic", btnAddMusic);
builder->get_widget("btnRemoveMusic", btnRemoveMusic);
builder->get_widget("btnEditMusic", btnEditMusic);
builder->get_widget("btnEditUser", btnEditUser);
}
void MainWindow::localization() {
@ -533,7 +610,7 @@ void MainWindow::localization() {
lblhelpHeader->set_text(read_documentation_web);
lblhelpText->set_text(_(redirected_documentation));
btnReadHelp->set_label(read_online);
btnCancelHelp->set_label(cancel);
btnCancelHelp->set_label(str_cancel);
chkAlwaysOpenHelp->set_label(always_redirect);
lblwebHeaderName->set_label(name_app);
btnRemoveMusic->set_tooltip_text(str_tooltip_del_melody);

@ -67,7 +67,7 @@ void me_thread(string cmd);
#define load_global _("Load global configuration")
#define load_local _("Load local configuration")
#define read_online _("Read online")
#define cancel _("Cancel")
#define str_cancel _("Cancel")
#define always_redirect _("Always redirect")
#define boot_screen_display_mode _("Boot screen display mode:")
#define no_loading_animation_800_600 _("No loading animation,\nfull log")
@ -158,6 +158,47 @@ void me_thread(string cmd);
#define str_del_user _("User deleted")
#define str_del_melody _("Melody deleted")
class View_edit_add_table {
private:
Glib::RefPtr<Gtk::Builder> builder;
Gtk::Window* wndQuotasAddProject;
Gtk::Button* btnCancel;
Gtk::Button* btnSave;
Gtk::CheckButton* chkAddEdit;
Gtk::Entry* entryCol1;
Gtk::Entry* entryCol2;
Gtk::Label* lblAddEditTitle;
Gtk::Label* lblAddEditCheckBox;
Gtk::Label* lblAddEditCol1;
Gtk::Label* lblAddEditCol2;
Gtk::Label* lblAddEdittTableName;
private:
View_edit_add_table();
~View_edit_add_table();
struct Data {
bool check;
string colomn1;
string colomn2;
};
struct Data old_data;
struct Data new_data;
string flag_save = false;
public:
void settings();
void event();
void localization();
void cancel();
void save();
void set_data(bool check, string colmn1, string colmn2);
void get_data();
void show();
void get_builder();
void show_edit();
void show_add();
};
class CmdArgParser : public Glib::OptionGroup
{
public:
@ -234,6 +275,8 @@ public:
Gtk::Button *btnRemoveUser;
Gtk::Button *btnAddMusic;
Gtk::Button *btnRemoveMusic;
Gtk::Button *btnEditUser;
Gtk::Button *btnEditMusic;
Gtk::CheckButton *chbVgaText;
Gtk::CheckButton *chbLoadVariantSelectionTimer;
Gtk::Entry *entryKernel;
@ -313,6 +356,7 @@ public:
vector<string> 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();
View_edit_add_table obj_view_edit_add_table = View_edit_add_table();
bool flag_load = false;
bool flag_save_all = false;
bool flag_blocked_tree_view = false;

@ -623,7 +623,7 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="height-request">65</property>
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-right">3</property>
@ -689,6 +689,31 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnEditUser">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-left">5</property>
<property name="margin-right">10</property>
<property name="margin-start">5</property>
<property name="margin-end">10</property>
<property name="margin-top">3</property>
<property name="margin-bottom">5</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-select-all</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnRemoveUser">
<property name="visible">True</property>
@ -711,7 +736,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
@ -773,7 +798,7 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<property name="height-request">65</property>
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-right">5</property>
@ -839,6 +864,31 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnEditMusic">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-left">5</property>
<property name="margin-right">10</property>
<property name="margin-start">5</property>
<property name="margin-end">10</property>
<property name="margin-top">3</property>
<property name="margin-bottom">5</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-select-all</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnRemoveMusic">
<property name="visible">True</property>
@ -861,7 +911,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
@ -1724,6 +1774,290 @@
</object>
</child>
</object>
<object class="GtkWindow" id="wndAddEditData">
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="icon-name">com.ublinux.ubl-settings-datetime</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="lblAddEdittTableName">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblAddEditTitle">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="lblAddEditCheckBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="chkAddEdit">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">7</property>
<property name="margin-bottom">5</property>
<property name="draw-indicator">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="lblAddEditCol1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entryCol1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="lblAddEditCol2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entryCol2">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="spacing">5</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="btnCancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="use-stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnSaveB">
<property name="label">gtk-save</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="use-stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child type="title">
<object class="GtkLabel" id="lblHeadeWndWeb1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">ubl-settings-bootloader</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">32</property>
<property name="icon-name">com.ublinux.ubl-settings-bootloader</property>
<property name="icon_size">5</property>
</object>
</child>
</object>
</child>
</object>
<object class="GtkApplicationWindow" id="wndShowWeb">
<property name="can-focus">False</property>
<property name="halign">start</property>

Loading…
Cancel
Save