QTfrontend/model/ThemeModel.cpp
changeset 8464 c708b4f5cffc
parent 8436 b89aacebb9db
child 8475 f605bc59c603
equal deleted inserted replaced
8462:19b1de9423ab 8464:c708b4f5cffc
    21  * @brief ThemeModel class implementation
    21  * @brief ThemeModel class implementation
    22  */
    22  */
    23 
    23 
    24 #include "physfs.h"
    24 #include "physfs.h"
    25 #include "ThemeModel.h"
    25 #include "ThemeModel.h"
       
    26 #include "hwconsts.h"
    26 
    27 
    27 ThemeModel::ThemeModel(QObject *parent) :
    28 ThemeModel::ThemeModel(QObject *parent) :
    28     QAbstractListModel(parent)
    29     QAbstractListModel(parent)
    29 {
    30 {
    30     m_data = QList<QMap<int, QVariant> >();
    31     m_data = QList<QMap<int, QVariant> >();
    48 }
    49 }
    49 
    50 
    50 
    51 
    51 void ThemeModel::loadThemes()
    52 void ThemeModel::loadThemes()
    52 {
    53 {
    53     const QString appDir = QString(PHYSFS_getBaseDir());
       
    54 
       
    55     beginResetModel();
    54     beginResetModel();
    56 
    55 
    57     DataManager & datamgr = DataManager::instance();
    56     DataManager & datamgr = DataManager::instance();
    58 
    57 
    59     QStringList themes =
    58     QStringList themes =
    75 
    74 
    76         QMap<int, QVariant> dataset;
    75         QMap<int, QVariant> dataset;
    77 
    76 
    78         // detect if theme is dlc
    77         // detect if theme is dlc
    79         QString themeDir = PHYSFS_getRealDir(QString("Themes/%1/icon.png").arg(theme).toLocal8Bit().data());
    78         QString themeDir = PHYSFS_getRealDir(QString("Themes/%1/icon.png").arg(theme).toLocal8Bit().data());
    80         dataset.insert(Qt::UserRole + 2, !themeDir.startsWith(appDir));
    79         dataset.insert(Qt::UserRole + 2, !themeDir.startsWith(datadir->absolutePath()));
    81 
    80 
    82         // set icon path
    81         // set icon path
    83         dataset.insert(Qt::UserRole + 1, iconpath);
    82         dataset.insert(Qt::UserRole + 1, iconpath);
    84 
    83 
    85         // set name
    84         // set name