diff --git a/source/ublexec.cc b/source/ublexec.cc index 0782862..5204ecc 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include "ublexec.h" using namespace std; @@ -268,6 +269,18 @@ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtrset_text(app_name_exec); name_app = txtCmd->get_text(); + int len_name_app = name_app.length(); + string array_del[] = {"%f","%F","%d","%D","%n","%N"}; + for (auto &del_sim: array_del){ + cout << del_sim << endl; + str_remove(name_app, del_sim); + if (name_app.length()!=len_name_app){ + txtCmd->set_text(name_app); + break; + } + + } + } } @@ -372,7 +385,7 @@ void MainWindow::open_list_app(){ else if (str_categor=="Network"){ this->tempalte_row(st_app.Name,st_app.Exec, path,list_Internet); } - else if (str_categor=="Multimedia" || str_categor== "Video" || str_categor== "Player" || str_categor== "AudioVideo"){ + else if (str_categor== "AudioVideo"){ this->tempalte_row(st_app.Name,st_app.Exec, path, list_Multimedia); } else if (str_categor=="Settings"){ @@ -580,6 +593,15 @@ vector MainWindow::split(const std::string &s, char delim) { return elems; } +string MainWindow::str_remove(std::string& source, const std::string& to_remove){ + auto begin = source.find(to_remove); + if (begin!=std::string::npos){ + int len_to_remove = to_remove.length(); + source.erase(begin, begin+len_to_remove); + } + return source; +} + void MainWindow::pars_apps(){ if (list_app.size()!=0){return;} namespace fs = std::filesystem; diff --git a/source/ublexec.h b/source/ublexec.h index 8abbcf9..a7f5ca3 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -102,6 +102,7 @@ public: void select_Development(); void select_System(); void icon_clear(); + string str_remove(std::string& source, const std::string& to_remove); vector split(const std::string &s, char delim); public: