diff options
author | am <am@f440f766-f032-0410-8965-dc7d17de2ca0> | 2009-07-21 13:48:56 +0000 |
---|---|---|
committer | am <am@f440f766-f032-0410-8965-dc7d17de2ca0> | 2009-07-21 13:48:56 +0000 |
commit | 84ed109c159dcbd0c9395717d54599e902060b26 (patch) | |
tree | 01bb4a4d6148ec46952a1cdd5e923bb7b642305e /coveritem.cpp | |
parent | ec3418479b28ca8e162f84d76c2eed78c27a114c (diff) | |
download | SheMov-84ed109c159dcbd0c9395717d54599e902060b26.tar.gz SheMov-84ed109c159dcbd0c9395717d54599e902060b26.tar.bz2 SheMov-84ed109c159dcbd0c9395717d54599e902060b26.zip |
-Made CoverItem behave consistent
-get QModelIndex from MovieModel by movieId
-ArchiveView: added delegates for dvd and size, MovieItem now returns size as int
-Finished EditArchiveItemDialog
-Reverted covereditor, it became too convoluted
git-svn-id: file:///var/svn/repos2/shemov/trunk@393 f440f766-f032-0410-8965-dc7d17de2ca0
Diffstat (limited to 'coveritem.cpp')
-rw-r--r-- | coveritem.cpp | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/coveritem.cpp b/coveritem.cpp index f42afc5..4955349 100644 --- a/coveritem.cpp +++ b/coveritem.cpp @@ -6,45 +6,27 @@ */ #include <QString> -#include <QSettings> +#include <QFileInfo> #include "coveritem.h" -CoverItem::CoverItem(const QString &filename, const QString &type, const QString &md5) : mFilename(filename), mType(type), mMd5(md5){ - setPath(); +CoverItem::CoverItem(const QString &fullPath, const QString &type, const QString &md5) : mFullPath(fullPath), mType(type), mMd5(md5){ + setFileName(); } 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); - } + mFullPath = fullPath; + setFileName(); } -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); +void CoverItem::setFileName(){ + QFileInfo info(mFullPath); + mFilename = info.fileName(); } |