From bd74eb2df37dd84ecf0279971c64c23ac5de8bce Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 27 May 2011 18:55:18 +0200 Subject: Turned dvd size constant into a global Moved constant dvd size in bytes to SmGlobals. It spread to several source files, so it seemed to be a candidate. --- filestreemodel.cpp | 5 +++-- filestreemodel.h | 1 + shemov.cpp | 2 +- smglobals.cpp | 1 + smglobals.h | 2 ++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/filestreemodel.cpp b/filestreemodel.cpp index e6bfde5..80c6b96 100644 --- a/filestreemodel.cpp +++ b/filestreemodel.cpp @@ -62,6 +62,7 @@ FilesTreeModel::FilesTreeModel(QStringList &headers, QObject *parent) : SmTreeMo mEditableColumns.insert(tr("Set quality"), Quality); mEditableColumns.insert(tr("Set file type"), FileType); mEditableColumns.insert(tr("Set dvd no."), DvdNo); + mDvdSize = SmGlobals::instance()->dvdSize(); } FilesTreeModel::~FilesTreeModel(){ @@ -165,7 +166,7 @@ QVariant FilesTreeModel::data(const QModelIndex &index, int role) const{ } if(role == Qt::ForegroundRole){ if(index.column() == SizeDisplay){ - if(item->data(Size).toLongLong() > Q_INT64_C(2147483648)){ + if(item->data(Size).toLongLong() > mDvdSize){ return QColor(Qt::red); } return QColor(Qt::green); @@ -422,7 +423,7 @@ bool FilesTreeModel::addFile(const QString &fullPath, int type, int quality, int QString md5Sum = Helper::md5Sum(fullPath); if(!fi.exists()){ //should be a dvd - size = Q_INT64_C(4707319808); + size = mDvdSize; md5Sum = QString(32, '0'); } diff --git a/filestreemodel.h b/filestreemodel.h index 9054368..315e6b2 100644 --- a/filestreemodel.h +++ b/filestreemodel.h @@ -85,6 +85,7 @@ class FilesTreeModel : public SmTreeModel { QColor mLocalColor; QColor mArchivedColor; QColor mFavoriteColor; + qint64 mDvdSize; }; #endif // FILESTREEMODEL_H diff --git a/shemov.cpp b/shemov.cpp index 96e2399..cf49b57 100644 --- a/shemov.cpp +++ b/shemov.cpp @@ -278,7 +278,7 @@ void SheMov::newMovieWizardWithFiles(){ void SheMov::setSize(qint64 size){ QLocale l; QString val; - const qint64 dvdSize = Q_INT64_C(4707319808); + 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); diff --git a/smglobals.cpp b/smglobals.cpp index 80c45ea..d521e9f 100644 --- a/smglobals.cpp +++ b/smglobals.cpp @@ -137,6 +137,7 @@ SmGlobals::SmGlobals() : mPictureViewer(0), mFrameCache(0){ mIcons.insert("Spreading pants", ":/spreadingpants.png"); mIcons.insert("Leather dog hood", ":/dog_hood.png"); mIcons.insert("Male chastity belt", ":/male_chastity_belt.png"); + mDvdSize = Q_INT64_C(4707319808); } //FrameCache diff --git a/smglobals.h b/smglobals.h index 9324b85..7033b34 100644 --- a/smglobals.h +++ b/smglobals.h @@ -49,6 +49,7 @@ class SmGlobals : public QObject { FrameCache *frameCache(); QSize cursorSize(); const QHash & icons() const { return mIcons; } + qint64 dvdSize() const { return mDvdSize; } private: SmGlobals(); @@ -60,6 +61,7 @@ class SmGlobals : public QObject { SmGlobals::FrameCache *mFrameCache; QSize mCursorSize; QHash mIcons; + qint64 mDvdSize; }; #endif -- cgit v1.2.3-70-g09d2