From 816b84b7a4263c587c661e4c7178f3b6721e4cfe Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 15 Feb 2014 04:55:46 +0100 Subject: Replace ArchiveModel::FileType with #define These constants are used all over the place and aren't really specific to ArchiveModel, so use the preprocessor. --- archivecontroller.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'archivecontroller.cpp') diff --git a/archivecontroller.cpp b/archivecontroller.cpp index 574b9c1..a7d0501 100644 --- a/archivecontroller.cpp +++ b/archivecontroller.cpp @@ -71,7 +71,7 @@ void ArchiveController::playSelectedFiles(){ QModelIndexList sel = mFileSelection->selectedRows(); QStringList files; foreach(QModelIndex i, sel){ - if(i.data(ArchiveFilesModel::FileTypeRole).toInt() == ArchiveFilesModel::Movie){ + if(i.data(ArchiveFilesModel::FileTypeRole).toInt() == FT_MOVIE){ QString fullPath = i.data(ArchiveFilesModel::FullPathRole).toString(); QFileInfo fi(fullPath); if(fi.exists()){ @@ -132,13 +132,13 @@ void ArchiveController::editFileType(){ if(ok && !item.isEmpty()){ int newType = 0; if(item == tr("Movie")){ - newType = ArchiveFilesModel::Movie; + newType = FT_MOVIE; }else if(item == tr("Front Cover")){ - newType = ArchiveFilesModel::FrontCover; + newType = FT_FRONTCOVER; }else if(item == tr("Back Cover")){ - newType = ArchiveFilesModel::BackCover; + newType = FT_BACKCOVER; }else if(item == tr("General Cover")){ - newType = ArchiveFilesModel::GeneralCover; + newType = FT_GENERALCOVER; } if(newType){ foreach(QModelIndex i, sel){ @@ -189,7 +189,7 @@ void ArchiveController::showPreview(){ QFileInfo fi(first); if(!fi.exists()){ pv->setFile(); - }else if(sel.first().data(ArchiveFilesModel::FileTypeRole).toInt() == ArchiveFilesModel::Movie){ + }else if(sel.first().data(ArchiveFilesModel::FileTypeRole).toInt() == FT_MOVIE){ qApp->setOverrideCursor(Qt::BusyCursor); QPixmap preview = Helper::preview(first); if(!preview.isNull()){ @@ -279,7 +279,7 @@ void ArchiveController::fileSelectionChanged(const QItemSelection &selected, con foreach(QModelIndex i, sel){ size += i.data(ArchiveFilesModel::SizeRole).toInt(); int type = i.data(ArchiveFilesModel::FileTypeRole).toInt(); - if(type == ArchiveFilesModel::Movie){ + if(type == FT_MOVIE){ int dur = i.data(ArchiveFilesModel::SizeDurRole).toInt(); duration += dur; if(dur == 0){ @@ -296,7 +296,7 @@ void ArchiveController::fileDoubleClicked(const QModelIndex &idx){ return; } int type = idx.data(ArchiveFilesModel::FileTypeRole).toInt(); - if(type == ArchiveFilesModel::Movie){ + if(type == FT_MOVIE){ QString fullPath = idx.data(ArchiveFilesModel::FullPathRole).toString(); QFileInfo fi(fullPath); if(!fi.exists()){ -- cgit v1.2.3-70-g09d2