|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
The full keyboard's tile->key map: which game tile sits on which physical key. More...
#include <fontkeyboard.h>
Public Types | |
| enum | Render { RenderEmpty = 0 , RenderTile , RenderPreview , RenderLabel } |
| < Current page = its modifier mask, 0-7. More... | |
| enum | Category { CatNone = 0 , CatNormal , CatSingle , CatMulti , CatVariable , CatPicture , CatControl } |
| Tile category. Order matches the old filter strip = the usage order. More... | |
Public Member Functions | |
| FontKeyboard (QObject *parent=nullptr) | |
| QVariantMap | keyDataFor (const QString &key, bool shift, bool ctrl, bool alt, bool caps) const |
| keyData() for the page this key actually reads. What the deck binds to. | |
| QVariantMap | keyData (int page, const QString &key) const |
| Everything a keycap needs: { ind, code, title, tip, category, render, empty, natural }. | |
| QVariantMap | spaceData () const |
| The same map for the spacebar (the Space tile lives there, not on a letter). | |
| protected::void | pageChanged () |
Static Public Member Functions | |
| static int | effectivePage (bool shift, bool ctrl, bool alt, bool caps) |
| Assignable keys per page: 26 letters + 10 digits + the 11 punctuation keys ( - = [ ] \ ; ' , .
| |
| static QString | pageBadge (int page) |
| The modifier badge for a page, e.g. "" / "Shift" / "Ctrl+Alt". | |
| static int | indFor (int page, const QString &key) |
The font code on key of page, or 0 when that key is empty. | |
| static QString | naturalChar (const QString &key, bool shift) |
What a REAL keyboard (US layout) types for key with/without Shift – "a"/"A", "1"/"!", "."/">". | |
| static QString | pageDescription (int page) |
| The quiet line under the deck saying what this page is. | |
| static QString | chopLastToken (const QString &str) |
| Drop the last whole token off a code string – "RED<player>" -> "RED". | |
Static Public Attributes | |
| static constexpr int | pageTotal = 8 |
| Modifier combos: none/S/C/A/SC/SA/CA/SCA. | |
The full keyboard's tile->key map: which game tile sits on which physical key.
Backs the redesigned full-screen name editor (screens/modal/FullKeyboard.qml), which draws a real ASDF/QWERTY deck whose 36 alphanumeric keys each carry one game tile. There are 255 tiles and 36 keys, so the deck has 8 pages – and Shift/Ctrl/Alt give exactly 8 modifier combinations, one per page.
The map itself (pageInd) is a hand-authored table, not a generated fill. Its doctrine, in priority order:
Pages follow the category order (Normal, Single-Char, Multi-Char, Variable, Picture, Control), so the four cheapest modifier combos hold everything you'd ever legitimately put in a name, and the two categories that glitch a name sit behind two- and three-key combos.
The Space tile is the one exception: it rides the deck's real spacebar (spaceInd), which is where every human already expects it. That is the only tile not on an alphanumeric key.
Every one of the 255 tiles appears exactly once across the 8 pages + the spacebar. That invariant is not a comment – it is pinned by tst_font_keyboard.
Exposed to QML as brg.keyboard.
Definition at line 64 of file fontkeyboard.h.
Tile category. Order matches the old filter strip = the usage order.
| Enumerator | |
|---|---|
| CatNone | |
| CatNormal | |
| CatSingle | |
| CatMulti | |
| CatVariable | |
| CatPicture | |
| CatControl | |
Definition at line 84 of file fontkeyboard.h.
| enum FontKeyboard::Render |
< Current page = its modifier mask, 0-7.
Display name of each page (indexed by mask). Pages in the order a human should meet them. How many pages (8). How a key draws its tile. The tile sheet can't render everything.
Definition at line 75 of file fontkeyboard.h.
|
explicit |
Definition at line 270 of file fontkeyboard.cpp.
|
static |
Drop the last whole token off a code string – "RED<player>" -> "RED".
A backspace must never bite one character out of the middle of a <code>.
Definition at line 492 of file fontkeyboard.cpp.
|
static |
Assignable keys per page: 26 letters + 10 digits + the 11 punctuation keys ( - = [ ] \ ; ' , .
/). The punctuation keys were dead filler at first; they now carry the tiles that BELONG on them (. types ., Shift+/ types ?`). */ static constexpr int keyTotal = 47;
int getPage() const; ///<
/ The 36 key labels in deck order (number row, QWERTY, ASDF, ZXCV). Test/QML helper. static QStringList keyLabels();
/ Which page a modifier combination selects. The whole point of 8 pages / 8 combos. static int pageFor(bool shift, bool ctrl, bool alt);
/** The page actually on show, once Caps Lock is taken into account.
Caps LOCKS THE SHIFT PAGE (it is a page selector, not a per-key letter-case rule): Shift inverts it, Ctrl/Alt ignore it. So every state the deck can be in is exactly one of the 8 pages – which is what lets the page strip always be right.
Definition at line 339 of file fontkeyboard.cpp.
Referenced by keyDataFor().
|
static |
The font code on key of page, or 0 when that key is empty.
Definition at line 374 of file fontkeyboard.cpp.
References pageTotal.
Referenced by keyData().
| QVariantMap FontKeyboard::keyData | ( | int | page, |
| const QString & | key ) const |
Everything a keycap needs: { ind, code, title, tip, category, render, empty, natural }.
Returns an empty-flagged map for an unmapped key – never a null/undefined.
Definition at line 417 of file fontkeyboard.cpp.
References indFor().
Referenced by keyDataFor().
| QVariantMap FontKeyboard::keyDataFor | ( | const QString & | key, |
| bool | shift, | ||
| bool | ctrl, | ||
| bool | alt, | ||
| bool | caps ) const |
keyData() for the page this key actually reads. What the deck binds to.
Definition at line 368 of file fontkeyboard.cpp.
References effectivePage(), and keyData().
|
static |
What a REAL keyboard (US layout) types for key with/without Shift – "a"/"A", "1"/"!", "."/">".
Empty for keys that produce no character.
This is what lets a cap drop its corner legend: if the deck types, on this key with these modifiers, exactly what the physical keyboard would, the legend has nothing to teach. It also states the design rule – a tile goes where a real keyboard would put it whenever it can, and must never pretend (a period on Ctrl+"/" while a real period sits on the period key is a false affordance).
Definition at line 391 of file fontkeyboard.cpp.
|
static |
The modifier badge for a page, e.g. "" / "Shift" / "Ctrl+Alt".
Definition at line 331 of file fontkeyboard.cpp.
References pageTotal.
| protected::void FontKeyboard::pageChanged | ( | ) |
|
static |
The quiet line under the deck saying what this page is.
Definition at line 409 of file fontkeyboard.cpp.
References pageTotal.
| QVariantMap FontKeyboard::spaceData | ( | ) | const |
The same map for the spacebar (the Space tile lives there, not on a letter).
Definition at line 422 of file fontkeyboard.cpp.
|
staticconstexpr |
Modifier combos: none/S/C/A/SC/SA/CA/SCA.
Definition at line 97 of file fontkeyboard.h.
Referenced by indFor(), pageBadge(), and pageDescription().