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).
82 lines
1.8 KiB
C++
82 lines
1.8 KiB
C++
#ifndef ARCHIVEMANAGER_H
|
|
#define ARCHIVEMANAGER_H
|
|
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
|
|
#include "modarchive.h"
|
|
#include "database.h"
|
|
|
|
class ArchiveCachedEntry : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
protected:
|
|
QObject *m_parent;
|
|
|
|
public:
|
|
bool m_valid;
|
|
//bool m_isdir;
|
|
ModLibrary *m_library;
|
|
ModEntry *m_entry;
|
|
Archive *m_archive;
|
|
|
|
ArchiveCachedEntry(QObject *p=nullptr) : QObject(p)
|
|
{
|
|
m_valid = false;
|
|
//m_isdir = false;
|
|
m_library = NULL;
|
|
m_entry = NULL;
|
|
m_archive = NULL;
|
|
}
|
|
|
|
ArchiveCachedEntry(const ArchiveCachedEntry &other)
|
|
: QObject(other.parent())
|
|
{
|
|
m_valid = other.m_valid;
|
|
//m_isdir = other.m_isdir;
|
|
m_library = other.m_library;
|
|
m_entry = other.m_entry;
|
|
m_archive = other.m_archive;
|
|
}
|
|
ArchiveCachedEntry &operator=(const ArchiveCachedEntry &other)
|
|
{
|
|
//QObject(other.m_parent);
|
|
m_valid = other.m_valid;
|
|
//m_isdir = other.m_isdir;
|
|
m_library = other.m_library;
|
|
m_entry = other.m_entry;
|
|
m_archive = other.m_archive;
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
class ArchiveManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
Database *m_database;
|
|
QString m_modsdir;
|
|
int m_profileId;
|
|
|
|
QTimer m_cacheTimer;
|
|
QMap< QString, ArchiveCachedEntry > m_cache;
|
|
|
|
public slots:
|
|
int reloadArchives();
|
|
void cleanCache();
|
|
|
|
public:
|
|
QHash< ModLibrary *, Archive * > m_archives;
|
|
|
|
explicit ArchiveManager(Database *db, const QString &modsdir, int profileId, QObject *parent = nullptr);
|
|
~ArchiveManager();
|
|
|
|
QHash<ModLibrary *, Archive *> getArchives();
|
|
|
|
bool findFile(const QString &qpath, ModLibrary **library, ModEntry **modentry, Archive **archive);
|
|
|
|
signals:
|
|
};
|
|
|
|
#endif // ARCHIVEMANAGER_H
|