TTW_Bot/filemanager.h

75 lines
2.0 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef FILEMANAGER_H
#define FILEMANAGER_H
#include <QString>
#include <QDir>
#include <QFile>
#include <QStandardPaths>
#include <QCoreApplication>
class FileManager
{
public:
// Типы файлов/папок
enum FileType {
Sounds,
Images,
Styles,
Voices,
Fonts,
Temp,
Backups,
Exports,
Logs,
Cache,
WebServerImages,
WebServerSounds,
Icons,
SystemStyles
};
// Режим копирования
enum CopyMode {
CopyIfNotExists, // Копировать только если не существует
CopyAlways, // Всегда копировать (перезаписывать)
CopyWithNewName // Копировать с новым именем (если существует)
};
static FileManager& instance();
// Основные пути
QString systemPath() const;
QString userDataPath() const;
// Получение путей
QString getPath(FileType type, const QString& subPath = "") const;
QString getFullPath(FileType type, const QString& fileName) const;
// Копирование файлов
bool copyToUserData(const QString& sourceFile, FileType type,
CopyMode mode = CopyIfNotExists,
QString* newFileName = nullptr);
// Проверка существования
bool existsInUserData(FileType type, const QString& fileName) const;
// Инициализация структуры папок
void initializeFolderStructure();
// Получение относительного пути для веб-сервера
QString getWebPath(FileType type, const QString& fileName) const;
private:
FileManager();
~FileManager() = default;
FileManager(const FileManager&) = delete;
FileManager& operator=(const FileManager&) = delete;
QString m_systemPath;
QString m_userDataPath;
};
#endif // FILEMANAGER_H