X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fimagedelegate.cpp;h=122196f3571afbea486da22ddd08e5822a0885e8;hb=54f5867e394981dd72548990064238454a6e2395;hp=eaae05fc00ed1ac3e3b2478bcf6ee4f00f4036e6;hpb=4beff2f35f649bb0befa58c8a89fdd702b3c9b4f;p=virtualjaguar diff --git a/src/gui/imagedelegate.cpp b/src/gui/imagedelegate.cpp index eaae05f..122196f 100644 --- a/src/gui/imagedelegate.cpp +++ b/src/gui/imagedelegate.cpp @@ -17,7 +17,7 @@ #include "imagedelegate.h" #include "filedb.h" - +#include "filelistmodel.h" //ImageDelegate::ImageDelegate(QObject * parent): QAbstractItemDelegate(parent)//, pixelSize(12) //{ @@ -87,12 +87,29 @@ The foreground of the item (the circle representing a pixel) must be rendered us // This is crappy. We really should have a properly scaled image ready to go so we // don't get Qt's default ugly looking fast scaling... + #warning "!!! FIX !!! Need to create properly scaled down cart/label images!" +//We've got the carts, now just need to do the labels... + // unsigned long i = index.model()->data(index, Qt::DisplayRole).toUInt(); +#if 0 unsigned long i = index.model()->data(index, Qt::DisplayRole).toUInt(); QString filename = index.model()->data(index, Qt::EditRole).toString(); QImage label = index.model()->data(index, Qt::DecorationRole).value(); +#else + unsigned long i = index.model()->data(index, FLM_INDEX).toUInt(); + QString filename = index.model()->data(index, FLM_FILENAME).toString(); + QImage label = index.model()->data(index, FLM_LABEL).value(); +#endif + QString nameToDraw; + if (i == 0xFFFFFFFF) // Not found... + { + int lastSlashPos = filename.lastIndexOf('/'); + nameToDraw = "\"" + filename.mid(lastSlashPos + 1) + "\""; + } + else + nameToDraw = romList[i].name; #if 0 if (role == Qt::DecorationRole) return list.at(index.row()).label; @@ -113,7 +130,8 @@ The foreground of the item (the circle representing a pixel) must be rendered us // painter->setPen(Qt::white); painter->setPen(QColor(255, 128, 0, 255)); // painter->drawText(QRect(option.rect.x()+20, option.rect.y()+73, 196, 70), Qt::TextWordWrap | Qt::AlignHCenter, QString(romList[i].name)); - painter->drawText(QRect(option.rect.x()+10, option.rect.y()+36, 196/2, 70/2), Qt::TextWordWrap | Qt::AlignHCenter, QString(romList[i].name)); + painter->drawText(QRect(option.rect.x()+10, option.rect.y()+36, 196/2, 70/2), + Qt::TextWordWrap | Qt::AlignHCenter, nameToDraw); } else {