Extract library paths methods to it's own struct in yacreader_global.h and use it everywhere

This commit is contained in:
Luis Ángel San Martín
2025-03-29 11:31:53 +01:00
parent 5aa637fdbe
commit d4b7c6dd8a
15 changed files with 133 additions and 90 deletions

View File

@ -1,10 +1,8 @@
#include "covercontroller_v2.h"
#include "db_helper.h" //get libraries
#include <QImage>
#include "yacreader_libraries.h"
#include "yacreader_http_session.h"
#include "template.h"
#include "../static.h"
#include "yacreader_global.h"
using stefanfrings::HttpRequest;
using stefanfrings::HttpResponse;
@ -22,7 +20,7 @@ void CoverControllerV2::service(HttpRequest &request, HttpResponse &response)
QString libraryName = DBHelper::getLibraryName(pathElements.at(3).toInt());
QString fileName = pathElements.at(5);
QImage img(libraries.getPath(libraryName) + "/.yacreaderlibrary/covers/" + fileName);
QImage img(YACReader::LibraryPaths::coverPathWithFileName(libraries.getPath(libraryName), fileName));
if (!img.isNull()) {
QByteArray ba;
QBuffer buffer(&ba);