Applied patch by richy_rich which removes BAlerts from jpeg

and jpeg2000 translators.
Fixes bug #3044


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31873 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2009-07-28 22:00:09 +00:00
parent 121805b410
commit c212b8f649
2 changed files with 4 additions and 62 deletions
@@ -131,31 +131,6 @@ SaveSettings(jpeg_settings *settings)
} }
//! Return true if settings were run, false if not
bool
SettingsChangedAlert()
{
// If settings view wasn't already initialized (settings not running)
// and user wants to run settings
if (!gAreSettingsRunning
&& (new BAlert("Different settings file",
"JPEG settings were set to default because of incompatible settings file.",
"Configure settings", "OK", NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go() == 0) {
// Create settings window (with no quit on close!), launch
// it and wait until it's closed
TranslatorWindow *window = new TranslatorWindow(false);
window->Show();
status_t err;
wait_for_thread(window->Thread(), &err);
return true;
}
return false;
}
/*! /*!
Load settings from config file Load settings from config file
If can't find it make them default and try to save If can't find it make them default and try to save
@@ -181,10 +156,6 @@ LoadSettings(jpeg_settings *settings)
fclose(file); fclose(file);
LoadDefaultSettings(settings); LoadDefaultSettings(settings);
SaveSettings(settings); SaveSettings(settings);
// Tell user settings were changed to default, and ask to run settings panel or not
if (SettingsChangedAlert())
// User configured settings, load them again
LoadSettings(settings);
} else } else
fclose(file); fclose(file);
} else if ((file = fopen(path.Path(), "wb+")) != NULL) { } else if ((file = fopen(path.Path(), "wb+")) != NULL) {
@@ -115,25 +115,6 @@ SaveSettings(jpeg_settings *settings)
} }
//! Return true if settings were run, false if not
bool
SettingsChangedAlert()
{
// If settings view wasn't already initialized (settings not running)
// and user wants to run settings
if (!gAreSettingsRunning && (new BAlert("Different settings file", "JPEG2000 settings were set to default because of incompatible settings file.", "Configure settings", "OK", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go() == 0) {
// Create settings window (with no quit on close!), launch it and wait until it's closed
status_t err;
TranslatorWindow *window = new TranslatorWindow(false);
window->Show();
wait_for_thread(window->Thread(), &err);
return true;
}
return false;
}
/*! /*!
Load settings from config file Load settings from config file
If can't find it make them default and try to save If can't find it make them default and try to save
@@ -159,20 +140,12 @@ LoadSettings(jpeg_settings *settings)
fclose(file); fclose(file);
LoadDefaultSettings(settings); LoadDefaultSettings(settings);
SaveSettings(settings); SaveSettings(settings);
// Tell user settings were changed to default, and ask to run settings panel or not
if (SettingsChangedAlert())
// User configured settings, load them again
LoadSettings(settings);
} else } else
fclose(file); fclose(file);
} else if ((file = fopen(path.Path(), "wb+"))) { } else if ((file = fopen(path.Path(), "wb+"))) {
LoadDefaultSettings(settings); LoadDefaultSettings(settings);
fwrite(settings, sizeof(jpeg_settings), 1, file); fwrite(settings, sizeof(jpeg_settings), 1, file);
fclose(file); fclose(file);
// Tell user settings were changed to default, and ask to run settings panel or not
if (SettingsChangedAlert())
// User configured settings, load them again
LoadSettings(settings);
} }
} }
@@ -1300,7 +1273,7 @@ Compress(BPositionIO *in, BPositionIO *out)
break; break;
default: default:
(new BAlert("Error", "Unknown color space.", "Quit"))->Go(); fprintf(stderr, "Unknown color space.\n");
return B_ERROR; return B_ERROR;
} }
@@ -1419,8 +1392,7 @@ Decompress(BPositionIO *in, BPositionIO *out)
out_color_space = B_RGBA32; out_color_space = B_RGBA32;
converter = read_rgba32; converter = read_rgba32;
} else { } else {
(new BAlert("Error", "Other than RGB with 3 or 4 color " fprintf(stderr, "Other than RGB with 3 or 4 color components not implemented.\n");
"components not implemented.", "Quit"))->Go();
return Error(ins, image, NULL, 0, NULL, B_ERROR); return Error(ins, image, NULL, 0, NULL, B_ERROR);
} }
break; break;
@@ -1436,13 +1408,12 @@ Decompress(BPositionIO *in, BPositionIO *out)
} }
break; break;
case JAS_IMAGE_CS_YCBCR: case JAS_IMAGE_CS_YCBCR:
(new BAlert("Error", "color space YCBCR not implemented yet.", fprintf(stderr, "Color space YCBCR not implemented yet.\n");
"Quit"))->Go();
return Error(ins, image, NULL, 0, NULL, B_ERROR); return Error(ins, image, NULL, 0, NULL, B_ERROR);
break; break;
case JAS_IMAGE_CS_UNKNOWN: case JAS_IMAGE_CS_UNKNOWN:
default: default:
(new BAlert("Error", "color space unknown.", "Quit"))->Go(); fprintf(stderr, "Color space unkown. \n");
return Error(ins, image, NULL, 0, NULL, B_ERROR); return Error(ins, image, NULL, 0, NULL, B_ERROR);
break; break;
} }