diff --git a/CHANGELOG.md b/CHANGELOG.md index bead0bd..dd6636e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +# 0.1.3 (04/2024) + +1. the card storage process was completely rewritten and siomplified to resolve reported issues (history model legacy from the Tagger app has been removed) +2. minor fixes related to the CODE-128 +3. CODE-128-mini barcode has been added - this is thge barcode where code types can be mixed to minimize barcode size +4. PICTURE could be selected to show barcode cut from the scanned picture as a last-resort solution, when barcode synthgesys does not work correctly +5. minor UI fixes + # 0.1.2 (02/2024) 1. fixes the editing issue: when editing a card, the last added card (card id in the list: 0) was always erased/replaced, not the intended one (issue #9) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b5fcbe..2020c9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE} DESTINATION ${DESKTOP_ install(DIRECTORY "app/graphics" DESTINATION ${DATA_DIR}) install(DIRECTORY "app/fonts" DESTINATION ${DATA_DIR}) install(DIRECTORY "app/icons" DESTINATION ${DATA_DIR}) +install(DIRECTORY "app/qml/libs" DESTINATION ${DATA_DIR}) install(DIRECTORY "import" DESTINATION ${DATA_DIR}) install(FILES "ubcards.apparmor" DESTINATION ${DATA_DIR}) install(FILES "ubcards-contenthub.json" DESTINATION ${DATA_DIR}) diff --git a/app/fonts/README.md b/app/fonts/README.md index db0d8ae..273cb85 100644 --- a/app/fonts/README.md +++ b/app/fonts/README.md @@ -1,2 +1,5 @@ -# This content comes from the CardWallet App for UBports - * it is licensed unbder BSD license attached \ No newline at end of file +# This directory contains bartcode fonts +* The content of the cardwallet directory comes from the CardWallet App for UBports + * licensed under the [BSD license](cardwallet/LICENSE) +* The content oif the librebarcode directory comes from the [librebarcode project](https://github.com/graphicore/librebarcode/) + * licensed under [OFL license](librebarcode/OFL.txt) diff --git a/app/fonts/Code128_new.ttf b/app/fonts/cardwallet/Code128_new.ttf similarity index 100% rename from app/fonts/Code128_new.ttf rename to app/fonts/cardwallet/Code128_new.ttf diff --git a/app/fonts/Free3of9.ttf b/app/fonts/cardwallet/Free3of9.ttf similarity index 100% rename from app/fonts/Free3of9.ttf rename to app/fonts/cardwallet/Free3of9.ttf diff --git a/app/fonts/I2of5_new.ttf b/app/fonts/cardwallet/I2of5_new.ttf similarity index 100% rename from app/fonts/I2of5_new.ttf rename to app/fonts/cardwallet/I2of5_new.ttf diff --git a/app/fonts/LICENSE b/app/fonts/cardwallet/LICENSE similarity index 100% rename from app/fonts/LICENSE rename to app/fonts/cardwallet/LICENSE diff --git a/app/fonts/ean13_new.ttf b/app/fonts/cardwallet/ean13_new.ttf similarity index 100% rename from app/fonts/ean13_new.ttf rename to app/fonts/cardwallet/ean13_new.ttf diff --git a/app/fonts/librebarcode/LibreBarcode128-Regular.ttf b/app/fonts/librebarcode/LibreBarcode128-Regular.ttf new file mode 100644 index 0000000..15ff2ba Binary files /dev/null and b/app/fonts/librebarcode/LibreBarcode128-Regular.ttf differ diff --git a/app/fonts/librebarcode/LibreBarcode128Text-Regular.ttf b/app/fonts/librebarcode/LibreBarcode128Text-Regular.ttf new file mode 100644 index 0000000..171b36a Binary files /dev/null and b/app/fonts/librebarcode/LibreBarcode128Text-Regular.ttf differ diff --git a/app/fonts/librebarcode/LibreBarcode39-Regular.ttf b/app/fonts/librebarcode/LibreBarcode39-Regular.ttf new file mode 100644 index 0000000..82b173a Binary files /dev/null and b/app/fonts/librebarcode/LibreBarcode39-Regular.ttf differ diff --git a/app/fonts/librebarcode/LibreBarcode39Extended-Regular.ttf b/app/fonts/librebarcode/LibreBarcode39Extended-Regular.ttf new file mode 100644 index 0000000..231afc9 Binary files /dev/null and b/app/fonts/librebarcode/LibreBarcode39Extended-Regular.ttf differ diff --git a/app/fonts/librebarcode/LibreBarcode39ExtendedText-Regular.ttf b/app/fonts/librebarcode/LibreBarcode39ExtendedText-Regular.ttf new file mode 100644 index 0000000..a2a4b4d Binary files /dev/null and b/app/fonts/librebarcode/LibreBarcode39ExtendedText-Regular.ttf differ diff --git a/app/fonts/librebarcode/LibreBarcode39Text-Regular.ttf b/app/fonts/librebarcode/LibreBarcode39Text-Regular.ttf new file mode 100644 index 0000000..bda6d86 Binary files /dev/null and b/app/fonts/librebarcode/LibreBarcode39Text-Regular.ttf differ diff --git a/app/fonts/librebarcode/LibreBarcodeEAN13Text-Regular.ttf b/app/fonts/librebarcode/LibreBarcodeEAN13Text-Regular.ttf new file mode 100644 index 0000000..75f7ea5 Binary files /dev/null and b/app/fonts/librebarcode/LibreBarcodeEAN13Text-Regular.ttf differ diff --git a/app/fonts/librebarcode/OFL.txt b/app/fonts/librebarcode/OFL.txt new file mode 100644 index 0000000..54028f3 --- /dev/null +++ b/app/fonts/librebarcode/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2017-2019 The Libre Barcode Project Authors (https://github.com/graphicore/librebarcode) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/app/qml/encoder.js b/app/qml/encoder.js index b512a86..741d790 100644 --- a/app/qml/encoder.js +++ b/app/qml/encoder.js @@ -41,9 +41,9 @@ function stringToBarcode (type, str) case 'CODE-128': if (/^-?\d+$/.test(str)) { /* Numeric-only codes are type C*/ - return "Ò" + getCodeC(str) + "Ó"; + return "Ò" + getCodeC(str) + "Î"; } else { - return "Ñ" + getCodeB(str) + "Ó"; + return "Ì" + getCodeB(str) + "Î"; } case 'DataBar': diff --git a/app/qml/libs/code128Encoder/OFL.txt b/app/qml/libs/code128Encoder/OFL.txt new file mode 100644 index 0000000..54028f3 --- /dev/null +++ b/app/qml/libs/code128Encoder/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2017-2019 The Libre Barcode Project Authors (https://github.com/graphicore/librebarcode) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/app/qml/libs/code128Encoder/README.md b/app/qml/libs/code128Encoder/README.md new file mode 100644 index 0000000..6541bc8 --- /dev/null +++ b/app/qml/libs/code128Encoder/README.md @@ -0,0 +1,4 @@ +# Code 128 Encoder + +* The content of the librebarcode directory comes from the [librebarcode project](https://github.com/graphicore/librebarcode/) + * licensed under [OFL license](OFL.txt) diff --git a/app/qml/libs/code128Encoder/encoder.mjs b/app/qml/libs/code128Encoder/encoder.mjs new file mode 100644 index 0000000..aef6ba4 --- /dev/null +++ b/app/qml/libs/code128Encoder/encoder.mjs @@ -0,0 +1,473 @@ +/* jshint esversion:6 */ +var data = [ + // the unicode chars are from: + // www.idautomation.com/barcode-fonts/code.128/user-manual.html + // http://www.jtbarton.com/Barcodes/Code128.aspx + // checksum value, pattern, canonical id/name (based on Code Set B) + // (name of the glyph in the font?), [unicode chars], textbelow_flag_or_charcodes + [ 0, ' ', ' ', '00', [' ', 'Â']] + , [ 1, '!', '!', '01', '!'] + , [ 2, '"', '"', '02', '"'] + , [ 3, '#', '#', '03', '#'] + , [ 4, '$', '$', '04', '$'] + , [ 5, '%', '%', '05', '%'] + , [ 6, '&', '&', '06', '&'] + , [ 7, "'", "'", "07", "'"] + , [ 8, '(', '(', '08', '('] + , [ 9, ')', ')', '09', ')'] + , [ 10, '*', '*', '10', '*'] + , [ 11, '+', '+', '11', '+'] + , [ 12, ',', ',', '12', ','] + , [ 13, '-', '-', '13', '-'] + , [ 14, '.', '.', '14', '.'] + , [ 15, '/', '/', '15', '/'] + , [ 16, '0', '0', '16', '0'] + , [ 17, '1', '1', '17', '1'] + , [ 18, '2', '2', '18', '2'] + , [ 19, '3', '3', '19', '3'] + , [ 20, '4', '4', '20', '4'] + , [ 21, '5', '5', '21', '5'] + , [ 22, '6', '6', '22', '6'] + , [ 23, '7', '7', '23', '7'] + , [ 24, '8', '8', '24', '8'] + , [ 25, '9', '9', '25', '9'] + , [ 26, ':', ':', '26', ':'] + , [ 27, ';', ';', '27', ';'] + , [ 28, '<', '<', '28', '<'] + , [ 29, '=', '=', '29', '='] + , [ 30, '>', '>', '30', '>'] + , [ 31, '?', '?', '31', '?'] + , [ 32, '@', '@', '32', '@'] + , [ 33, 'A', 'A', '33', 'A'] + , [ 34, 'B', 'B', '34', 'B'] + , [ 35, 'C', 'C', '35', 'C'] + , [ 36, 'D', 'D', '36', 'D'] + , [ 37, 'E', 'E', '37', 'E'] + , [ 38, 'F', 'F', '38', 'F'] + , [ 39, 'G', 'G', '39', 'G'] + , [ 40, 'H', 'H', '40', 'H'] + , [ 41, 'I', 'I', '41', 'I'] + , [ 42, 'J', 'J', '42', 'J'] + , [ 43, 'K', 'K', '43', 'K'] + , [ 44, 'L', 'L', '44', 'L'] + , [ 45, 'M', 'M', '45', 'M'] + , [ 46, 'N', 'N', '46', 'N'] + , [ 47, 'O', 'O', '47', 'O'] + , [ 48, 'P', 'P', '48', 'P'] + , [ 49, 'Q', 'Q', '49', 'Q'] + , [ 50, 'R', 'R', '50', 'R'] + , [ 51, 'S', 'S', '51', 'S'] + , [ 52, 'T', 'T', '52', 'T'] + , [ 53, 'U', 'U', '53', 'U'] + , [ 54, 'V', 'V', '54', 'V'] + , [ 55, 'W', 'W', '55', 'W'] + , [ 56, 'X', 'X', '56', 'X'] + , [ 57, 'Y', 'Y', '57', 'Y'] + , [ 58, 'Z', 'Z', '58', 'Z'] + , [ 59, '[', '[', '59', '['] + , [ 60, '\\', '\\', '60', '\\'] + , [ 61, ']', ']', '61', ']'] + , [ 62, '^', '^', '62', '^'] + , [ 63, '_', '_', '63', '_'] + , [ 64, 'NUL', '`', '64', '`'] + , [ 65, 'SOH', 'a', '65', 'a'] + , [ 66, 'STX', 'b', '66', 'b'] + , [ 67, 'ETX', 'c', '67', 'c'] + , [ 68, 'EOT', 'd', '68', 'd'] + , [ 69, 'ENQ', 'e', '69', 'e'] + , [ 70, 'ACK', 'f', '70', 'f'] + , [ 71, 'BEL', 'g', '71', 'g'] + , [ 72, 'BS', 'h', '72', 'h'] + , [ 73, 'HT', 'i', '73', 'i'] + , [ 74, 'LF', 'j', '74', 'j'] + , [ 75, 'VT', 'k', '75', 'k'] + , [ 76, 'FF', 'l', '76', 'l'] + , [ 77, 'CR', 'm', '77', 'm'] + , [ 78, 'SO', 'n', '78', 'n'] + , [ 79, 'SI', 'o', '79', 'o'] + , [ 80, 'DLE', 'p', '80', 'p'] + , [ 81, 'DC1', 'q', '81', 'q'] + , [ 82, 'DC2', 'r', '82', 'r'] + , [ 83, 'DC3', 's', '83', 's'] + , [ 84, 'DC4', 't', '84', 't'] + , [ 85, 'NAK', 'u', '85', 'u'] + , [ 86, 'SYN', 'v', '86', 'v'] + , [ 87, 'ETB', 'w', '87', 'w'] + , [ 88, 'CAN', 'x', '88', 'x'] + , [ 89, 'EM', 'y', '89', 'y'] + , [ 90, 'SUB', 'z', '90', 'z'] + , [ 91, 'ESC', '{', '91', '{'] + , [ 92, 'FS', '|', '92', '|'] + , [ 93, 'GS', '}', '93', '}'] + , [ 94, 'RS', '~', '94', '~'] + , [ 95, 'US', 'DEL', '95', 'Ã'] + , [ 96, 'FNC 3', 'FNC 3', '96', 'Ä'] + , [ 97, 'FNC 2', 'FNC 2', '97', 'Å'] + , [ 98, 'Shift B', 'Shift A', '98', 'Æ'] + , [ 99, 'Code C', 'Code C', '99', 'Ç'] + , [ 100, 'Code B', 'FNC 4', 'Code B', 'È'] + , [ 101, 'FNC 4', 'Code A', 'Code A', 'É'] + , [ 102, 'FNC 1', 'FNC 1', 'FNC 1', 'Ê'] + , [ 103, 'Start Code A', 'Start Code A', 'Start Code A', 'Ë'] + , [ 104, 'Start Code B', 'Start Code B', 'Start Code B', 'Ì'] + , [ 105, 'Start Code C', 'Start Code C', 'Start Code C', 'Í'] + + ] + , stopChar = 'Î' + ; + +var CodeSymbol = (function() { +function CodeSymbol(value, checksumValue, code, switchedCode, char, isCtrl) { + Object.defineProperties(this, { + value: {value: value} // lol + , checksumValue: {value: checksumValue} + , code: {value: code} + , switchedCode: {value: switchedCode || code} + , char: {value: char} + , weight: {value: weight(isCtrl, value)} + , isCtrl: {value: isCtrl} + , isShif: {value: (new Set(['Shift B', 'Shift A'])).has(value)} + , isSwitch: {value: !!switchedCode} + }); +} +var _p = CodeSymbol.prototype; + +_p.toString = function(){ + return [''].join(''); +}; + +function weight(isCtrl, value) { + // A symbol always has a weight of 1, its impact on the + // encoded result length is the weight function. + // control characters weight is 0. + // Code C symbols is 2 (they all encode 2 digits) + return 1 - (isCtrl ? 0 : value.length); +} + +return CodeSymbol; +})(); + +var CodeSet = (function() { +function CodeSet(name, data, stopChar) { + Object.defineProperties(this, { + name: {value: name} + , stopChar: {value: stopChar} + }); + + this._data = data; + this._values = new Map(); + this._symbols = new Map(); + this._byIndex = []; + var i, l, column; + switch(this.name) { + case('A'): + column = 1; + break; + case('B'): + column = 2; + break; + case('C'): + column = 3; + break; + } + for(i=0,l=data.length;i= 64; + else if(this.name === 'B') + isCtrl = checksumValue >= 95; + else if(this.name === 'C') + isCtrl = checksumValue >= 100; + + char = data[data.length - 1]; + if(char instanceof Array) + // it's an array + char = char[0]; + + symbol = new CodeSymbol(value, checksumValue, code, switchedCode, char, isCtrl); + this._symbols.set(value, symbol); + } + return symbol; +}; + +return CodeSet; +})(); + +var codeSetA = new CodeSet('A', data, stopChar) + , codeSetB = new CodeSet('B', data, stopChar) + , codeSetC = new CodeSet('C', data, stopChar) + , startCodeA = codeSetA.get('Start Code A') + , startCodeB = codeSetB.get('Start Code B') + , startCodeC = codeSetC.get('Start Code C') + ; + +function _addPaths(weight2Paths, paths) { + var i, l + , encoded + , equalWeightPaths + ; + for(i=0,l=paths.length;i we'll only explore the lightest routes + var weight2Paths = new Map() + // start with three routes, one for each code: + , lightest = _addPaths(weight2Paths, [ + new Encoding([startCodeB]) + , new Encoding([startCodeA]) + , new Encoding([startCodeC]) + ]) + , i, l + , lightestPaths + // used to not solve the same sub-system multiple times + , explored = new Map() + , encoded, results, intermediates, solution, weights + ; + + while(weight2Paths.size) { + weights = Array.from(weight2Paths.keys()); + lightest = weights[0]; + for(i=1,l=weights.length;i= 3 && this.symbols[this.symbols.length - 2].isShift) + return this.symbols[this.symbols.length - 2].code; + // `switchedCode` is equal to `code` if the symbol is + // not switching. + return this.lastSymbol.switchedCode; + } + } + , chars: { + get: function() { + if(!this._chars) { + var allChars = this.symbols.map(function(s){return s.char;}); + allChars.push(this._getCheckSumSymbol().char + , this.currentCode.stopChar); + this._chars = allChars.join(''); + } + return this._chars; + } + } +}); + +_p._calculateChecksum = function() { + var i, l, position, sum = 0; + for(i=0,l=this.symbols.length;i 10) x0 = x0 - 10; + if(y0 > 10) y0 = y0 - 10; qDebug() << "extracting code image (" << x0 << y0 << ") ("<< x1 << y1 << ")"; QImage codeImage = image.copy(x0, y0, width, height); diff --git a/po/ubcards.pot b/po/ubcards.pot index a9e122e..0d0d69c 100644 --- a/po/ubcards.pot +++ b/po/ubcards.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-11 22:16+0000\n" +"POT-Creation-Date: 2024-04-12 18:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../app/qml/ubcards.qml:98 +#: ../app/qml/ubcards.qml:100 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:98 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:98 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:98 @@ -25,7 +25,7 @@ msgstr "" msgid "Shopping" msgstr "" -#: ../app/qml/ubcards.qml:100 +#: ../app/qml/ubcards.qml:102 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:100 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:100 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:100 @@ -33,7 +33,7 @@ msgstr "" msgid "Car" msgstr "" -#: ../app/qml/ubcards.qml:102 +#: ../app/qml/ubcards.qml:104 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:102 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:102 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:102 @@ -41,7 +41,7 @@ msgstr "" msgid "Health" msgstr "" -#: ../app/qml/ubcards.qml:104 +#: ../app/qml/ubcards.qml:106 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:104 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:104 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:104 @@ -49,7 +49,7 @@ msgstr "" msgid "Sport" msgstr "" -#: ../app/qml/ubcards.qml:106 +#: ../app/qml/ubcards.qml:108 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:106 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:106 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:106 @@ -57,7 +57,7 @@ msgstr "" msgid "Travel" msgstr "" -#: ../app/qml/ubcards.qml:108 +#: ../app/qml/ubcards.qml:110 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:108 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:108 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:108 @@ -65,7 +65,7 @@ msgstr "" msgid "Restaurant" msgstr "" -#: ../app/qml/ubcards.qml:110 +#: ../app/qml/ubcards.qml:112 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:110 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:110 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:110 @@ -73,7 +73,7 @@ msgstr "" msgid "Garden" msgstr "" -#: ../app/qml/ubcards.qml:112 +#: ../app/qml/ubcards.qml:114 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:112 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:112 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:112 @@ -81,7 +81,7 @@ msgstr "" msgid "Education" msgstr "" -#: ../app/qml/ubcards.qml:115 +#: ../app/qml/ubcards.qml:117 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:115 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:115 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:115 @@ -89,7 +89,7 @@ msgstr "" msgid "Loyality Card" msgstr "" -#: ../app/qml/ubcards.qml:287 +#: ../app/qml/ubcards.qml:291 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:277 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:277 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:269 @@ -98,7 +98,7 @@ msgid "Error" msgstr "" #. TRANSLATORS: Displayed after a picture has been scanned and no code was found in it -#: ../app/qml/ubcards.qml:298 +#: ../app/qml/ubcards.qml:302 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:288 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:288 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:280 @@ -106,7 +106,7 @@ msgstr "" msgid "No code found in image" msgstr "" -#: ../app/qml/ubcards.qml:312 +#: ../app/qml/ubcards.qml:316 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:302 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:302 #: ../build/arm-linux-gnueabihf/app/po/ubcards.desktop.h:1 @@ -116,7 +116,7 @@ msgstr "" msgid "UBcards" msgstr "" -#: ../app/qml/ubcards.qml:316 ../app/qml/ubcards.qml:1149 +#: ../app/qml/ubcards.qml:320 ../app/qml/ubcards.qml:1153 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:306 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1135 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:306 @@ -128,7 +128,7 @@ msgstr "" msgid "About" msgstr "" -#: ../app/qml/ubcards.qml:328 ../app/qml/ubcards.qml:336 +#: ../app/qml/ubcards.qml:332 ../app/qml/ubcards.qml:340 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:318 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:326 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:318 @@ -139,7 +139,7 @@ msgid "Add New Card" msgstr "" #. TRANSLATORS: Name of an action in the toolbar to import pictures from other applications and scan them for codes -#: ../app/qml/ubcards.qml:341 +#: ../app/qml/ubcards.qml:345 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:331 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:331 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:323 @@ -148,7 +148,7 @@ msgid "Import image" msgstr "" #. TRANSLATORS: Name of an action in the toolbar to scan barcode -#: ../app/qml/ubcards.qml:353 ../app/qml/ubcards.qml:571 +#: ../app/qml/ubcards.qml:357 ../app/qml/ubcards.qml:575 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:343 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:560 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:343 @@ -160,14 +160,14 @@ msgstr "" msgid "Scan Card" msgstr "" -#: ../app/qml/ubcards.qml:397 +#: ../app/qml/ubcards.qml:401 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:387 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:387 msgid "" "Set card type and card number manually below OR scan code using icons above." msgstr "" -#: ../app/qml/ubcards.qml:413 ../app/qml/ubcards.qml:878 +#: ../app/qml/ubcards.qml:417 ../app/qml/ubcards.qml:882 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:403 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:867 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:403 @@ -179,19 +179,19 @@ msgstr "" msgid "Card type:" msgstr "" -#: ../app/qml/ubcards.qml:430 +#: ../app/qml/ubcards.qml:434 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:420 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:420 msgid "Set card number:" msgstr "" -#: ../app/qml/ubcards.qml:453 +#: ../app/qml/ubcards.qml:457 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:443 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:443 msgid "Insert Card" msgstr "" -#: ../app/qml/ubcards.qml:457 +#: ../app/qml/ubcards.qml:461 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:447 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:447 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:439 @@ -199,11 +199,11 @@ msgstr "" msgid "Card-Name" msgstr "" -#: ../app/qml/ubcards.qml:548 +#: ../app/qml/ubcards.qml:552 msgid "Edited: " msgstr "" -#: ../app/qml/ubcards.qml:708 +#: ../app/qml/ubcards.qml:712 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:697 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:697 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:689 @@ -211,7 +211,7 @@ msgstr "" msgid "Decoding image" msgstr "" -#: ../app/qml/ubcards.qml:734 ../app/qml/ubcards.qml:745 +#: ../app/qml/ubcards.qml:738 ../app/qml/ubcards.qml:749 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:723 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:734 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:723 @@ -223,7 +223,7 @@ msgstr "" msgid "Edit Card" msgstr "" -#: ../app/qml/ubcards.qml:734 +#: ../app/qml/ubcards.qml:738 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:723 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:723 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:715 @@ -231,7 +231,7 @@ msgstr "" msgid "View Card" msgstr "" -#: ../app/qml/ubcards.qml:754 +#: ../app/qml/ubcards.qml:758 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:743 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:743 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:735 @@ -240,7 +240,7 @@ msgid "Copy to Clipboard" msgstr "" #. TRANSLATORS: Name of an action in the toolbar to import show card code as QR code -#: ../app/qml/ubcards.qml:762 +#: ../app/qml/ubcards.qml:766 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:751 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:751 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:743 @@ -248,7 +248,7 @@ msgstr "" msgid "Show as QR Code" msgstr "" -#: ../app/qml/ubcards.qml:769 +#: ../app/qml/ubcards.qml:773 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:758 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:758 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:750 @@ -256,7 +256,7 @@ msgstr "" msgid "Open URL" msgstr "" -#: ../app/qml/ubcards.qml:777 +#: ../app/qml/ubcards.qml:781 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:766 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:766 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:758 @@ -264,7 +264,7 @@ msgstr "" msgid "Save" msgstr "" -#: ../app/qml/ubcards.qml:821 +#: ../app/qml/ubcards.qml:825 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:810 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:810 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:802 @@ -273,7 +273,7 @@ msgid "Card name:" msgstr "" #. TRANSLATORS: Default Card Name -#: ../app/qml/ubcards.qml:834 +#: ../app/qml/ubcards.qml:838 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:823 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:823 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:815 @@ -281,7 +281,7 @@ msgstr "" msgid "New Card Name" msgstr "" -#: ../app/qml/ubcards.qml:854 +#: ../app/qml/ubcards.qml:858 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:843 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:843 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:835 @@ -289,7 +289,7 @@ msgstr "" msgid "Card category:" msgstr "" -#: ../app/qml/ubcards.qml:1023 +#: ../app/qml/ubcards.qml:1027 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1009 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1009 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1000 @@ -297,7 +297,7 @@ msgstr "" msgid "Contact" msgstr "" -#: ../app/qml/ubcards.qml:1059 +#: ../app/qml/ubcards.qml:1063 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1045 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1045 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1036 @@ -305,14 +305,14 @@ msgstr "" msgid "QR code" msgstr "" -#: ../app/qml/ubcards.qml:1090 +#: ../app/qml/ubcards.qml:1094 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1076 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1076 msgid "QR Code" msgstr "" #. TRANSLATORS: Version number -#: ../app/qml/ubcards.qml:1205 +#: ../app/qml/ubcards.qml:1209 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1191 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1191 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1182 @@ -321,7 +321,7 @@ msgstr "" msgid "App Version %1" msgstr "" -#: ../app/qml/ubcards.qml:1216 +#: ../app/qml/ubcards.qml:1220 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1202 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1202 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1193 @@ -329,7 +329,7 @@ msgstr "" msgid "Maintained by" msgstr "" -#: ../app/qml/ubcards.qml:1217 +#: ../app/qml/ubcards.qml:1221 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1203 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1203 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1194 @@ -337,7 +337,7 @@ msgstr "" msgid "Jan Belohoubek" msgstr "" -#: ../app/qml/ubcards.qml:1229 +#: ../app/qml/ubcards.qml:1233 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1215 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1215 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1206 @@ -345,7 +345,7 @@ msgstr "" msgid "Please report bugs to the" msgstr "" -#: ../app/qml/ubcards.qml:1230 +#: ../app/qml/ubcards.qml:1234 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1216 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1216 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1207 @@ -353,7 +353,7 @@ msgstr "" msgid "issue tracker" msgstr "" -#: ../app/qml/ubcards.qml:1238 +#: ../app/qml/ubcards.qml:1242 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1224 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1224 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1215 @@ -361,7 +361,7 @@ msgstr "" msgid "Please support" msgstr "" -#: ../app/qml/ubcards.qml:1239 +#: ../app/qml/ubcards.qml:1243 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1225 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1225 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1216 @@ -369,7 +369,7 @@ msgstr "" msgid "the app development" msgstr "" -#: ../app/qml/ubcards.qml:1255 +#: ../app/qml/ubcards.qml:1259 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1241 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1241 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1232 @@ -377,7 +377,7 @@ msgstr "" msgid "Thanks to" msgstr "" -#: ../app/qml/ubcards.qml:1262 +#: ../app/qml/ubcards.qml:1266 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1248 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1248 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1239 @@ -385,7 +385,7 @@ msgstr "" msgid "Chris Clime, Tagger application:" msgstr "" -#: ../app/qml/ubcards.qml:1270 +#: ../app/qml/ubcards.qml:1274 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1256 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1256 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1247 @@ -393,7 +393,7 @@ msgstr "" msgid "Richard Lee, Card Wallet application:" msgstr "" -#: ../app/qml/ubcards.qml:1278 +#: ../app/qml/ubcards.qml:1282 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1264 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1264 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1255 @@ -401,7 +401,7 @@ msgstr "" msgid "Fonticons, Inc., Font Awesome" msgstr "" -#: ../app/qml/ubcards.qml:1286 +#: ../app/qml/ubcards.qml:1290 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1272 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1272 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1263 @@ -409,7 +409,7 @@ msgstr "" msgid "Sam Hewitt, Suru Icons" msgstr "" -#: ../app/qml/ubcards.qml:1296 +#: ../app/qml/ubcards.qml:1300 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1282 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1282 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1273 @@ -417,7 +417,7 @@ msgstr "" msgid "Released under the terms of the GNU GPLv3" msgstr "" -#: ../app/qml/ubcards.qml:1302 +#: ../app/qml/ubcards.qml:1306 #: ../build/arm-linux-gnueabihf/app/app/qml/ubcards.qml:1288 #: ../build/arm-linux-gnueabihf/app/install/qml/ubcards.qml:1288 #: ../build/x86_64-linux-gnu/app/app/qml/ubcards.qml:1279