You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
246 lines
9.1 KiB
246 lines
9.1 KiB
|
|
#include <cstddef>
|
|
#include <iostream>
|
|
#include <gtkmm.h>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <stdio.h>
|
|
#include <gtkmm/stock.h>
|
|
#include <gtkmm/window.h>
|
|
#include <gtkmm/plug.h>
|
|
#include <locale.h>
|
|
#include <libintl.h>
|
|
#include <glibmm/i18n.h>
|
|
#include <map>
|
|
#include "my_cmd.h"
|
|
#include "ubl-util-standard.c"
|
|
#include "util.h"
|
|
#include "save.h"
|
|
#include "load.h"
|
|
#include "ubl-settings-bootloader-cm.h"
|
|
#include <dlfcn.h>
|
|
#ifdef WEBKIT_FOUND
|
|
#include <webkit2/webkit2.h>
|
|
#endif
|
|
#include "my_localization.h"
|
|
|
|
#include "my_process.h"
|
|
using namespace std;
|
|
|
|
extern string path_app;
|
|
extern string app_name;
|
|
extern string path_glade;
|
|
extern string path_css;
|
|
extern int socket_ext_id_I;
|
|
extern int socket_trd_id_I;
|
|
extern const string path_img_head_background;
|
|
extern string version_application;
|
|
extern bool flag_save;
|
|
extern bool flag_save_local;
|
|
extern bool flag_save_global;
|
|
extern bool flag_load_global;
|
|
extern bool flag_lock_help;
|
|
void me_thread(string cmd);
|
|
class CmdArgParser : public Glib::OptionGroup
|
|
{
|
|
public:
|
|
CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help);
|
|
::Window GetSocketID() const;
|
|
|
|
private:
|
|
int m_socketID = 0;
|
|
|
|
};
|
|
|
|
class MainWindow : public Gtk::ApplicationWindow {
|
|
public:
|
|
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
|
|
public:
|
|
ModelColumns() {add(check_button), add(name); add(description); }
|
|
//Gtk::TreeModelColumn<Gtk::CheckButton> check_button;
|
|
Gtk::TreeModelColumn<bool> check_button;
|
|
Gtk::TreeModelColumn<Glib::ustring> name;
|
|
Gtk::TreeModelColumn<Glib::ustring> description;
|
|
};
|
|
ModelColumns m_columns;
|
|
Glib::RefPtr<Gtk::Builder> builder;
|
|
Gtk::SpinButton *spbSecond;
|
|
Gtk::Label *lblInfoSeconds;
|
|
Gtk::Label *lblInfoDefaultDonw;
|
|
Gtk::Label *lblInfoCommand;
|
|
Gtk::Label *lblInfoCommand1;
|
|
Gtk::Label *lblHeaderAboutTopic;
|
|
Gtk::Label *lblInfoCommand2;
|
|
Gtk::Label *lblLoadMenu;
|
|
Gtk::Label *lblInfoInputTerminal;
|
|
Gtk::Label *lblInfoOutputTerminal;
|
|
Gtk::Label *lblHeaderName;
|
|
Gtk::Label *lblInfoHead;
|
|
Gtk::CheckButton *chbVgaText;
|
|
Gtk::CheckButton *chbLoadVariantSelectionTimer;
|
|
Gtk::Entry *entryKernel;
|
|
Gtk::Entry *entryIPT;
|
|
Gtk::Entry *entryOTT;
|
|
Gtk::Box *boxColor;
|
|
Gtk::AboutDialog *aboutWindows;
|
|
Gtk::MenuItem *btnAbout;
|
|
Gtk::MenuItem *btnSynopsis;
|
|
Gtk::MenuItem *btnSaveLocalGlob;
|
|
Gtk::MenuItem *btnSaveLocal;
|
|
Gtk::MenuItem *btnSaveGlob;
|
|
Gtk::MenuItem *btnLoadGlob;
|
|
Gtk::MenuItem *btnLoadLocal;
|
|
Gtk::Button *btnLoad;
|
|
Gtk::Button *btnSave;
|
|
Gtk::Button *btnSettings;
|
|
Gtk::Widget *boxButton;
|
|
Gtk::Widget *boxSave;
|
|
Gtk::Box *boxInfoError;
|
|
Gtk::Box *boxWidgetAll;
|
|
Gtk::Label *lblWarning;
|
|
Gtk::Image *imgInfo;
|
|
Gtk::ButtonBox *btnBoxAboutDialog;
|
|
Gtk::TreeView *treeViewKernel;
|
|
Gtk::TreeView *treeViewIPT;
|
|
Gtk::TreeView *treeViewOTT;
|
|
Gtk::Image *imgBG;
|
|
Gtk::Overlay *overHead;
|
|
Gtk::ComboBoxText *cmbDefaultDonw;
|
|
Gtk::ComboBoxText *cmbDownloadMode;
|
|
Gtk::CheckButton *chbSecurityLogin;
|
|
Gtk::CheckButton *chbPasswordProtecc;
|
|
Gtk::Entry *entrySecurityLogin;
|
|
Gtk::Entry *entryPasswordProtecc;
|
|
Gtk::Label *lblHeadeWndWeb;
|
|
|
|
Gtk::Label *lblwebHeaderName;
|
|
Gtk::Label *lblhelpText;
|
|
Gtk::Label *lblhelpHeader;
|
|
Gtk::CheckButton *chkAlwaysOpenHelp;
|
|
Gtk::Button *btnReadHelp;
|
|
Gtk::Button *btnCancelHelp;
|
|
Gtk::Window *wndShowWeb;
|
|
|
|
std::vector<std::string> vec_Option_kernel;
|
|
std::vector<std::string> vec_Option_IPT;
|
|
std::vector<std::string> vec_Option_OTT;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> list_store_kernel;
|
|
Glib::RefPtr<Gtk::ListStore> list_store_IPT;
|
|
Glib::RefPtr<Gtk::ListStore> list_store_OTT;
|
|
#ifdef WEBKIT_FOUND
|
|
Gtk::Window *wndWeb;
|
|
Gtk::Widget *three;
|
|
WebKitWebView *one;
|
|
#endif
|
|
|
|
void set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store, Gtk::Entry &entry, std::vector<std::string> &vec_Option, int size);
|
|
Gtk::TreeModel::Row row_kernel;
|
|
Gtk::TreeModel::Row row_IPT;
|
|
Gtk::TreeModel::Row row_OTT;
|
|
std::map <string, string> map_cmd_selection;
|
|
std::map <string, string> map_global_cmd_selection;
|
|
std::map <string, string> map_local_cmd_selection;
|
|
|
|
Gtk::Label *lblDownloadMode;
|
|
Lib_save::Save obj_save = Lib_save::Save();
|
|
Lib_Load::Load obj_load = Lib_Load::Load();
|
|
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();
|
|
bool flag_load = false;
|
|
bool flag_save_all = false;
|
|
bool flag_blocked_tree_view = false;
|
|
bool flag_save_block = false;
|
|
bool flag_open_browser = false;
|
|
int index_error = 0;
|
|
size_t size_kernel = 0;
|
|
size_t size_IPT = 0;
|
|
size_t size_OTT = 0;
|
|
Glib::RefPtr<Gtk::StyleContext> boxInfo;
|
|
string str_cmd_error = "";
|
|
template<typename Type>
|
|
struct Result{
|
|
Type response;
|
|
int error;
|
|
};
|
|
std::map <string, string> map_cmd_error;
|
|
|
|
MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder);
|
|
MainWindow(Glib::RefPtr<Gtk::Builder> const& builder);
|
|
~MainWindow();
|
|
void open_browser();
|
|
void get_menu_boot(std::map <string, string> &map_temp);
|
|
void set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size,string key);
|
|
void set_row(Glib::RefPtr<Gtk::ListStore> &list_store, int size, std::string name, bool flag_chbox);
|
|
void get_builder();
|
|
bool gui_exit(GdkEventAny*);
|
|
void init_dict(string flag_load);
|
|
void add_CSS();
|
|
void show_pass();
|
|
void localization();
|
|
void event();
|
|
void settings();
|
|
void fn_event_intelMax1();
|
|
void fn_event_intelMax4();
|
|
void synopsis_show();
|
|
void set_data_cfg();
|
|
void set_active_boot_second();
|
|
void get_download_mode(std::map <string, string> &map_temp);
|
|
void view_add_cell(Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m , std::array<std::vector<std::string>, 5> &arr_view, size_t index);
|
|
void wrapper_system(string cmd, string thread_str);
|
|
struct Result<string> wrapper_call(string cmd);
|
|
void log_mess_error(string &cmd);
|
|
void wrapper_save_all_cfg();
|
|
void wrapper_save_local_cfg();
|
|
void wrapper_save_global_cfg();
|
|
bool save_template(string cmd, string cmd_remove, string flag_save);
|
|
void view_add_colums(Gtk::TreeView &treeView);
|
|
vector<string> read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m);
|
|
void download_local_cfg();
|
|
void template_open_browser();
|
|
void download_globl_cfg();
|
|
void flag_block_gui();
|
|
void info_status_app(string stule);
|
|
bool check_save(string flag_save, string key_name);
|
|
void info_warning_error(int mess);
|
|
int check_root();
|
|
bool focus_out_txt_kernel(GdkEventFocus*);
|
|
bool focus_out_txt_IPT(GdkEventFocus*);
|
|
bool focus_out_txt_OTT(GdkEventFocus*);
|
|
void fill_in_view();
|
|
void set_security_login();
|
|
void get_security_login(std::map <string, string> &map_temp);
|
|
bool check_flag_save(string flag_save);
|
|
void set_download_mode();
|
|
void change_password_protecc();
|
|
bool focus_out_txt_login(GdkEventFocus*);
|
|
void change_security_login();
|
|
void get_default_load(std::map <string, string> &map_temp);
|
|
bool focus_out_txt_password(GdkEventFocus*);
|
|
void get_password_protec(std::map <string, string> &map_temp);
|
|
void set_password_protec();
|
|
void set_entry(Gtk::Entry* entry , std::map<string, string> &map_temp, string key);
|
|
void load_template(std::map<string, string>* map_temp, string cmd);
|
|
vector<string> get_setting_entry_all(string key, std::map <string, string>* map_temp);
|
|
void cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cmd_remove);
|
|
void item_selected_kernel(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
|
|
void item_selected_OTT(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
|
|
void item_selected_IPT(const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&);
|
|
string template_item_selected(int size, Glib::RefPtr<Gtk::ListStore> &list_store);
|
|
};
|
|
|
|
class SettingsPlug : public Gtk::Plug{
|
|
public:
|
|
Gtk::Window *window;
|
|
SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder);
|
|
|
|
private:
|
|
Gtk::Widget *plugBox;
|
|
Gtk::Widget *parent;
|
|
};
|
|
|
|
void help();
|
|
|
|
|