Ticket #4364: scaleMax.diff
File scaleMax.diff, 2.9 KB (added by , 16 years ago) |
---|
-
mythgallery/mythgallery/gallerysettings.cpp
34 34 return gc; 35 35 }; 36 36 37 static HostCheckBox *MythGalleryScaleMax() 38 { 39 HostCheckBox *gc = new HostCheckBox("GalleryScaleMax"); 40 gc->setLabel(QObject::tr("Scale Max")); 41 gc->setValue(true); 42 gc->setHelpText(QObject::tr("If set, images are scaled to fill the whole screen. If cleared, they are scaled to fit in the screen.")); 43 return gc; 44 }; 45 37 46 static HostComboBox *MythGallerySortOrder() 38 47 { 39 48 HostComboBox *gc = new HostComboBox("GallerySortOrder"); … … 215 224 general->setLabel(QObject::tr("MythGallery Settings (General)")); 216 225 general->addChild(MythGalleryDir()); 217 226 general->addChild(MythGalleryThumbnailLocation()); 227 general->addChild(MythGalleryScaleMax()); 218 228 general->addChild(MythGallerySortOrder()); 219 229 general->addChild(MythGalleryImportDirs()); 220 230 general->addChild(MythGalleryMoviePlayerCmd()); -
mythgallery/mythgallery/galleryutil.cpp
409 409 if ((sz.width() > 0) && (sz.height() > 0)) 410 410 imageAspect = (double)sz.width() / (double)sz.height(); 411 411 412 // scale to dest height for most images 413 int scalewidth = (int)((float)dest.height() * imageAspect / pixelAspect); 414 int scaleheight = dest.height(); 415 if (scalewidth > dest.width()) 412 int scaleWidth; 413 int scaleHeight; 414 if (gContext->GetNumSetting("GalleryScaleMax", 0)) 416 415 { 417 // scale to dest width for extra wide images 418 scalewidth = dest.width(); 419 scaleheight = (int)((float)dest.width() * pixelAspect / imageAspect); 416 // scale-max to dest width for most images 417 scaleWidth = dest.width(); 418 scaleHeight = (int)((float)dest.width() * pixelAspect / imageAspect); 419 if (scaleHeight < dest.height()) 420 { 421 // scale-max to dest height for extra wide images 422 scaleWidth = (int)((float)dest.height() * imageAspect / pixelAspect); 423 scaleHeight = dest.height(); 424 } 420 425 } 426 else 427 { 428 // scale-min to dest height for most images 429 scaleWidth = (int)((float)dest.height() * imageAspect / pixelAspect); 430 scaleHeight = dest.height(); 431 if (scaleWidth > dest.width()) 432 { 433 // scale-min to dest width for extra wide images 434 scaleWidth = dest.width(); 435 scaleHeight = (int)((float)dest.width() * pixelAspect / imageAspect); 436 } 437 } 421 438 422 sz.scale(scale width, scaleheight, QSize::ScaleFree);439 sz.scale(scaleWidth, scaleHeight, QSize::ScaleFree); 423 440 return sz; 424 441 } 425 442