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.
ubl-settings-bootloader/source/ubl-settings-bootloader.h

174 lines
6.4 KiB

#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 "ubl-util-standard.c"
#include "util.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;
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(cmd_get),add(cmd_set_true),add(cmd_set_false),add(check_button), add(name); add(description); }
//Gtk::TreeModelColumn<Gtk::CheckButton> check_button;
Gtk::TreeModelColumn<Glib::ustring> cmd_get;
Gtk::TreeModelColumn<Glib::ustring> cmd_set_true;
Gtk::TreeModelColumn<Glib::ustring> cmd_set_false;
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 *lblInfoCommand2;
Gtk::Label *lblLoadMenu;
Gtk::Label *lblInfoInputTerminal;
Gtk::Label *lblInfoOutputTerminal;
Gtk::Label *lblHeaderName;
Gtk::Label *lblInfoHead;
Gtk::CheckButton *chbVgaText;
Gtk::CheckButton *chbintelMax4;
Gtk::CheckButton *chbintelMax1;
Gtk::CheckButton *chbLoadVariantSelectionTimer;
Gtk::CheckButton *chbLastSelectionWillBecome;
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;
Glib::RefPtr<Gtk::ListStore> list_store_kernel;
Glib::RefPtr<Gtk::ListStore> list_store_IPT;
Glib::RefPtr<Gtk::ListStore> list_store_OTT;
Gtk::TreeModel::Row row_kernel;
Gtk::TreeModel::Row row_IPT;
Gtk::TreeModel::Row row_OTT;
std::map <string, string> map_cmd_selection_kernel;
std::map <string, string> map_cmd_selection_IPT;
std::map <string, string> map_cmd_selection_OTT;
std::map <string, string> map_global_cmd_selection_kernel;
std::map <string, string> map_global_cmd_selection_IPT;
std::map <string, string> map_global_cmd_selection_OTT;
std::map <string, string> map_local_cmd_selection_kernel;
std::map <string, string> map_local_cmd_selection_IPT;
std::map <string, string> map_local_cmd_selection_OTT;
bool flag_load = false;
bool flag_save_all = false;
bool flag_save_global = false;
bool flag_save_local = false;
int index_error = 0;
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);
void get_menu_boot(string cmd);
void set_menu_boot(string cmd);
void get_builder();
void add_CSS();
void localization();
void event();
void settings();
void fn_event_intelMax1();
void fn_event_intelMax4();
void synopsis_show();
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 save_global_local_cfg();
void save_local_cfg();
void view_add_colums(Gtk::TreeView &treeView);
void save_global_cfg();
void read_file_and_view(string file_name ,Gtk::TreeModel::Row &row, Glib::RefPtr<Gtk::ListStore> list_store_m);
void download_local_cfg();
void download_globl_cfg();
void info_status_app(string stule);
void info_warning_error(int mess);
int check_root();
void fill_in_view();
string dynamic_update_entry(std::map<string, string> &map_view, std::map<string, string> &map_global_view, std::map<string, string> &map_local_view) ;
void item_selected_kernel(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&);
void item_selected_OTT(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&);
void item_selected_IPT(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator&);
void template_item_selected(std::map<string, string> &map_view, const Gtk::TreeModel::Path& path, 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();