mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-02 11:55:36 -04:00
[keyboard] Move all the keyboard (AbstractList)Models to the models file
This commit is contained in:
parent
1d696253c3
commit
b54273f904
4 changed files with 212 additions and 211 deletions
|
@ -20,63 +20,6 @@
|
|||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
|
||||
class KeyboardModelsModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( int currentIndex WRITE setCurrentIndex READ currentIndex NOTIFY currentIndexChanged )
|
||||
|
||||
public:
|
||||
explicit KeyboardModelsModel( QObject* parent = nullptr );
|
||||
int rowCount( const QModelIndex& = QModelIndex() ) const override;
|
||||
QVariant data( const QModelIndex& index, int role ) const override;
|
||||
|
||||
void setCurrentIndex( const int& index );
|
||||
int currentIndex() const;
|
||||
const QMap< QString, QString > item( const int& index ) const;
|
||||
|
||||
public slots:
|
||||
void refresh();
|
||||
|
||||
protected:
|
||||
QHash< int, QByteArray > roleNames() const override;
|
||||
|
||||
private:
|
||||
int m_currentIndex = -1;
|
||||
QVector< QMap< QString, QString > > m_list;
|
||||
void detectModels();
|
||||
|
||||
signals:
|
||||
void currentIndexChanged( int index );
|
||||
};
|
||||
|
||||
class KeyboardVariantsModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( int currentIndex WRITE setCurrentIndex READ currentIndex NOTIFY currentIndexChanged )
|
||||
|
||||
public:
|
||||
explicit KeyboardVariantsModel( QObject* parent = nullptr );
|
||||
void setVariants( QMap< QString, QString > variants );
|
||||
|
||||
int rowCount( const QModelIndex& = QModelIndex() ) const override;
|
||||
QVariant data( const QModelIndex& index, int role ) const override;
|
||||
|
||||
void setCurrentIndex( const int& index );
|
||||
int currentIndex() const;
|
||||
|
||||
const QMap< QString, QString > item( const int& index ) const;
|
||||
|
||||
protected:
|
||||
QHash< int, QByteArray > roleNames() const override;
|
||||
|
||||
private:
|
||||
int m_currentIndex = -1;
|
||||
QVector< QMap< QString, QString > > m_list;
|
||||
|
||||
signals:
|
||||
void currentIndexChanged( int index );
|
||||
};
|
||||
|
||||
class Config : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue