完成框架目录和模块重构;新增核心、单例、工具、加密及框架 SDK;统一任务、相机和 RPC 接口,并增加离线检测、相机标定、备份恢复、版本管理、崩溃守护和心跳监控功能。
56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <QMutex>
|
|
#include <QString>
|
|
#include <QVariantMap>
|
|
|
|
#include <nlohmannJson.hpp>
|
|
|
|
class modelMD5Manager {
|
|
public:
|
|
struct ModelMD5Info {
|
|
QString modelPath;
|
|
QString modelMD5;
|
|
QString geforcePath;
|
|
QString geforceMD5;
|
|
QString cachedModelMD5;
|
|
QString cachedGeforceMD5;
|
|
bool hasGeforce = false;
|
|
bool modelMatched = true;
|
|
bool geforceMatched = true;
|
|
bool geforceExistedBeforeInit = false;
|
|
|
|
QString activeMD5() const;
|
|
};
|
|
|
|
struct InitSnapshot {
|
|
QString modelPath;
|
|
QString modelMD5;
|
|
QString geforcePathBeforeInit;
|
|
QString geforceMD5BeforeInit;
|
|
};
|
|
|
|
modelMD5Manager() = default;
|
|
|
|
static QString fileMD5(const QString& path);
|
|
static QString findGeforceFile(const QString& modelPath);
|
|
InitSnapshot beginInit(const QString& modelPath);
|
|
ModelMD5Info completeInit(const InitSnapshot& snapshot);
|
|
ModelMD5Info refresh(const QString& modelPath);
|
|
QString cachedModelMD5(const QString& modelPath);
|
|
void saveAfterUpdate(const QString& modelPath);
|
|
|
|
private:
|
|
static QString normalizePath(const QString& path);
|
|
static QString recordKey(const QString& modelPath);
|
|
QString cachePath() const;
|
|
void ensureLoaded();
|
|
QVariantMap recordForKey(const QString& key) const;
|
|
void saveRecordUnlocked(const ModelMD5Info& info);
|
|
|
|
QMutex mutex;
|
|
bool loaded = false;
|
|
nlohmann::ordered_json root = nlohmann::ordered_json::object();
|
|
nlohmann::ordered_json records = nlohmann::ordered_json::object();
|
|
};
|