Commit fca9b840 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

apply patch #89701 from Lucas Carlon about to manage arrow keys to navigate...

apply patch #89701 from Lucas Carlon about to manage arrow keys to navigate between items as with PAGE_UP and PAGE_DOWN
This affect ImageEditor, LightTable, AlbumGUI Preview Mode, and ImportGUI Preview Mode.
BUGS: 339053
FIXED-IN: 4.6.0
parent b1723489
......@@ -13,4 +13,5 @@ BUGFIXES FROM KDE BUGZILLA (https://www.digikam.org/changelog):
005 ==> 338532 - Sidecar files are neither created nor updated under Windows.
006 ==> 335661 - CANVAS : image is displayed with wrong magnification after crop.
007 ==> 338996 - CANVAS : Selection coordinates/size do not show either during selection or update when using selection area adjust controls [patch].
008 ==>
008 ==> 339053 - Allow the usage of arrows to move in the photo sequence when in preview [patch].
009 ==>
......@@ -25,28 +25,48 @@
#ifndef DIGIKAMGLOBALS_H
#define DIGIKAMGLOBALS_H
// Macros for image filters.
// Qt includes
#include <QObject>
#include <QShortcut>
/** Macros for image filters.
*/
#define CLAMP0255(a) qBound(0,a,255)
#define CLAMP065535(a) qBound(0,a,65535)
#define CLAMP(x,l,u) qBound(l,x,u)
#define MAX3(a, b, c) (qMax(qMax(a,b),c))
#define MIN3(a, b, c) (qMin(qMin(a,b),c))
// Degrees to radian conversion coeff (PI/180). To optimize computation.
/** Degrees to radian conversion coeff (PI/180). To optimize computation.
*/
#define DEG2RAD 0.017453292519943
namespace Digikam
{
// Field value limits for all digiKam-specific fields (not EXIF/IPTC fields)
/** Convenience method for creating keyboard shortcuts.
*/
inline QShortcut* defineShortcut(QWidget* const w, const QKeySequence& key, const QObject* receiver, const char* slot)
{
QShortcut* const s = new QShortcut(w);
s->setKey(key);
s->setContext(Qt::WidgetWithChildrenShortcut);
QObject::connect(s, SIGNAL(activated()), receiver, slot);
return s;
}
/** Field value limits for all digiKam-specific fields (not EXIF/IPTC fields)
*/
static const int RatingMin = 0;
static const int RatingMax = 5;
static const int NoRating = -1;
// --------------------------------------------------------
// segments for histograms and curves
/** segments for histograms and curves
*/
static const int NUM_SEGMENTS_16BIT = 65536;
static const int NUM_SEGMENTS_8BIT = 256;
static const int MAX_SEGMENT_16BIT = NUM_SEGMENTS_16BIT - 1;
......@@ -54,8 +74,9 @@ static const int MAX_SEGMENT_8BIT = NUM_SEGMENTS_8BIT - 1;
// --------------------------------------------------------
// Delay in milliseconds to automatically expands album tree-view with D&D
// See bug #286263 for details.
/** Delay in milliseconds to automatically expands album tree-view with D&D
* See bug #286263 for details.
*/
static const int AUTOEXPANDDELAY = 800;
// --------------------------------------------------------
......
......@@ -231,15 +231,13 @@ QString DigikamView::Private::userPresentableAlbumTitle(const QString& title) co
void DigikamView::Private::addPageUpDownActions(DigikamView* const q, QWidget* const w)
{
QShortcut* const nextImageShortcut = new QShortcut(w);
nextImageShortcut->setKey(Qt::Key_PageDown);
nextImageShortcut->setContext(Qt::WidgetWithChildrenShortcut);
QObject::connect(nextImageShortcut, SIGNAL(activated()), q, SLOT(slotNextItem()));
QShortcut* const prevImageShortcut = new QShortcut(w);
prevImageShortcut->setKey(Qt::Key_PageUp);
prevImageShortcut->setContext(Qt::WidgetWithChildrenShortcut);
QObject::connect(prevImageShortcut, SIGNAL(activated()), q, SLOT(slotPrevItem()));
defineShortcut(w, Qt::Key_PageDown, q, SLOT(slotNextItem()));
defineShortcut(w, Qt::Key_Down, q, SLOT(slotNextItem()));
defineShortcut(w, Qt::Key_Right, q, SLOT(slotNextItem()));
defineShortcut(w, Qt::Key_PageUp, q, SLOT(slotPrevItem()));
defineShortcut(w, Qt::Key_Up, q, SLOT(slotPrevItem()));
defineShortcut(w, Qt::Key_Left, q, SLOT(slotPrevItem()));
}
// -------------------------------------------------------------------------------------------
......
......@@ -58,11 +58,13 @@
// KDE includes
#include <kdeversion.h>
#include <kaboutdata.h>
#include <kaction.h>
#if KDE_IS_VERSION(4,1,68)
#include <kactioncategory.h>
#endif
#include <kaboutdata.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <kapplication.h>
#include <kconfig.h>
......@@ -167,7 +169,8 @@ namespace Digikam
const QString EditorWindow::CONFIG_GROUP_NAME = "ImageViewer Settings";
EditorWindow::EditorWindow(const char* const name)
: DXmlGuiWindow(0), d(new Private)
: DXmlGuiWindow(0),
d(new Private)
{
setObjectName(name);
setWindowFlags(Qt::Window);
......@@ -638,14 +641,16 @@ void EditorWindow::setupStandardActions()
connect(ThemeManager::instance(), SIGNAL(signalThemeChanged()),
this, SLOT(slotThemeChanged()));
// -- Keyboard-only actions added to <MainWindow> ------------------------------
// -- Keyboard-only actions --------------------------------------------------------
KAction* altBackwardAction = new KAction(i18n("Previous Image"), this);
actionCollection()->addAction("editorwindow_backward_shift_space", altBackwardAction);
altBackwardAction->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_Space));
connect(altBackwardAction, SIGNAL(triggered()), this, SLOT(slotBackward()));
// -- Tool control actions ------------------------------
d->addPageUpDownActions(this, this);
// -- Tool control actions ---------------------------------------------------------
m_selectToolsAction = new KActionMenu(KIcon("applications-graphics"),
i18nc("@action Select image editor tool/filter", "Select Tool"), this);
......
......@@ -40,6 +40,7 @@
// Local includes
#include "globals.h"
#include "editorwindow.h"
#include "versionmanager.h"
......@@ -117,6 +118,7 @@ public:
void legacyUpdateSplitterState(KConfigGroup& group);
void plugNewVersionInFormatAction(EditorWindow* const q, KActionMenu* const menuAction, const QString& text, const QString& format);
void addPageUpDownActions(EditorWindow* const q, QWidget* const w);
public:
......@@ -294,6 +296,14 @@ void EditorWindow::Private::plugNewVersionInFormatAction(EditorWindow* const q,
menuAction->menu()->addAction(action);
}
void EditorWindow::Private::addPageUpDownActions(EditorWindow* const q, QWidget* const w)
{
defineShortcut(w, Qt::Key_Down, q, SLOT(slotForward()));
defineShortcut(w, Qt::Key_Right, q, SLOT(slotForward()));
defineShortcut(w, Qt::Key_Up, q, SLOT(slotBackward()));
defineShortcut(w, Qt::Key_Left, q, SLOT(slotBackward()));
}
} // namespace Digikam
#endif /* EDITORWINDOWPRIVATE_H */
......@@ -36,6 +36,7 @@
// Local includes
#include "config-digikam.h"
#include "globals.h"
#include "importui.h"
#include "importiconview.h"
#include "thumbnailsize.h"
......@@ -110,19 +111,13 @@ public:
void ImportView::Private::addPageUpDownActions(ImportView* const q, QWidget* const w)
{
QShortcut* const nextImageShortcut = new QShortcut(w);
nextImageShortcut->setKey(Qt::Key_PageDown);
nextImageShortcut->setContext(Qt::WidgetWithChildrenShortcut);
defineShortcut(w, Qt::Key_PageDown, q, SLOT(slotNextItem()));
defineShortcut(w, Qt::Key_Down, q, SLOT(slotNextItem()));
defineShortcut(w, Qt::Key_Right, q, SLOT(slotNextItem()));
connect(nextImageShortcut, SIGNAL(activated()),
q, SLOT(slotNextItem()));
QShortcut* const prevImageShortcut = new QShortcut(w);
prevImageShortcut->setKey(Qt::Key_PageUp);
prevImageShortcut->setContext(Qt::WidgetWithChildrenShortcut);
connect(prevImageShortcut, SIGNAL(activated()),
q, SLOT(slotPrevItem()));
defineShortcut(w, Qt::Key_PageUp, q, SLOT(slotPrevItem()));
defineShortcut(w, Qt::Key_Up, q, SLOT(slotPrevItem()));
defineShortcut(w, Qt::Key_Left, q, SLOT(slotPrevItem()));
}
ImportView::ImportView(ImportUI* const ui, ImportImageModel* const model, ImportFilterModel* const filterModel, QWidget* const parent)
......@@ -265,7 +260,7 @@ void ImportView::setupConnections()
/*void ImportView::connectIconViewFilter(FilterStatusBar* filterbar)
{
ImageAlbumFilterModel* model = d->iconView->imageAlbumFilterModel();
ImageAlbumFilterModel* const model = d->iconView->imageAlbumFilterModel();
connect(model, SIGNAL(filterMatches(bool)),
filterbar, SLOT(slotFilterMatches(bool)));
......
......@@ -649,7 +649,9 @@ void LightTableWindow::setupActions()
// Provides a menu entry that allows showing/hiding the statusbar
createStandardStatusBarAction();
// -- Keyboard-only actions added to <MainWindow> ------------------------------
// -- Keyboard-only actions ----------------------------------------------------
d->addPageUpDownActions(this, this);
KAction* const altBackwardAction = new KAction(i18n("Previous Image"), this);
actionCollection()->addAction("lighttable_backward_shift_space", altBackwardAction);
......
......@@ -36,6 +36,7 @@
// Local includes
#include "globals.h"
#include "imagepropertiessidebardb.h"
#include "statusprogressbar.h"
#include "dzoombar.h"
......@@ -95,6 +96,10 @@ public:
{
}
void addPageUpDownActions(LightTableWindow* const q, QWidget* const w);
public:
bool autoLoadOnRightPanel;
bool autoSyncPreview;
bool cancelSlideShow;
......@@ -147,6 +152,14 @@ public:
ImagePropertiesSideBarDB* rightSideBar;
};
void LightTableWindow::Private::addPageUpDownActions(LightTableWindow* const q, QWidget* const w)
{
defineShortcut(w, Qt::Key_Down, q, SLOT(slotForward()));
defineShortcut(w, Qt::Key_Right, q, SLOT(slotForward()));
defineShortcut(w, Qt::Key_Up, q, SLOT(slotBackward()));
defineShortcut(w, Qt::Key_Left, q, SLOT(slotBackward()));
}
} // namespace Digikam
#endif /* LIGHTTABLEWINDOWPRIVATE_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment