From 7588b84965869ac56a1ace2a40a7e63e043e463f Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 2 Feb 2023 14:37:43 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B1=D0=B0=D0=B3=20=D1=81=20=D1=84=D0=BB=D0=B0?= =?UTF-8?q?=D0=B3=D0=B0=D0=BC=D0=B8=20=D0=B7=D0=B0=D1=83=D0=BF=D1=81=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D0=B0?= =?UTF-8?q?,=20=D1=84=D0=BB=D0=B0=D0=B3=D0=B8=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D1=8F=D1=8E=D1=82=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ublexec.cc | 24 +++++++++++++++++++++++- source/ublexec.h | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) 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: