/* === This file is part of Calamares - === * * Copyright 2014, Teo Mrnjavac * * Portions from the Manjaro Installation Framework * by Roland Singer * Copyright (C) 2007 Free Software Foundation, Inc. * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Calamares is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Calamares. If not, see . */ #ifndef KEYBOARDPREVIEW_H #define KEYBOARDPREVIEW_H #include #include #include #include #include #include #include #include #include #include #include class KeyBoardPreview : public QWidget { Q_OBJECT public: explicit KeyBoardPreview( QWidget* parent = nullptr ); void setLayout(QString layout); void setVariant(QString variant); private: enum KB_TYPE { KB_104, KB_105, KB_106 }; struct KB { bool kb_extended_return; QList > keys; }; struct Code { QString plain, shift, ctrl, alt; }; QString layout, variant; QFont lowerFont, upperFont; KB* kb, kbList[3]; QList codes; int space, usable_width, key_w; void loadInfo(); bool loadCodes(); QString regular_text(int index); QString shift_text(int index); QString ctrl_text(int index); QString alt_text(int index); QString fromUnicodeString(QString raw); protected: void paintEvent(QPaintEvent* event); void resizeEvent(QResizeEvent* event); }; #endif // KEYBOARDPREVIEW_H