[KPhotoAlbum] [PATCH] make grid around images optional

Henner Zeller h.zeller at acm.org
Fri May 4 13:24:00 CEST 2007


Hi,

> Attached is the updated version of the patch which also makes resizing
> work with left button and control key :), same as in my last patch for
> enabling panning in Viewer.

mmh, shouldn't we be consistent here ? If ctrl-<mouse-move> means
panning in the viewer, it should mean the same in the thumbnail view
(leave alone that we have to implement panning there, but still).

How about shift-<mouse move> ?

Does anyone know some 'standard' behaviour of these mouse interactions
in KDE or in user interfaces in general ? We should stick to these as
much as possible to not confuse users.

While we are at the grid code: how about setting the mouse cursor to
SizeAllCursor ?

cheers,
  -henner

>
> Thanks again for your review,
> -jkt
>
> --
> cd /local/pub && more beer > /dev/mouth
>
> Index: Settings/SettingsData.h
> ===================================================================
> --- Settings/SettingsData.h     (revision 660935)
> +++ Settings/SettingsData.h     (working copy)
> @@ -96,6 +96,7 @@
>      intProperty( Thumbnails, autoShowThumbnailView, setAutoShowThumbnailView, 0 );
>      boolProperty( Thumbnails, showNewestThumbnailFirst, setShowNewestFirst, false );
>      boolProperty( Thumbnails, thumbnailDarkBackground, setThumbnailDarkBackground, false );
> +    boolProperty( Thumbnails, thumbnailDisplayGrid, setThumbnailDisplayGrid, true );
>
>      void setThumbnailCache( int value );
>      int thumbnailCache() const;
> Index: Settings/SettingsDialog.cpp
> ===================================================================
> --- Settings/SettingsDialog.cpp (revision 660935)
> +++ Settings/SettingsDialog.cpp (working copy)
> @@ -227,6 +227,12 @@
>      _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" );
> @@ -275,6 +281,10 @@
>                 "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 +404,7 @@
>      _albumCategory->setCurrentText( cat->text() );
>
>      _thumbnailDarkBackground->setChecked( opt->thumbnailDarkBackground() );
> +    _thumbnailDisplayGrid->setChecked( opt->thumbnailDisplayGrid() );
>      _displayLabels->setChecked( opt->displayLabels() );
>      _displayCategories->setChecked( opt->displayCategories() );
>      _viewImageSetup->setSize( opt->viewerSize() );
> @@ -475,6 +486,7 @@
>
>      opt->setAlbumCategory( name );
>      opt->setThumbnailDarkBackground( _thumbnailDarkBackground->isChecked() );
> +    opt->setThumbnailDisplayGrid( _thumbnailDisplayGrid->isChecked() );
>      opt->setDisplayLabels( _displayLabels->isChecked() );
>      opt->setDisplayCategories( _displayCategories->isChecked() );
>      opt->setViewerSize( _viewImageSetup->size() );
> Index: Settings/SettingsDialog.h
> ===================================================================
> --- Settings/SettingsDialog.h   (revision 660935)
> +++ Settings/SettingsDialog.h   (working copy)
> @@ -116,6 +116,7 @@
>      QCheckBox* _thumbnailDarkBackground;
>      QCheckBox* _displayLabels;
>      QCheckBox* _displayCategories;
> +    QCheckBox* _thumbnailDisplayGrid;
>      QSpinBox* _autoShowThumbnailView;
>      QSpinBox* _thumbnailCache;
>
> Index: ThumbnailView/ThumbnailWidget.cpp
> ===================================================================
> --- ThumbnailView/ThumbnailWidget.cpp   (revision 660935)
> +++ ThumbnailView/ThumbnailWidget.cpp   (working copy)
> @@ -414,14 +414,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 );
> +        }
>      }
>  }
>
> @@ -592,7 +595,7 @@
>
>  void ThumbnailView::ThumbnailWidget::mousePressEvent( QMouseEvent* event )
>  {
> -    if (event->button() & MidButton )
> +    if ( (event->button() & MidButton) || (event->state() & Qt::ControlButton) )
>          _mouseHandler = &_gridResizeInteraction;
>      else
>          _mouseHandler = &_selectionInteraction;
>
> _______________________________________________
> KPhotoAlbum mailing list
> KPhotoAlbum at kdab.net
> http://mail.kdab.net/mailman/listinfo/kphotoalbum
>
>
>


-- 
Henner Zeller | h.zeller at acm.org
Bücher kaufen und freie Software fördern | http://bookzilla.de


More information about the KPhotoAlbum mailing list