2017-12-20 14:39:09 +01:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
2014-07-04 15:33:59 +02:00
|
|
|
*
|
|
|
|
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
|
|
|
*
|
|
|
|
* Portions from the Manjaro Installation Framework
|
|
|
|
* by Roland Singer <roland@manjaro.org>
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KEYBOARDPREVIEW_H
|
|
|
|
#define KEYBOARDPREVIEW_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QRectF>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPen>
|
|
|
|
#include <QPainterPath>
|
|
|
|
#include <QColor>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QProcess>
|
|
|
|
#include <QString>
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
|
|
|
|
class KeyBoardPreview : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-06-13 21:33:20 +02:00
|
|
|
explicit KeyBoardPreview( QWidget* parent = nullptr );
|
2014-07-04 15:33:59 +02:00
|
|
|
|
|
|
|
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<QList<int> > keys;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Code {
|
|
|
|
QString plain, shift, ctrl, alt;
|
|
|
|
};
|
|
|
|
|
|
|
|
QString layout, variant;
|
|
|
|
QFont lowerFont, upperFont;
|
2015-02-26 01:57:19 +01:00
|
|
|
KB* kb, kbList[3];
|
2014-07-04 15:33:59 +02:00
|
|
|
QList<Code> 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:
|
2015-02-26 01:57:19 +01:00
|
|
|
void paintEvent(QPaintEvent* event);
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
2014-07-04 15:33:59 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KEYBOARDPREVIEW_H
|