|
|
|
|
@ -380,25 +380,45 @@ void MainWindow::save_global_local_cfg() {
|
|
|
|
|
|
|
|
|
|
void MainWindow::info_warning_error(int mess) {
|
|
|
|
|
if (error_info > 0 || warning_info > 0) {
|
|
|
|
|
if (cmd_error.length()!=0){
|
|
|
|
|
vector<int> vec_cmd_prob;
|
|
|
|
|
vec_cmd_prob = this->find_all(cmd_error, " ");
|
|
|
|
|
size_t size_vec_prob = vec_cmd_prob.size();
|
|
|
|
|
if (size_vec_prob > 1){
|
|
|
|
|
int index = size_vec_prob - 1;
|
|
|
|
|
index = vec_cmd_prob[index];
|
|
|
|
|
if (index){
|
|
|
|
|
cmd_error = cmd_error.substr(index, cmd_error.length());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
info_status_app("boxInfoMessError");
|
|
|
|
|
imgInfo->set("warning.svg");
|
|
|
|
|
error_info = 0;
|
|
|
|
|
warning_info = 0;
|
|
|
|
|
string mess_error = "";
|
|
|
|
|
if (mess == 0) {
|
|
|
|
|
lblWarning->set_text(_("Local configuration reading error"));
|
|
|
|
|
mess_error = _("Local configuration reading error") + cmd_error;
|
|
|
|
|
lblWarning->set_text(mess_error);
|
|
|
|
|
}
|
|
|
|
|
else if (mess == 1) {
|
|
|
|
|
lblWarning->set_text(_("Global configuration read error"));
|
|
|
|
|
mess_error = _("Global configuration read error") + cmd_error;
|
|
|
|
|
lblWarning->set_text(mess_error);
|
|
|
|
|
}
|
|
|
|
|
else if (mess == 2) {
|
|
|
|
|
lblWarning->set_text(_("Local configuration write error"));
|
|
|
|
|
mess_error = _("Local configuration write error") + cmd_error;
|
|
|
|
|
lblWarning->set_text(mess_error);
|
|
|
|
|
}
|
|
|
|
|
else if (mess == 3) {
|
|
|
|
|
lblWarning->set_text(_("Global configuration write error"));
|
|
|
|
|
mess_error = _("Global configuration write error") + cmd_error;
|
|
|
|
|
lblWarning->set_text(mess_error);
|
|
|
|
|
}
|
|
|
|
|
else if (mess == 4) {
|
|
|
|
|
lblWarning->set_text(_("Error saved local and global configuration"));
|
|
|
|
|
mess_error = _("Error saved local and global configuration") + cmd_error;
|
|
|
|
|
lblWarning->set_text(mess_error);
|
|
|
|
|
}
|
|
|
|
|
cmd_error = "";
|
|
|
|
|
cmd_error_write = "";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
info_status_app("boxInfoMessOK");
|
|
|
|
|
@ -427,8 +447,8 @@ void MainWindow::wrapper_system(string cmd, string thread_str = "") {
|
|
|
|
|
int response_cmd = system(cmd.c_str());
|
|
|
|
|
if (response_cmd != 0) {
|
|
|
|
|
error_info += 1;
|
|
|
|
|
cmd_error_write = cmd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::hardware_clock_global(string &local, string &etc) {
|
|
|
|
|
@ -623,18 +643,21 @@ struct MainWindow::Result<string> MainWindow::wrapper_call(string cmd) {
|
|
|
|
|
obj_result.response = response;
|
|
|
|
|
obj_result.error = 1;
|
|
|
|
|
warning_info += 1;
|
|
|
|
|
cmd_error = cmd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
obj_result.response = response;
|
|
|
|
|
obj_result.error = 2;
|
|
|
|
|
warning_info += 1;
|
|
|
|
|
cmd_error = cmd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
obj_result.response = response;
|
|
|
|
|
obj_result.error = 3;
|
|
|
|
|
warning_info += 1;
|
|
|
|
|
cmd_error = cmd;
|
|
|
|
|
}
|
|
|
|
|
return obj_result;
|
|
|
|
|
}
|
|
|
|
|
@ -998,6 +1021,7 @@ void MainWindow::append_zone() {
|
|
|
|
|
|
|
|
|
|
void MainWindow::update_time_date() {
|
|
|
|
|
string cmd = "";
|
|
|
|
|
string response = "";
|
|
|
|
|
if ((year != 0) && (month != 0) && (day != 0)) {
|
|
|
|
|
string str_month = "";
|
|
|
|
|
string str_day = "";
|
|
|
|
|
@ -1054,7 +1078,9 @@ void MainWindow::post_entry_data() {
|
|
|
|
|
str_month+str_day+"\"";
|
|
|
|
|
string str_error_clock = this->call(cmd);
|
|
|
|
|
size_t index = str_error_clock.find("date:");
|
|
|
|
|
if (index == std::string::npos) {
|
|
|
|
|
if (index != std::string::npos) {
|
|
|
|
|
lblMessage->set_text(_("Incorrect date format"));
|
|
|
|
|
mess_dchp->show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|