From ec3418479b28ca8e162f84d76c2eed78c27a114c Mon Sep 17 00:00:00 2001 From: am Date: Mon, 20 Jul 2009 17:37:08 +0000 Subject: -started on editing the archive -big probs with the covers, I'll stop for now, can't think straight any more -changes to MovieModel -changes to MovieItem -modified CoverEditor to allow adding files (untested) git-svn-id: file:///var/svn/repos2/shemov/trunk@392 f440f766-f032-0410-8965-dc7d17de2ca0 --- coveritem.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'coveritem.cpp') diff --git a/coveritem.cpp b/coveritem.cpp index f29e81c..f42afc5 100644 --- a/coveritem.cpp +++ b/coveritem.cpp @@ -6,7 +6,45 @@ */ #include +#include #include "coveritem.h" -CoverItem::CoverItem(const QString &filename, const QString &type, const QString &md5) : mFilename(filename), mType(type), mMd5(md5) {}; +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); +} + -- cgit v1.2.3-70-g09d2