Bug 145207 - Add a way for special configuration/mouse to resize thumbnails with an alternative to the middle button
Summary: Add a way for special configuration/mouse to resize thumbnails with an altern...
Status: RESOLVED WORKSFORME
Alias: None
Product: kphotoalbum
Classification: Applications
Component: Thumbnail Viewer (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR wishlist
Target Milestone: ---
Assignee: Tuomas Suutari
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-08 22:55 UTC by Baptiste MATHUS
Modified: 2007-05-20 16:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
This patch lets you use the classical way (Middle button) or Ctrl+Alt to resize thumbs (1.17 KB, patch)
2007-05-08 23:09 UTC, Baptiste MATHUS
Details
"Video" shot made with wink showing the pb with Ctrl-Wheel (398.90 KB, application/x-shockwave-flash)
2007-05-19 21:03 UTC, Baptiste MATHUS
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Baptiste MATHUS 2007-05-08 22:55:56 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Ubuntu Packages
OS:                Linux

At the moment, if you don't have a middle button or activated the middle button emulation, or simply can't have a middle button, virtually or not, you can't resize thumbs without going in the preferences window.

So, it would be great if there was an alternative for this. For example, using Ctrl+Left button or something like that in addition to the actual key combination.
Comment 1 Baptiste MATHUS 2007-05-08 23:09:30 UTC
Created attachment 20519 [details]
This patch lets you use the classical way (Middle button) or Ctrl+Alt to resize thumbs
Comment 2 Tuomas Suutari 2007-05-16 11:45:42 UTC
A patch that added Ctrl+Shift+MouseButton for this operation was already applied. But it broke selection, so I changed it to Ctrl+Alt+MouseButton as you suggested.

Using Ctrl+MouseWheel for resizing the thumbnails seems to be more "standard" way. If that's possible, it would be nice improvement too. So leaving this bug as open until that's implemented.
Comment 3 Tuomas Suutari 2007-05-17 03:06:14 UTC
SVN commit 665452 by suutari:

Make it possible to resize thumbnails with Ctrl+MouseWheel too.

CCBUG: 145207


 M  +29 -2     ThumbnailWidget.cpp  
 M  +3 -0      ThumbnailWidget.h  


--- trunk/extragear/graphics/kphotoalbum/ThumbnailView/ThumbnailWidget.cpp #665451:665452
@@ -51,6 +51,7 @@
 ThumbnailView::ThumbnailWidget::ThumbnailWidget( QWidget* parent, const char* name )
     :QGridView( parent, name ),
      _gridResizeInteraction( this ),
+     _wheelResizing( false ),
      _selectionInteraction( this ),
      _mouseTrackingHandler( this ),
      _mouseHandler( &_mouseTrackingHandler ),
@@ -85,7 +86,7 @@
     QPixmap doubleBuffer( cellRect().size() );
     QPainter painter( &doubleBuffer );
     paintCellBackground( &painter, row, col );
-    if ( !_mouseHandler->isResizingGrid() ) {
+    if ( !_mouseHandler->isResizingGrid() && !_wheelResizing ) {
         paintCellPixmap( &painter, row, col );
         paintCellText( &painter, row, col );
     }
@@ -454,7 +455,7 @@
     else
         p->fillRect( rect, palette().active().base() );
 
-    if (_mouseHandler->isResizingGrid() ||
+    if (_mouseHandler->isResizingGrid() || _wheelResizing ||
         Settings::SettingsData::instance()->thumbnailDisplayGrid()) {
         p->setPen( palette().active().dark() );
         // left of frame
@@ -508,6 +509,16 @@
     possibleEmitSelectionChanged();
 }
 
+void ThumbnailView::ThumbnailWidget::keyReleaseEvent( QKeyEvent* event )
+{
+    if ( _wheelResizing && event->key() == Qt::Key_Control ) {
+        _wheelResizing = false;
+        repaintScreen();
+    }
+    else
+        QGridView::keyReleaseEvent(event);
+}
+
 void ThumbnailView::ThumbnailWidget::keyboardMoveEvent( QKeyEvent* event )
 {
     static QString startPossition;
@@ -664,8 +675,24 @@
     }
 }
 
+void ThumbnailView::ThumbnailWidget::wheelEvent( QWheelEvent* event )
+{
+    if ( event->state() & ControlButton ) {
+        event->accept();
 
+        _wheelResizing = true;
 
+        int delta = event->delta() / 20;
+
+        Settings::SettingsData::instance()->setThumbSize( QMAX( 32, cellWidth() + delta ) );
+
+        updateCellSize();
+    }
+    else
+        QGridView::wheelEvent(event);
+}
+
+
 void ThumbnailView::ThumbnailWidget::emitDateChange( int x, int y )
 {
     if ( _isSettingDate )
--- trunk/extragear/graphics/kphotoalbum/ThumbnailView/ThumbnailWidget.h #665451:665452
@@ -105,11 +105,13 @@
 
     // event handlers
     virtual void keyPressEvent( QKeyEvent* );
+    virtual void keyReleaseEvent( QKeyEvent* );
     virtual void showEvent( QShowEvent* );
     virtual void mousePressEvent( QMouseEvent* );
     virtual void mouseMoveEvent( QMouseEvent* );
     virtual void mouseReleaseEvent( QMouseEvent* );
     virtual void mouseDoubleClickEvent ( QMouseEvent* );
+    virtual void wheelEvent( QWheelEvent* );
     virtual void resizeEvent( QResizeEvent* );
     void keyboardMoveEvent( QKeyEvent* );
     virtual void dimensionChange ( int oldNumRows, int oldNumCols );
@@ -188,6 +190,7 @@
     ThumbnailToolTip* _toolTip;
 
     GridResizeInteraction _gridResizeInteraction;
+    bool _wheelResizing;
     SelectionInteraction _selectionInteraction;
     MouseTrackingInteraction _mouseTrackingHandler;
     MouseInteraction* _mouseHandler;
Comment 4 Tuomas Suutari 2007-05-17 03:12:30 UTC
*** Bug has been marked as fixed ***.
Comment 5 Baptiste MATHUS 2007-05-19 20:19:30 UTC
The Ctrl+scroll seems to be buggy, at least for me. It doesn't refresh. It works fine with Middle button, or Ctrl-Alt. But ctrl-mousewheel, after releasing, eveything stays black. 

I made a quick "winkshot" if necessary.
Comment 6 Baptiste MATHUS 2007-05-19 21:03:48 UTC
Created attachment 20634 [details]
"Video" shot made with wink showing the pb with Ctrl-Wheel

This short is composed of three parts, separated with "next" buttons:
* After the first one, resizing is shown to be working with Ctrl-Alt
* After the second one, resizing is shown to be working with Middle mouse
button
* After the third one, the bug with Ctrl-mousewheel is shown.
Comment 7 Tuomas Suutari 2007-05-20 11:06:45 UTC
Hmm... I have no idea why it doesn't work with you. With my system it works just fine. Maybe there's something about Qt's event handling mechanism that I don't understand.

The idea was to enable resizing mode with Ctrl+MouseWheel and keep it on until you release Ctrl. So it seems that your KPA doesn't get the Ctrl released event.

This is how I use it:
1. Move mouse cursor over the thumbnail view
2. Press Ctrl
3. Scroll mouse wheel to resize
4. Release Ctrl

Any difference in the way that you're using it?

Does pressing/releasing Ctrl again help?
Comment 8 Baptiste MATHUS 2007-05-20 16:25:14 UTC
I found why it wasn't working, though I don't know who's I should send the report: us or gnome mouse manager.

I activated a feature associated to my mouse cursor. When I push Ctrl, a quickly "narrowing square" appears around my mouse pointer, it makes it a useful way to quickly find your cursor without shaking the mouse :-). If I disable this feature anyway, the feature is KPA works perfectly.

Well, I just tested another thing that was't working (other than KPA) and it works now :-/. I guess I'm gonna have a report sent to the gnome-mouse-properties team :-).

Sorry for that. (Marking the bug as resolved again, but I'm not sure I've the right to do that currently...).