[KPhotoAlbum] Patch to allow setting thumbnail size

Robert L Krawitz rlk at alum.mit.edu
Sun Jun 18 19:41:32 BST 2006


Here's a patch to enable setting the thumbnail size from the dialog.
I find this useful so that I can choose whether to see many small
thumbnails or fewer large ones.  The tooltip preview isn't really what
I want (I've never used it -- I have tooltips turned off anyway).  I
renamed "Preview image size:" to "Tooltip preview image size:" to make
it more apparent what it is.

BTW, it appears that startup has slowed down somewhat recently,
although I'm not absolutely positive of that.  It *may* have happened
after I rescanned for images and it picked up some videos I had.

Index: ThumbnailView/ThumbnailWidget.cpp
===================================================================
--- ThumbnailView/ThumbnailWidget.cpp	(revision 552529)
+++ ThumbnailView/ThumbnailWidget.cpp	(working copy)
@@ -936,6 +936,7 @@
     if ( Settings::SettingsData::instance()->displayLabels() )
         h += QFontMetrics( font() ).height() +2;
     setCellHeight( h );
+    updateGridSize();
 }
 
 void ThumbnailView::ThumbnailWidget::viewportPaintEvent( QPaintEvent* e )
Index: Settings/SettingsData.h
===================================================================
--- Settings/SettingsData.h	(revision 552529)
+++ Settings/SettingsData.h	(working copy)
@@ -84,6 +84,7 @@
 
     // -------------------------------------------------- Thumbnails
     intProperty( Thumbnails, previewSize, setPreviewSize, 256 );
+    intProperty( Thumbnails, thumbnailSize, setThumbnailSize, 128 );
     boolProperty( Thumbnails, displayLabels, setDisplayLabels, true );
     intProperty( Thumbnails, autoShowThumbnailView, setAutoShowThumbnailView, 0 );
     boolProperty( Thumbnails, showNewestThumbnailFirst, setShowNewestFirst, false );
Index: Settings/SettingsDialog.cpp
===================================================================
--- Settings/SettingsDialog.cpp	(revision 552529)
+++ Settings/SettingsDialog.cpp	(working copy)
@@ -227,12 +227,19 @@
     int row = 0;
 
     // Preview size
-    QLabel* previewSizeLabel = new QLabel( i18n("Preview image size:" ), top, "previewSizeLabel" );
+    QLabel* previewSizeLabel = new QLabel( i18n("Tooltip preview image size:" ), top, "previewSizeLabel" );
     _previewSize = new QSpinBox( 0, 2000, 10, top, "_previewSize" );
     _previewSize->setSpecialValueText( i18n("No Image Preview") );
     lay->addWidget( previewSizeLabel, row, 0 );
     lay->addWidget( _previewSize, row, 1 );
 
+    // Thumbnail size
+    ++row;
+    QLabel* thumbnailSizeLabel = new QLabel( i18n("Thumbnail image size:" ), top, "thumbnailSizeLabel" );
+    _thumbnailSize = new QSpinBox( 0, 512, 16, top, "_thumbnailSize" );
+    lay->addWidget( thumbnailSizeLabel, row, 0 );
+    lay->addWidget( _thumbnailSize, row, 1 );
+
     // Display Labels
     ++row;
     _displayLabels = new QCheckBox( i18n("Display labels in thumbnail view" ), top, "displayLabels" );
@@ -267,6 +274,11 @@
     QWhatsThis::add( _previewSize, txt );
 
 
+    txt = i18n( "<qt><p>Thumbnail image size</p></qt>" );
+    QWhatsThis::add( thumbnailSizeLabel, txt );
+    QWhatsThis::add( _thumbnailSize, txt );
+
+
     txt = i18n("<qt>Checking this option will show the base name for the file under "
                "thumbnails in the thumbnail view</qt>");
     QWhatsThis::add( _displayLabels, txt );
@@ -383,6 +395,7 @@
 
     // General page
     _previewSize->setValue( opt->previewSize() );
+    _thumbnailSize->setValue( opt->thumbSize() );
     _trustTimeStamps->setCurrentItem( opt->tTimeStamps() );
     _useEXIFRotate->setChecked( opt->useEXIFRotate() );
     _useEXIFComments->setChecked( opt->useEXIFComments() );
@@ -442,6 +455,7 @@
 
     // General
     opt->setPreviewSize( _previewSize->value() );
+    opt->setThumbSize( _thumbnailSize->value() );
     opt->setTTimeStamps( (TimeStampTrust) _trustTimeStamps->currentItem() );
     opt->setUseEXIFRotate( _useEXIFRotate->isChecked() );
     opt->setUseEXIFComments( _useEXIFComments->isChecked() );
Index: Settings/SettingsDialog.h
===================================================================
--- Settings/SettingsDialog.h	(revision 552529)
+++ Settings/SettingsDialog.h	(working copy)
@@ -92,6 +92,7 @@
     QCheckBox* _useEXIFRotate;
     QCheckBox* _useEXIFComments;
     QSpinBox* _previewSize;
+    QSpinBox* _thumbnailSize;
     QComboBox* _albumCategory;
     QCheckBox* _displayLabels;
     QCheckBox* _searchForImagesOnStartup;




More information about the Kphotoalbum mailing list