#include "filepicker.h"
#include "crc32.h"
+#include "filelistmodel.h"
+#include "filethread.h"
#include "settings.h"
#include "types.h"
const char file[128];
};
-RomIdentifier romList[] = {
+RomIdentifier romList2[] = {
{ 0x0509C85E, "Raiden (World)", "" },
{ 0x08F15576, "Iron Soldier (World) (v1.04)", "" },
{ 0x0957A072, "Kasumi Ninja (World)", "" },
{
setWindowTitle("Insert Cartridge...");
- fileList = new QListWidget(this);
+#if 1
+ fileList2 = new QListWidget(this);
// addWidget(fileList);
QVBoxLayout * layout = new QVBoxLayout();
// layout->setSizeConstraint(QLayout::SetFixedSize);
setLayout(layout);
- layout->addWidget(fileList);
+ layout->addWidget(fileList2);
- PopulateList();
+// PopulateList();
+ fileThread = new FileThread(this);
+
+ /*bool b =*/ connect(fileThread, SIGNAL(FoundAFile(unsigned long)), this, SLOT(AddFileToList(unsigned long)));
+//printf("FilePickerWindow: Connection to FileThread %s...\n", (b ? "succeeded" : "failed"));
+
+ fileThread->Go(fileList2);
+#else
+QStringList numbers;
+numbers << "One" << "Two" << "Three" << "Four" << "Five";
+
+QAbstractItemModel * model = new StringListModel(numbers);
+QListView * view = new QListView;
+view->setModel(model);
+
+#endif
+}
+
+// Need a slot here to pickup stuff from the thread...
+
+void FilePickerWindow::AddFileToList(unsigned long index)
+{
+ printf("--> Found CRC: %08X...\n", (uint32)index);
}
+
+/*
void FilePickerWindow::PopulateList(void)
{
QDir romDir(vjs.ROMPath);
file.close();
//printf("FilePickerWindow: File crc == %08X...\n", crc);
- for(int j=0; romList[j].crc32 != 0xFFFFFFFF; j++)
+ for(int j=0; romList2[j].crc32 != 0xFFFFFFFF; j++)
{
- if (romList[j].crc32 == crc)
+ if (romList2[j].crc32 == crc)
{
-printf("FilePickerWindow: Found match [%s]...\n", romList[j].name);
- new QListWidgetItem(QIcon(":/res/generic.png"), romList[j].name, fileList);
+printf("FilePickerWindow: Found match [%s]...\n", romList2[j].name);
+ new QListWidgetItem(QIcon(":/res/generic.png"), romList2[j].name, fileList);
break;
}
}
delete[] buffer;
}
}
-
+*/