DATABASE SUPPORT, ARTWORK, and a title display

This commit is contained in:
2026-08-14 12:44:56 -05:00
parent 39850225fc
commit e769d50a68
11 changed files with 534 additions and 16 deletions
+23
View File
@@ -2,13 +2,35 @@
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QtQml>
#include <QDebug>
#include "input/InputManager.h"
#include "library/LibraryDatabase.h"
#include "library/GameRepository.h"
#include "library/GameLibraryModel.h"
int main(int argc, char *argv[])
{
// creates our Qt GUI app
QGuiApplication app(argc, argv);
// opens nomad's persistent library database, ensures ready schema, etc
LibraryDatabase libraryDatabase;
if (!libraryDatabase.open()) {
qCritical() << "Failed to open nomad library:" << libraryDatabase.lastError();
return -1;
}
// GameRepository hadnles reading our game records from the database, while
// GameLibraryModel exposes those records in a QML-friendly list model
GameRepository gameRepository(libraryDatabase.database());
GameLibraryModel gameLibraryModel(gameRepository);
// database diagnostics
qDebug() << "Library database:" << libraryDatabase.databasePath();
qDebug() << "Games loaded:" << gameLibraryModel.rowCount();
// creats InputManager and installs it as an application-wide event filter so it can observe input events before normal delivery
InputManager inputManager;
app.installEventFilter(&inputManager);
@@ -22,6 +44,7 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
// make our InputManager instance available to QML for signals
engine.rootContext()->setContextProperty("inputManager", &inputManager);
engine.rootContext()->setContextProperty("gameLibraryModel", &gameLibraryModel);
// load our Main.qml into the engine to start things off
engine.loadFromModule("nomad", "Main");