Ticket #3044: 3304.diff

File 3304.diff, 4.1 KB (added by richy_rich, 15 years ago)

patch for issue 3044

  • jpeg/JPEGTranslator.cpp

     
    131131}
    132132
    133133
    134 //! Return true if settings were run, false if not
    135 bool
    136 SettingsChangedAlert()
    137 {
    138     // If settings view wasn't already initialized (settings not running)
    139     // and user wants to run settings
    140     if (!gAreSettingsRunning
    141         && (new BAlert("Different settings file",
    142                 "JPEG settings were set to default because of incompatible settings file.",
    143                 "Configure settings", "OK", NULL, B_WIDTH_AS_USUAL,
    144                 B_WARNING_ALERT))->Go() == 0) {
    145         // Create settings window (with no quit on close!), launch
    146         // it and wait until it's closed
    147         TranslatorWindow *window = new TranslatorWindow(false);
    148         window->Show();
    149 
    150         status_t err;
    151         wait_for_thread(window->Thread(), &err);
    152         return true;
    153     }
    154 
    155     return false;
    156 }
    157 
    158 
    159134/*!
    160135    Load settings from config file
    161136    If can't find it make them default and try to save
     
    181156            fclose(file);
    182157            LoadDefaultSettings(settings);
    183158            SaveSettings(settings);
    184             // Tell user settings were changed to default, and ask to run settings panel or not
    185             if (SettingsChangedAlert())
    186                 // User configured settings, load them again
    187                 LoadSettings(settings);
    188159        } else
    189160            fclose(file);
    190161    } else if ((file = fopen(path.Path(), "wb+")) != NULL) {
  • jpeg2000/JPEG2000Translator.cpp

     
    115115}
    116116
    117117
    118 //! Return true if settings were run, false if not
    119 bool
    120 SettingsChangedAlert()
    121 {
    122     // If settings view wasn't already initialized (settings not running)
    123     // and user wants to run settings
    124     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) {
    125         // Create settings window (with no quit on close!), launch it and wait until it's closed
    126         status_t err;
    127         TranslatorWindow *window = new TranslatorWindow(false);
    128         window->Show();
    129         wait_for_thread(window->Thread(), &err);
    130         return true;
    131     }
    132 
    133     return false;
    134 }
    135 
    136 
    137118/*!
    138119    Load settings from config file
    139120    If can't find it make them default and try to save
     
    159140            fclose(file);
    160141            LoadDefaultSettings(settings);
    161142            SaveSettings(settings);
    162             // Tell user settings were changed to default, and ask to run settings panel or not
    163             if (SettingsChangedAlert())
    164                 // User configured settings, load them again
    165                 LoadSettings(settings);
    166143        } else
    167144            fclose(file);
    168145    } else if ((file = fopen(path.Path(), "wb+"))) {
    169146        LoadDefaultSettings(settings);
    170147        fwrite(settings, sizeof(jpeg_settings), 1, file);
    171148        fclose(file);
    172         // Tell user settings were changed to default, and ask to run settings panel or not
    173         if (SettingsChangedAlert())
    174             // User configured settings, load them again
    175             LoadSettings(settings);
    176149    }
    177150}
    178151
     
    13001273            break;
    13011274
    13021275        default:
    1303             (new BAlert("Error", "Unknown color space.", "Quit"))->Go();
     1276            fprintf(stderr, "Unknown color space.\n");
    13041277            return B_ERROR;
    13051278    }
    13061279
     
    14191392                out_color_space = B_RGBA32;
    14201393                converter = read_rgba32;
    14211394            } else {
    1422                 (new BAlert("Error", "Other than RGB with 3 or 4 color "
    1423                     "components not implemented.", "Quit"))->Go();
     1395                fprintf(stderr, "Other than RGB with 3 or 4 color components not implemented.\n");
    14241396                return Error(ins, image, NULL, 0, NULL, B_ERROR);
    14251397            }
    14261398            break;
     
    14361408            }
    14371409            break;
    14381410        case JAS_IMAGE_CS_YCBCR:
    1439             (new BAlert("Error", "color space YCBCR not implemented yet.",
    1440                 "Quit"))->Go();
     1411            fprintf(stderr, "Color space YCBCR not implemented yet.\n");
    14411412            return Error(ins, image, NULL, 0, NULL, B_ERROR);
    14421413            break;
    14431414        case JAS_IMAGE_CS_UNKNOWN:
    14441415        default:
    1445             (new BAlert("Error", "color space unknown.", "Quit"))->Go();
     1416            fprintf(stderr, "Color space unkown. \n");
    14461417            return Error(ins, image, NULL, 0, NULL, B_ERROR);
    14471418            break;
    14481419    }