QVariant rs_GameModel
::headerData(int section, Qt
::Orientation orientation,
int role
) const { if (role != Qt::DisplayRole)
if (role == Qt::DisplayRole) {
if (section == cols.at(0)) {
return tr("Juego");
} else if (section == cols.at(1)) {
return tr("Tipo");
} else if (section == cols.at(2)) {
return tr("Valoracion");
} else if (section == cols.at(3)) {
return tr("Emulador");
} else if (section == cols.at(4)) {
return tr("Usos");
} else if (section == cols.at(5)) {
return tr("Genero");
} else if (section == cols.at(6)) {
return tr("Idioma");
} else if (section == cols.at(7)) {
return tr("Año");
} else if (section == cols.at(8)) {
return tr("Compañia");
} else if (section == cols.at(9)) {
return tr("Jugadores");
} else if (section == cols.at(10)) {
return tr("Ruta");
}
}
}
QVariant rs_GameModel::headerData(int section, Qt::Orientation orientation, int role) const {
if (role != Qt::DisplayRole)
return QVariant();
if (role == Qt::DisplayRole) {
if (section == cols.at(0)) {
return tr("Juego");
} else if (section == cols.at(1)) {
return tr("Tipo");
} else if (section == cols.at(2)) {
return tr("Valoracion");
} else if (section == cols.at(3)) {
return tr("Emulador");
} else if (section == cols.at(4)) {
return tr("Usos");
} else if (section == cols.at(5)) {
return tr("Genero");
} else if (section == cols.at(6)) {
return tr("Idioma");
} else if (section == cols.at(7)) {
return tr("Año");
} else if (section == cols.at(8)) {
return tr("Compañia");
} else if (section == cols.at(9)) {
return tr("Jugadores");
} else if (section == cols.at(10)) {
return tr("Ruta");
}
}
return QVariant();
}
To copy to clipboard, switch view to plain text mode
if (!index.isValid()) {
}
if (index.row() >= romCount || index.row() < 0 ) {
}
if (role == Qt::TextAlignmentRole) {
if (index.column() > 0 && index.column() < 10) {
return Qt::AlignHCenter;
}
}
if (role == Qt::UserRole) {
if (index.column() == cols.at(0)) {
return ROMs.at(index.row()).section(";", 11, 11);
}
}
if (role == Qt::DecorationRole) {
if (index.column() == cols.at(0)) {
return QIcon(QString("Skin/%1/icons/sys/rom16.png").
arg(CurrSkin
));
}
if (index.column() == cols.at(1)) {
QString tmpExt
= ROMs.
at(index.
row()).
section(";",
1,
1);
if (tmpExt.compare("zip", Qt::CaseInsensitive) == 0 || tmpExt.compare("7Z", Qt::CaseInsensitive) == 0 || tmpExt.compare("r", Qt::CaseInsensitive) == 0 ) {
return QIcon(QString("Skin/%1/icons/sys/compressed16.png").
arg(CurrSkin
));
} else if (tmpExt.compare("iso", Qt::CaseInsensitive) == 0 || tmpExt.compare("cue", Qt::CaseInsensitive) == 0 || tmpExt.compare("bin", Qt::CaseInsensitive) == 0 ||
tmpExt.compare("nrg", Qt::CaseInsensitive) == 0 || tmpExt.compare("mdf", Qt::CaseInsensitive) == 0 || tmpExt.compare("mds", Qt::CaseInsensitive) == 0 ) {
return QIcon(QString("Skin/%1/icons/sys/cddvd16.png").
arg(CurrSkin
));
} else {
return QIcon(QString("Skin/%1/icons/sys/cartridge16.png").
arg(CurrSkin
));;
}
}
}
if (role == Qt::DisplayRole) {
if (index.column() == cols.at(0)) {
return ROMs.at(index.row()).section(";", 0, 0);
}
if (index.column() == cols.at(3)) {
if (ROMs.at(index.row()).section(";", 3,3) == "0") {
return cEmulator;
} else { return ROMs.at(index.row()).section(";", 3,3); }
}
if (index.column() == cols.at(4)) {
return ROMs.at(index.row()).section(";", 4, 4);
}
if (index.column() == cols.at(6)) {
return ROMs.at(index.row()).section(";", 6, 6);
}
if (index.column() == cols.at(10)) {
return ROMs.at(index.row()).section(";", 10, 10);
}
}
}
QVariant rs_GameModel::data(const QModelIndex &index, int role) const {
if (!index.isValid()) {
return QVariant();
}
if (index.row() >= romCount || index.row() < 0 ) {
return QVariant();
}
if (role == Qt::TextAlignmentRole) {
if (index.column() > 0 && index.column() < 10) {
return Qt::AlignHCenter;
}
}
if (role == Qt::UserRole) {
if (index.column() == cols.at(0)) {
return ROMs.at(index.row()).section(";", 11, 11);
}
}
if (role == Qt::DecorationRole) {
if (index.column() == cols.at(0)) {
return QIcon(QString("Skin/%1/icons/sys/rom16.png").arg(CurrSkin));
}
if (index.column() == cols.at(1)) {
QString tmpExt = ROMs.at(index.row()).section(";", 1, 1);
if (tmpExt.compare("zip", Qt::CaseInsensitive) == 0 || tmpExt.compare("7Z", Qt::CaseInsensitive) == 0 || tmpExt.compare("r", Qt::CaseInsensitive) == 0 ) {
return QIcon(QString("Skin/%1/icons/sys/compressed16.png").arg(CurrSkin));
} else if (tmpExt.compare("iso", Qt::CaseInsensitive) == 0 || tmpExt.compare("cue", Qt::CaseInsensitive) == 0 || tmpExt.compare("bin", Qt::CaseInsensitive) == 0 ||
tmpExt.compare("nrg", Qt::CaseInsensitive) == 0 || tmpExt.compare("mdf", Qt::CaseInsensitive) == 0 || tmpExt.compare("mds", Qt::CaseInsensitive) == 0 ) {
return QIcon(QString("Skin/%1/icons/sys/cddvd16.png").arg(CurrSkin));
} else {
return QIcon(QString("Skin/%1/icons/sys/cartridge16.png").arg(CurrSkin));;
}
}
}
if (role == Qt::DisplayRole) {
if (index.column() == cols.at(0)) {
return ROMs.at(index.row()).section(";", 0, 0);
}
if (index.column() == cols.at(3)) {
if (ROMs.at(index.row()).section(";", 3,3) == "0") {
return cEmulator;
} else { return ROMs.at(index.row()).section(";", 3,3); }
}
if (index.column() == cols.at(4)) {
return ROMs.at(index.row()).section(";", 4, 4);
}
if (index.column() == cols.at(6)) {
return ROMs.at(index.row()).section(";", 6, 6);
}
if (index.column() == cols.at(10)) {
return ROMs.at(index.row()).section(";", 10, 10);
}
}
return QVariant();
}
To copy to clipboard, switch view to plain text mode
Bookmarks