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).
71 lines
1.5 KiB
C++
71 lines
1.5 KiB
C++
#ifndef MODARCHIVE_H
|
|
#define MODARCHIVE_H
|
|
|
|
#include <QObject>
|
|
#include <QMap>
|
|
#include <QMutex>
|
|
#include <unarr.h>
|
|
#include <sys/stat.h>
|
|
|
|
class ArchiveCacheEntry : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
QByteArray m_data;
|
|
int m_accessCount;
|
|
bool m_cached;
|
|
bool m_loading;
|
|
off_t m_offset;
|
|
struct stat m_stat;
|
|
time_t m_lastAccess;
|
|
QMutex m_mutex;
|
|
bool m_locked;
|
|
|
|
ArchiveCacheEntry(QObject *parent=NULL) :
|
|
QObject(parent),
|
|
m_accessCount{0},
|
|
m_cached{false},
|
|
m_loading{false},
|
|
m_offset{0},
|
|
m_lastAccess{0},
|
|
m_locked{false}
|
|
{
|
|
}
|
|
};
|
|
|
|
class Archive : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
ar_stream *m_stream;
|
|
ar_archive *m_archive;
|
|
QString m_arcpath;
|
|
QMutex m_mutex;
|
|
bool m_suicidal;
|
|
|
|
QMap< QString, ArchiveCacheEntry * > m_cache;
|
|
|
|
private:
|
|
bool open();
|
|
bool close();
|
|
|
|
public:
|
|
explicit Archive(const QString &arcpath, QObject *parent = nullptr);
|
|
~Archive();
|
|
|
|
QString getPath() { return m_arcpath; }
|
|
QMap<QString, ArchiveCacheEntry *> *getEntries();
|
|
QByteArray *getEntry(const QString &path);
|
|
void releaseEntry(const QString &path);
|
|
bool contains(const QString &path);
|
|
ArchiveCacheEntry *cache(const QString &path);
|
|
void cleanCache(time_t olderThan);
|
|
|
|
void killme();
|
|
void checkIfLifeIsWorthIt();
|
|
|
|
signals:
|
|
};
|
|
|
|
#endif // MODARCHIVE_H
|