Исправлено событие изменение размеров окна

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

@ -52,6 +52,8 @@ int main(int argc, char** argv) {
pars_flag(1, argc, argv);
MainWindow* wnd = nullptr;
builder->get_widget_derived("window", wnd);
wnd->settings();
wnd->event();
auto r = app->run(*wnd);
delete wnd;
return r;

@ -46,6 +46,9 @@ SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> build
MainWindow* wnd = nullptr;
builder->get_widget_derived("window", wnd);
builder->get_widget("plugBox", plugBox);
wnd->settings();
wnd->set_plug(plugBox);
wnd->event();
plugBox->get_parent()->remove(*plugBox);
add(*plugBox);
show_all_children();
@ -61,12 +64,10 @@ int MainWindow::check_root() {
MainWindow::MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder)
: Gtk::ApplicationWindow(obj), builder{builder} {
this->builder = builder;
this->settings();
}
MainWindow::MainWindow(Glib::RefPtr<Gtk::Builder> const& builder) {
this->builder = builder;
this->settings();
}
void MainWindow::settings() {
@ -89,6 +90,7 @@ void MainWindow::settings() {
overHead->add_overlay(*boxWidget);
btnBoxAboutDialog->set_visible(false);
ubl_make_plugs(boxSave,boxButton, socket_ext_id_I, socket_trd_id_I);
#ifdef WEBKIT_FOUND
one = WEBKIT_WEB_VIEW(webkit_web_view_new());
three = Glib::wrap(GTK_WIDGET(one));
@ -125,7 +127,10 @@ void MainWindow::settings() {
this->set_active_boot_second();
this->fill_in_view();
}
this->event();
}
void MainWindow::set_plug(Gtk::Widget *plug) {
this->plug = plug;
}
vector<tuple<string, vector<string>>> MainWindow::format_os_list(vector<string> &os_control_list) {
@ -520,13 +525,11 @@ void MainWindow::localization() {
btnSave->set_label(str_save);
btnLoad->set_label(str_load);
this->set_title(name_app);
// Todo: check
lblDownloadMode->set_text(boot_screen_display_mode);
cmbDownloadMode->append(loading_animation_with);
cmbDownloadMode->append(loading_animation_without);
cmbDownloadMode->append(no_loading_animation);
cmbDownloadMode->append(lack_loading_animation);
lblDownloadMode->set_text(boot_screen_display_mode);
lblhelpHeader->set_text(read_documentation_web);
lblhelpText->set_text(_(redirected_documentation));
btnReadHelp->set_label(read_online);
@ -676,6 +679,45 @@ void MainWindow::event() {
}
this->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::gui_exit));
chbLoadVariantSelectionTimer->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_active_boot_second));
if (plug == NULL) {
this->signal_check_resize().connect(sigc::mem_fun(*this, &MainWindow::check_resize_window));
}
else {
plug->get_parent()->signal_check_resize().connect(sigc::mem_fun(*this, &MainWindow::check_resize_window));
}
}
void MainWindow::check_resize_window() {
int height = 0;
int width = 0;
if (plug == NULL) {
height = this->get_window()->get_height();
width = this->get_window()->get_width();
}
else {
height = plug->get_window()->get_height();
width = plug->get_window()->get_width();
// lblInfoHead->set_text(to_string(height));
}
if (height != old_height) {
if (minimal_height >= height) {
cmbDownloadMode->remove_all();
cmbDownloadMode->append(loading_animation_with);
cmbDownloadMode->append(loading_animation_without);
cmbDownloadMode->append(no_loading_animation_800_600);
cmbDownloadMode->append(lack_loading_animation_800_600);
}
else {
cmbDownloadMode->remove_all();
cmbDownloadMode->append(loading_animation_with);
cmbDownloadMode->append(loading_animation_without);
cmbDownloadMode->append(no_loading_animation);
cmbDownloadMode->append(lack_loading_animation);
}
}
old_height = height;
old_width = width;
}
void MainWindow::set_tree_view_user() {
@ -747,6 +789,7 @@ void MainWindow::set_init_data_user(std::map<string, string> &map_temp) {
}
}
Glib::RefPtr<Gtk::TreeModel> treeViewUserModel = treeViewUser->get_model();
treeViewUser->signal_cursor_changed().connect(sigc::mem_fun(*this, &MainWindow::check_space_user));
treeViewUserModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::select_line_user));
this->view_add_colums_user(*treeViewUser);
}
@ -849,6 +892,7 @@ void MainWindow::set_init_data_melody(std::map<string, string> &map_temp) {
this->set_add_data_melody(row_melody, flag, name, code);
}
Glib::RefPtr<Gtk::TreeModel> treeViewMelodyModel = treeViewMelody->get_model();
treeViewMelody->signal_cursor_changed().connect(sigc::mem_fun(*this, &MainWindow::check_space_melody));
treeViewMelodyModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::select_line_melody));
this->view_add_colums_melody(*treeViewMelody);
}
@ -908,13 +952,7 @@ void MainWindow::remove_melody() {
flag_validate_del_melody = false;
}
void MainWindow::select_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
treeViewKernel->get_selection()->unselect_all();
treeViewOTT->get_selection()->unselect_all();
treeViewIPT->get_selection()->unselect_all();
treeViewMelody->get_selection()->unselect_all();
iter_user_del = iter;
flag_validate_del_user = true;
void MainWindow::check_space_user() {
bool flag_error = false;
string name = "";
string password = "";
@ -943,16 +981,8 @@ void MainWindow::select_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeMo
lblWarning->set_text(str_add_user);
}
}
len_old_user = len_new_user;
}
void MainWindow::select_line_melody(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
treeViewKernel->get_selection()->unselect_all();
treeViewOTT->get_selection()->unselect_all();
treeViewIPT->get_selection()->unselect_all();
treeViewUser->get_selection()->unselect_all();
iter_melody_del = iter;
flag_validate_del_melody = true;
void MainWindow::check_space_melody() {
string code_melodyes = "";
string melody_title = "";
size_t len_new_melody = 0;
@ -980,6 +1010,37 @@ void MainWindow::select_line_melody(const Gtk::TreeModel::Path&, const Gtk::Tree
lblWarning->set_text(str_add_melody);
}
}
}
void MainWindow::select_line_user(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
treeViewKernel->get_selection()->unselect_all();
treeViewOTT->get_selection()->unselect_all();
treeViewIPT->get_selection()->unselect_all();
treeViewMelody->get_selection()->unselect_all();
iter_user_del = iter;
size_t len_new_user = 0;
flag_validate_del_user = true;
Glib::RefPtr<Gtk::TreeModel> treeViewUser_model = treeViewUser->get_model();
Gtk::TreeModel::Children children = treeViewUser_model->children();
for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) {
len_new_user += 1;
}
len_old_user = len_new_user;
}
void MainWindow::select_line_melody(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator& iter) {
treeViewKernel->get_selection()->unselect_all();
treeViewOTT->get_selection()->unselect_all();
treeViewIPT->get_selection()->unselect_all();
treeViewUser->get_selection()->unselect_all();
iter_melody_del = iter;
size_t len_new_melody = 0;
flag_validate_del_melody = true;
Glib::RefPtr<Gtk::TreeModel> treeViewMelody_model = treeViewMelody->get_model();
Gtk::TreeModel::Children children = treeViewMelody_model->children();
for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter) {
len_new_melody += 1;
}
this->validate_melody();
len_old_melody = len_new_melody;
}

@ -36,6 +36,8 @@ extern bool flag_load_global;
extern bool flag_lock_help;
void me_thread(string cmd);
#define minimal_width 640
#define minimal_height 500
#define str_tooltip_add_user _("Add user")
#define str_tooltip_del_user _("Delete user")
#define str_tooltip_add_melody _("Add melody")
@ -68,7 +70,8 @@ void me_thread(string cmd);
#define cancel _("Cancel")
#define always_redirect _("Always redirect")
#define boot_screen_display_mode _("Boot screen display mode:")
#define no_loading_animation _("No loading animation,\nfull log")
#define no_loading_animation_800_600 _("No loading animation,\nfull log")
#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")
@ -78,7 +81,8 @@ void me_thread(string cmd);
#define user_password_configuration_edit_mode _("User password to enter boot configuration edit mode")
#define loading_animation_with _("Loading animation with the magazine")
#define loading_animation_without _("Loading animation without a magazine")
#define lack_loading_animation _("Lack of loading animation with the\noutput of the abbreviated log")
#define lack_loading_animation_800_600 _("Lack of loading animation with the\noutput of the abbreviated log")
#define lack_loading_animation _("Lack of loading animation with the output of the abbreviated log")
#define web_url _("https://wiki.ublinux.com")
#define enter_password _("Enter your password")
#define enter_login _("Enter login")
@ -211,6 +215,7 @@ public:
ModelColumnsUser m_columns_user;
ModelColumnsMelody m_columns_melody;
Glib::RefPtr<Gtk::Builder> builder;
Gtk::Widget *plug = NULL;
Gtk::SpinButton *spbSecond;
Gtk::Label *lblBootMenuUsers;
Gtk::Label *lblRingtoneStartup;
@ -321,7 +326,8 @@ public:
size_t size_OTT = 0;
size_t len_old_melody = 0;
size_t len_old_user = 0;
int old_height = 0;
int old_width = 0;
Glib::RefPtr<Gtk::StyleContext> boxInfo;
string str_cmd_error = "";
template <typename Type>
@ -411,6 +417,10 @@ public:
bool intel_idle_cstate_check(int size, Glib::RefPtr<Gtk::ListStore> &list_store, string key);
void wrapper_add_data_user();
void wrapper_add_data_melody();
void check_resize_window();
void set_plug(Gtk::Widget *plug);
void check_space_user();
void check_space_melody();
};
class SettingsPlug : public Gtk::Plug

@ -111,8 +111,7 @@
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label" translatable="yes">Running applications as a user with a
specified priority</property>
<property name="label" translatable="yes">ubl-settings-bootloader</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="size" value="15360"/>
@ -640,9 +639,6 @@ specified priority</property>
<object class="GtkTreeView" id="treeViewUser">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
@ -793,9 +789,6 @@ specified priority</property>
<object class="GtkTreeView" id="treeViewMelody">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
@ -968,9 +961,6 @@ specified priority</property>
<object class="GtkTreeView" id="treeViewKernel">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
@ -1096,9 +1086,6 @@ specified priority</property>
<object class="GtkTreeView" id="treeViewIPT">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
@ -1224,9 +1211,6 @@ specified priority</property>
<object class="GtkTreeView" id="treeViewOTT">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>

@ -29,6 +29,12 @@ msgstr ""
msgid "Add melody"
msgstr ""
msgid "No loading animation, full log"
msgstr ""
msgid "Lack of loading animation with the output of the abbreviated log"
msgstr ""
msgid "Delete melody"
msgstr "Удалить мелодию"

@ -223,6 +223,9 @@ msgstr "Терминал для вывода"
msgid "Lack of loading animation with the\noutput of the abbreviated log"
msgstr "Отсутствие анимации загрузки с\nвыводом сокращенного журнала"
msgid "Lack of loading animation with the output of the abbreviated log"
msgstr "Отсутствие анимации загрузки с выводом сокращенного журнала"
#, fuzzy
msgid "Last Successful Download"
msgstr "Последняя удачная загрузка"
@ -312,6 +315,9 @@ msgstr "Максимальная производительность, упра
msgid "No loading animation,\nfull log"
msgstr "Отсутствие анимации загрузки\nс выводом журнала"
msgid "No loading animation, full log"
msgstr "Отсутствие анимации загрузки с выводом журнала"
#: source/ubl-settings-bootloader.cc:444 source/ubl-settings-bootloader.cc:446
msgid "Not available"
msgstr "Отсутствует"

Loading…
Cancel
Save