[Digikam-devel] [Bug 145236] small wishes for the light-table
Gilles Caulier
caulier.gilles at gmail.com
Sat May 12 20:37:15 BST 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=145236
------- Additional Comments From caulier.gilles gmail com 2007-05-12 21:37 -------
SVN commit 663963 by cgilles:
digiKam from trunk : Light Table : Add "Navigate by Pair" option.
In this mode drag & drop is disable between thumbbar and left/right panels.
The options to set amnually the item on Left or Right panel are also disable (main menu and pop-up menu)
The light table will set automaticly the left item with the current item selected on thumbbar and the right item
is the next item on thumbbar.
CCBUGS: 145236
M +26 -7 lighttablebar.cpp
M +4 -0 lighttablebar.h
M +23 -9 lighttablepreview.cpp
M +2 -0 lighttablepreview.h
M +6 -0 lighttableview.cpp
M +1 -0 lighttableview.h
M +47 -2 lighttablewindow.cpp
M +1 -0 lighttablewindow.h
M +3 -1 lighttablewindowui.rc
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.cpp #663962:663963
@ -56,7 +56,8 @
{
setMouseTracking(true);
readToolTipSettings();
- m_toolTip = new LightTableBarToolTip(this);
+ m_toolTip = new LightTableBarToolTip(this);
+ m_navigateByPair = false;
connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
this, SLOT(slotUpdate()));
@ -95,6 +96,11 @
delete m_toolTip;
}
+void LightTableBar::setNavigateByPair(bool b)
+{
+ m_navigateByPair = b;
+}
+
void LightTableBar::slotImageRatingChanged(Q_LLONG imageId)
{
for (ThumbBarItem *item = firstItem(); item; item = item->next())
@ -124,6 +130,13 @
popmenu.insertItem(SmallIcon("previous"), i18n("Show on left panel"), 10);
popmenu.insertItem(SmallIcon("next"), i18n("Show on right panel"), 11);
popmenu.insertItem(SmallIcon("editimage"), i18n("Edit"), 12);
+
+ if (m_navigateByPair)
+ {
+ popmenu.setItemEnabled(10, false);
+ popmenu.setItemEnabled(11, false);
+ }
+
popmenu.insertSeparator();
popmenu.insertItem(SmallIcon("fileclose"), i18n("Remove"), 13);
popmenu.insertItem(SmallIcon("editshred"), i18n("Clear all"), 14);
@ -219,13 +232,16 @
void LightTableBar::setOnLeftPanel(const ImageInfo* info)
{
- if (!info) return;
-
for (ThumbBarItem *item = firstItem(); item; item = item->next())
{
LightTableBarItem *ltItem = dynamic_cast<LightTableBarItem*>(item);
if (ltItem)
- ltItem->setOnLeftPanel(ltItem->info()->id() == info->id());
+ {
+ if (info)
+ ltItem->setOnLeftPanel(ltItem->info()->id() == info->id());
+ else
+ ltItem->setOnLeftPanel(false);
+ }
}
triggerUpdate();
@ -233,13 +249,16 @
void LightTableBar::setOnRightPanel(const ImageInfo* info)
{
- if (!info) return;
-
for (ThumbBarItem *item = firstItem(); item; item = item->next())
{
LightTableBarItem *ltItem = dynamic_cast<LightTableBarItem*>(item);
if (ltItem)
- ltItem->setOnRightPanel(ltItem->info()->id() == info->id());
+ {
+ if (info)
+ ltItem->setOnRightPanel(ltItem->info()->id() == info->id());
+ else
+ ltItem->setOnRightPanel(false);
+ }
}
triggerUpdate();
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #663962:663963
@ -72,6 +72,8 @
void removeItem(const ImageInfo* info);
+ void setNavigateByPair(bool b);
+
signals:
void signalLightTableBarItemSelected(ImageInfo*);
@ -104,6 +106,8 @
private:
+ bool m_navigateByPair;
+
QPixmap m_ratingPixmap;
LightTableBarToolTip *m_toolTip;
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablepreview.cpp #663962:663963
@ -91,6 +91,7 @
hasPrev = false;
hasNext = false;
selected = false;
+ dragAndDropEnabled = true;
currentFitWindowZoom = 0;
previewSize = 1024;
}
@ -98,6 +99,7 @
bool hasPrev;
bool hasNext;
bool selected;
+ bool dragAndDropEnabled;
int previewSize;
@ -172,6 +174,11 @
delete d;
}
+void LightTablePreview::setDragAndDropEnabled(bool b)
+{
+ d->dragAndDropEnabled = b;
+}
+
void LightTablePreview::setImage(const QImage& image)
{
d->preview = image;
@ -647,15 +654,18 @
d->path = QString();
d->imageInfo = 0;
- QPixmap pix(visibleWidth(), visibleHeight());
- pix.fill(ThemeEngine::instance()->baseColor());
- QPainter p(&pix);
- p.setPen(QPen(ThemeEngine::instance()->textRegColor()));
- p.drawText(0, 0, pix.width(), pix.height(),
- Qt::AlignCenter|Qt::WordBreak,
- i18n("Drag and drop here an item"));
- p.end();
- setImage(pix.convertToImage());
+ if (d->dragAndDropEnabled)
+ {
+ QPixmap pix(visibleWidth(), visibleHeight());
+ pix.fill(ThemeEngine::instance()->baseColor());
+ QPainter p(&pix);
+ p.setPen(QPen(ThemeEngine::instance()->textRegColor()));
+ p.drawText(0, 0, pix.width(), pix.height(),
+ Qt::AlignCenter|Qt::WordBreak,
+ i18n("Drag and drop here an item"));
+ p.end();
+ setImage(pix.convertToImage());
+ }
updateZoomAndSize(true);
emit signalPreviewLoaded(false);
@ -671,6 +681,8 @
void LightTablePreview::contentsDragMoveEvent(QDragMoveEvent *e)
{
+ if (!d->dragAndDropEnabled) return;
+
KURL::List urls;
KURL::List kioURLs;
QValueList<int> albumIDs;
@ -686,6 +698,8 @
void LightTablePreview::contentsDropEvent(QDropEvent *e)
{
+ if (!d->dragAndDropEnabled) return;
+
KURL::List urls;
KURL::List kioURLs;
QValueList<int> albumIDs;
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablepreview.h #663962:663963
@ -68,6 +68,8 @
void setSelected(bool sel);
+ void setDragAndDropEnabled(bool b);
+
signals:
void signalDroppedItems(const ImageInfoList&);
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.cpp #663962:663963
@ -149,6 +149,12 @
slotLeftContentsMoved(d->leftPreview->contentsX(), d->leftPreview->contentsY());
}
+void LightTableView::setNavigateByPair(bool b)
+{
+ d->leftPreview->setDragAndDropEnabled(!b);
+ d->rightPreview->setDragAndDropEnabled(!b);
+}
+
void LightTableView::slotDecreaseZoom()
{
if (!d->syncPreview) return;
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.h #663962:663963
@ -51,6 +51,7 @
~LightTableView();
void setSyncPreview(bool sync);
+ void setNavigateByPair(bool b);
void setLeftImageInfo(ImageInfo* info=0);
void setRightImageInfo(ImageInfo* info=0);
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #663962:663963
@ -113,6 +113,7 @
backwardAction = 0;
firstAction = 0;
lastAction = 0;
+ navigateByPairAction = 0;
}
bool autoSyncPreview;
@ -152,6 +153,7 @
KToggleAction *fullScreenAction;
KToggleAction *syncPreviewAction;
+ KToggleAction *navigateByPairAction;
KAccel *accelerators;
@ -464,6 +466,12 @
actionCollection(), "lighttable_syncpreview");
d->syncPreviewAction->setEnabled(false);
+ d->navigateByPairAction = new KToggleAction(i18n("Navigate by Pair"), "kcmsystem",
+ CTRL+SHIFT+Key_P, this,
+ SLOT(slotToggleNavigateByPair()),
+ actionCollection(), "lighttable_navigatebypair");
+ d->navigateByPairAction->setEnabled(false);
+
d->zoomPlusAction = KStdAction::zoomIn(d->previewView, SLOT(slotIncreaseZoom()),
actionCollection(), "lighttable_zoomplus");
d->zoomPlusAction->setEnabled(false);
@ -685,6 +693,8 @
d->forwardAction->setEnabled(true);
d->firstAction->setEnabled(true);
d->lastAction->setEnabled(true);
+ d->syncPreviewAction->setEnabled(true);
+ d->navigateByPairAction->setEnabled(true);
LightTableBarItem* curr = d->barView->findItemByInfo(info);
if (curr)
@ -700,6 +710,26 @
d->forwardAction->setEnabled(false);
d->lastAction->setEnabled(false);
}
+
+ if (d->navigateByPairAction->isChecked())
+ {
+ d->setItemLeftAction->setEnabled(false);
+ d->setItemRightAction->setEnabled(false);
+
+ d->barView->setOnLeftPanel(info);
+ slotSetItemOnLeftPanel(info);
+
+ LightTableBarItem* next = dynamic_cast<LightTableBarItem*>(curr->next());
+ if (next)
+ {
+ d->barView->setOnRightPanel(next->info());
+ slotSetItemOnRightPanel(next->info());
+ }
+ else
+ {
+ slotSetItemOnRightPanel(0);
+ }
+ }
}
}
else
@ -714,6 +744,8 @
d->forwardAction->setEnabled(false);
d->firstAction->setEnabled(false);
d->lastAction->setEnabled(false);
+ d->syncPreviewAction->setEnabled(false);
+ d->navigateByPairAction->setEnabled(false);
}
d->previewView->checkForSelection(info);
@ -762,13 +794,19 @
void LightTableWindow::slotSetItemOnLeftPanel(ImageInfo* info)
{
d->previewView->setLeftImageInfo(info);
- d->leftSidebar->itemChanged(info);
+ if (info)
+ d->leftSidebar->itemChanged(info);
+ else
+ d->leftSidebar->slotNoCurrentItem();
}
void LightTableWindow::slotSetItemOnRightPanel(ImageInfo* info)
{
d->previewView->setRightImageInfo(info);
- d->rightSidebar->itemChanged(info);
+ if (info)
+ d->rightSidebar->itemChanged(info);
+ else
+ d->rightSidebar->slotNoCurrentItem();
}
void LightTableWindow::slotClearItemsList()
@ -1274,5 +1312,12 @
d->barView->setSelected( d->barView->lastItem() );
}
+void LightTableWindow::slotToggleNavigateByPair()
+{
+ d->barView->setNavigateByPair(d->navigateByPairAction->isChecked());
+ d->previewView->setNavigateByPair(d->navigateByPairAction->isChecked());
+ slotItemSelected(d->barView->currentItemImageInfo());
+}
+
} // namespace Digikam
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.h #663962:663963
@ -112,6 +112,7 @
void slotToggleOnSyncPreview(bool);
void slotToggleSyncPreview();
+ void slotToggleNavigateByPair();
void slotEditItem();
void slotEditItem(ImageInfo*);
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindowui.rc #663962:663963
@ -1,5 +1,5 @
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui version="15" name="lighttablewindow" >
+<gui version="17" name="lighttablewindow" >
<MenuBar>
@ -26,6 +26,7 @
<Action name="lighttable_slideshow" />
<Separator/>
<Action name="lighttable_syncpreview" />
+ <Action name="lighttable_navigatebypair" />
<Separator/>
<Action name="lighttable_zoomplus" />
<Action name="lighttable_zoomminus" />
@ -63,6 +64,7 @
<Separator/>
<Action name="lighttable_setitemleft" />
<Action name="lighttable_setitemright" />
+ <Action name="lighttable_navigatebypair" />
<Separator/>
<Action name="lighttable_zoomfit2window" />
<Action name="lighttable_zoomfit2select" />
More information about the Digikam-devel
mailing list