Index: Settings/SettingsData.h
===================================================================
--- Settings/SettingsData.h	(revision 662961)
+++ Settings/SettingsData.h	(working copy)
@@ -66,6 +66,15 @@
         NaturalSize = 1,
         NaturalSizeIfFits = 2
     };
+    enum ThumbnailAspectRatio {
+    	Aspect_1_1 = 0,
+	Aspect_4_3 = 1,
+	Aspect_3_2 = 2,
+	Aspect_16_9 = 3,
+	Aspect_3_4 = 4,
+	Aspect_2_3 = 5,
+	Aspect_9_16 = 6
+    };
     enum WindowType { MainWindow = 0, ConfigWindow = 1 };
 
 class SettingsData :public QObject {
@@ -95,7 +104,9 @@
     boolProperty( Thumbnails, displayCategories, setDisplayCategories, false );
     intProperty( Thumbnails, autoShowThumbnailView, setAutoShowThumbnailView, 0 );
     boolProperty( Thumbnails, showNewestThumbnailFirst, setShowNewestFirst, false );
-    boolProperty( Thumbnails, thumbnailDarkBackground, setThumbnailDarkBackground, false );
+    boolProperty( Thumbnails, thumbnailDarkBackground, setThumbnailDarkBackground, true );
+    boolProperty( Thumbnails, thumbnailDisplayGrid, setThumbnailDisplayGrid, false );
+    intProperty( Thumbnails, thumbnailSpace, setThumbnailSpace, 1);
 
     void setThumbnailCache( int value );
     int thumbnailCache() const;
@@ -167,6 +178,9 @@
     void setTTimeStamps( TimeStampTrust );
     TimeStampTrust tTimeStamps() const;
 
+    void setThumbnailAspectRatio(ThumbnailAspectRatio);
+    ThumbnailAspectRatio thumbnailAspectRatio() const;
+
     QString imageDirectory() const;
 
     QString HTMLBaseDir() const;
Index: Settings/SettingsDialog.cpp
===================================================================
--- Settings/SettingsDialog.cpp	(revision 662961)
+++ Settings/SettingsDialog.cpp	(working copy)
@@ -222,11 +222,33 @@
     lay->addWidget( thumbnailSizeLabel, row, 0 );
     lay->addWidget( _thumbnailSize, row, 1 );
 
+    // Thumbnail aspect ratio
+    ++row;
+    QLabel* thumbnailAspectRatioLabel = new QLabel( i18n("Thumbnail table cells aspect ratio"), top, "thumbnailAspectRatioLabel");
+    _thumbnailAspectRatio = new KComboBox( top );
+    _thumbnailAspectRatio->insertStringList( QStringList() << i18n("1:1") << i18n("4:3") 
+        << i18n("3:2") << i18n("16:9") << i18n("3:4") << i18n("2:3") << i18n("9:16"));
+    lay->addWidget( thumbnailAspectRatioLabel, row, 0 );
+    lay->addWidget( _thumbnailAspectRatio, row, 1 );
+
+    // Space around cells
+    ++row;
+    QLabel* thumbnailSpaceLabel = new QLabel( i18n("Space around cells"), top, "thumbnailSpaceLabel");
+    _thumbnailSpace = new QSpinBox( 1, 20, 1, top );
+    lay->addWidget( thumbnailSpaceLabel, row, 0 );
+    lay->addWidget( _thumbnailSpace, row, 1 );
+
     // Display dark background
     ++row;
     _thumbnailDarkBackground = new QCheckBox( i18n("Show thumbnails on dark background" ), top, "thumbnailDarkBackground");
     lay->addMultiCellWidget( _thumbnailDarkBackground, row, row, 0, 1 );
 
+    // Display grid lines in the thumbnail view
+    ++row;
+    _thumbnailDisplayGrid = new QCheckBox( i18n("Display grid around thumbnails" ),
+                                           top, "_thumbnailDisplayGrid");
+    lay->addMultiCellWidget( _thumbnailDisplayGrid, row, row, 0, 1 );
+
     // Display Labels
     ++row;
     _displayLabels = new QCheckBox( i18n("Display labels in thumbnail view" ), top, "displayLabels" );
@@ -270,11 +292,21 @@
     QWhatsThis::add( thumbnailSizeLabel, txt );
     QWhatsThis::add( _thumbnailSize, txt );
 
+    txt = i18n("<p>Choose what aspect ratio the cells holding thumbnails should have.</p>");
+    QWhatsThis::add( _thumbnailAspectRatio, txt );
+
+    txt = i18n("<p>How thick the cell padding should be.</p>");
+    QWhatsThis::add( thumbnailSpaceLabel, txt );
+
     txt = i18n("<p>The background color in the thumbnail view is "
                "the systems' default background; by checking this option, "
                "you can set it to be dark instead.</p>");
     QWhatsThis::add( _thumbnailDarkBackground, txt );
 
+    txt = i18n("<p>If you want to see grid around your thumbnail images, "
+               "select this option.</p>");
+    QWhatsThis::add( _thumbnailDisplayGrid, txt );
+
     txt = i18n("<p>Checking this option will show the base name for the file under "
                "thumbnails in the thumbnail view.</p>");
     QWhatsThis::add( _displayLabels, txt );
@@ -394,6 +426,9 @@
     _albumCategory->setCurrentText( cat->text() );
 
     _thumbnailDarkBackground->setChecked( opt->thumbnailDarkBackground() );
+    _thumbnailDisplayGrid->setChecked( opt->thumbnailDisplayGrid() );
+    _thumbnailAspectRatio->setCurrentItem( opt->thumbnailAspectRatio() );
+    _thumbnailSpace->setValue( opt->thumbnailSpace() );
     _displayLabels->setChecked( opt->displayLabels() );
     _displayCategories->setChecked( opt->displayCategories() );
     _viewImageSetup->setSize( opt->viewerSize() );
@@ -459,6 +494,7 @@
     opt->setPreviewSize( _previewSize->value() );
     opt->setThumbSize( _thumbnailSize->value() );
     opt->setTTimeStamps( (TimeStampTrust) _trustTimeStamps->currentItem() );
+    opt->setThumbnailAspectRatio( (ThumbnailAspectRatio) _thumbnailAspectRatio->currentItem() );
     opt->setUseEXIFRotate( _useEXIFRotate->isChecked() );
     opt->setUseEXIFComments( _useEXIFComments->isChecked() );
     opt->setSearchForImagesOnStartup( _searchForImagesOnStartup->isChecked() );
@@ -475,6 +511,8 @@
 
     opt->setAlbumCategory( name );
     opt->setThumbnailDarkBackground( _thumbnailDarkBackground->isChecked() );
+    opt->setThumbnailDisplayGrid( _thumbnailDisplayGrid->isChecked() );
+    opt->setThumbnailSpace( _thumbnailSpace->value() );
     opt->setDisplayLabels( _displayLabels->isChecked() );
     opt->setDisplayCategories( _displayCategories->isChecked() );
     opt->setViewerSize( _viewImageSetup->size() );
Index: Settings/SettingsDialog.h
===================================================================
--- Settings/SettingsDialog.h	(revision 662961)
+++ Settings/SettingsDialog.h	(working copy)
@@ -116,8 +116,11 @@
     QCheckBox* _thumbnailDarkBackground;
     QCheckBox* _displayLabels;
     QCheckBox* _displayCategories;
+    QCheckBox* _thumbnailDisplayGrid;
     QSpinBox* _autoShowThumbnailView;
     QSpinBox* _thumbnailCache;
+    KComboBox* _thumbnailAspectRatio;
+    QSpinBox* _thumbnailSpace;
 
     // Categories page
     QListBox* _categories;
Index: Settings/SettingsData.cpp
===================================================================
--- Settings/SettingsData.cpp	(revision 662961)
+++ Settings/SettingsData.cpp	(working copy)
@@ -109,6 +109,15 @@
     return (TimeStampTrust) value(  STR("General"), STR("trustTimeStamps"), (int) Always );
 }
 
+void Settings::SettingsData::setThumbnailAspectRatio( Settings::ThumbnailAspectRatio aspect )
+{
+    setValue( STR("Thumbnail View"), STR("thumbnailAspectRatio"), (int) aspect);
+}
+Settings::ThumbnailAspectRatio Settings::SettingsData::thumbnailAspectRatio() const
+{
+    return (ThumbnailAspectRatio) value(  STR("Thumbnail View"), STR("thumbnailAspectRatio"), (int) Aspect_1_1);
+}
+
 void Settings::SettingsData::setViewerStandardSize(StandardViewSize v)
 {
     setValue( STR("Viewer"), STR("standardViewerSize"), (int) v );
Index: ThumbnailView/ThumbnailWidget.cpp
===================================================================
--- ThumbnailView/ThumbnailWidget.cpp	(revision 662961)
+++ ThumbnailView/ThumbnailWidget.cpp	(working copy)
@@ -114,9 +114,12 @@
 
         }
         else {
-            int size = Settings::SettingsData::instance()->thumbSize();
+            QRect dimensions = cellDimensions();
             int angle = DB::ImageDB::instance()->info( fileName )->angle();
-            ThumbnailRequest* request = new ThumbnailRequest( fileName, QSize( size, size ), angle, this );
+            ThumbnailRequest* request = new ThumbnailRequest(
+                fileName, QSize( dimensions.width() - 2 * Settings::SettingsData::instance()->thumbnailSpace(),
+                                 dimensions.height() - 2 * Settings::SettingsData::instance()->thumbnailSpace() ),
+                angle, this );
             request->setCache();
             ImageManager::Manager::instance()->load( request );
         }
@@ -130,8 +133,10 @@
 {
     QString text, line;
 
-    int thumbnailSize = Settings::SettingsData::instance()->thumbSize();
-    int maxCharacters = thumbnailSize / QFontMetrics( font() ).maxWidth() * 2;
+    QRect dimensions = cellDimensions();
+    int thumbnailHeight = dimensions.height() - 2 * Settings::SettingsData::instance()->thumbnailSpace();
+    int thumbnailWidth = dimensions.width(); // no substracting here
+    int maxCharacters = thumbnailHeight / QFontMetrics( font() ).maxWidth() * 2;
 
     if ( Settings::SettingsData::instance()->displayLabels()) {
         text += DB::ImageDB::instance()->info( fileName )->label();;
@@ -156,7 +161,7 @@
                             line += QString::fromLatin1( ", " );
                         line += item;
                     }
-                    if ( QFontMetrics( font() ).width( line ) > thumbnailSize ) {
+                    if ( QFontMetrics( font() ).width( line ) > thumbnailWidth ) {
                         line = line.left( maxCharacters );
                         line += QString::fromLatin1( " ..." );
                     }
@@ -250,6 +255,40 @@
 }
 
 /**
+ * Return desired size of the whole cell
+ */
+QRect ThumbnailView::ThumbnailWidget::cellDimensions() const
+{
+    int width = Settings::SettingsData::instance()->thumbSize();
+    int height = width;
+
+    switch (Settings::SettingsData::instance()->thumbnailAspectRatio()) {
+        case Settings::Aspect_16_9:
+	    height = (int) (height * 9.0 / 16);
+	    break;
+        case Settings::Aspect_4_3:
+	    height = (int) (height * 3.0 / 4);
+	    break;
+        case Settings::Aspect_3_2:
+	    height = (int) (height * 2.0 / 3);
+	    break;
+        case Settings::Aspect_9_16:
+	    width = (int) (width * 9.0 / 16);
+	    break;
+        case Settings::Aspect_3_4:
+	    width = (int) (width * 3.0 / 4);
+	    break;
+        case Settings::Aspect_2_3:
+	    width = (int) (width * 2.0 / 3);
+	    break;
+	case Settings::Aspect_1_1:
+	    // nothing
+	    ;
+    }
+    return QRect(0, 0, width, height);
+}
+
+/**
  * Return the geometry for the icon in the cell (row,col). The returned coordinates are local to the cell.
  */
 QRect ThumbnailView::ThumbnailWidget::iconGeometry( int row, int col ) const
@@ -258,15 +297,18 @@
     if ( fileName.isNull() ) // empty cell
         return QRect();
 
-    int size = Settings::SettingsData::instance()->thumbSize() + SPACE;
+    QRect dimensions = cellDimensions();
+    const int space = Settings::SettingsData::instance()->thumbnailSpace();
+    int width = dimensions.width() - 2 * space;
+    int height = dimensions.height() - 2 * space;
+
     QPixmap* pix = QPixmapCache::find( fileName );
     if ( !pix )
-        return QRect( SPACE, SPACE, size, size );
+        return QRect( space, space, width, height );
 
-    int xoff = 1 + (size - pix->width())/2; // 1 is for the border at the left
-    int yoff = (size - pix->height() );
-    if ( !Settings::SettingsData::instance()->displayLabels() && !Settings::SettingsData::instance()->displayCategories())
-        yoff /= 2; // we wil center the images if we do not show the label, otherwise we will align it to the bottom
+    int xoff = space + (width - pix->width()) / 2;
+    int yoff = space + (height - pix->height()) / 2;
+
     return QRect( xoff, yoff, pix->width(), pix->height() );
 }
 
@@ -412,14 +454,17 @@
     else
         p->fillRect( rect, palette().active().base() );
 
-    p->setPen( palette().active().dark() );
-    // left of frame
-    if ( col != 0 )
-        p->drawLine( rect.left(), rect.top(), rect.left(), rect.bottom() );
+    if (_mouseHandler->isResizingGrid() ||
+        Settings::SettingsData::instance()->thumbnailDisplayGrid()) {
+        p->setPen( palette().active().dark() );
+        // left of frame
+        if ( col != 0 )
+            p->drawLine( rect.left(), rect.top(), rect.left(), rect.bottom() );
 
-    // bottom line
-    if ( row != numRows() -1 ) {
-        p->drawLine( rect.left(), rect.bottom() -1, rect.right(), rect.bottom()-1 );
+        // bottom line
+        if ( row != numRows() -1 ) {
+            p->drawLine( rect.left(), rect.bottom() -1, rect.right(), rect.bottom()-1 );
+        }
     }
 }
 
@@ -590,7 +635,8 @@
 
 void ThumbnailView::ThumbnailWidget::mousePressEvent( QMouseEvent* event )
 {
-    if (event->button() & MidButton )
+    if ( (event->button() & MidButton) ||
+         ((event->state() & Qt::ControlButton) && (event->state() & Qt::ShiftButton)) )
         _mouseHandler = &_gridResizeInteraction;
     else
         _mouseHandler = &_selectionInteraction;
@@ -1069,11 +1115,11 @@
 
 void ThumbnailView::ThumbnailWidget::updateCellSize()
 {
-    int size = Settings::SettingsData::instance()->thumbSize() + SPACE;
-    setCellWidth( size );
+    QRect dimensions = cellDimensions();
+    setCellWidth( dimensions.width() );
 
     const int oldHeight = cellHeight();
-    const int height = size +2 + textHeight( true );
+    const int height = dimensions.height() + 2 + textHeight( true );
     setCellHeight( height );
     updateGridSize();
     if ( height != oldHeight && ! _currentItem.isNull() ) {
Index: ThumbnailView/ThumbnailWidget.h
===================================================================
--- ThumbnailView/ThumbnailWidget.h	(revision 662961)
+++ ThumbnailView/ThumbnailWidget.h	(working copy)
@@ -41,8 +41,6 @@
 class ThumbnailWidget : public QGridView, public ImageManager::ImageClient {
     Q_OBJECT
 
-    static const int SPACE = 3;
-
 public:
     ThumbnailWidget( QWidget* parent, const char* name = 0 );
     void setImageList( const QStringList& list );
@@ -97,6 +95,7 @@
     int lastVisibleRow( VisibleState ) const;
     int numRowsPerPage() const;
     QRect iconGeometry( int row, int col ) const;
+    QRect cellDimensions() const;
     int noOfCategoriesForImage( const QString& image ) const;
     int textHeight( bool reCalc ) const;
     QRect cellTextGeometry( int row, int col ) const;
