File indexing completed on 2023-12-03 08:26:47
0001 /*************************************************************************** 0002 * Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 0018 ***************************************************************************/ 0019 0020 #ifndef LOCALEMODELS_H 0021 #define LOCALEMODELS_H 0022 0023 #include <QAbstractListModel> 0024 0025 #include <QIcon> 0026 0027 /** 0028 * The following models are there to store the localized names and the codes of languages and countries 0029 * Only codes supported by KDE are supported by these models 0030 */ 0031 0032 /** 0033 * The CountryModel stores localized names as well as the codes and the corresponding icons of countries 0034 */ 0035 class CountryModel : public QAbstractListModel 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 CountryModel(QObject *parent = nullptr); 0041 0042 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0043 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0044 0045 void setupModelData(); 0046 0047 private: 0048 QStringList m_countryCodes; 0049 QStringList m_countryNames; 0050 }; 0051 0052 /** 0053 * The LanguageModel stores localized names as well as the codes of languages 0054 */ 0055 class LanguageModel : public QAbstractListModel 0056 { 0057 Q_OBJECT 0058 0059 public: 0060 LanguageModel(QObject *parent = nullptr); 0061 0062 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0063 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0064 0065 void setupModelData(); 0066 0067 private: 0068 QStringList m_languageCodes; 0069 QStringList m_languageNames; 0070 }; 0071 0072 #endif