You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
/* |
|
optionsmodel.h |
|
SPDX-FileCopyrightText: 2021 Han Young <hanyoung@protonmail.com> |
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later |
|
*/ |
|
|
|
#pragma once |
|
|
|
#include <array> |
|
|
|
#include <QAbstractListModel> |
|
|
|
#include "regionandlangsettings.h" |
|
|
|
class RegionAndLangSettings; |
|
class KCMRegionAndLang; |
|
|
|
class OptionsModel : public QAbstractListModel |
|
{ |
|
Q_OBJECT |
|
public: |
|
enum Roles { Name = Qt::DisplayRole, Subtitle, Example, Page }; |
|
explicit OptionsModel(KCMRegionAndLang *parent); |
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; |
|
QHash<int, QByteArray> roleNames() const override; |
|
|
|
public Q_SLOTS: |
|
void handleLangChange(); |
|
|
|
private: |
|
QString implicitFormatExampleMsg() const; |
|
QString getNativeName(const QString &locale) const; |
|
|
|
QString m_numberExample; |
|
QString m_timeExample; |
|
QString m_currencyExample; |
|
QString m_measurementExample; |
|
|
|
std::array<std::pair<QString, KCM_RegionAndLang::SettingType>, 5> m_staticNames; // title, page |
|
|
|
RegionAndLangSettings *m_settings; |
|
};
|
|
|