eteran / nedit-ng

a Qt5 port of the NEdit using modern C++14
GNU General Public License v2.0
96 stars 26 forks source link

nedit-import: Convert shortcuts to valid QT equivalents #339

Open GrAndAG opened 1 year ago

GrAndAG commented 1 year ago

Original nedit shortcuts can contain names of keys (such as Period, Comma, Prior, Slash, etc.) which are not supported by nedit-ng. I had to add several replace() calls into import.cpp to handle some cases that I found in my macros. Like this:

accStr.replace(QLatin1String("Period"), QLatin1String("."), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Comma"), QLatin1String(","), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Bracketright"), QLatin1String("]"), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Bracketleft"), QLatin1String("["), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Backslash"), QLatin1String("\\"), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Slash"), QLatin1String("/"), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Apostrophe"), QLatin1String("'"), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Grave"), QLatin1String("`"), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Prior"), QLatin1String("PgUp"), Qt::CaseInsensitive);
accStr.replace(QLatin1String("Next"), QLatin1String("PgDown"), Qt::CaseInsensitive);

I'm pretty sure that it does not cover all cases.

eteran commented 1 year ago

Oh, interesting, I'll have to take a look at this. Thanks!

I've also been planning to revamp how the shortcuts are handled in NG so they are more configurable too.

eteran commented 1 year ago

So I can definitely do this sort of fixup... but I'd love to find a place which lists the translations so I can just get them all correct once. Looking into it.