X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Ffilepicker.cpp;h=52117362d37b98184392f298864bab397efeda1f;hb=8e680eb382eceb22f52cb923958ac652d693eb1a;hp=a221d03a2fbd3f030dd6a99b95a09b8e556b2202;hpb=8549cdb01f45764f69a6483285dc0771ea66c007;p=virtualjaguar diff --git a/src/gui/filepicker.cpp b/src/gui/filepicker.cpp index a221d03..5211736 100644 --- a/src/gui/filepicker.cpp +++ b/src/gui/filepicker.cpp @@ -9,12 +9,15 @@ // Who When What // --- ---------- ------------------------------------------------------------- // JLH 01/22/2010 Created this file +// JLH 02/06/2010 Modified to use Qt model/view framework // #include "filepicker.h" #include "crc32.h" +#include "filelistmodel.h" #include "filethread.h" +#include "imagedelegate.h" #include "settings.h" #include "types.h" @@ -112,30 +115,49 @@ FilePickerWindow::FilePickerWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt: { setWindowTitle("Insert Cartridge..."); -#if 1 - fileList = new QListWidget(this); +#if 0 + fileList2 = new QListWidget(this); // addWidget(fileList); QVBoxLayout * layout = new QVBoxLayout(); // layout->setSizeConstraint(QLayout::SetFixedSize); setLayout(layout); - layout->addWidget(fileList); + layout->addWidget(fileList2); // PopulateList(); fileThread = new FileThread(this); - fileThread->Go(fileList); -#else -QStringList numbers; -numbers << "One" << "Two" << "Three" << "Four" << "Five"; -QAbstractItemModel * model = new StringListModel(numbers); -QListView * view = new QListView; -view->setModel(model); + /*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 +//is there any reason why this must be cast as a QAbstractListModel? +//Also, need to think about data structure for the model... + model = new FileListModel(); + fileList = new QListView(); + fileList->setModel(model); + ImageDelegate * delegate = new ImageDelegate(this); + fileList->setItemDelegate(delegate); + + QVBoxLayout * layout = new QVBoxLayout; + setLayout(layout); + layout->addWidget(fileList); + ((FileListModel *)model)->AddData(QIcon(":/res/generic.png")); + ((FileListModel *)model)->AddData(QIcon(":/res/generic.png")); #endif } +// Need a slot here to pickup stuff from the thread... + +void FilePickerWindow::AddFileToList(unsigned long index) +{ + printf("--> Found CRC: %08X...\n", romList2[index].crc32); +} + + /* void FilePickerWindow::PopulateList(void) {