|
|
|
@ -162,9 +162,8 @@ void MainWindow::localization(){
|
|
|
|
void MainWindow::event(){
|
|
|
|
void MainWindow::event(){
|
|
|
|
btnFilemaneg->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_filemaneg));
|
|
|
|
btnFilemaneg->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_filemaneg));
|
|
|
|
btnListApp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_list_app));
|
|
|
|
btnListApp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_list_app));
|
|
|
|
btnStart->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::start_cmd));
|
|
|
|
btnStart->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::entry_app));
|
|
|
|
cmbUser->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::changed_user));
|
|
|
|
chbTerminal->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::denamic_cmd));
|
|
|
|
//chbTerminal->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::execute_terminal));
|
|
|
|
|
|
|
|
chbAnotherUser->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::activ_or_block_other_user));
|
|
|
|
chbAnotherUser->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::activ_or_block_other_user));
|
|
|
|
spinPriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_scale_priority));
|
|
|
|
spinPriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_scale_priority));
|
|
|
|
scalePriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_spin_priority));
|
|
|
|
scalePriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_spin_priority));
|
|
|
|
@ -197,9 +196,32 @@ void MainWindow::event(){
|
|
|
|
});
|
|
|
|
});
|
|
|
|
rbSu->signal_toggled().connect(sigc::mem_fun(*this,&MainWindow::nice_hight));
|
|
|
|
rbSu->signal_toggled().connect(sigc::mem_fun(*this,&MainWindow::nice_hight));
|
|
|
|
rbPkexec->signal_toggled().connect(sigc::mem_fun(*this,&MainWindow::nice_hight));
|
|
|
|
rbPkexec->signal_toggled().connect(sigc::mem_fun(*this,&MainWindow::nice_hight));
|
|
|
|
|
|
|
|
cmbUser->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::denamic_cmd));
|
|
|
|
|
|
|
|
rbSudo->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::denamic_cmd));
|
|
|
|
|
|
|
|
txtCmd->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_cmd));
|
|
|
|
|
|
|
|
txtCmd->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_in_txt_cmd));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::focus_in_txt_cmd(GdkEventFocus* event){
|
|
|
|
|
|
|
|
if (user_cmd.length() != 0){
|
|
|
|
|
|
|
|
//txtCmd->set_text(user_cmd);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (name_app.length() != 0){
|
|
|
|
|
|
|
|
//txtCmd->set_text(name_app);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (path_file.length() != 0){
|
|
|
|
|
|
|
|
//txtCmd->set_text(path_file);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
user_cmd = txtCmd->get_text();
|
|
|
|
|
|
|
|
//txtCmd->set_text(user_cmd);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd_old = txtCmd->get_text();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::nice_hight(){
|
|
|
|
void MainWindow::nice_hight(){
|
|
|
|
|
|
|
|
|
|
|
|
Glib::ustring entry_user = cmbUser->get_active_text();
|
|
|
|
Glib::ustring entry_user = cmbUser->get_active_text();
|
|
|
|
if (geteuid() != 0){
|
|
|
|
if (geteuid() != 0){
|
|
|
|
spinPriority->set_range(0,19);
|
|
|
|
spinPriority->set_range(0,19);
|
|
|
|
@ -208,7 +230,8 @@ void MainWindow::nice_hight(){
|
|
|
|
scalePriority->set_value(0);
|
|
|
|
scalePriority->set_value(0);
|
|
|
|
lblTimeEpriorityLow->set_text("19 (Низкий)");
|
|
|
|
lblTimeEpriorityLow->set_text("19 (Низкий)");
|
|
|
|
lblTime4EpriorityHigh->set_text("0 (Высокий)");
|
|
|
|
lblTime4EpriorityHigh->set_text("0 (Высокий)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this->denamic_cmd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -275,6 +298,9 @@ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::List
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
auto app_name_exec = row[m_Columns.app_name_exec];
|
|
|
|
auto app_name_exec = row[m_Columns.app_name_exec];
|
|
|
|
const Glib::ustring description = row[m_Columns.m_col_description];
|
|
|
|
const Glib::ustring description = row[m_Columns.m_col_description];
|
|
|
|
|
|
|
|
path_file = "";
|
|
|
|
|
|
|
|
name_app = "";
|
|
|
|
|
|
|
|
user_cmd = "";
|
|
|
|
txtCmd->set_text(app_name_exec);
|
|
|
|
txtCmd->set_text(app_name_exec);
|
|
|
|
name_app = txtCmd->get_text();
|
|
|
|
name_app = txtCmd->get_text();
|
|
|
|
int len_name_app = name_app.length();
|
|
|
|
int len_name_app = name_app.length();
|
|
|
|
@ -351,6 +377,7 @@ void MainWindow::activ_or_block_execute_epriority(){
|
|
|
|
lblInfoNooPriority->set_sensitive(flag);
|
|
|
|
lblInfoNooPriority->set_sensitive(flag);
|
|
|
|
lblTimeEpriorityLow->set_sensitive(flag);
|
|
|
|
lblTimeEpriorityLow->set_sensitive(flag);
|
|
|
|
lblTime4EpriorityHigh->set_sensitive(flag);
|
|
|
|
lblTime4EpriorityHigh->set_sensitive(flag);
|
|
|
|
|
|
|
|
this->denamic_cmd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::open_filemaneg(){
|
|
|
|
void MainWindow::open_filemaneg(){
|
|
|
|
@ -362,6 +389,8 @@ void MainWindow::close_filemaneg(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_path_filemaneg(){
|
|
|
|
void MainWindow::get_path_filemaneg(){
|
|
|
|
|
|
|
|
name_app = "";
|
|
|
|
|
|
|
|
user_cmd = "";
|
|
|
|
path_file = wndChooseFileWallpaper->get_filename();
|
|
|
|
path_file = wndChooseFileWallpaper->get_filename();
|
|
|
|
if (path_file.length() == 0){}
|
|
|
|
if (path_file.length() == 0){}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
@ -437,14 +466,10 @@ void MainWindow::open_list_app(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::start_cmd(){
|
|
|
|
string MainWindow::start_cmd(string user_cmd=""){
|
|
|
|
string str_cmd_terminal="";
|
|
|
|
string str_cmd_terminal="";
|
|
|
|
string str_variants_root = "";
|
|
|
|
string str_variants_root = "";
|
|
|
|
string str_nice_cmd = "";
|
|
|
|
string str_nice_cmd = "";
|
|
|
|
string user_cmd = "";
|
|
|
|
|
|
|
|
if (name_app.length()==0 && path_file.length()==0){
|
|
|
|
|
|
|
|
user_cmd = txtCmd->get_text();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chbAnotherUser->get_active()){
|
|
|
|
if (chbAnotherUser->get_active()){
|
|
|
|
if (geteuid()!=0){
|
|
|
|
if (geteuid()!=0){
|
|
|
|
//chbTerminal->set_active(true);
|
|
|
|
//chbTerminal->set_active(true);
|
|
|
|
@ -489,10 +514,10 @@ void MainWindow::start_cmd(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (user_cmd.length()==0 && name_app.length()==0 && path_file.length()==0){
|
|
|
|
if (user_cmd.length()==0 && name_app.length()==0 && path_file.length()==0){
|
|
|
|
messageError->show();
|
|
|
|
messageError->show();
|
|
|
|
return;
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (chbTerminal->get_active()){
|
|
|
|
if (chbTerminal->get_active() == true){
|
|
|
|
str_cmd_terminal = "xterm -e ";
|
|
|
|
str_cmd_terminal = "xterm -e ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
@ -505,41 +530,65 @@ void MainWindow::start_cmd(){
|
|
|
|
else if (name_app!=""){
|
|
|
|
else if (name_app!=""){
|
|
|
|
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + name_app;
|
|
|
|
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + name_app;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else if (user_cmd.length()>0){
|
|
|
|
bool flag_xdg = false;
|
|
|
|
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " " + user_cmd;
|
|
|
|
if (user_cmd.find("xdg-open")!=string::npos){
|
|
|
|
}
|
|
|
|
flag_xdg=true;
|
|
|
|
if (cmd.find("-e su ")!=string::npos){
|
|
|
|
}
|
|
|
|
cmd+=" \"";
|
|
|
|
string str_del = " ";
|
|
|
|
|
|
|
|
this->str_remove(user_cmd, str_del);
|
|
|
|
|
|
|
|
str_del = "\"";
|
|
|
|
|
|
|
|
this->str_remove(user_cmd, str_del);
|
|
|
|
|
|
|
|
vector<std::string> vec_user_cmd = this->split(user_cmd, ' ');
|
|
|
|
|
|
|
|
size_t vec_len = vec_user_cmd.size();
|
|
|
|
|
|
|
|
user_cmd = vec_user_cmd[vec_len-1];
|
|
|
|
|
|
|
|
if (flag_xdg==false){
|
|
|
|
|
|
|
|
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + user_cmd;
|
|
|
|
|
|
|
|
if (cmd.find("-e su ") != string::npos){
|
|
|
|
|
|
|
|
cmd += "\"";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " xdg-open " + user_cmd ;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
txtCmd->set_text(cmd);
|
|
|
|
|
|
|
|
cmd += " > /dev/null 2>&1";
|
|
|
|
cmd += " > /dev/null 2>&1";
|
|
|
|
std::thread t(&me_thread, cmd);
|
|
|
|
|
|
|
|
t.detach();
|
|
|
|
return cmd;
|
|
|
|
path_file_name = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::call_app(string &cmd){
|
|
|
|
path_file = "";
|
|
|
|
path_file = "";
|
|
|
|
name_app = "";
|
|
|
|
name_app = "";
|
|
|
|
|
|
|
|
if (cmd.length() != 0){
|
|
|
|
|
|
|
|
std::thread t([&](string cmd){system(cmd.c_str());}, cmd);
|
|
|
|
|
|
|
|
t.detach();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::denamic_cmd(){
|
|
|
|
|
|
|
|
if (chbTerminal->get_active()==true || chbAnotherUser->get_active()==true || cbxExecuteEpriority->get_active()==true){
|
|
|
|
|
|
|
|
if (txtCmd->get_text().length()==0){
|
|
|
|
|
|
|
|
chbTerminal->set_active(false);
|
|
|
|
|
|
|
|
chbAnotherUser->set_active(false);
|
|
|
|
|
|
|
|
cbxExecuteEpriority->set_active(false);
|
|
|
|
|
|
|
|
path_file = "";
|
|
|
|
|
|
|
|
name_app = "";
|
|
|
|
|
|
|
|
user_cmd = "";
|
|
|
|
|
|
|
|
txtCmd->set_text(user_cmd);
|
|
|
|
|
|
|
|
messageError->show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
txtCmd->set_text(this->start_cmd(user_cmd));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
if (user_cmd.length() != 0){
|
|
|
|
|
|
|
|
txtCmd->set_text(this->start_cmd(user_cmd));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void me_thread(string cmd){
|
|
|
|
bool MainWindow::focus_out_txt_cmd(GdkEventFocus* event){
|
|
|
|
system(cmd.c_str());
|
|
|
|
//this->focus_in_txt_cmd(event);
|
|
|
|
|
|
|
|
if (cmd_old!=txtCmd->get_text()){
|
|
|
|
|
|
|
|
user_cmd = txtCmd->get_text();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this->denamic_cmd();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::entry_app(){
|
|
|
|
|
|
|
|
if (name_app.length()==0 && path_file.length()==0){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
string cmd = txtCmd->get_text();
|
|
|
|
|
|
|
|
this->call_app(cmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::changed_user(){
|
|
|
|
void MainWindow::changed_user(){
|
|
|
|
@ -576,14 +625,17 @@ void MainWindow::activ_or_block_other_user(){
|
|
|
|
if (flag_sudo == true){
|
|
|
|
if (flag_sudo == true){
|
|
|
|
rbSudo->set_sensitive(flag);
|
|
|
|
rbSudo->set_sensitive(flag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this->denamic_cmd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::change_scale_priority(){
|
|
|
|
void MainWindow::change_scale_priority(){
|
|
|
|
scalePriority->set_value(spinPriority->get_value_as_int());
|
|
|
|
scalePriority->set_value(spinPriority->get_value_as_int());
|
|
|
|
|
|
|
|
this->denamic_cmd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::change_spin_priority(){
|
|
|
|
void MainWindow::change_spin_priority(){
|
|
|
|
spinPriority->set_value(scalePriority->get_value());
|
|
|
|
spinPriority->set_value(scalePriority->get_value());
|
|
|
|
|
|
|
|
this->denamic_cmd();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::pars_dir_bin(){
|
|
|
|
void MainWindow::pars_dir_bin(){
|
|
|
|
|