Skip to content

Commit

Permalink
imagefiledata: format changed to QByteArray
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihemreyildiz committed Sep 17, 2022
1 parent f69f4ed commit 8a81580
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/util/imagefiledata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ImageFileData::ImageFileData(
: QImage(QImage::fromData(coverArtBytes)),
m_coverArtBytes(coverArtBytes) {
if (format != nullptr) {
m_coverArtFormat = QString(format);
m_coverArtFormat = QByteArray(format);
}
}

Expand All @@ -36,7 +36,7 @@ ImageFileData ImageFileData::fromFilePath(const QString& coverArtFilePath) {
return ImageFileData(coverArtBytes, coverArtFormat);
}

bool ImageFileData::saveFile(QString coverArtAbsoluteFilePath) const {
bool ImageFileData::saveFile(const QString& coverArtAbsoluteFilePath) const {
QFile coverArtFile(coverArtAbsoluteFilePath);
coverArtFile.open(QIODevice::WriteOnly);
if (!coverArtFile.write(m_coverArtBytes)) {
Expand All @@ -50,7 +50,7 @@ bool ImageFileData::saveFile(QString coverArtAbsoluteFilePath) const {
}

// This method is only called when there is a temp file created.
bool ImageFileData::saveFileAddSuffix(QString pathWithoutSuffix) const {
bool ImageFileData::saveFileAddSuffix(const QString& pathWithoutSuffix) const {
QFile coverArtFile(pathWithoutSuffix + '.' + m_coverArtFormat);
coverArtFile.open(QIODevice::WriteOnly);
if (!coverArtFile.write(m_coverArtBytes)) {
Expand Down
6 changes: 3 additions & 3 deletions src/util/imagefiledata.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class ImageFileData : public QImage {
return m_coverArtBytes;
}

bool saveFile(QString coverArtAbsoluteFilePath) const;
bool saveFileAddSuffix(QString pathWithoutSuffix) const;
bool saveFile(const QString& coverArtAbsoluteFilePath) const;
bool saveFileAddSuffix(const QString& pathWithoutSuffix) const;

private:
QByteArray m_coverArtBytes;
QString m_coverArtFormat;
QByteArray m_coverArtFormat;
};

0 comments on commit 8a81580

Please sign in to comment.