blob: f42afc5d5568c61a101055ded57ccec3e075f854 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later version.
*/
#include <QString>
#include <QSettings>
#include "coveritem.h"
CoverItem::CoverItem(const QString &filename, const QString &type, const QString &md5) : mFilename(filename), mType(type), mMd5(md5){
setPath();
}
CoverItem::CoverItem() {};
void CoverItem::setFileName(const QString &filename){
mFilename = filename;
setPath();
}
void CoverItem::setMd5(const QString &md5){
mMd5 = md5;
setPath();
}
void CoverItem::setFullPath(const QString &fullPath){
if(fullPath.contains('/')){
mFullPath = fullPath;
QString wc = fullPath;
int idx = fullPath.lastIndexOf('/') + 1;
mFilename = wc.remove(0, idx);
}
}
void CoverItem::setPath(){
if(mFilename.isEmpty() || mMd5.isEmpty()){
return;
}
// assume it's the full path
if(mFilename.contains('/')){
return;
}
QSettings s;
QString archive = s.value("paths/archivedir").toString();
mFullPath = QString("%1/%2/%3/%4").arg(archive).arg(mMd5[0]).arg(mMd5[1]).arg(mFilename);
}
|