Updated QML and C++ in various places to build and work with new Qt (6.4+) Minor bugfixes, possibly caused by the Qt version bump, and mostly in JS logic. Tried (again) to get mod sorting working by dragging them within the list. Initial support for Profiles. (To switch between FO4 and FOLON, for example.) Initial "Launch Game" stuff, but it's far from done. Don't use it (yet).
99 lines
2.1 KiB
C++
99 lines
2.1 KiB
C++
#ifndef DATABASE_H
|
|
#define DATABASE_H
|
|
|
|
#include <QObject>
|
|
#include <QFileSystemWatcher>
|
|
#include <QSqlDatabase>
|
|
|
|
class ModEntry : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
int m_id;
|
|
QString m_archivePath;
|
|
QString m_installedPath;
|
|
|
|
ModEntry() : m_id{0} {}
|
|
/*
|
|
ModEntry(const ModEntry &other)
|
|
: QObject()
|
|
{
|
|
m_id = other.m_id;
|
|
m_archivePath = other.m_archivePath;
|
|
m_installedPath = other.m_installedPath;
|
|
}
|
|
|
|
ModEntry &operator=(const ModEntry &other)
|
|
{
|
|
m_id = other.m_id;
|
|
m_archivePath = other.m_archivePath;
|
|
m_installedPath = other.m_installedPath;
|
|
return *this;
|
|
}
|
|
*/
|
|
};
|
|
|
|
class ModLibrary : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
int m_id;
|
|
QString m_filename;
|
|
QList<ModEntry *> m_entries;
|
|
|
|
ModLibrary() : m_id{0} {}
|
|
~ModLibrary() {
|
|
for( ModEntry *ent : m_entries )
|
|
ent->deleteLater();
|
|
}
|
|
/*
|
|
ModLibrary(const ModLibrary &other)
|
|
: QObject()
|
|
{
|
|
m_id = other.m_id;
|
|
m_filename = other.m_filename;
|
|
m_entries = other.m_entries;
|
|
}
|
|
|
|
ModLibrary &operator=(const ModLibrary &other)
|
|
{
|
|
m_id = other.m_id;
|
|
m_filename = other.m_filename;
|
|
m_entries = other.m_entries;
|
|
return *this;
|
|
}
|
|
|
|
friend bool operator<(const ModLibrary &a, const ModLibrary &b)
|
|
{
|
|
return a.m_id < b.m_id;
|
|
}
|
|
*/
|
|
};
|
|
|
|
class Database : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
bool m_open;
|
|
QSqlDatabase m_database;
|
|
QStringList m_overrides;
|
|
|
|
public:
|
|
explicit Database(QObject *parent = nullptr);
|
|
//~Database();
|
|
|
|
void setDatabase(QSqlDatabase &db);
|
|
bool open(const QString &dbpath);
|
|
void readOverrides();
|
|
QList<ModLibrary *> archiveList(int profileId);
|
|
QStringList proxyList(int profileId);
|
|
QList<ModEntry *> modManifest(int id);
|
|
|
|
bool isProxyOverride(const QString &filepath);
|
|
bool registerProxyOverride(const QString &filepath);
|
|
bool unregisterProxyOverride(const QString &filepath);
|
|
};
|
|
|
|
#endif // DATABASE_H
|