parent
fd5b9ce76b
commit
8dac902ceb
@ -1,7 +1,12 @@
|
||||
ubl-settings-bootloader.glade~
|
||||
test.cpp
|
||||
.vscode
|
||||
.vscode/
|
||||
ubl-settings-bootloader
|
||||
ubl-settings-bootloader_ru.po~
|
||||
*~
|
||||
build/
|
||||
compile/
|
||||
*#
|
||||
terminal-commands/
|
||||
compile/
|
||||
source/ubl-cmake.h
|
||||
vgcore*
|
||||
.BUILD.md
|
||||
.updatebuild.sh
|
||||
.install.sh
|
||||
@ -1,34 +0,0 @@
|
||||
#include "load.h"
|
||||
|
||||
namespace Lib_Load{
|
||||
void Load::set_count_error(int count_error) {
|
||||
process.set_count_error(count_error);
|
||||
}
|
||||
string Load::get_cmd_error() {
|
||||
return process.get_cmd_error();
|
||||
}
|
||||
map<string, string>& Load::get_load_data(std::map <string, string> &map_temp, string cmd) {
|
||||
string response = "";
|
||||
string key = "";
|
||||
string value = "";
|
||||
response = process.call_all_sections(cmd);
|
||||
vector<string> vec_str_key_value = Utils::split(response, '\n');
|
||||
for (const string ¶m: vec_str_key_value) {
|
||||
if ((param.find("(null)") == std::string::npos) && (param.length() != 0 )) {
|
||||
if (param.find("=") != std::string::npos) {
|
||||
size_t index = param.find("=");
|
||||
key = param.substr(0, index);
|
||||
value = param.substr(index + 1, param.length());
|
||||
Utils::str_replace_all(value, " \"","");
|
||||
Utils::str_replace_all(value, "\"","");
|
||||
map_temp[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map_temp;
|
||||
}
|
||||
int Load::get_count_error() {
|
||||
return process.get_count_error();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
#ifndef LOAD_H
|
||||
#define LOAD_H
|
||||
|
||||
#include "my_process.h"
|
||||
namespace Lib_Load{
|
||||
class Load {
|
||||
|
||||
private:
|
||||
string sections;
|
||||
My_Process::My_Process_call process = My_Process::My_Process_call();
|
||||
public:
|
||||
int get_count_error();
|
||||
void set_count_error(int count_error);
|
||||
string get_cmd_error();
|
||||
map<string, string>& get_load_data(std::map <string, string> &map_temp, string str_flag_load);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
@ -1,100 +0,0 @@
|
||||
#include "ubl-settings-bootloader.h"
|
||||
|
||||
|
||||
void pars_flag(int index_start, int argc, char* argv[]);
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
string str_argv= "";
|
||||
string str_cmd_argv = "";
|
||||
for (int i=1; i<argc; i++){
|
||||
str_cmd_argv+= to_string(*argv[i]) + " ";
|
||||
}
|
||||
if (argc > 1){
|
||||
str_argv = argv[1];
|
||||
}
|
||||
bindtextdomain("ubl-settings-bootloader", "/usr/share/locale/");
|
||||
bind_textdomain_codeset("ubl-settings-bootloader", "UTF-8");
|
||||
textdomain("ubl-settings-bootloader");
|
||||
if (str_argv.find("--socket-id") != std::string::npos) {
|
||||
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example.plug");
|
||||
auto builder = Gtk::Builder::create_from_resource(path_glade);
|
||||
Glib::init();
|
||||
setlocale(LC_ALL, "");
|
||||
Glib::OptionContext context;
|
||||
|
||||
CmdArgParser parser{
|
||||
"Socket ID",
|
||||
"Command line argument for socket ID communication.",
|
||||
"No help available, sorry"
|
||||
};
|
||||
|
||||
context.set_main_group(parser);
|
||||
context.parse(argc, argv);
|
||||
|
||||
::Window socketID = parser.GetSocketID();
|
||||
|
||||
// Handle plug:
|
||||
SettingsPlug plug{socketID, builder};
|
||||
plug.show();
|
||||
|
||||
app->run(plug);
|
||||
return 0;
|
||||
}
|
||||
else if (str_argv.find("-") != std::string::npos || argc == 1) {
|
||||
int len_argv = 1;
|
||||
auto app = Gtk::Application::create(len_argv, argv, "org.gtkmm.example.plug");
|
||||
auto builder = Gtk::Builder::create_from_resource(path_glade);
|
||||
pars_flag(1, argc, argv);
|
||||
MainWindow* wnd = nullptr;
|
||||
builder->get_widget_derived("window", wnd);
|
||||
GObject *window_obj = G_OBJECT(wnd->gobj());
|
||||
Utils::yon_window_config_setup(GTK_WINDOW(window_obj));
|
||||
Utils::yon_window_config_load(ui_config_path);
|
||||
wnd->settings();
|
||||
wnd->event();
|
||||
wnd->set_menu_os_to_button();
|
||||
auto r = app->run(*wnd);
|
||||
delete wnd;
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
void pars_flag(int index_start, int argc, char* argv[]) {
|
||||
string str_argv = "";
|
||||
for (int i = index_start; i<argc; i++){
|
||||
str_argv = argv[i];
|
||||
if (str_argv == "--help" || str_argv == "-h"){
|
||||
help();
|
||||
exit(1);
|
||||
}
|
||||
else if (str_argv == "--version" || str_argv == "-v"){
|
||||
string version = string(str_version) + version_application + "\n";
|
||||
cout << version.c_str();
|
||||
exit(1);
|
||||
}
|
||||
else if (str_argv == "--lock-help") {
|
||||
flag_lock_help = true;
|
||||
}
|
||||
else if (str_argv == "--lock-save") {
|
||||
flag_save = true;
|
||||
flag_save_local = true;
|
||||
flag_save_global = true;
|
||||
}
|
||||
else if (str_argv == "--lock-save-local"){
|
||||
flag_save_local = true;
|
||||
}
|
||||
else if (str_argv == "--lock-save-global"){
|
||||
flag_save_global = true;
|
||||
}
|
||||
else if (str_argv == "--lock-load-global"){
|
||||
flag_load_global = true;
|
||||
}
|
||||
else{
|
||||
if (index_start == 1){
|
||||
g_print(no_recognized);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,185 +0,0 @@
|
||||
#include "menu_os.h"
|
||||
|
||||
|
||||
Menu_os::Menu_os(/* args */)
|
||||
{
|
||||
}
|
||||
|
||||
Menu_os::~Menu_os()
|
||||
{
|
||||
}
|
||||
|
||||
void Menu_os::set_last_launched_os(string str_last_launched_os) {
|
||||
this->str_last_launched_os = str_last_launched_os;
|
||||
}
|
||||
|
||||
void Menu_os::set_builder(Glib::RefPtr<Gtk::Builder>& builder, string path_glade) {
|
||||
this->builder = builder;
|
||||
this->path_glade = path_glade;
|
||||
builder->get_widget("revealerL1", revealerL1);
|
||||
builder->get_widget("revealerL2", revealerL2);
|
||||
builder->get_widget("boxALLL3", boxALLL3);
|
||||
builder->get_widget("boxLevel1", boxLevel1);
|
||||
builder->get_widget("btnToLev1", btnToLev1);
|
||||
revealerL1->set_reveal_child(true);
|
||||
}
|
||||
|
||||
void Menu_os::set_btnOpenMenuOS(Gtk::Button *btnOpenMenuOS) {
|
||||
this->btnOpenMenuOS = btnOpenMenuOS;
|
||||
}
|
||||
|
||||
void Menu_os::set_map(vector<tuple<string, vector<string>>> &vec_list_os) {
|
||||
this->vec_list_os = vec_list_os;
|
||||
}
|
||||
|
||||
void Menu_os::init() {
|
||||
revealerL1->set_reveal_child(true);
|
||||
revealerL2->set_reveal_child(true);
|
||||
size_t index_l1 = 0;
|
||||
string key = "";
|
||||
|
||||
for (tuple<string, vector<string>> tuple_os: vec_list_os) {
|
||||
key = get<0>(tuple_os);
|
||||
vector<string> vec_value = get<1>(tuple_os);
|
||||
map_menu_level_1[key] = new struct_menu_level1;
|
||||
Glib::RefPtr<Gtk::Builder> builder_level_1 = Gtk::Builder::create_from_resource(path_glade);
|
||||
builder_level_1->get_widget("lblRevL1", map_menu_level_1[key]->lblRevL1);
|
||||
builder_level_1->get_widget("btnToL2AndLv3", map_menu_level_1[key]->btnToL2AndLv3);
|
||||
builder_level_1->get_widget("boxMenuLevel1", map_menu_level_1[key]->boxMenuLevel1);
|
||||
map_menu_level_1[key]->btnToL2AndLv3_css = map_menu_level_1[key]->btnToL2AndLv3->get_style_context();
|
||||
map_menu_level_1[key]->btnToL2AndLv3_css->add_class("noborder");
|
||||
map_menu_level_1[key]->builder = builder_level_1;
|
||||
boxLevel1->pack_start(*(map_menu_level_1[key]->boxMenuLevel1));
|
||||
map_menu_level_1[key]->name = key;
|
||||
this->html_last_launched_os(key, map_menu_level_1[key]->lblRevL1);
|
||||
map_menu_level_1[key]->btnToL2AndLv3->signal_clicked().connect(
|
||||
sigc::bind<Gtk::Label*, string&, string&> (sigc::mem_fun( *this,
|
||||
&Menu_os::event_template), map_menu_level_1[key]->lblRevL1,
|
||||
name_level_1, map_menu_level_1[key]->name));
|
||||
if (vec_value.size()!= 0) {
|
||||
builder_level_1->get_widget("revealerL3", map_menu_level_1[key]->revealer);
|
||||
builder_level_1->get_widget("boxLevel3", map_menu_level_1[key]->boxLevel3);
|
||||
boxALLL3->pack_start(*(map_menu_level_1[key]->revealer));
|
||||
}
|
||||
else {
|
||||
map_menu_level_1[key]->revealer = NULL;
|
||||
map_menu_level_1[key]->boxLevel3 = NULL;
|
||||
}
|
||||
size_t index_l3 = 0;
|
||||
if (vec_value.size() == 0) {
|
||||
builder_level_1->get_widget("btnToL2AndLv3Image", map_menu_level_1[key]->btnToL2AndLv3Image);
|
||||
map_menu_level_1[key]->btnToL2AndLv3Image->hide();
|
||||
}
|
||||
else {
|
||||
builder_level_1->get_widget("btnToL2AndLv3Image", map_menu_level_1[key]->btnToL2AndLv3Image);
|
||||
}
|
||||
for (string& str_level_3: vec_value) {
|
||||
auto builder_level_3 = Gtk::Builder::create_from_resource(path_glade);
|
||||
map_menu_level_1[key]->vec_menu_level_3.push_back(new struct_menu_level_3);
|
||||
builder_level_3->get_widget("btnToL3",
|
||||
map_menu_level_1[key]->vec_menu_level_3[index_l3]->btnToL3);
|
||||
builder_level_3->get_widget("lblToL3",
|
||||
map_menu_level_1[key]->vec_menu_level_3[index_l3]->lblToL3);
|
||||
map_menu_level_1[key]->vec_menu_level_3[index_l3]->btnToL3_css =
|
||||
map_menu_level_1[key]->vec_menu_level_3[index_l3]->btnToL3->get_style_context();
|
||||
map_menu_level_1[key]->vec_menu_level_3[index_l3]->btnToL3_css->add_class("noborder");
|
||||
this->html_last_launched_os(str_level_3, map_menu_level_1[key]->vec_menu_level_3[index_l3]->lblToL3);
|
||||
map_menu_level_1[key]->boxLevel3->pack_start(
|
||||
*(map_menu_level_1[key]->vec_menu_level_3[index_l3]->btnToL3));
|
||||
map_menu_level_1[key]->vec_menu_level_3[index_l3]->btnToL3->signal_clicked().connect(
|
||||
sigc::bind<Gtk::Label*, string&, string&> (sigc::mem_fun(*this,
|
||||
&Menu_os::event_template), map_menu_level_1[key]->vec_menu_level_3[index_l3]->lblToL3,
|
||||
name_level_3, map_menu_level_1[key]->name));
|
||||
map_menu_level_1[key]->vec_menu_level_3[index_l3]->builder_level_3 = builder_level_3;
|
||||
index_l3 += 1;
|
||||
|
||||
}
|
||||
index_l1 += 1;
|
||||
}
|
||||
}
|
||||
void Menu_os::close_revealer() {
|
||||
for (auto& [key, values]: map_menu_level_1) {
|
||||
if (values->revealer != NULL) {
|
||||
values->revealer->set_reveal_child(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Menu_os::set_main_revealer(Gtk::Revealer *revealer) {
|
||||
this->main_revealer = revealer;
|
||||
}
|
||||
|
||||
void Menu_os::show() {
|
||||
revealerL1->set_reveal_child(true);
|
||||
revealerL2->set_reveal_child(false);
|
||||
this->close_revealer();
|
||||
main_revealer->set_reveal_child(true);
|
||||
}
|
||||
void Menu_os::event() {
|
||||
btnToLev1->signal_clicked().connect(sigc::mem_fun(*this, &Menu_os::to_l1));
|
||||
}
|
||||
void Menu_os::set_entry(Gtk::Entry *entry) {
|
||||
this->entry = entry;
|
||||
}
|
||||
void Menu_os::event_template(Gtk::Label* label, string& name_level, string& key) {
|
||||
name_level = label->get_label();
|
||||
key_global = key;
|
||||
Utils::str_remove(name_level_1, "<b>");
|
||||
Utils::str_remove(name_level_1, "</b>");
|
||||
Utils::str_remove(name_level_3, "<b>");
|
||||
Utils::str_remove(name_level_3, "</b>");
|
||||
Gtk::Revealer *revealer = map_menu_level_1[key]->revealer;
|
||||
if (&name_level == &name_level_1 && map_menu_level_1[key]->vec_menu_level_3.size() != 0) {
|
||||
revealerL1->set_reveal_child(false);
|
||||
revealerL2->set_reveal_child(true);
|
||||
this->close_revealer();
|
||||
revealer->set_reveal_child(true);
|
||||
name_level_3 = "";
|
||||
}
|
||||
else if (map_menu_level_1[key]->vec_menu_level_3.size() == 0) {
|
||||
entry->set_text(name_level_1);
|
||||
name_level_3 = "";
|
||||
main_revealer->set_reveal_child(false);
|
||||
}
|
||||
else {
|
||||
main_revealer->set_reveal_child(false);
|
||||
entry->set_text(name_level_1 + name_level_3);
|
||||
}
|
||||
}
|
||||
void Menu_os::to_l1() {
|
||||
revealerL1->set_reveal_child(true);
|
||||
revealerL2->set_reveal_child(false);
|
||||
map_menu_level_1[key_global]->revealer->set_reveal_child(false);
|
||||
key_global = "";
|
||||
}
|
||||
|
||||
void Menu_os::html_last_launched_os(string name_os, Gtk::Label *label) {
|
||||
string margin_name_os = "";
|
||||
size_t index_find = this->str_last_launched_os.find(">");
|
||||
size_t len_last_launched_os = this->str_last_launched_os.length();
|
||||
if (index_find != string::npos) {
|
||||
string level_1 = this->str_last_launched_os.substr(0, index_find + 1);
|
||||
string level_3 = this->str_last_launched_os.substr(index_find + 1, len_last_launched_os - 1);
|
||||
if (name_os == level_1) {
|
||||
margin_name_os = "<b>" + name_os + "</b>";
|
||||
label->set_markup(margin_name_os);
|
||||
}
|
||||
else if (name_os == level_3) {
|
||||
margin_name_os = "<b>" + name_os + "</b>";
|
||||
label->set_markup(margin_name_os);
|
||||
}
|
||||
else {
|
||||
label->set_text(name_os);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this->str_last_launched_os == name_os) {
|
||||
margin_name_os = "<b>" + name_os + "</b>";
|
||||
label->set_markup(margin_name_os);
|
||||
}
|
||||
else {
|
||||
label->set_text(name_os);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
#ifndef Menu_os_H
|
||||
#define Menu_os_H
|
||||
#include <gtkmm.h>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "util.h"
|
||||
using namespace std;
|
||||
|
||||
class Menu_os
|
||||
{
|
||||
private:
|
||||
Glib::RefPtr<Gtk::Builder> builder;
|
||||
vector<tuple<string, vector<string>>> vec_list_os;
|
||||
|
||||
Gtk::Revealer *revealerL1;
|
||||
Gtk::Revealer *revealerL2;
|
||||
Gtk::Button *btnToLev1;
|
||||
Gtk::Revealer *main_revealer;
|
||||
string str_last_launched_os = "";
|
||||
private:
|
||||
string name_level_1 = "";
|
||||
string name_level_3 = "";
|
||||
string key_global = "";
|
||||
Gtk::Entry *entry;
|
||||
string path_glade = "";
|
||||
Gtk::Box *boxALLL3;
|
||||
Gtk::Box *boxLevel1;
|
||||
Gtk::Button *btnOpenMenuOS;
|
||||
struct struct_menu_level_3 {
|
||||
Gtk::Button *btnToL3;
|
||||
Gtk::Label *lblToL3;
|
||||
Glib::RefPtr<Gtk::Builder> builder_level_3;
|
||||
Glib::RefPtr<Gtk::StyleContext> btnToL3_css;
|
||||
};
|
||||
struct struct_menu_level1 {
|
||||
Gtk::Label *lblRevL1;
|
||||
Gtk::Button *btnToL2AndLv3;
|
||||
Gtk::MenuButton* btnToL2AndLv3Image;
|
||||
Gtk::Revealer *revealer;
|
||||
Gtk::Box *boxLevel3;
|
||||
Gtk::Box *boxMenuLevel1;
|
||||
string name;
|
||||
Glib::RefPtr<Gtk::Builder> builder;
|
||||
vector<struct struct_menu_level_3*> vec_menu_level_3;
|
||||
Glib::RefPtr<Gtk::StyleContext> btnToL2AndLv3_css;
|
||||
};
|
||||
|
||||
std::map<string, struct struct_menu_level1*> map_menu_level_1;
|
||||
|
||||
|
||||
public:
|
||||
Menu_os(/* args */);
|
||||
void set_builder(Glib::RefPtr<Gtk::Builder>& builder, string path_glade);
|
||||
void set_map(vector<tuple<string, vector<string>>> &vec_list_os);
|
||||
void init();
|
||||
void show();
|
||||
void close_revealer();
|
||||
void settings();
|
||||
void html_last_launched_os(string name_os, Gtk::Label *label);
|
||||
void set_last_launched_os(string str_last_launched_os);
|
||||
void set_entry(Gtk::Entry *entry);
|
||||
void event_template(Gtk::Label* label, string& name_level, string& key);
|
||||
void event();
|
||||
void set_main_revealer(Gtk::Revealer *revealer);
|
||||
void set_btnOpenMenuOS(Gtk::Button *btnOpenMenuOS);
|
||||
void to_l1();
|
||||
~Menu_os();
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
#include "my_process.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace My_Process {
|
||||
#define debug false
|
||||
struct Utils::Result<string> My_Process_call::call(string cmd) {
|
||||
this->i_error_old = this->i_error;
|
||||
struct Utils::Result<string> obj_result;
|
||||
string response = Utils::call(cmd);
|
||||
obj_result.response = response;
|
||||
if ((response.find("(null)") == std::string::npos) && (response.length() != 0 )) {
|
||||
if (response.find("=") != std::string::npos) {
|
||||
if (response.find("\n") != std::string::npos) {
|
||||
response = response.substr(response.find("=")+1,response.length());
|
||||
response = response.substr(0,response.find("\n"));
|
||||
obj_result.response = response;
|
||||
obj_result.error = 0;
|
||||
}
|
||||
else {
|
||||
obj_result.error = 1;
|
||||
this->i_error += 1;
|
||||
this->log_mess_error(cmd);
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj_result.error = 2;
|
||||
this->i_error += 1;
|
||||
str_cmd_error = cmd;
|
||||
this->log_mess_error(cmd);
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj_result.error = 3;
|
||||
this->i_error += 1;
|
||||
str_cmd_error = cmd;
|
||||
this->log_mess_error(cmd);
|
||||
}
|
||||
return obj_result;
|
||||
}
|
||||
|
||||
int My_Process::get_count_error() {
|
||||
return this->i_error;
|
||||
}
|
||||
|
||||
void My_Process::set_back_count_error() {
|
||||
this->i_error = this->i_error_old;
|
||||
}
|
||||
|
||||
void My_Process_system::call(string cmd, string thread_str = "") {
|
||||
string cmd_new = cmd + " " + thread_str;
|
||||
int response_cmd = system(cmd_new.c_str());
|
||||
if (response_cmd != 0) {
|
||||
this->i_error += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void My_Process::set_count_error(int count_error) {
|
||||
this->i_error = count_error;
|
||||
this->str_cmd_error = "";
|
||||
}
|
||||
|
||||
void My_Process::log_mess_error(string) {
|
||||
}
|
||||
|
||||
string My_Process::get_cmd_error() {
|
||||
return this->str_cmd_error;
|
||||
}
|
||||
string My_Process_call::call_all_sections(string cmd) {
|
||||
char buffer[PATH_MAX] = {0};
|
||||
std::string result = "";
|
||||
FILE* pipe = popen(cmd.c_str(), "r");
|
||||
if (!pipe) throw std::runtime_error("popen() failed!");
|
||||
try {
|
||||
while (fgets(buffer, sizeof buffer, pipe) != NULL) {
|
||||
result += buffer;
|
||||
}
|
||||
} catch (...) {
|
||||
pclose(pipe);
|
||||
throw;
|
||||
}
|
||||
pclose(pipe);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
#ifndef SAVE_H
|
||||
#define SAVE_H
|
||||
|
||||
#include "util.h"
|
||||
namespace My_Process{
|
||||
class My_Process {
|
||||
public:
|
||||
int i_error = 0;
|
||||
int i_error_old = 0;
|
||||
string str_cmd_error = "";
|
||||
int get_count_error();
|
||||
void set_count_error(int count_error);
|
||||
void set_back_count_error();
|
||||
void log_mess_error(string);
|
||||
string get_cmd_error();
|
||||
};
|
||||
|
||||
|
||||
class My_Process_call: public My_Process {
|
||||
public:
|
||||
struct Utils::Result<string> call(string cmd);
|
||||
string call_all_sections(string cmd);
|
||||
|
||||
};
|
||||
|
||||
class My_Process_system: public My_Process {
|
||||
public:
|
||||
void call(string cmd, string thread_str);
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@ -1,165 +0,0 @@
|
||||
#include "save.h"
|
||||
|
||||
namespace Lib_save {
|
||||
|
||||
vector<string> Save::get_error() {
|
||||
return this->vec_errors;
|
||||
}
|
||||
|
||||
bool Save::get_state_save() {
|
||||
return this->flag_no_save;
|
||||
}
|
||||
|
||||
void Save::set_data_global(std::map <string, string> &map_global) {
|
||||
this->map_global = &map_global;
|
||||
}
|
||||
|
||||
void Save::set_data_local(std::map <string, string> &map_local) {
|
||||
this->map_local = &map_local;
|
||||
}
|
||||
|
||||
void Save::set_data_gui(std::map <string, string> &map_gui) {
|
||||
this->map_gui = &map_gui;
|
||||
}
|
||||
|
||||
bool Save::check_save(string flag_save, string key_name) {
|
||||
std::map <string, string>:: iterator iter_map_data;
|
||||
std::map <string, string>:: iterator iter_map_data_old;
|
||||
std::map <string, string> *map_data_old=NULL;
|
||||
if (flag_save == "system") {
|
||||
map_data_old = map_local;
|
||||
}
|
||||
else if (flag_save == "global") {
|
||||
map_data_old = map_global;
|
||||
}
|
||||
iter_map_data = (*map_gui).find(key_name);
|
||||
iter_map_data_old = (*map_data_old).find(key_name);
|
||||
if ((*map_local).find(key_name) != (*map_local).end() && (*map_global).find(key_name) != (*map_global).end()) {
|
||||
if ((*map_local)[key_name] != (*map_global)[key_name]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) {
|
||||
return true;
|
||||
}
|
||||
else if (iter_map_data->second != iter_map_data_old->second) {
|
||||
return true;
|
||||
}
|
||||
else if (iter_map_data->second.length() == 0 && iter_map_data_old->second.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
else if (iter_map_data->second == iter_map_data_old->second) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Save::wrapper_check_save(string flag_save, string key_name) {
|
||||
if (flag_save == "all") {
|
||||
bool bool_flag_save = this->check_save("system", key_name);
|
||||
if (bool_flag_save) {
|
||||
return true;
|
||||
}
|
||||
return this->check_save("global", key_name);
|
||||
}
|
||||
else {
|
||||
return this->check_save(flag_save, key_name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int Save::get_count_error() {
|
||||
return process.get_count_error();
|
||||
}
|
||||
|
||||
string Save::get_cmd_error() {
|
||||
return process.get_cmd_error();
|
||||
}
|
||||
|
||||
void Save::set_count_error(int count_error) {
|
||||
process.set_count_error(count_error);
|
||||
}
|
||||
|
||||
void Save::set_vec_params(vector<string>& vec_param_names) {
|
||||
this->vec_param_names = &vec_param_names;
|
||||
}
|
||||
|
||||
void Save::save(string sections, string str_flag_save) {
|
||||
string key = "";
|
||||
string value = "";
|
||||
string cmd = "";
|
||||
string str_error = "";
|
||||
this->flag_no_save = true;
|
||||
for (const auto &key: *vec_param_names) {
|
||||
if (map_gui->find(key) != map_gui->end()) {
|
||||
value = (*map_gui)[key];
|
||||
if (this->wrapper_check_save(str_flag_save, key)) {
|
||||
if (value.length() != 0) {
|
||||
cmd = "ubconfig --target " + str_flag_save + " set " + sections + " " +
|
||||
key + "=\"" + value + "\"";
|
||||
}
|
||||
else if (value.length() == 0) {
|
||||
cmd = "ubconfig --target " + str_flag_save + " remove " + sections + " " + key;
|
||||
}
|
||||
else {
|
||||
cmd = "";
|
||||
}
|
||||
if (cmd.length() != 0) {
|
||||
process.call(cmd, "");
|
||||
this->flag_no_save = false;
|
||||
str_error = process.get_cmd_error();
|
||||
if (str_error.length() != 0) {
|
||||
this->vec_errors.push_back(str_error);
|
||||
str_error = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void Save::save_one_cmd(string cmd1, string cmd_remove, string str_flag_save) {
|
||||
string key = "";
|
||||
string value = "";
|
||||
string cmd = "";
|
||||
this->flag_no_save = true;
|
||||
cmd = cmd1;
|
||||
string remove = cmd_remove;
|
||||
for (const auto &key: *vec_param_names) {
|
||||
if (map_gui->find(key) != map_gui->end()) {
|
||||
value = (*map_gui)[key];
|
||||
if (this->wrapper_check_save(str_flag_save, key)) {
|
||||
if (value.length() != 0) {
|
||||
cmd = cmd + key + "=\"" + value + "\" ";
|
||||
}
|
||||
else if (value.length() == 0) {
|
||||
remove = remove + key + " ";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cmd.length() != cmd1.length()) {
|
||||
this->template_save(cmd);
|
||||
}
|
||||
if (cmd_remove.length() != remove.length()) {
|
||||
this->template_save(remove);
|
||||
}
|
||||
}
|
||||
|
||||
void Save::template_save(string cmd) {
|
||||
string str_error = "";
|
||||
process.call(cmd, "");
|
||||
this->flag_no_save = false;
|
||||
str_error = process.get_cmd_error();
|
||||
if (str_error.length() != 0) {
|
||||
this->vec_errors.push_back(str_error);
|
||||
str_error = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
#ifndef MY_PROCESS_H
|
||||
#define MY_PROCESS_H
|
||||
|
||||
#include "my_process.h"
|
||||
namespace Lib_save {
|
||||
|
||||
class Save {
|
||||
private:
|
||||
std::map <string, string> *map_global;
|
||||
std::map <string, string> *map_local;
|
||||
std::map <string, string> *map_gui;
|
||||
vector<string> vec_errors;
|
||||
vector<string>* vec_param_names;
|
||||
My_Process::My_Process_system process = My_Process::My_Process_system();
|
||||
bool flag_no_save;
|
||||
void template_save(string cmd);
|
||||
public:
|
||||
void set_data_global(std::map <string, string> &map_global);
|
||||
void set_data_local(std::map <string, string> &map_local);
|
||||
void set_data_gui(std::map <string, string> &map_gui);
|
||||
bool check_save(string flag_save, string key_name);
|
||||
bool get_state_save();
|
||||
bool wrapper_check_save(string flag_save, string key_name);
|
||||
void save_one_cmd(string cmd1, string cmd_remove, string str_flag_save);
|
||||
int get_count_error();
|
||||
string get_cmd_error();
|
||||
void set_count_error(int count_error);
|
||||
void set_vec_params(vector<string>& vec_param_names);
|
||||
void save(string sections, string str_flag_save) ;
|
||||
vector<string> get_error();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@ -1 +0,0 @@
|
||||
#cmakedefine WEBKIT_FOUND
|
||||
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
#cmakedefine WEBKIT_FOUND
|
||||
@ -0,0 +1,3 @@
|
||||
|
||||
#define TITLE_LABEL _("ubl-settings-bootloader")
|
||||
#define TITLE_INFO_LABEL _("TEMPLATE configuration")
|
||||
@ -1,91 +0,0 @@
|
||||
#include "ubl-util-standard.h"
|
||||
#ifndef __cplusplus
|
||||
#ifndef UBL_GET_STANDARD_UI
|
||||
#define UBL_GET_STANDARD_UI
|
||||
|
||||
|
||||
inline returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id){
|
||||
returnstruct *ret=(returnstruct*)malloc(sizeof(returnstruct*));
|
||||
if (left_plug_id>0&&LeftWidget){
|
||||
GtkWidget *plug=gtk_plug_new(left_plug_id);
|
||||
GtkWidget *toplug=LeftWidget;
|
||||
if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
|
||||
g_object_ref(G_OBJECT(toplug));
|
||||
GtkWidget *parent=gtk_widget_get_parent(toplug);
|
||||
gtk_container_remove(GTK_CONTAINER(parent),toplug);
|
||||
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||
} else
|
||||
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||
gtk_widget_show(GTK_WIDGET(plug));
|
||||
ret->plugLeft=plug;
|
||||
}
|
||||
if (right_plug_id>0&&RightWidget){
|
||||
GtkWidget *plug=gtk_plug_new(right_plug_id);
|
||||
GtkWidget *toplug=RightWidget;
|
||||
if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
|
||||
g_object_ref(G_OBJECT(toplug));
|
||||
GtkWidget *parent=gtk_widget_get_parent(toplug);
|
||||
gtk_container_remove(GTK_CONTAINER(parent),toplug);
|
||||
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||
} else
|
||||
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||
gtk_widget_show(GTK_WIDGET(plug));
|
||||
ret->plugRight=plug;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
|
||||
inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id){
|
||||
if (left_plug_id>0&&LeftWidget){
|
||||
GtkWidget *plug=gtk_plug_new(left_plug_id);
|
||||
GtkWidget *toplug=GTK_WIDGET(LeftWidget->gobj());
|
||||
{GdkScreen *screen = gtk_widget_get_screen(plug);
|
||||
gtk_widget_set_app_paintable(plug,TRUE);
|
||||
GdkVisual *colormap = gdk_screen_get_rgba_visual(screen);
|
||||
gtk_widget_set_visual(plug, colormap);}
|
||||
{GdkScreen *screen = gtk_widget_get_screen(toplug);
|
||||
gtk_widget_set_app_paintable(toplug,TRUE);
|
||||
GdkVisual *colormap = gdk_screen_get_rgba_visual(screen);
|
||||
gtk_widget_set_visual(toplug, colormap);}
|
||||
if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
|
||||
g_object_ref(G_OBJECT(toplug));
|
||||
GtkWidget *parent=gtk_widget_get_parent(toplug);
|
||||
gtk_container_remove(GTK_CONTAINER(parent),toplug);
|
||||
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||
} else
|
||||
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||
gtk_widget_show(GTK_WIDGET(plug));
|
||||
gtk_style_context_add_class(gtk_widget_get_style_context(plug),"bkim");
|
||||
gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"bkim");
|
||||
gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar");
|
||||
}
|
||||
if (right_plug_id>0&&RightWidget){
|
||||
GtkWidget *plug=gtk_plug_new(right_plug_id);
|
||||
GtkWidget *toplug=GTK_WIDGET(RightWidget->gobj());
|
||||
{GdkScreen *screen = gtk_widget_get_screen(plug);
|
||||
gtk_widget_set_app_paintable(plug,TRUE);
|
||||
GdkVisual *colormap = gdk_screen_get_rgba_visual(screen);
|
||||
gtk_widget_set_visual(plug, colormap);}
|
||||
{GdkScreen *screen = gtk_widget_get_screen(toplug);
|
||||
gtk_widget_set_app_paintable(toplug,TRUE);
|
||||
GdkVisual *colormap = gdk_screen_get_rgba_visual(screen);
|
||||
gtk_widget_set_visual(toplug, colormap);}
|
||||
if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
|
||||
g_object_ref(G_OBJECT(toplug));
|
||||
GtkWidget *parent=gtk_widget_get_parent(toplug);
|
||||
gtk_container_remove(GTK_CONTAINER(parent),toplug);
|
||||
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||
} else
|
||||
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||
gtk_widget_show(GTK_WIDGET(plug));
|
||||
gtk_style_context_add_class(gtk_widget_get_style_context(plug),"bkim");
|
||||
gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"bkim");
|
||||
gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1,20 +0,0 @@
|
||||
#ifndef __cplusplus
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkx.h>
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *plugLeft;
|
||||
GtkWidget *plugRight;
|
||||
|
||||
|
||||
} returnstruct;
|
||||
static returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id);
|
||||
#else
|
||||
#include <gtkmm.h>
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gtkmm/window.h>
|
||||
#include <gtkmm/plug.h>
|
||||
|
||||
|
||||
static void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id);
|
||||
#endif
|
||||
@ -1,166 +1,139 @@
|
||||
.textHead{
|
||||
text-shadow: 2px 2px @theme_bg_color;
|
||||
color: @theme_text_color;
|
||||
}
|
||||
.boxInfoMessError{
|
||||
background-color: #ea9999;
|
||||
}
|
||||
.boxInfoMessOK{
|
||||
background-color: #f3f0ac;
|
||||
}
|
||||
.bannerbackground {
|
||||
background-color: #404040;
|
||||
.thin {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
.view_app {
|
||||
background-color: @theme_bg_color;
|
||||
.noborder {
|
||||
border:none;
|
||||
}
|
||||
.view_app.view.cell:selected {
|
||||
background-color:@theme_selected_bg_color;
|
||||
color:@theme_selected_text_color;
|
||||
transition: 10ms ease-out;
|
||||
border-radius: 3px;
|
||||
.nobackground {
|
||||
background:transparent;
|
||||
}
|
||||
#GnomeIcon{
|
||||
border-style:solid;
|
||||
border-bottom-width: 1px;
|
||||
border-image: linear-gradient(90deg, alpha(@theme_text_color,0.4) 55%, alpha(@theme_bg_color, 0) 100%);
|
||||
border-image-slice: 1;
|
||||
.nobackground:active {
|
||||
background:transparent;
|
||||
}
|
||||
|
||||
#SepIcon{
|
||||
background-color: alpha(@theme_text_color, 0.6);
|
||||
.textHead{
|
||||
text-shadow: 2px 2px @theme_bg_color;
|
||||
color: @theme_text_color;
|
||||
}
|
||||
|
||||
#iconlabel {
|
||||
font-size:14px;
|
||||
font-weight: bold;
|
||||
|
||||
.inherited>* {
|
||||
border:none;
|
||||
background:inherit;
|
||||
}
|
||||
.roundborder * {
|
||||
border-width:0px;
|
||||
border-radius:5px;
|
||||
}
|
||||
.noborder {
|
||||
border: none;
|
||||
}
|
||||
.menu:hover {
|
||||
border-color:alpha(@theme_text_color, 0.01);
|
||||
}
|
||||
.menu {
|
||||
border-color:alpha(@theme_text_color, 0.01);
|
||||
}
|
||||
.menu:hover >* {
|
||||
border-color:alpha(@theme_text_color, 0.01);
|
||||
.workingbg {
|
||||
background:@theme_base_color;
|
||||
}
|
||||
.menuitembottom{
|
||||
margin-top:0px;
|
||||
margin-bottom:3px;
|
||||
}
|
||||
.menuitemmiddle{
|
||||
margin-top:0px;
|
||||
margin-bottom:0px;
|
||||
}
|
||||
margin-top:0px;
|
||||
margin-bottom:3px;
|
||||
border-color:inherit;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
}
|
||||
.menuitemmiddle{
|
||||
margin-top:0px;
|
||||
margin-bottom:0px;
|
||||
border-color:inherit;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
}
|
||||
|
||||
.menuitemtop{
|
||||
margin-bottom:0px;
|
||||
}
|
||||
.menuitemtop *{
|
||||
margin:2px 2px 0 2px;
|
||||
padding: 5px 10px 3px 5px;
|
||||
}
|
||||
.menuitemmiddle *{
|
||||
margin:0 2px 0 2px;
|
||||
padding: 3px 10px 3px 5px;
|
||||
}
|
||||
.menuitembottom *{
|
||||
margin:0 2px 2px 2px;
|
||||
padding: 3px 10px 5px 5px;
|
||||
}
|
||||
.menuitemtop:hover {
|
||||
background:@theme_bg_color;
|
||||
border-color:inherit;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
}
|
||||
.menuitemmiddle:hover {
|
||||
background:@theme_bg_color;
|
||||
border-color:inherit;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
}
|
||||
.menuitembottom:hover {
|
||||
background:@theme_bg_color;
|
||||
border-color:inherit;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
|
||||
}
|
||||
.menuitemtop:hover* {
|
||||
margin:2px 2px 0 2px;
|
||||
padding: 5px 10px 3px 5px;
|
||||
background:@theme_selected_bg_color;
|
||||
border-radius:2px;
|
||||
}
|
||||
.menuitemmiddle:hover* {
|
||||
margin:0 2px 0 2px;
|
||||
padding: 3px 10px 3px 5px;
|
||||
background:@theme_selected_bg_color;
|
||||
border-radius:2px;
|
||||
}
|
||||
.menuitembottom:hover* {
|
||||
margin:0 2px 2px 2px;
|
||||
padding: 3px 10px 5px 5px;
|
||||
background:@theme_selected_bg_color;
|
||||
border-radius:2px;
|
||||
.menuitemtop{
|
||||
margin-bottom:0px;
|
||||
border-color:inherit;
|
||||
border-top-width:inherit;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
}
|
||||
.menuitemtop >*{
|
||||
margin:4px 2px 0 2px;
|
||||
padding: 3px 10px 3px 5px;
|
||||
border:transparent;
|
||||
}
|
||||
.menuitemmiddle >*{
|
||||
margin:0 2px 0 2px;
|
||||
padding: 3px 10px 3px 5px;
|
||||
border:transparent;
|
||||
}
|
||||
.menuitembottom >*{
|
||||
margin:0 2px 2px 2px;
|
||||
padding: 3px 10px 3px 5px;
|
||||
}
|
||||
.menuitemtop:hover {
|
||||
background:@theme_bg_color;
|
||||
border-color:inherit;
|
||||
border-top-width:inherit;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
}
|
||||
.menuitemmiddle:hover {
|
||||
background:@theme_bg_color;
|
||||
border-color:inherit;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
}
|
||||
.menuitembottom:hover {
|
||||
background:@theme_bg_color;
|
||||
border-color:inherit;
|
||||
border-bottom-width:0px;
|
||||
border-left-width:inherit;
|
||||
border-right-width:inherit;
|
||||
|
||||
}
|
||||
.menuitemtop:hover>* {
|
||||
margin:4px 2px 0 2px;
|
||||
padding: 3px 10px 3px 5px;
|
||||
background:@theme_selected_bg_color;
|
||||
border-radius:2px;
|
||||
}
|
||||
.menuitemmiddle:hover>* {
|
||||
margin:0 2px 0 2px;
|
||||
padding: 3px 10px 3px 5px;
|
||||
background:@theme_selected_bg_color;
|
||||
border-radius:2px;
|
||||
}
|
||||
.menuitembottom:hover>* {
|
||||
margin:0 2px 2px 2px;
|
||||
padding: 3px 10px 3px 5px;
|
||||
background:@theme_selected_bg_color;
|
||||
border-radius:2px;
|
||||
}
|
||||
.boxInfoMessError{
|
||||
background-color: #ea9999;
|
||||
}
|
||||
|
||||
.workingbg, #workingbg {
|
||||
background-color:@theme_base_color;
|
||||
}
|
||||
.workingbg.view.cell:selected {
|
||||
background-color:@theme_selected_bg_color;
|
||||
}
|
||||
.workingbg.view.cell:hover {
|
||||
background-color:darker(@theme_selected_bg_color);
|
||||
color:@theme_selected_text_color;
|
||||
border-radius:3px;
|
||||
}
|
||||
.bkim {
|
||||
transition: 200ms ease-out;
|
||||
background-image: none;
|
||||
.boxInfoMessOK{
|
||||
background-color: #f3f0ac;
|
||||
}
|
||||
.noborder{
|
||||
border:none;
|
||||
.errorBox {
|
||||
border-width: 2px;
|
||||
border-color: #ea9999;
|
||||
border-style:solid;
|
||||
}
|
||||
|
||||
.bkim{
|
||||
opacity:0.99;
|
||||
border:none;
|
||||
.chosenOutline{
|
||||
transition: 0ms;
|
||||
border-width: 1px;
|
||||
border-color: #f3f0ac;
|
||||
border-style:solid;
|
||||
}
|
||||
|
||||
.bkim_no_plug{
|
||||
background-color: transparent;
|
||||
opacity:0.99;
|
||||
}
|
||||
.thin{
|
||||
margin:0px;
|
||||
padding: 0px;
|
||||
}
|
||||
.nobg{
|
||||
background: none;
|
||||
}
|
||||
.addbg * {
|
||||
background-color: @theme_bg_color;
|
||||
.separatorTop{
|
||||
border-color: darker (@theme_bg_color);
|
||||
border-top-width:1px;
|
||||
border-style:solid;
|
||||
}
|
||||
|
||||
.addbg_revealer * {
|
||||
background-color: @theme_base_color;
|
||||
.separatorBottom{
|
||||
border-color: darker (@theme_bg_color);
|
||||
border-bottom-width:1px;
|
||||
border-style:solid;
|
||||
}
|
||||
.offset_revealer{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: @theme_text_color;
|
||||
|
||||
.marginright image{
|
||||
margin-right: 2px;
|
||||
}
|
||||
.bultar {
|
||||
border:none;
|
||||
}
|
||||
|
||||
treeview row:nth-child(odd) { background-color: #000000; }
|
||||
|
||||
treeview row:nth-child(even) { background-color: #ffffff; }
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue