File indexing completed on 2025-03-16 03:35:12
0001 // xlsxmediafile.cpp 0002 0003 #include <QtGlobal> 0004 #include <QCryptographicHash> 0005 0006 #include "xlsxmediafile_p.h" 0007 0008 QT_BEGIN_NAMESPACE_XLSX 0009 0010 MediaFile::MediaFile(const QByteArray &bytes, const QString &suffix, const QString &mimeType) 0011 : m_contents(bytes), m_suffix(suffix), m_mimeType(mimeType) 0012 , m_index(0), m_indexValid(false) 0013 { 0014 m_hashKey = QCryptographicHash::hash(m_contents, QCryptographicHash::Md5); 0015 } 0016 0017 MediaFile::MediaFile(const QString &fileName) 0018 :m_fileName(fileName), m_index(0), m_indexValid(false) 0019 { 0020 0021 } 0022 0023 void MediaFile::set(const QByteArray &bytes, const QString &suffix, const QString &mimeType) 0024 { 0025 m_contents = bytes; 0026 m_suffix = suffix; 0027 m_mimeType = mimeType; 0028 m_hashKey = QCryptographicHash::hash(m_contents, QCryptographicHash::Md5); 0029 m_indexValid = false; 0030 } 0031 0032 void MediaFile::setFileName(const QString &name) 0033 { 0034 m_fileName = name; 0035 } 0036 0037 QString MediaFile::fileName() const 0038 { 0039 return m_fileName; 0040 } 0041 0042 QString MediaFile::suffix() const 0043 { 0044 return m_suffix; 0045 } 0046 0047 QString MediaFile::mimeType() const 0048 { 0049 return m_mimeType; 0050 } 0051 0052 QByteArray MediaFile::contents() const 0053 { 0054 return m_contents; 0055 } 0056 0057 int MediaFile::index() const 0058 { 0059 return m_index; 0060 } 0061 0062 bool MediaFile::isIndexValid() const 0063 { 0064 return m_indexValid; 0065 } 0066 0067 void MediaFile::setIndex(int idx) 0068 { 0069 m_index = idx; 0070 m_indexValid = true; 0071 } 0072 0073 QByteArray MediaFile::hashKey() const 0074 { 0075 return m_hashKey; 0076 } 0077 0078 QT_END_NAMESPACE_XLSX