From 602f98c0777d7a956ddb03af5d66ad3c8b67b3c5 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 28 Feb 2023 11:43:47 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD,=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=B7=D0=B0=D0=B3=D0=BE?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=D0=BE=D0=BA=20=D0=BE=D0=BA=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- #ublexec.glade# | 1505 +++++++++++++++++++++++++++++++++++++++++ nohup.out | 0 source/CMakeLists.txt | 2 +- source/main.cc | 2 +- source/ublexec.cc | 95 ++- source/ublexec.h | 8 + ublexec.glade | 176 ++++- ublexec_ru.po | 3 + 8 files changed, 1730 insertions(+), 61 deletions(-) create mode 100644 #ublexec.glade# create mode 100644 nohup.out mode change 100644 => 100755 source/main.cc diff --git a/#ublexec.glade# b/#ublexec.glade# new file mode 100644 index 0000000..15fcf33 --- /dev/null +++ b/#ublexec.glade# @@ -0,0 +1,1505 @@ + + + + + + False + О Программе + False + True + center + ubl-settings-datetime + dialog + True + ublexec + 1.2 + Copyright © 2023 - UBSoft Software LLC + Setting the date and time + https://ublinux.ru/ + Project Home Page + Это приложение распространяется без каких-либо гарантий. +Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. + UBGroup + UBGroup + ublexec + True + gpl-2-0 + + + False + vertical + 2 + + + False + end + + + + + + False + False + 0 + + + + + + + + + + -20 + 19 + 1 + 10 + + + 500 + 400 + False + + + True + False + vertical + + + True + False + Selecting Programs + + + False + True + 0 + + + + + True + True + in + + + False + 5 + 5 + 5 + 5 + 5 + natural + + + True + False + 1 + 1 + 5 + 0 + etched-out + + + True + False + 12 + + + True + False + vertical + + + True + False + start + Graphics + + + False + True + 0 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 1 + + + + + True + False + start + Tools + + + False + True + 2 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 3 + + + + + True + False + start + Internet + + + False + True + 4 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 5 + + + + + True + False + start + Multimedia + + + False + True + 6 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 7 + + + + + True + False + start + Settings + + + False + True + 8 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 9 + + + + + True + False + start + Education + + + False + True + 10 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 11 + + + + + True + False + start + Office + + + False + True + 12 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 13 + + + + + True + False + start + Other + + + False + True + 14 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 15 + + + + + True + False + start + Development + + + False + True + 16 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 17 + + + + + True + False + start + System + + + False + True + 18 + + + + + True + True + 1 + queue + 1 + 1 + 1 + + + + True + True + 19 + + + + + + + + + + True + False + + + + + + + + + + + + True + True + 1 + + + + + True + False + end + start + + + ОК + -1 + -1 + True + True + True + + + True + True + 0 + + + + + Выход + True + True + True + + + True + True + 1 + + + + + False + True + 2 + + + + + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + gtk-media-play + + + False + Внимание! + dialog + + + False + vertical + 2 + + + False + True + end + + + + + + ОК + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + True + False + 10 + 10 + 15 + Select an executable file or program + + + True + True + 2 + + + + + + + False + + + True + False + 0 + none + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + True + True + Synopsis + + + False + True + 2 + + + + + True + True + True + About the program + + + False + True + 3 + + + + + + + + + + + + + + False + + + True + False + vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 69 + ublexec + + + False + True + 0 + + + + + True + False + start + 5 + 5 + 5 + 5 + 6 + 6 + Running applications as a user with a +specified priority + + + + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + vertical + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 0.019999999552965164 + in + + + True + False + 5 + 5 + vertical + + + True + False + + + 145 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + Team + True + 0 + + + False + True + 0 + + + + + 330 + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + True + 1 + + + + + True + True + True + end + 5 + 5 + 5 + 5 + 6 + 6 + + + True + False + center + center + 5 + 5 + 5 + 5 + 6 + 6 + gtk-directory + + + + + False + True + 2 + + + + + True + True + True + end + 5 + 5 + 5 + 5 + 6 + 6 + + + True + False + center + center + 5 + 5 + 5 + 5 + 6 + 6 + edit-select-all + + + + + False + True + 3 + + + + + False + True + 0 + + + + + True + False + 6 + 6 + + + 131 + True + False + 15 + 5 + 15 + 5 + + + False + True + 0 + + + + + True + True + False + start + center + 5 + 5 + 5 + 5 + 6 + True + + + True + False + Run in the terminal emulator + + + + + False + True + 1 + + + + + False + True + 1 + + + + + + + True + False + Command Line + + + + + True + True + 0 + + + + + True + True + 1 + + + + + True + False + 5 + vertical + + + True + False + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + vertical + + + True + False + + + True + True + False + start + center + 5 + 5 + 5 + 5 + 6 + 6 + True + + + True + False + Run as another user + + + + + False + True + 0 + + + + + pkexec + True + True + False + True + rbSu + + + False + True + 1 + + + + + su + True + True + False + True + rbPkexec + + + False + True + 2 + + + + + sudo + True + True + False + True + rbSu + + + False + True + 3 + + + + + 95 + True + False + end + 15 + 5 + 15 + 5 + + + False + True + 4 + + + + + False + True + 0 + + + + + True + False + + + 145 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + User Name + True + 0 + + + False + True + 0 + + + + + 330 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + + + False + True + 1 + + + + + False + True + 1 + + + + + + + True + False + User + + + + + True + True + 0 + + + + + True + True + 2 + + + + + True + False + 5 + vertical + + + True + False + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 5 + 5 + vertical + + + True + True + False + start + center + 5 + 5 + 5 + 5 + 6 + 6 + True + + + True + False + Change startup priority + + + + + False + True + 0 + + + + + True + False + + + 5 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + Priority + True + 0 + + + False + True + 0 + + + + + True + True + 5 + 5 + 5 + 5 + 6 + 6 + adjustment1 + 20 + 0 + 0 + + + True + True + 1 + + + + + True + True + 5 + 5 + 5 + 5 + 6 + 6 + True + + + False + True + 2 + + + + + False + True + 1 + + + + + True + False + + + 65 + True + False + 15 + 5 + 15 + 5 + 0 + + + False + True + 0 + + + + + 145 + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 19 (Low) + True + 0 + + + False + True + 1 + + + + + True + False + end + center + 5 + 5 + 5 + 5 + 6 + 6 + -20 (High) + True + 0 + + + True + True + 3 + + + + + 95 + True + False + end + 15 + 5 + 15 + 5 + + + False + True + 4 + + + + + False + True + 2 + + + + + + + True + False + Priority + + + + + True + True + 0 + + + + + True + True + 3 + + + + + Run + True + True + True + 5 + 5 + 5 + 5 + 6 + 6 + image1 + True + + + False + True + 4 + + + + + True + True + 0 + + + + + True + True + 2 + + + + + + + True + False + True + + + True + False + Ublexec + + + + + True + False + 32 + ublexec + + + + + True + False + + + True + True + False + True + True + none + popInfo + + + + + + False + True + 0 + + + + + end + 1 + + + + + + + False + Пожалуйста выберите Файл + True + center + 500 + 400 + True + dialog + True + True + + + False + vertical + 2 + + + False + end + + + gtk-cancel + True + True + True + True + + + True + True + 0 + + + + + gtk-ok + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + + + + + diff --git a/nohup.out b/nohup.out new file mode 100644 index 0000000..e69de29 diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 82357c3..96395cd 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -10,7 +10,7 @@ add_definitions(${GTK_CFLAGS_OTHER}) find_package(Threads REQUIRED) #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a -g") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wmissing-declarations -fdiagnostics-color=always") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wmissing-declarations -fdiagnostics-color=always -g") set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/source/main.cc b/source/main.cc old mode 100644 new mode 100755 index 0995b90..37d7cdb --- a/source/main.cc +++ b/source/main.cc @@ -65,4 +65,4 @@ int main(int argc, char** argv) return r; } -} +} \ No newline at end of file diff --git a/source/ublexec.cc b/source/ublexec.cc index 10eb8dc..41f48f3 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -110,6 +110,14 @@ void MainWindow::get_builder(){ builder->get_widget("iconDevelopment", iconDevelopment); builder->get_widget("iconSystem", iconSystem); builder->get_widget("lblSystem", lblSystem); + builder->get_widget("lblHeaderName", lblHeaderName); + builder->get_widget("popInfo", popInfo); + builder->get_widget("btnSynopsis", btnSynopsis); + builder->get_widget("btnAbout", btnAbout); + builder->get_widget("aboutWindows", aboutWindows); + builder->get_widget("btnSettings", btnSettings); + builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog); + } void MainWindow::set_icon_array(){ @@ -150,6 +158,9 @@ void MainWindow::add_CSS(){ } void MainWindow::localization(){ + aboutWindows->set_comments(gettext("ublexec")); + aboutWindows->set_website_label(gettext("Project Home Page")); + lblHeaderName->set_text(gettext("ublexec")); this->set_title(gettext("ublexec")); btnStart->set_label(gettext("Run")); wndChooseFileWallpaper->set_title(gettext("Please select File")); @@ -204,6 +215,14 @@ void MainWindow::event(){ iconOther->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Other)); iconDevelopment->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Development)); iconSystem->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_System)); + btnSynopsis->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show)); + btnAbout->signal_clicked().connect([&](){aboutWindows->show();}); + btnSettings->signal_clicked().connect([&](){popInfo->show();}); +} + +void MainWindow::synopsis_show(){ + //wrapper_system("xdg-open https://wiki.ublinux.ru/ru/home"); + } void MainWindow::icon_clear(){ @@ -312,6 +331,7 @@ void MainWindow::settings(){ rbPkexec->set_sensitive(false); rbSu->set_sensitive(false); rbSudo->set_sensitive(false); + btnBoxAboutDialog->set_visible(false); //Gtk::Widget *standartHead; //Gtk::Widget *plugBox; @@ -354,7 +374,7 @@ void MainWindow::close_filemaneg(){ void MainWindow::get_path_filemaneg(){ path_file = wndChooseFileWallpaper->get_filename(); - if (path_file.length()==0){} + if (path_file.length() == 0){} else{ txtCmd->set_text(path_file); this->close_filemaneg(); @@ -420,7 +440,6 @@ void MainWindow::open_list_app(){ else if (str_categor=="System"){ this->tempalte_row(st_app.Name,st_app.Exec, path, list_System); } - } } dialogStartMenu->show_all(); @@ -435,46 +454,28 @@ void MainWindow::start_cmd(){ if (name_app.length()==0 && path_file.length()==0){ user_cmd = txtCmd->get_text(); } - //========================================= if (chbAnotherUser->get_active()){ if (geteuid()!=0){ //chbTerminal->set_active(true); } if (rbPkexec->get_active()){ if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { - str_variants_root = " pkexec --user ${USER} env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; - } else if (chbAnotherUser->get_active()){ str_variants_root = " pkexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; - } else{ str_variants_root = " pkexec --user ${USER} env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; } } else if (rbSu->get_active()){ - if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { - str_variants_root="su "; - } - else if (chbAnotherUser->get_active()){ - str_variants_root="su --user " + cmbUser->get_active_text() + " "; - } - else{ - str_variants_root="su"; - } + chbTerminal->set_active(true); + str_variants_root="su -l " + cmbUser->get_active_text() + " -c \" DISPLAY=$DISPLAY "; } else if (rbSudo->get_active()){ - if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { - str_variants_root="sudo "; - } - else if (chbAnotherUser->get_active()){ - str_variants_root="sudo --user " + cmbUser->get_active_text() + " "; - } - else{ - str_variants_root="sudo "; - } + chbTerminal->set_active(true); + str_variants_root="sudo -u " + cmbUser->get_active_text() + " "; } } if (cbxExecuteEpriority->get_active()){ @@ -487,38 +488,30 @@ void MainWindow::start_cmd(){ } if (chbTerminal->get_active()){ - str_cmd_terminal=" xterm -e "; + str_cmd_terminal = " xterm -e "; } else{ - str_cmd_terminal=""; + str_cmd_terminal = ""; } string cmd = ""; - if (path_file!=""){ + if (path_file != ""){ cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + " xdg-open '" + path_file + "' "; } else if (name_app!=""){ cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + name_app; } else{ - user_cmd = this->str_remove(user_cmd, str_cmd_terminal); - user_cmd = this->str_remove(user_cmd, str_variants_root); - user_cmd = this->str_remove(user_cmd, str_nice_cmd); - string str_del = "xterm -e"; - user_cmd = this->str_remove(user_cmd, str_del); - str_del = "nohup"; + string str_del = " "; user_cmd = this->str_remove(user_cmd, str_del); - str_del = "pkexec --user superadmin env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY"; + vector vec_user_cmd = this->split(user_cmd, ' '); + size_t vec_len = vec_user_cmd.size(); + user_cmd = vec_user_cmd[vec_len-1]; + str_del = "\""; user_cmd = this->str_remove(user_cmd, str_del); - str_del = " &"; - user_cmd = this->str_remove(user_cmd, str_del); - for (int index=-20; index<20; index++){ - str_del = to_string(index); - user_cmd = this->str_remove(user_cmd, str_del); - } - str_del = cmbUser->get_active_text(); - user_cmd = this->str_remove(user_cmd, str_del); - cmd = str_nice_cmd + " nohup " + str_cmd_terminal + str_variants_root + user_cmd ; + if (str_variants_root.find("su -l") != string::npos){ + cmd += "\""; + } } txtCmd->set_text(cmd); @@ -559,13 +552,13 @@ void MainWindow::activ_or_block_other_user(){ cmbUser->set_active(0); cmbUser->set_sensitive(flag); lblInfoUserName->set_sensitive(flag); - if (flag_pkexec==true){ + if (flag_pkexec == true){ rbPkexec->set_sensitive(flag); } - if (flag_su==true){ + if (flag_su == true){ rbSu->set_sensitive(flag); } - if (flag_sudo==true){ + if (flag_sudo == true){ rbSudo->set_sensitive(flag); } } @@ -585,13 +578,13 @@ void MainWindow::pars_dir_bin(){ for (const auto & entry : fs::directory_iterator(path)){ file_name = entry.path().filename().string(); if (file_name=="su"){ - flag_su=true; + flag_su = true; } else if (file_name=="sudo"){ - flag_sudo=true; + flag_sudo = true; } else if (file_name=="pkexec"){ - flag_pkexec=true; + flag_pkexec = true; } } rbPkexec->set_sensitive(flag_pkexec); @@ -610,7 +603,7 @@ void MainWindow::pars_users(){ break; } - if (entry->pw_uid>=1000 && entry->pw_uid!=65534){ + if (entry->pw_uid >= 1000 && entry->pw_uid!=65534){ cmbUser->append(entry->pw_name); } } @@ -630,7 +623,7 @@ vector MainWindow::split(const std::string &s, char delim) { string MainWindow::str_remove(std::string& source, const std::string& to_remove){ auto begin = source.find(to_remove); - if (begin!=std::string::npos){ + if (begin != std::string::npos){ int len_to_remove = to_remove.length(); source.erase(begin, begin+len_to_remove); } diff --git a/source/ublexec.h b/source/ublexec.h index a06c417..9d6f608 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -74,6 +74,7 @@ public: void select_System(); void icon_clear(); void set_icon_array(); + void synopsis_show(); //static void me_thread(string cmd); void unselect_icon(Gtk::IconView *icon_entry); string str_remove(std::string& source, const std::string& to_remove); @@ -147,6 +148,7 @@ public: Gtk::Label *lblOther; Gtk::Label *lblDevelopment; Gtk::Label *lblSystem; + Gtk::Label *lblHeaderName; Gtk::IconView *iconGraphics; Gtk::IconView *iconTools; @@ -159,6 +161,12 @@ public: Gtk::IconView *iconDevelopment; Gtk::IconView *iconSystem; Gtk::IconView *iconEntry; + Gtk::Popover *popInfo; + Gtk::ModelButton *btnAbout; + Gtk::ModelButton *btnSynopsis; + Gtk::AboutDialog *aboutWindows; + Gtk::MenuButton *btnSettings; + Gtk::ButtonBox *btnBoxAboutDialog; Glib::RefPtr list_Graphics; Glib::RefPtr list_Tools; diff --git a/ublexec.glade b/ublexec.glade index 6ecef10..8898c27 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -2,6 +2,59 @@ + + False + + + + + + False + О Программе + False + True + center + ubl-settings-datetime + dialog + True + ublexec + 1.2 + Copyright © 2023 - UBSoft Software LLC + Setting the date and time + https://ublinux.ru/ + Project Home Page + Это приложение распространяется без каких-либо гарантий. +Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. + UBGroup + UBGroup + ublexec + True + gpl-2-0 + + + False + vertical + 2 + + + False + end + + + + + + False + False + 0 + + + + + + + + -20 19 @@ -525,9 +578,65 @@ + + False + + + True + False + 0 + none + + + True + False + 5 + 5 + 5 + 5 + + + True + False + vertical + + + True + True + True + Synopsis + + + False + True + 2 + + + + + True + True + True + About the program + + + False + True + 3 + + + + + + + + + + + + False - UBConfig - ubexec True @@ -807,14 +916,14 @@ specified priority - False + True True 0 - False + True True 1 @@ -1004,14 +1113,14 @@ specified priority - False + True True 0 - False + True True 2 @@ -1237,14 +1346,14 @@ specified priority - False + True True 0 - False + True True 3 @@ -1279,13 +1388,64 @@ specified priority - False + True True 2 + + + True + False + True + + + True + False + Ublexec + + + + + True + False + 32 + ublexec + + + + + True + False + + + True + True + False + True + True + none + popInfo + + + + + + False + True + 0 + + + + + end + 1 + + + + False diff --git a/ublexec_ru.po b/ublexec_ru.po index 926e51a..f3fb935 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -6,6 +6,9 @@ msgid "" msgstr "" +msgid "Project Home Page" +msgstr "Домашняя страница проекта" + msgid "System" msgstr "Система"