diff --git a/Makefile b/Makefile index cf46ddb..eaaad3a 100644 --- a/Makefile +++ b/Makefile @@ -123,10 +123,10 @@ install: check uninstall @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/images/" "logo-background.png" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg" - @install -Dm644 -t /usr/share/${PKGNAME}/ cmdline-linux.csv + @install -Dm644 -t /usr/share/${PKGNAME}/ grub-cmdline-linux.csv @install -Dm644 -t /usr/share/${PKGNAME}/ grub-terminal-input.csv @install -Dm644 -t /usr/share/${PKGNAME}/ grub-terminal-output.csv - @install -Dm644 -t /usr/share/${PKGNAME}/ grub-melodylist.csv + @install -Dm644 -t /usr/share/${PKGNAME}/ grub-play.csv @if [ -z ${DESTDIR} ]; then \ [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \ update-desktop-database --quiet &>/dev/null || true; \ diff --git a/cmdline-linux.csv b/cmdline-linux.csv deleted file mode 100644 index 1aba2df..0000000 --- a/cmdline-linux.csv +++ /dev/null @@ -1,14 +0,0 @@ -Option,Description -quiet,Downloading without text messages -splash,Show welcome window -noplymouth,Disable Plymouth -acpi=off,Disable ACPI -noapic,Disable APIC -nolapic,Disable local APIC -single,Single User Mode -nomodeset,Disable kernel selection and loading of video drivers -915.enable_dc=0,Disable GPU power management -ahci.mobile_lpm_policy=1,"Maximum performance, power management" -snd-intel-dspcfg.dsp_driver=1,Forced selection of an Intel sound device driver -intel_idle.max_cstate=1,Prevents the processor from going into a deep sleep state -intel_idle.max_cstate=4,Eliminates flickering laptop display on Ultra Voltage processors diff --git a/grub-cmdline-linux.csv b/grub-cmdline-linux.csv new file mode 100644 index 0000000..214b158 --- /dev/null +++ b/grub-cmdline-linux.csv @@ -0,0 +1,14 @@ +Option;Description +quiet;Downloading without text messages +splash;Show welcome window +noplymouth;Disable Plymouth +acpi=off;Disable ACPI +noapic;Disable APIC +nolapic;Disable local APIC +single;Single User Mode +nomodeset;Disable kernel selection and loading of video drivers +915.enable_dc=0;Disable GPU power management +ahci.mobile_lpm_policy=1;Maximum performance, power management +snd-intel-dspcfg.dsp_driver=1;Forced selection of an Intel sound device driver +intel_idle.max_cstate=1;Prevents the processor from going into a deep sleep state +intel_idle.max_cstate=4;Eliminates flickering laptop display on Ultra Voltage processors diff --git a/grub-melodylist.csv b/grub-melodylist.csv deleted file mode 100644 index 79edc2e..0000000 --- a/grub-melodylist.csv +++ /dev/null @@ -1 +0,0 @@ -ubbeep,1 22 333 4444 5555 \ No newline at end of file diff --git a/grub-play.csv b/grub-play.csv new file mode 100644 index 0000000..1c42eb8 --- /dev/null +++ b/grub-play.csv @@ -0,0 +1,2 @@ +Option;Tone code +ubbeep;1 22 333 4444 5555 \ No newline at end of file diff --git a/grub-terminal-input.csv b/grub-terminal-input.csv index 4bd7f47..98148e6 100644 --- a/grub-terminal-input.csv +++ b/grub-terminal-input.csv @@ -1,6 +1,6 @@ -Option,Description -console,PC BIOS & EFI console -serial,Serial terminal -ofconsole,Open Firmware Console -at_keyboard,PC AT Keyboard (Coreboot) -usb_keyboard,USB Keyboard (HID Boot protocol) +Option;Description +console;PC BIOS & EFI console +serial;Serial terminal +ofconsole;Open Firmware Console +at_keyboard;PC AT Keyboard (Coreboot) +usb_keyboard;USB Keyboard (HID Boot protocol) diff --git a/grub-terminal-output.csv b/grub-terminal-output.csv index 30453d6..e4a86fd 100644 --- a/grub-terminal-output.csv +++ b/grub-terminal-output.csv @@ -1,6 +1,6 @@ -Option,Description -console,PC BIOS & EFI console -serial,Serial terminal -ofconsole,Open Firmware Console -gfxterm,Output in graphical mode -vga_text,VGA text output (Coreboot) +Option;Description +console;PC BIOS & EFI console +serial;Serial terminal +ofconsole;Open Firmware Console +gfxterm;Output in graphical mode +vga_text;VGA text output (Coreboot) diff --git a/source/main.cc b/source/main.cc index 4dd1d03..8b88c69 100644 --- a/source/main.cc +++ b/source/main.cc @@ -8,7 +8,12 @@ int main(int argc, char** argv) { string str_cmd_argv = ""; for (int i=1; i 1){ str_argv = argv[1]; } diff --git a/source/save.cc b/source/save.cc index c824093..8fc3d11 100644 --- a/source/save.cc +++ b/source/save.cc @@ -57,6 +57,20 @@ bool Save::check_save(string flag_save, string key_name) { 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(); } @@ -82,7 +96,7 @@ void Save::save(string sections, string str_flag_save) { for (const auto &key: *vec_param_names) { if (map_gui->find(key) != map_gui->end()) { value = (*map_gui)[key]; - if (this->check_save(str_flag_save, key)) { + if (this->wrapper_check_save(str_flag_save, key)) { if (value.length() != 0) { cmd = "ubconfig --target " + str_flag_save + " set " + sections + " " + key + "=\"" + value + "\""; @@ -117,7 +131,7 @@ void Save::save_one_cmd(string cmd1, string cmd_remove, string str_flag_save) { for (const auto &key: *vec_param_names) { if (map_gui->find(key) != map_gui->end()) { value = (*map_gui)[key]; - if (this->check_save(str_flag_save, key)) { + if (this->wrapper_check_save(str_flag_save, key)) { if (value.length() != 0) { cmd = cmd + key + "=\"" + value + "\" "; } diff --git a/source/save.h b/source/save.h index 40b13a1..b268b31 100644 --- a/source/save.h +++ b/source/save.h @@ -20,7 +20,7 @@ public: void set_data_gui(std::map &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(); diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index 7ab2130..a486a47 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -717,10 +717,10 @@ void MainWindow::set_init_data_superuser(std::map &map_temp) { void MainWindow::set_data_csv_melody() { string path_name = ""; - path_name = path_name + path_resources + "/" + "grub-melodylist.csv"; + path_name = path_name + path_resources + "/" + melody_csv; string line; - string all_melody = ""; - string all_melody_old = ""; + string all_melody = "Option;Tone code\n"; + string all_melody_old = "Option;Tone code\n"; string code_melodyes = ""; ifstream in(path_name); if (in.is_open()) { @@ -734,7 +734,7 @@ void MainWindow::set_data_csv_melody() { Gtk::TreeModel::Row row = *iter; code_melodyes = row[m_columns_melody.melody_code] + ""; if (code_melodyes.length() != 0 && (row[m_columns_melody.title] + "").length() != 0) { - all_melody += row[m_columns_melody.title] + "," + code_melodyes + "\n"; + all_melody += row[m_columns_melody.title] + ";" + code_melodyes + "\n"; if (row[m_columns_melody.check_button]) { map_cmd_selection["GRUB_PLAY"] = code_melodyes + ""; } @@ -749,11 +749,7 @@ void MainWindow::set_data_csv_melody() { } } if (all_melody_old != all_melody) { - ofstream fout(path_name, ios_base::out | ios_base::trunc); - if (fout.is_open()) { - fout << all_melody; - fout.close(); - } + Utils::write_file(path_name, all_melody); } } @@ -769,7 +765,7 @@ void MainWindow::set_init_data_melody(std::map &map_temp) { list_store_melody = Gtk::ListStore::create(m_columns_melody); treeViewMelody->set_model(list_store_melody); string path_name = ""; - path_name = path_name + path_resources + "/" + "grub-melodylist.csv"; + path_name = path_name + path_resources + "/" + melody_csv; vector> vec_melody = Utils::read_csv_melody(path_name); bool flag = false; string cgf_code_melody = map_temp["GRUB_PLAY"]; @@ -955,15 +951,11 @@ void MainWindow::set_active_boot_second() { void MainWindow::wrapper_save_all_cfg() { this->set_data_cfg(); - bool _flag_save_global1 = true; - bool _flag_save_local1 = true; - if (flag_save_global == false) { - _flag_save_global1 = this->save_template(global_save, global_remove , "global"); - } - if (flag_save_local == false) { - _flag_save_local1 = this->save_template(system_save, system_remove , "system"); + bool _flag_save_all = true; + if (flag_save_global == false || flag_save_local == false) { + _flag_save_all = this->save_template(all_save, all_remove, "all"); } - if (_flag_save_global1 && _flag_save_local1) { + if (_flag_save_all) { this->info_warning_error(5); } else { diff --git a/source/ubl-settings-bootloader.h b/source/ubl-settings-bootloader.h index 21ec440..36ece7a 100644 --- a/source/ubl-settings-bootloader.h +++ b/source/ubl-settings-bootloader.h @@ -54,7 +54,7 @@ void me_thread(string cmd); #define str_about_1 _("About") #define str_save _("Save") #define str_load _("Load") -#define save_all _("Save in global and local configuration") +#define save_all _("Save configuration") #define save_local _("Save in local configuration") #define save_global _("Save in global configuration") #define load_global _("Load global configuration") @@ -120,16 +120,19 @@ void me_thread(string cmd); #define global_load "ubconfig --default --source global get boot" #define system_load "ubconfig --default --source system get boot" -#define global_save "ubconfig --target global set boot " +#define all_save "ubconfig set boot " +#define all_remove "ubconfig remove boot " +#define global_save "ubconfig --target global --noexecute set boot " #define system_save "ubconfig --target system set boot " -#define global_remove "ubconfig --target global remove boot " +#define global_remove "ubconfig --target global --noexecute remove boot " #define system_remove "ubconfig --target system remove boot " #define link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-bootloader" #define cmd_xdg "xdg-open " #define cmd_execute "su -l %s -c \" DISPLAY=$DISPLAY %s \"" #define icon_checked "com.ublinux.ubl-settings-bootloader.checked" #define icon_warning "com.ublinux.ubl-settings-bootloader.warning" -#define kernel_csv "cmdline-linux.csv" +#define kernel_csv "grub-cmdline-linux.csv" +#define melody_csv "grub-play.csv" #define IPT_csv "grub-terminal-input.csv" #define OTT_csv "grub-terminal-output.csv" #define path_app "/usr/bin/" diff --git a/source/util.cc b/source/util.cc index f2e47de..61c7688 100644 --- a/source/util.cc +++ b/source/util.cc @@ -8,7 +8,7 @@ array, 5> read_csv(const string& filename) { vector vec_opcision; ifstream file(filename); string line; - char delimiter = ','; + char delimiter = ';'; getline(file, line); while (getline(file, line)) { stringstream stream(line); @@ -50,11 +50,20 @@ array, 5> read_csv(const string& filename) { return array_vectors; } +void write_file(string path_name, string data) { + ofstream fout(path_name, ios_base::out | ios_base::trunc); + if (fout.is_open()) { + fout << data; + fout.close(); + } +} + vector> read_csv_melody(const string& filename) { vector> vec_music; ifstream file(filename); string line; - char delimiter = ','; + char delimiter = ';'; + getline(file, line); while (getline(file, line)) { stringstream stream(line); string name; diff --git a/source/util.h b/source/util.h index 59909c2..0267564 100644 --- a/source/util.h +++ b/source/util.h @@ -46,5 +46,6 @@ void str_remove(std::string& source, std::string to_remove); void str_replace_all(string &str_base, string str_find, string str_replace); std::vector split(std::string text, char delim); vector> read_csv_melody(const string& filename); +void write_file(string path_name, string data); } #endif \ No newline at end of file diff --git a/ubl-settings-bootloader.pot b/ubl-settings-bootloader.pot index 7dedcd7..72699a2 100644 --- a/ubl-settings-bootloader.pot +++ b/ubl-settings-bootloader.pot @@ -373,7 +373,7 @@ msgstr "" #: source/ubl-settings-bootloader.h:56 source/ubl-settings-bootloader.h:55 #: source/ubl-settings-bootloader.cc:432 source/ubl-settings-bootloader.cc:302 -msgid "Save in global and local configuration" +msgid "Save configuration" msgstr "" #: source/ubl-settings-bootloader.cc:293 diff --git a/ubl-settings-bootloader_ru.po b/ubl-settings-bootloader_ru.po index 46c2af2..5028f71 100644 --- a/ubl-settings-bootloader_ru.po +++ b/ubl-settings-bootloader_ru.po @@ -391,8 +391,8 @@ msgstr "Сохранить в локальную конфигурацию" #: source/ubl-settings-bootloader.h:56 source/ubl-settings-bootloader.h:55 #: source/ubl-settings-bootloader.cc:432 source/ubl-settings-bootloader.cc:302 -msgid "Save in global and local configuration" -msgstr "Сохранить в глобальную и локальную конфигурацию" +msgid "Save configuration" +msgstr "Сохранить конфигурацию" #: source/ubl-settings-bootloader.cc:293 #, fuzzy