even mode fixed dialog code

This commit is contained in:
filux 2015-06-28 19:43:10 +02:00
parent 68cfb32e96
commit 455b4731e2
1 changed files with 47 additions and 33 deletions

View File

@ -36,43 +36,57 @@ bool PlatformExceptionHandler::disableBacktrace = false;
const char * getDialogCommand() { const char * getDialogCommand() {
/* /*
if (::system(NULL)) { if (::system(NULL)) {
if (::system("which gdialog") == 0) if (::system("which gdialog") == 0)
return "gdialog"; return "gdialog";
else if (::system("which kdialog") == 0) else if (::system("which kdialog") == 0)
return "kdialog"; return "kdialog";
} }
*/ */
FILE *file;
char file_string [100];
FILE *file = popen("which zenity","r"); file = popen("which zenity","r");
//printf("File #1 [%p]\n",file); //printf("File #1 [%p]\n",file);
if (file != NULL) { if (fgets(file_string, 100, file) != NULL ) {
pclose(file); pclose(file);
return "zenity"; return "zenity";
} }
else if (file != NULL) {
pclose(file);
}
file = popen("which kdialog","r"); file = popen("which kdialog","r");
//printf("File #2 [%p]\n",file); //printf("File #2 [%p]\n",file);
if (file != NULL) { if (fgets(file_string, 100, file) != NULL ) {
pclose(file); pclose(file);
return "kdialog"; return "kdialog";
} }
else if (file != NULL) {
pclose(file);
}
file = popen("which yad","r"); file = popen("which yad","r");
//printf("File #1 [%p]\n",file); //printf("File #3 [%p]\n",file);
if (file != NULL) { if (fgets(file_string, 100, file) != NULL ) {
pclose(file); pclose(file);
return "yad"; return "yad";
} }
else if (file != NULL) {
pclose(file);
}
file = popen("which gdialog","r"); file = popen("which gdialog","r");
//printf("File #1 [%p]\n",file); //printf("File #4 [%p]\n",file);
if (file != NULL) { if (fgets(file_string, 100, file) != NULL ) {
pclose(file); pclose(file);
return "gdialog"; return "gdialog";
} }
else if (file != NULL) {
pclose(file);
}
return NULL; return NULL;
} }
bool showMessage(std::string warning,string writepath) { bool showMessage(std::string warning,string writepath) {
@ -93,10 +107,10 @@ bool showMessage(std::string warning,string writepath) {
//command += " --title \"Error\" --msgbox \"`printf \"" + warning + "\"`\""; //command += " --title \"Error\" --msgbox \"`printf \"" + warning + "\"`\"";
command += " --title \"Error\" "; command += " --title \"Error\" ";
if (dialogCommand == "kdialog") { if (!strcmp(dialogCommand, "kdialog")) {
command += "--textbox " + text_file + " 640 360"; command += "--textbox " + text_file + " 640 360";
} }
else if (dialogCommand == "yad") { else if (!strcmp(dialogCommand, "yad")) {
command += "--text-info --center --wrap --width 640 --height 360 --filename=" + text_file; command += "--text-info --center --wrap --width 640 --height 360 --filename=" + text_file;
} }
else { else {