Начата работа по "меню ос"

pull/18/head
Igor Belitskiy 3 years ago
parent 079a78d613
commit e096aba614

@ -0,0 +1,26 @@
#include "menu_os.h"
menu_os::menu_os(/* args */)
{
}
menu_os::~menu_os()
{
}
void menu_os::init() {
this->m_box(Gtk::ORIENTATION_VERTICAL);
for (auto& [key, value]: map_list_os) {
Gtk::Button *button = new Gtk::button();
Gtk::Revealer *revealer = new Gtk::Revealer();
std::map<std::string, Gtk::struct_menu_os_button_v_2> map_buttons_level_2;
map_buttons_level_1[key] = struct_menu_os_button{button, revealer}
}
}
void menu_os::crete_menu_level_2(string key, std::map<std::string, Gtk::struct_menu_os_button_v_2> &map_buttons_level_2) {
map_buttons_level_2[key] =
}

@ -0,0 +1,27 @@
#include <gtkmm.h>
class menu_os
{
private:
struct struct_menu_os_button_v_2{
Gtk::Button* button;
};
struct struct_menu_os_button{
Gtk::Button* button;
Gtk::Revealer* revealer;
std::map<std::string, Gtk::struct_menu_os_button_v_2> map_buttons_level_2;
};
std::map<std::string, Gtk::struct_menu_os_button> map_buttons_level_1;
std::map <string, vector> map_list_os;
Gtk::Box m_box;
Gtk::Revealer* level_1;
public:
menu_os(/* args */);
void set_popover(Gtk::Popover *popover);
void set_map(std::map <string, vector> map_list_os);
void crete_menu_level_2(string key, std::map<std::string, Gtk::struct_menu_os_button_v_2> &map_buttons_level_2);
void init();
~menu_os();
};

@ -347,40 +347,28 @@ void MainWindow::get_password_protec(std::map <string, string> &map_temp) {
string MainWindow::template_item_selected(int size, Glib::RefPtr<Gtk::ListStore> &list_store, string key) {
string cmds = map_cmd_selection[key];
string param = "";
string str_del = "";
Utils::str_replace_all(cmds, "\"", "");
for (int index = 0; index < size; index++) {
Gtk::TreeModel::Row row = list_store->children()[index];
if(row) {
param = row[m_columns.name] + "";
string param = row[m_columns.name] + "";
if (row[m_columns.check_button] == true && cmds.find(param) == string::npos) {
if (cmds.length() > 0) {
if (cmds[cmds.length() - 1] == ' ') {
cmds = cmds + param + " ";
}
else {
cmds = cmds + " " + param + " ";
}
}
else {
cmds = cmds + param + " ";
}
cmds += " " + param + " ";
}
else if (row[m_columns.check_button] == false) {
if (cmds.find(param) != string::npos) {
str_del = ", " + param;
Utils::str_remove(cmds, str_del);
str_del = "," + param;
Utils::str_remove(cmds, str_del);
Utils::str_remove(cmds, param);
}
if (row[m_columns.check_button] == false && cmds.find(param) != string::npos) {
string param_del = " " + param;
Utils::str_remove(cmds, param_del);
Utils::str_remove(cmds, param);
}
}
}
cmds = "\"" + cmds + "\"";
Utils::str_replace_all(cmds, " ", " ");
Utils::str_replace_all(cmds, "\" ", "\"");
if (cmds.length() > 0) {
if (cmds[0] == ' ') {
cmds = cmds.substr(1, cmds.length() - 1);
}
}
cmds = "\"" + cmds + "\"";
return cmds;
}
@ -603,10 +591,10 @@ bool MainWindow::focus_out_txt_OTT(GdkEventFocus*) {
return true;
}
void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store, Gtk::Entry &entry, std::vector<string> &vec_Option, int size, string key) {
void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store, Gtk::Entry &entry, std::vector<std::string> &vec_Option, int size, string key) {
flag_blocked_tree_view = true;
vector<string> vec_params;
string text = entry.get_text();
std::string text = entry.get_text();
Utils::str_replace_all(text, " ", "");
vec_params = Utils::split(text, ',');
for (auto &name: vec_Option) {
@ -615,10 +603,20 @@ void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store
for (auto &name: vec_params) {
this->set_row(list_store, size, name, true);
}
flag_blocked_tree_view = false;
Utils::str_replace_all(text, " \"", "\"");
Utils::str_replace_all(text, "\"", "");
Utils::str_remove(text, ",");
if (text.length() > 0) {
if (text[0] == ' ') {
text = text.substr(1, text.length() - 1);
}
}
if (text.find("\"") == string::npos && text.length() != 0) {
text = "\"" + text + "\"";
}
map_cmd_selection[key] = text;
flag_blocked_tree_view = false;
}
void MainWindow::get_menu_boot(std::map <string, string> &map_temp) {
@ -688,11 +686,26 @@ void MainWindow::event(){
entryKernel->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_kernel));
entryIPT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_IPT));
entryOTT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_OTT));
entryKernel->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_tree_view));
entryIPT->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_tree_view));
entryOTT->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_tree_view));
}
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));
}
bool MainWindow::focus_tree_view(GdkEventFocus*) {
treeViewKernel->set_can_focus(false);
treeViewIPT->set_can_focus(false);
treeViewOTT->set_can_focus(false);
treeViewKernel->collapse_all();
treeViewIPT->collapse_all();
treeViewOTT->collapse_all();
return true;
}
bool MainWindow::gui_exit(GdkEventAny*) {
exit(1);
return true;

@ -294,6 +294,7 @@ class MainWindow : public Gtk::ApplicationWindow {
bool focus_out_txt_IPT(GdkEventFocus*);
bool focus_out_txt_OTT(GdkEventFocus*);
void fill_in_view();
bool focus_tree_view(GdkEventFocus*);
void set_security_login();
void get_security_login(std::map <string, string> &map_temp);
bool check_flag_save(string flag_save);

@ -7,6 +7,16 @@
<property name="ignore-hidden">True</property>
</object>
<object class="GtkSizeGroup"/>
<object class="GtkPopover">
<property name="can-focus">False</property>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
</child>
</object>
<object class="GtkSizeGroup"/>
<object class="GtkButton">
<property name="visible">True</property>
@ -48,6 +58,109 @@
</object>
</child>
</object>
<object class="GtkPopover">
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkRevealer">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="transition-type">none</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
</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="GtkRevealer">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="transition-type">none</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label111</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRevealer">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="transition-type">none</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label2222</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="GtkRevealer">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="transition-type">none</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label333</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkPopoverMenu">
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
</object>
<object class="GtkAboutDialog" id="aboutWindows">
<property name="can-focus">False</property>
<property name="resizable">False</property>
@ -487,6 +600,22 @@ specified priority</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>

Loading…
Cancel
Save