obj/app.o \
obj/configwin.o \
obj/filepicker.o \
+ obj/moc_filepicker.o \
obj/filelistmodel.o \
obj/filethread.o \
+ obj/moc_filethread.o \
obj/mainwin.o \
obj/moc_mainwin.o \
obj/glwidget.o \
#include <QApplication>
#include "mainwin.h"
+#include "types.h"
// Here's the main application loop--short and simple...
int main(int argc, char * argv[])
Q_INIT_RESOURCE(vj); // This must the same name as the exe filename
//or is it the .qrc filename???
+ // This is so we can pass this stuff using signal/slot mechanism...
+//ick int id = qRegisterMetaType<uint32>();
App app(argc, argv); // Declare an instance of the application
QVariant FileListModel::headerData(int section, Qt::Orientation orientation, int role/*= Qt::DisplayRole*/) const
{
+#if 0
// Not sure that this is necessary for our purposes...
// Especially since this model would never make use of this info...
if (role != Qt::DisplayRole)
return QString("Column %1").arg(section);
else
return QString("Row %1").arg(section);
+#else
+ // This seems more like what we want...
+ if (role == Qt::SizeHintRole)
+ return QSize(1, 1);
+
+ return QVariant();
+#endif
}
void FileListModel::AddData(QIcon pix)
#include "filepicker.h"
#include "crc32.h"
+#include "filelistmodel.h"
#include "filethread.h"
#include "settings.h"
#include "types.h"
setWindowTitle("Insert Cartridge...");
#if 1
- fileList = new QListWidget(this);
+ 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);
+
+ /*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";
#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)
{
//
#include <QtGui>
+#include "types.h"
// Forward declarations
class QListWidget;
class FileThread;
+class FileListModel;
+class QListView;
class FilePickerWindow: public QWidget
{
+ // Once we have signals/slots, we need this...
+ Q_OBJECT
+
public:
FilePickerWindow(QWidget * parent = 0);
+ public slots:
+ void AddFileToList(unsigned long index);
+
protected:
// void PopulateList(void);
private:
- QListWidget * fileList;
+ QListWidget * fileList2;
FileThread * fileThread;
+ FileListModel * model;
+ QListView * fileList;
};
{
printf("FileThread: Found match [%s]...\n", romList[index].name);
new QListWidgetItem(QIcon(":/res/generic.png"), romList[index].name, listWidget);
-// break;
+ emit FoundAFile(romList[index].crc32);
}
}
class FileThread: public QThread
{
+ Q_OBJECT
+
public:
FileThread(QObject * parent = 0);
~FileThread();
void Go(QListWidget * lw);
+ signals:
+ void FoundAFile(unsigned long index);
+
protected:
void run(void);
uint32 FindCRCIndexInFileList(uint32);