Fixed barcode scanner issue on Windows with czech keyboard.

This commit is contained in:
2018-05-10 15:06:27 +02:00
parent b8ed333c3a
commit b69637165d
6 changed files with 79 additions and 4 deletions
+1
View File
@@ -13,5 +13,6 @@
#include "settingsform.h"
#include "enums.h"
#include "objectbinder.h"
#include "helper.h"
#endif // CORE_H
+4 -2
View File
@@ -66,7 +66,8 @@ SOURCES += \
csvimporter.cpp \
importdialog.cpp \
importprogress.cpp \
reporting/variablefiller.cpp
reporting/variablefiller.cpp \
helper.cpp
HEADERS += core.h\
core_global.h \
@@ -132,7 +133,8 @@ HEADERS += core.h\
iimportprogress.h \
importdialog.h \
importprogress.h \
reporting/variablefiller.h
reporting/variablefiller.h \
helper.h
unix {
target.path = /usr/lib
+39
View File
@@ -0,0 +1,39 @@
#include "helper.h"
#include "define.h"
const QMap<QString, QString> Helper::m_numMap{
{"+", "1"},
{"ě", "2"},
{"š", "3"},
{"č", "4"},
{"ř", "5"},
{"ž", "6"},
{"ý", "7"},
{"á", "8"},
{"í", "9"},
{"é", "0"}
};
Helper::Helper()
{
}
QString Helper::replaceByNumbers(const QString &str)
{
QString ret;
std::for_each(ALL(str), [&](QChar c){
QString replaced = m_numMap[c];
if (replaced.isEmpty())
{
ret.append(c);
}
else
{
ret.append(replaced);
}
});
return ret;
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef HELPER_H
#define HELPER_H
#include <QString>
#include <QMap>
class Helper
{
public:
Helper();
static QString replaceByNumbers(const QString &str);
private:
static const QMap<QString, QString> m_numMap;
};
#endif // HELPER_H