+void FilePickerWindow::LoadButtonPressed(void)
+{
+ // TODO: Get the text of the current selection, call the MainWin slot for loading
+ emit(RequestLoad(currentFile));
+ this->hide();
+}
+
+//
+// This slot gets called when the QListView gets clicked on. Updates
+// the cart graphic and accompanying text.
+//
+void FilePickerWindow::UpdateSelection(const QModelIndex & current, const QModelIndex &/*previous*/)
+{
+#if 0
+ QString s = current.model()->data(current, Qt::EditRole).toString();
+ unsigned long i = current.model()->data(current, Qt::DisplayRole).toUInt();
+ QImage label = current.model()->data(current, Qt::DecorationRole).value<QImage>();
+// printf("FPW: %s\n", s.toAscii().data());
+ unsigned long fileSize = current.model()->data(current, Qt::WhatsThisRole).toUInt();
+#else
+// QString s = current.model()->data(current, FLM_FILENAME).toString();
+ currentFile = current.model()->data(current, FLM_FILENAME).toString();
+ unsigned long i = current.model()->data(current, FLM_INDEX).toUInt();
+ QImage label = current.model()->data(current, FLM_LABEL).value<QImage>();
+ unsigned long fileSize = current.model()->data(current, FLM_FILESIZE).toUInt();
+// printf("FPW: %s\n", s.toAscii().data());
+#endif
+
+//hm.
+//currentFile = s;
+
+//373x172 is label size...
+//365x168 now...
+ if (!label.isNull())
+ {
+/*
+ QImage cartImg(":/res/cart-blank.png");
+ QPainter painter(&cartImg);
+ painter.drawPixmap(23, 87, QPixmap(":/res/label-blank.png"));
+ painter.end();
+ cartSmall = cartImg.scaled(488/4, 395/4, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+*/
+ QImage cart(":/res/cart-blank.png");
+ QPainter painter(&cart);
+//Though this should probably be done when this is loaded, instead of every time here...
+//QImage scaledImg = label.scaled(373, 172, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+//painter.drawPixmap(23, 87, QPixmap::fromImage(scaledImg));
+ // Now, looks like it is...
+// painter.drawPixmap(23, 87, QPixmap::fromImage(label));
+ painter.drawPixmap(27, 89, QPixmap::fromImage(label));
+// painter.drawPixmap(23, 87, 373, 172, QPixmap::fromImage(label));
+
+// Well, heck. This should be done to the label *before* we get here.
+ painter.drawPixmap(27, 89, QPixmap::fromImage(QImage(":/res/upper-left.png")));
+ painter.drawPixmap(27+355, 89, QPixmap::fromImage(QImage(":/res/upper-right.png")));
+
+ painter.end();
+ cartImage->setPixmap(QPixmap::fromImage(cart));
+ }
+ else
+ {
+ // We should try to be intelligent with our updates here, and only redraw when
+ // we're going from a selection with a label to a selection without. Now, we
+ // redraw regardless.
+ QImage cart(":/res/cart-blank.png");
+ QPainter painter(&cart);
+// painter.drawPixmap(23, 87, QPixmap::fromImage(QImage(":/res/label-blank.png")));
+ painter.drawPixmap(27, 89, QPixmap::fromImage(QImage(":/res/label-blank.png")));
+ painter.end();
+ cartImage->setPixmap(QPixmap::fromImage(cart));
+ }
+
+//1048576
+//2097152
+//4194304
+ prettyFilename = romList[i].name;
+ title->setText(QString("<h2>%1</h2>").arg(romList[i].name));
+//Kludge for now, we'll have to fix this later...
+ QString fileType = QString(romList[i].flags & FF_ROM ? "%1MB Cartridge" : "%1*** UNKNOWN ***")
+ .arg(fileSize / 1048576);
+ QString crcString = QString("%1").arg(romList[i].crc32, 8, 16, QChar('0')).toUpper();
+ QString notes =
+/* (romList[i].flags & FF_ROM ? "Jaguar ROM " : "")*/
+ QString(romList[i].flags & FF_BAD_DUMP ? "<b>BAD DUMP</b>" : "");
+ data->setText(QString("%1<br>%2<br>%3<br>%4").arg(fileType).arg(crcString).arg("???%").arg(notes));
+}
+
+/*
+ Super Duper Awesome Guy (World)
+
+ Type: 4MB Cartridge
+ CRC32: FEDCBA98
+Compatibility: DOES NOT WORK
+ Notes: Universal Header detected; Requires DSP
+
+
+ Stupid Homebrew Game That Sux
+
+ Type: ABS/COF Executable (43853 bytes)
+ CRC32: 76543210
+Compatibility: Unknown
+ Notes: $4000 Load, $4000 Run
+
+
+ Action Hopscotch Plus (Prototype)
+
+ Type: 2MB Alpine ROM
+ CRC32: 44889921
+Compatibility: 80% (or ****)
+ Notes: EEPROM available
+
+
+*/