source: calamares/trunk/fuentes/src/modules/keyboard/keyboardwidget/keyboardpreview.h @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 17 months ago

sync with github

File size: 2.1 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014, Teo Mrnjavac <teo@kde.org>
4 *
5 *   Portions from the Manjaro Installation Framework
6 *   by Roland Singer <roland@manjaro.org>
7 *   Copyright (C) 2007 Free Software Foundation, Inc.
8 *
9 *   Calamares is free software: you can redistribute it and/or modify
10 *   it under the terms of the GNU General Public License as published by
11 *   the Free Software Foundation, either version 3 of the License, or
12 *   (at your option) any later version.
13 *
14 *   Calamares is distributed in the hope that it will be useful,
15 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 *   GNU General Public License for more details.
18 *
19 *   You should have received a copy of the GNU General Public License
20 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#ifndef KEYBOARDPREVIEW_H
24#define KEYBOARDPREVIEW_H
25
26#include <QWidget>
27#include <QRectF>
28#include <QFont>
29#include <QPainter>
30#include <QPen>
31#include <QPainterPath>
32#include <QColor>
33#include <QPixmap>
34#include <QProcess>
35#include <QString>
36#include <QStringList>
37
38
39class KeyBoardPreview : public QWidget
40{
41    Q_OBJECT
42public:
43    explicit KeyBoardPreview( QWidget* parent = nullptr );
44   
45    void setLayout(QString layout);
46    void setVariant(QString variant);
47
48private:
49    enum KB_TYPE { KB_104, KB_105, KB_106 };
50
51    struct KB {
52        bool kb_extended_return;
53        QList<QList<int> > keys;
54    };
55
56    struct Code {
57        QString plain, shift, ctrl, alt;
58    };
59
60    QString layout, variant;
61    QFont lowerFont, upperFont;
62    KB* kb, kbList[3];
63    QList<Code> codes;
64    int space, usable_width, key_w;
65
66    void loadInfo();
67    bool loadCodes();
68    QString regular_text(int index);
69    QString shift_text(int index);
70    QString ctrl_text(int index);
71    QString alt_text(int index);
72    QString fromUnicodeString(QString raw);
73
74protected:
75    void paintEvent(QPaintEvent* event);
76    void resizeEvent(QResizeEvent* event);
77
78};
79
80#endif // KEYBOARDPREVIEW_H
Note: See TracBrowser for help on using the repository browser.