QTfrontend/model/ThemeModel.cpp
changeset 8475 f605bc59c603
parent 8464 c708b4f5cffc
child 9080 9b42757d7e71
equal deleted inserted replaced
8473:555235e90010 8475:f605bc59c603
    74 
    74 
    75         QMap<int, QVariant> dataset;
    75         QMap<int, QVariant> dataset;
    76 
    76 
    77         // detect if theme is dlc
    77         // detect if theme is dlc
    78         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());
    79         dataset.insert(Qt::UserRole + 2, !themeDir.startsWith(datadir->absolutePath()));
    79         bool isDLC = !themeDir.startsWith(datadir->absolutePath());
       
    80         dataset.insert(IsDlcRole, isDLC);
    80 
    81 
    81         // set icon path
    82         // set icon path
    82         dataset.insert(Qt::UserRole + 1, iconpath);
    83         dataset.insert(IconPathRole, iconpath);
    83 
    84 
    84         // set name
    85         // set name
    85         dataset.insert(Qt::DisplayRole, theme);
    86         dataset.insert(ActualNameRole, theme);
    86 
    87 
    87         // load and set icon
    88         // set displayed name
    88         QIcon icon;
    89         dataset.insert(Qt::DisplayRole, (isDLC ? "*" : "") + theme);
    89         icon.addPixmap(QPixmap(iconpath), QIcon::Normal);
       
    90         icon.addPixmap(QPixmap(iconpath), QIcon::Disabled);
       
    91 
       
    92         dataset.insert(Qt::DecorationRole, icon);
       
    93 
    90 
    94         // load and set preview icon
    91         // load and set preview icon
    95         QIcon preview(QString("physfs://Themes/%1/icon@2x.png").arg(theme));
    92         QIcon preview(QString("physfs://Themes/%1/icon@2x.png").arg(theme));
    96         dataset.insert(Qt::UserRole, preview);
    93         dataset.insert(Qt::DecorationRole, preview);
    97 
    94 
    98         m_data.append(dataset);
    95         m_data.append(dataset);
    99     }
    96     }
   100 
    97 
   101 
    98