diff options
author | Arno <am@disconnect.de> | 2014-02-14 15:51:19 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2014-02-14 15:51:19 +0100 |
commit | c8a12c10bba1a74282e84f7613d76912c419cd35 (patch) | |
tree | 27727664d65767756474387dc5f783d744fefa39 | |
parent | 424d37e94dbf820e3d0559e0041d6d2cd005f072 (diff) | |
download | SheMov-c8a12c10bba1a74282e84f7613d76912c419cd35.tar.gz SheMov-c8a12c10bba1a74282e84f7613d76912c419cd35.tar.bz2 SheMov-c8a12c10bba1a74282e84f7613d76912c419cd35.zip |
Fix size filter in Archive Browser
The size filter filtered more than selectedSize in the statusBar
suggested, because it used a differet size. Fix it by using a #define
everywhere.
-rw-r--r-- | archivebrowser.cpp | 2 | ||||
-rw-r--r-- | archivebrowsermodel.cpp | 5 | ||||
-rw-r--r-- | archivemodel.cpp | 2 | ||||
-rw-r--r-- | shemov.cpp | 13 | ||||
-rw-r--r-- | smglobals.cpp | 1 | ||||
-rw-r--r-- | smglobals.h | 5 |
6 files changed, 14 insertions, 14 deletions
diff --git a/archivebrowser.cpp b/archivebrowser.cpp index fa72253..006c9e7 100644 --- a/archivebrowser.cpp +++ b/archivebrowser.cpp @@ -80,7 +80,7 @@ void ArchiveBrowser::browserSelectionChanged(const QItemSelection &selected, con } emit sizeChanged(mSelectedSize); emit itemCountChanged(mSelectedItems); - qint64 remaining = Q_INT64_C(1024 * 1024 * 1024 * 4) - mSelectedSize; + qint64 remaining = DVDSIZE - mSelectedSize; mProxy->setBytesRemaining(remaining); } diff --git a/archivebrowsermodel.cpp b/archivebrowsermodel.cpp index 08a0752..5da95f1 100644 --- a/archivebrowsermodel.cpp +++ b/archivebrowsermodel.cpp @@ -11,6 +11,7 @@ #include "archivebrowsermodel.h" #include "smtreeitem.h" +#include "smglobals.h" #include "helper.h" ArchiveBrowserModel::ArchiveBrowserModel(const QStringList &headers, QObject *parent) : SmTreeModel(headers, parent), mNumFields(8) { @@ -52,10 +53,10 @@ QVariant ArchiveBrowserModel::data(const QModelIndex &index, int role) const { if(col == TotalSize){ qint64 s = item->data(TotalSize).toDouble(); QColor retval = Qt::green; - if(s > Q_INT64_C(1024 * 1024 * 1024 * 2)){ + if(s > DVDSIZE){ retval = Qt::cyan; } - if(s > Q_INT64_C(1024 * 1024 * 1024 * 4)){ + if(s > DVDSIZE){ retval = Qt::red; } return retval; diff --git a/archivemodel.cpp b/archivemodel.cpp index 212c60d..388833d 100644 --- a/archivemodel.cpp +++ b/archivemodel.cpp @@ -759,7 +759,7 @@ QVariant ArchiveFilesModel::data(const QModelIndex &index, int role) const { } if(col == Size){ qint64 size = item->data(Size).toInt(); - qint64 fMax = Q_INT64_C(1024 * 1024 * 1024 * 4); + qint64 fMax = DVDSIZE; if(size < fMax){ return QBrush(Qt::green); }else{ @@ -309,14 +309,13 @@ void SheMov::newMovieWizardWithFiles(){ void SheMov::setSize(qint64 size){ QLocale l; QString val; - const qint64 dvdSize = SmGlobals::instance()->dvdSize(); - qint64 free = dvdSize - size; - QString selectedSize = l.toString(size / 1024.0 / 1024.0, 'f', 2); - QString freeSize = l.toString(free / 1024.0 / 1024.0, 'f', 2); - if(size < dvdSize){ - val = QString("<span style=\"color:#008000\">%1 (%2) MiB</span>").arg(selectedSize).arg(freeSize); + qint64 free = DVDSIZE - size; + QString selectedSize = l.toString(size); + QString freeSize = l.toString(free); + if(size < DVDSIZE){ + val = QString("<span style=\"color:#008000\">%1 (%2)</span>").arg(selectedSize).arg(freeSize); }else{ - val = QString("<span style=\"color:#ff0000\">%1 (%2) MiB</span>").arg(selectedSize).arg(freeSize); + val = QString("<span style=\"color:#ff0000\">%1 (%2)</span>").arg(selectedSize).arg(freeSize); } mSelectedSize->setText(val); } diff --git a/smglobals.cpp b/smglobals.cpp index b82ba3c..5f50ede 100644 --- a/smglobals.cpp +++ b/smglobals.cpp @@ -161,7 +161,6 @@ SmGlobals::SmGlobals() : mPictureViewer(0), mArchiveController(0){ mIcons.insert("Dick in a cage", ":/dick_in_cage.png"); mIcons.insert("Used tampon", ":/used_tampon.png"); mIcons.insert("Clean tampon", ":/clean_tampon.png"); - mDvdSize = Q_INT64_C(4707319808) - 20 * 1024 *1024; mFiletypeMap.insert(ArchiveFilesModel::Movie, tr("Movie")); mFiletypeMap.insert(ArchiveFilesModel::FrontCover, tr("Front Cover")); mFiletypeMap.insert(ArchiveFilesModel::BackCover, tr("Back Cover")); diff --git a/smglobals.h b/smglobals.h index ac80c87..e01a500 100644 --- a/smglobals.h +++ b/smglobals.h @@ -18,6 +18,9 @@ class QPixmap; class SeriesTreeWidget; class ArchiveController; +// this was: 4707319808 - 20 * 1024 *1024 +#define DVDSIZE 4686348288 + class SmGlobals : public QObject { Q_OBJECT public: @@ -31,7 +34,6 @@ class SmGlobals : public QObject { QIcon iconFor(const QString &type); const QSize minPVSize() const { return QSize(640, 480); } const QHash<QString, QString> & icons() const { return mIcons; } - qint64 dvdSize() const { return mDvdSize; } QHash<int, QString> filetypeMap() const { return mFiletypeMap; } private: @@ -44,7 +46,6 @@ class SmGlobals : public QObject { SeriesTreeWidget *mSeriesTreeWidget; QSize mCursorSize; QHash<QString, QString> mIcons; - qint64 mDvdSize; ArchiveController *mArchiveController; QHash<int, QString> mFiletypeMap; }; |