diff options
author | Arno <am@disconnect.de> | 2011-05-27 18:55:18 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2011-05-27 18:55:18 +0200 |
commit | bd74eb2df37dd84ecf0279971c64c23ac5de8bce (patch) | |
tree | d2a6c2353b4fcef1423cb8fd4fd7f0f418b808b1 | |
parent | d924a6414962435a0695441216474c7d95044233 (diff) | |
download | SheMov-bd74eb2df37dd84ecf0279971c64c23ac5de8bce.tar.gz SheMov-bd74eb2df37dd84ecf0279971c64c23ac5de8bce.tar.bz2 SheMov-bd74eb2df37dd84ecf0279971c64c23ac5de8bce.zip |
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.
-rw-r--r-- | filestreemodel.cpp | 5 | ||||
-rw-r--r-- | filestreemodel.h | 1 | ||||
-rw-r--r-- | shemov.cpp | 2 | ||||
-rw-r--r-- | smglobals.cpp | 1 | ||||
-rw-r--r-- | 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 @@ -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<QString, QString> & 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<QString, QString> mIcons; + qint64 mDvdSize; }; #endif |