42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#ifndef MEDIAFILEMANAGER_H
|
|
#define MEDIAFILEMANAGER_H
|
|
|
|
#include <QString>
|
|
#include <QVector>
|
|
|
|
struct MediaFile {
|
|
QString name;
|
|
QString filePath;
|
|
|
|
MediaFile() = default;
|
|
MediaFile(const QString& n, const QString& p) : name(n), filePath(p) {}
|
|
};
|
|
|
|
class MediaFileManager
|
|
{
|
|
public:
|
|
MediaFileManager();
|
|
~MediaFileManager() = default;
|
|
|
|
bool addFile(const QString& name, const QString& filePath);
|
|
bool removeFile(const QString& name);
|
|
bool updateFile(const QString& oldName, const QString& newName, const QString& newFilePath);
|
|
|
|
QString getFilePathByName(const QString& name) const;
|
|
int getFileCount() const;
|
|
QVector<MediaFile> getAllFiles() const;
|
|
|
|
bool contains(const QString& name) const;
|
|
|
|
// Новые методы для управления файлами
|
|
bool renameFile(const QString& oldName, const QString& newName);
|
|
bool updateFilePath(const QString& name, const QString& newFilePath);
|
|
|
|
private:
|
|
int findFileIndex(const QString& name) const;
|
|
|
|
QVector<MediaFile> mediaFiles;
|
|
};
|
|
|
|
#endif // MEDIAFILEMANAGER_H
|