/*! * * Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file MSDCardFile.h * \author (last) Vy * \date (last) 18-Jul-2023 * \author (original) Vy * \date (original) 18-Jul-2023 * */ #pragma once // Qt #include #include // Project // forward declarations class tst_models; namespace Model { /*! * \brief The SD Card File class * Provides abstraction for a SD Card File * \details Holds information about the SD Card File such as filename and size * */ class MSDCardFile { public: struct Data { public: bool operator==(const Data &d1) { const QString otherFilePath(QString("%1/%2").arg(d1.filePath()).arg(d1.fileName())); QFileInfo otherFile(otherFilePath); if(_fileInfo.exists() && otherFile.exists()) return _fileInfo == otherFile; return false; } explicit Data() {} explicit Data(const QString &vFilePath) : _fileInfo(QFileInfo(vFilePath)) { } QString filePath() const { return _fileInfo.path(); } QString fileName() const { return _fileInfo.fileName (); } qint64 fileSize_bytes() const { return _fileInfo.size (); } bool isSymLink() { return _fileInfo.isSymbolicLink(); } private: QFileInfo _fileInfo; }; }; } typedef Model::MSDCardFile::Data SDCardFileData;