2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2020-03-25 16:08:12 +01:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2020 Camilo Higuita <milo.h@aol.com>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2020-03-25 16:08:12 +01:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2020-03-25 16:08:12 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KEYBOARD_CONFIG_H
|
|
|
|
#define KEYBOARD_CONFIG_H
|
|
|
|
|
2020-04-03 10:18:07 +02:00
|
|
|
#include "Job.h"
|
|
|
|
#include "KeyboardLayoutModel.h"
|
2020-10-27 02:56:19 +01:00
|
|
|
#include "AdditionalLayoutInfo.h"
|
2020-04-03 10:18:07 +02:00
|
|
|
|
2020-03-26 15:57:02 +01:00
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QMap>
|
2020-03-25 16:08:12 +01:00
|
|
|
#include <QObject>
|
|
|
|
#include <QTimer>
|
2020-03-26 15:57:02 +01:00
|
|
|
#include <QUrl>
|
2020-03-25 16:08:12 +01:00
|
|
|
|
|
|
|
class Config : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-03-26 15:57:02 +01:00
|
|
|
Q_PROPERTY( KeyboardModelsModel* keyboardModelsModel READ keyboardModels CONSTANT FINAL )
|
|
|
|
Q_PROPERTY( KeyboardLayoutModel* keyboardLayoutsModel READ keyboardLayouts CONSTANT FINAL )
|
|
|
|
Q_PROPERTY( KeyboardVariantsModel* keyboardVariantsModel READ keyboardVariants CONSTANT FINAL )
|
|
|
|
Q_PROPERTY( QString prettyStatus READ prettyStatus NOTIFY prettyStatusChanged FINAL )
|
2020-03-25 16:08:12 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Config( QObject* parent = nullptr );
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
2020-10-12 16:30:06 +02:00
|
|
|
Calamares::JobList createJobs();
|
2020-03-25 16:08:12 +01:00
|
|
|
QString prettyStatus() const;
|
|
|
|
|
|
|
|
void onActivate();
|
|
|
|
void finalize();
|
|
|
|
|
2020-10-12 16:30:06 +02:00
|
|
|
void setConfigurationMap( const QVariantMap& configurationMap );
|
|
|
|
|
2020-10-25 12:29:33 +01:00
|
|
|
static AdditionalLayoutInfo getAdditionalLayoutInfo( const QString& layout );
|
2020-10-25 03:14:42 +01:00
|
|
|
|
2020-03-25 16:08:12 +01:00
|
|
|
private:
|
|
|
|
void guessLayout( const QStringList& langParts );
|
2020-03-26 15:57:02 +01:00
|
|
|
void updateVariants( const QPersistentModelIndex& currentItem, QString currentVariant = QString() );
|
2020-03-25 16:08:12 +01:00
|
|
|
|
2020-03-26 15:57:02 +01:00
|
|
|
KeyboardModelsModel* m_keyboardModelsModel;
|
|
|
|
KeyboardLayoutModel* m_keyboardLayoutsModel;
|
|
|
|
KeyboardVariantsModel* m_keyboardVariantsModel;
|
2020-03-25 16:08:12 +01:00
|
|
|
|
|
|
|
QString m_selectedLayout;
|
|
|
|
QString m_selectedModel;
|
|
|
|
QString m_selectedVariant;
|
2020-10-25 03:14:42 +01:00
|
|
|
AdditionalLayoutInfo m_selectedLayoutsAdditionalLayoutInfo;
|
2020-03-25 16:08:12 +01:00
|
|
|
QTimer m_setxkbmapTimer;
|
|
|
|
|
2020-10-12 16:30:06 +02:00
|
|
|
// From configuration
|
|
|
|
QString m_xOrgConfFileName;
|
|
|
|
QString m_convertedKeymapPath;
|
|
|
|
bool m_writeEtcDefaultKeyboard = true;
|
|
|
|
|
|
|
|
|
2020-03-25 16:08:12 +01:00
|
|
|
protected:
|
2020-03-26 15:57:02 +01:00
|
|
|
KeyboardModelsModel* keyboardModels() const;
|
|
|
|
KeyboardLayoutModel* keyboardLayouts() const;
|
|
|
|
KeyboardVariantsModel* keyboardVariants() const;
|
2020-03-25 16:08:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void prettyStatusChanged();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|