[Digikam-devel] extragear/graphics/digikam
Gilles Caulier
caulier.gilles at gmail.com
Mon May 7 14:41:36 BST 2007
SVN commit 662103 by cgilles:
digikam from trunk : Light Table : full support of Drag & Drop
CCMAIL: digikam-devel at kde.org
M +18 -18 project/digikam.kdevelop
M +42 -1 utilities/lighttable/lighttablepreview.cpp
M +5 -1 utilities/lighttable/lighttablepreview.h
M +6 -0 utilities/lighttable/lighttableview.cpp
M +3 -1 utilities/lighttable/lighttableview.h
M +30 -0 utilities/lighttable/lighttablewindow.cpp
M +2 -0 utilities/lighttable/lighttablewindow.h
--- trunk/extragear/graphics/digikam/project/digikam.kdevelop #662102:662103
@@ -12,7 +12,7 @@
</keywords>
<projectdirectory>./</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
- <description></description>
+ <description/>
<ignoreparts/>
<projectname>digikam</projectname>
<defaultencoding/>
@@ -74,11 +74,11 @@
<kdevdebugger>
<general>
<dbgshell>libtool</dbgshell>
- <programargs></programargs>
- <gdbpath></gdbpath>
- <configGdbScript></configGdbScript>
- <runShellScript></runShellScript>
- <runGdbScript></runGdbScript>
+ <programargs/>
+ <gdbpath/>
+ <configGdbScript/>
+ <runShellScript/>
+ <runGdbScript/>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
@@ -107,14 +107,14 @@
<runmultiplejobs>false</runmultiplejobs>
<numberofjobs>1</numberofjobs>
<dontact>false</dontact>
- <makebin></makebin>
+ <makebin/>
<prio>0</prio>
</make>
<run>
<directoryradio>build</directoryradio>
<customdirectory>/</customdirectory>
- <mainprogram>digikam/digikam/digikam</mainprogram>
- <programargs></programargs>
+ <mainprogram>/home/gilles/Documents/devel/SVN/trunk/graphics/digikam/digikam/digikam</mainprogram>
+ <programargs/>
<terminal>false</terminal>
<autocompile>false</autocompile>
<envvars/>
@@ -133,17 +133,17 @@
<configargs>--enable-debug=full</configargs>
<builddir>../..</builddir>
<topsourcedir>../..</topsourcedir>
- <cppflags></cppflags>
- <ldflags></ldflags>
+ <cppflags/>
+ <ldflags/>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
- <ccompilerbinary></ccompilerbinary>
- <cxxcompilerbinary></cxxcompilerbinary>
- <f77compilerbinary></f77compilerbinary>
- <cflags></cflags>
- <cxxflags></cxxflags>
- <f77flags></f77flags>
+ <ccompilerbinary/>
+ <cxxcompilerbinary/>
+ <f77compilerbinary/>
+ <cflags/>
+ <cxxflags/>
+ <f77flags/>
</default>
</configurations>
</kdevautoproject>
@@ -192,7 +192,7 @@
<includePaths>.;</includePaths>
</codecompletion>
<creategettersetter>
- <prefixGet></prefixGet>
+ <prefixGet/>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablepreview.cpp #662102:662103
@@ -57,8 +57,8 @@
#include "albumdb.h"
#include "albummanager.h"
#include "albumsettings.h"
+#include "dragobjects.h"
#include "fastscale.h"
-#include "imageinfo.h"
#include "dmetadata.h"
#include "dpopupmenu.h"
#include "metadatahub.h"
@@ -119,6 +119,9 @@
{
d = new LightTablePreviewPriv;
+ viewport()->setAcceptDrops(true);
+ setAcceptDrops(true);
+
slotThemeChanged();
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@@ -622,4 +625,42 @@
bitBlt(pix, 0, 0, &img, 0, 0);
}
+void LightTablePreview::contentsDragMoveEvent(QDragMoveEvent *e)
+{
+ KURL::List urls;
+ KURL::List kioURLs;
+ QValueList<int> albumIDs;
+ QValueList<int> imageIDs;
+
+ if (!ItemDrag::decode(e, urls, kioURLs, albumIDs, imageIDs))
+ {
+ e->ignore();
+ return;
+ }
+ e->accept();
+}
+
+void LightTablePreview::contentsDropEvent(QDropEvent *e)
+{
+ KURL::List urls;
+ KURL::List kioURLs;
+ QValueList<int> albumIDs;
+ QValueList<int> imageIDs;
+ ImageInfoList list;
+
+ if (ItemDrag::decode(e, urls, kioURLs, albumIDs, imageIDs))
+ {
+ for (QValueList<int>::const_iterator it = imageIDs.begin();
+ it != imageIDs.end(); ++it)
+ {
+ list.append(new ImageInfo(*it));
+ emit signalDroppedItems(list);
+ }
+ }
+ else
+ {
+ e->ignore();
+ }
+}
+
} // NameSpace Digikam
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablepreview.h #662102:662103
@@ -31,6 +31,7 @@
// Local includes
+#include "imageinfo.h"
#include "previewwidget.h"
#include "digikam_export.h"
@@ -40,7 +41,6 @@
{
class LoadingDescription;
-class ImageInfo;
class LightTablePreviewPriv;
class DIGIKAM_EXPORT LightTablePreview : public PreviewWidget
@@ -65,6 +65,7 @@
signals:
+ void signalDroppedItems(const ImageInfoList&);
void signalDeleteItem(ImageInfo*);
void signalEditItem(ImageInfo*);
void signalPreviewLoaded();
@@ -97,6 +98,9 @@
void updateZoomAndSize(bool alwaysFitToWindow);
inline void paintPreview(QPixmap *pix, int sx, int sy, int sw, int sh);
+ void contentsDragMoveEvent(QDragMoveEvent*);
+ void contentsDropEvent(QDropEvent*);
+
private:
LightTablePreviewPriv* d;
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.cpp #662102:662103
@@ -97,6 +97,12 @@
connect(d->leftPreview, SIGNAL(signalEditItem(ImageInfo*)),
this, SIGNAL(signalEditItem(ImageInfo*)));
+
+ connect(d->rightPreview, SIGNAL(signalDroppedItems(const ImageInfoList&)),
+ this, SIGNAL(signalRightDroppedItems(const ImageInfoList&)));
+
+ connect(d->leftPreview, SIGNAL(signalDroppedItems(const ImageInfoList&)),
+ this, SIGNAL(signalLeftDroppedItems(const ImageInfoList&)));
connect(d->rightPreview, SIGNAL(signalSlideShow()),
this, SIGNAL(signalSlideShow()));
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.h #662102:662103
@@ -32,12 +32,12 @@
// Local includes.
+#include "imageinfo.h"
#include "digikam_export.h"
namespace Digikam
{
-class ImageInfo;
class LightTableViewPriv;
class DIGIKAM_EXPORT LightTableView : public QFrame
@@ -77,6 +77,8 @@
void signalLeftZoomFactorChanged(double);
void signalRightZoomFactorChanged(double);
+ void signalLeftDroppedItems(const ImageInfoList&);
+ void signalRightDroppedItems(const ImageInfoList&);
void signalSlideShow();
void signalDeleteItem(ImageInfo*);
void signalEditItem(ImageInfo*);
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #662102:662103
@@ -330,6 +330,12 @@
connect(d->previewView, SIGNAL(signalSlideShow()),
this, SLOT(slotToggleSlideShow()));
+ connect(d->previewView, SIGNAL(signalLeftDroppedItems(const ImageInfoList&)),
+ this, SLOT(slotLeftDroppedItems(const ImageInfoList&)));
+
+ connect(d->previewView, SIGNAL(signalRightDroppedItems(const ImageInfoList&)),
+ this, SLOT(slotRightDroppedItems(const ImageInfoList&)));
+
ImageAttributesWatch *watch = ImageAttributesWatch::instance();
connect(watch, SIGNAL(signalFileMetadataChanged(const KURL &)),
@@ -488,6 +494,30 @@
}
}
+void LightTableWindow::slotLeftDroppedItems(const ImageInfoList& list)
+{
+ ImageInfo *info = *(list.begin());
+ loadImageInfos(list, info);
+
+ // We will check if first item from list is already stored in thumbbar
+ // Note than thumbbar store all ImageInfo reference in memory for preview object.
+ LightTableBarItem *item = d->barView->findItemByInfo(info);
+ if (item)
+ slotSetItemOnLeftPanel(item->info());
+}
+
+void LightTableWindow::slotRightDroppedItems(const ImageInfoList& list)
+{
+ ImageInfo *info = *(list.begin());
+ loadImageInfos(list, info);
+
+ // We will check if first item from list is already stored in thumbbar
+ // Note than thumbbar store all ImageInfo reference in memory for preview object.
+ LightTableBarItem *item = d->barView->findItemByInfo(info);
+ if (item)
+ slotSetItemOnRightPanel(item->info());
+}
+
void LightTableWindow::slotSetItemOnLeftPanel(ImageInfo* info)
{
d->previewView->setLeftImageInfo(info);
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.h #662102:662103
@@ -104,6 +104,8 @@
void slotFileMetadataChanged(const KURL&);
void slotLeftZoomFactorChanged(double);
void slotRightZoomFactorChanged(double);
+ void slotLeftDroppedItems(const ImageInfoList&);
+ void slotRightDroppedItems(const ImageInfoList&);
private:
More information about the Digikam-devel
mailing list