display logo image validation errors on the GUI
parent
41c46afcc5
commit
85dea70cba
|
@ -2795,6 +2795,12 @@
|
||||||
"osdSetupReplaceLogoHelp": {
|
"osdSetupReplaceLogoHelp": {
|
||||||
"message": "Customized logo image has to be 288×72 pixels in size containing black and white pixels only on a completely green background."
|
"message": "Customized logo image has to be 288×72 pixels in size containing black and white pixels only on a completely green background."
|
||||||
},
|
},
|
||||||
|
"osdSetupReplaceLogoImageSizeError": {
|
||||||
|
"message": "Invalid image size; expected $1×$2 instead of $3×$4"
|
||||||
|
},
|
||||||
|
"osdSetupReplaceLogoImageColorsError": {
|
||||||
|
"message": "The image contains an invalid color palette (only green, black and white are allowed)"
|
||||||
|
},
|
||||||
"osdSetupUploadFont": {
|
"osdSetupUploadFont": {
|
||||||
"message": "Upload Font"
|
"message": "Upload Font"
|
||||||
},
|
},
|
||||||
|
|
|
@ -173,9 +173,8 @@ var openLogoImage = function() {
|
||||||
expectedHeight = FONT.constants.SIZES.CHAR_HEIGHT
|
expectedHeight = FONT.constants.SIZES.CHAR_HEIGHT
|
||||||
* FONT.constants.LOGO.TILES_NUM_VERT;
|
* FONT.constants.LOGO.TILES_NUM_VERT;
|
||||||
if (img.width != expectedWidth || img.height != expectedHeight) {
|
if (img.width != expectedWidth || img.height != expectedHeight) {
|
||||||
reject("invalid image size; expected "
|
reject(i18n.getMessage("osdSetupReplaceLogoImageSizeError",
|
||||||
+ expectedWidth + "×" + expectedHeight + " instead of "
|
[expectedWidth, expectedHeight, img.width, img.height]));
|
||||||
+ img.width + "×" + img.height);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var canvas = document.createElement('canvas'),
|
var canvas = document.createElement('canvas'),
|
||||||
|
@ -188,7 +187,7 @@ var openLogoImage = function() {
|
||||||
var rgbPixel = ctx.getImageData(x, y, 1, 1).data.slice(0, 3),
|
var rgbPixel = ctx.getImageData(x, y, 1, 1).data.slice(0, 3),
|
||||||
colorKey = rgbPixel.join("-");
|
colorKey = rgbPixel.join("-");
|
||||||
if (!FONT.constants.LOGO.MCM_COLORMAP[colorKey]) {
|
if (!FONT.constants.LOGO.MCM_COLORMAP[colorKey]) {
|
||||||
reject("invalid color palette");
|
reject(i18n.getMessage("osdSetupReplaceLogoImageColorsError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1886,6 +1885,7 @@ TABS.osd.initialize = function (callback) {
|
||||||
FONT.logoPreview($logoPreview);
|
FONT.logoPreview($logoPreview);
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
console.error("error loading image:", error);
|
console.error("error loading image:", error);
|
||||||
|
GUI.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue