[Digikam-devel] [Bug 145227] change ratings via short-cuts in the light-table
Gilles Caulier
caulier.gilles at gmail.com
Thu May 10 09:30:11 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=145227
------- Additional Comments From caulier.gilles gmail com 2007-05-10 10:30 -------
SVN commit 663144 by cgilles:
digikam from trunk : Light Table : Highlight the current image selected in thumbbar to right or left panel used a color frame around the preview. The current color scheme theme is used to draw the frame border.
CCBUGS: 145227
M +37 -30 libs/themeengine/themeengine.cpp
M +6 -2 libs/themeengine/themeengine.h
M +1 -1 utilities/lighttable/lighttablebar.h
M +21 -0 utilities/lighttable/lighttablepreview.cpp
M +3 -0 utilities/lighttable/lighttablepreview.h
M +35 -3 utilities/lighttable/lighttableview.cpp
M +2 -0 utilities/lighttable/lighttableview.h
M +16 -2 utilities/lighttable/lighttablewindow.cpp
M +5 -2 utilities/lighttable/lighttablewindow.h
--- trunk/extragear/graphics/digikam/libs/themeengine/themeengine.cpp #663143:663144
@ -6,7 +6,8 @
* Date : 2004-08-02
* Description : theme engine methods
*
- * Copyright (C) 2004 by Renchi Raju <renchi pooh tam uiuc edu>
+ * Copyright (C) 2004-2005 by Renchi Raju <renchi pooh tam uiuc edu>
+ * Copyright (C) 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@ -50,6 +51,7 @
#include "theme.h"
#include "texture.h"
#include "themeengine.h"
+#include "themeengine.moc"
namespace Digikam
{
@ -201,40 +203,40 @
t->textSpecialRegColor = QColor("#0000EF");
t->textSpecialSelColor = cg.highlightedText();
- t->bannerColor = cg.highlight();
- t->bannerColorTo = cg.highlight().dark(120);
- t->bannerBevel = Theme::FLAT;
- t->bannerGrad = Theme::SOLID;
- t->bannerBorder = false;
- t->bannerBorderColor = Qt::black;
+ t->bannerColor = cg.highlight();
+ t->bannerColorTo = cg.highlight().dark(120);
+ t->bannerBevel = Theme::FLAT;
+ t->bannerGrad = Theme::SOLID;
+ t->bannerBorder = false;
+ t->bannerBorderColor = Qt::black;
- t->thumbRegColor = cg.base();
- t->thumbRegColorTo = cg.base();
- t->thumbRegBevel = Theme::FLAT;
- t->thumbRegGrad = Theme::SOLID;
- t->thumbRegBorder = true;
+ t->thumbRegColor = cg.base();
+ t->thumbRegColorTo = cg.base();
+ t->thumbRegBevel = Theme::FLAT;
+ t->thumbRegGrad = Theme::SOLID;
+ t->thumbRegBorder = true;
t->thumbRegBorderColor = QColor("#E0E0EF");
- t->thumbSelColor = cg.highlight();
- t->thumbSelColorTo = cg.highlight();
- t->thumbSelBevel = Theme::FLAT;
- t->thumbSelGrad = Theme::SOLID;
- t->thumbSelBorder = true;
+ t->thumbSelColor = cg.highlight();
+ t->thumbSelColorTo = cg.highlight();
+ t->thumbSelBevel = Theme::FLAT;
+ t->thumbSelGrad = Theme::SOLID;
+ t->thumbSelBorder = true;
t->thumbSelBorderColor = QColor("#E0E0EF");
- t->listRegColor = cg.base();
- t->listRegColorTo = cg.base();
- t->listRegBevel = Theme::FLAT;
- t->listRegGrad = Theme::SOLID;
- t->listRegBorder = false;
- t->listRegBorderColor = Qt::black;
+ t->listRegColor = cg.base();
+ t->listRegColorTo = cg.base();
+ t->listRegBevel = Theme::FLAT;
+ t->listRegGrad = Theme::SOLID;
+ t->listRegBorder = false;
+ t->listRegBorderColor = Qt::black;
- t->listSelColor = cg.highlight();
- t->listSelColorTo = cg.highlight();
- t->listSelBevel = Theme::FLAT;
- t->listSelGrad = Theme::SOLID;
- t->listSelBorder = true;
- t->listSelBorderColor = Qt::black;
+ t->listSelColor = cg.highlight();
+ t->listSelColorTo = cg.highlight();
+ t->listSelBevel = Theme::FLAT;
+ t->listSelGrad = Theme::SOLID;
+ t->listSelBorder = true;
+ t->listSelBorderColor = Qt::black;
}
void ThemeEngine::loadTheme()
@ -530,6 +532,11 @
return d->currTheme->baseColor;
}
+QColor ThemeEngine::thumbSelColor() const
+{
+ return d->currTheme->thumbSelColor;
+}
+
QColor ThemeEngine::textRegColor() const
{
return d->currTheme->textRegColor;
@ -592,4 +599,4 @
} // NameSpace Digikam
-#include "themeengine.moc"
+
--- trunk/extragear/graphics/digikam/libs/themeengine/themeengine.h #663143:663144
@ -6,7 +6,8 @
* Date : 2004-08-02
* Description : theme engine methods
*
- * Copyright (C) 2004 by Renchi Raju <renchi pooh tam uiuc edu>
+ * Copyright (C) 2004-2005 by Renchi Raju <renchi pooh tam uiuc edu>
+ * Copyright (C) 2006-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@ -56,11 +57,14 @
void setCurrentTheme(const QString& name);
Theme* getCurrentTheme();
- QColor baseColor() const;
+ QColor baseColor() const;
+ QColor thumbSelColor() const;
+
QColor textRegColor() const;
QColor textSelColor() const;
QColor textSpecialRegColor() const;
QColor textSpecialSelColor() const;
+
QPixmap bannerPixmap(int w, int h);
QPixmap thumbRegPixmap(int w, int h);
QPixmap thumbSelPixmap(int w, int h);
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #663143:663144
@ -80,7 +80,7 @
private slots:
- void slotItemSelected(ThumbBarItem* i);
+ void slotItemSelected(ThumbBarItem*);
private:
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablepreview.cpp #663143:663144
@ -31,6 +31,7 @
#include <qtoolbutton.h>
#include <qtooltip.h>
#include <qpixmap.h>
+#include <qdrawutil.h>
// KDE includes.
@ -89,12 +90,14 @
imageInfo = 0;
hasPrev = false;
hasNext = false;
+ selected = false;
currentFitWindowZoom = 0;
previewSize = 1024;
}
bool hasPrev;
bool hasNext;
+ bool selected;
int previewSize;
@ -143,6 +146,9 @
QToolTip::add(d->cornerButton, i18n("Pan the image"));
setCornerWidget(d->cornerButton);
+ setLineWidth(4);
+ setSelected(false);
+
// ------------------------------------------------------------
connect(d->cornerButton, SIGNAL(pressed()),
@ -514,6 +520,7 @
void LightTablePreview::slotThemeChanged()
{
setBackgroundColor(ThemeEngine::instance()->baseColor());
+ frameChanged();
}
void LightTablePreview::slotCornerButtonPressed()
@ -698,4 +705,18 @
}
}
+void LightTablePreview::setSelected(bool sel)
+{
+ d->selected = sel;
+ frameChanged();
+}
+
+void LightTablePreview::drawFrame(QPainter *p)
+{
+ if (d->selected)
+ qDrawPlainRect(p, frameRect(), ThemeEngine::instance()->thumbSelColor(), lineWidth());
+ else
+ qDrawPlainRect(p, frameRect(), colorGroup().background(), lineWidth());
+}
+
} // NameSpace Digikam
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablepreview.h #663143:663144
@ -66,6 +66,8 @
void setImagePath(const QString& path=QString());
void setPreviousNextPaths(const QString& previous, const QString &next);
+ void setSelected(bool sel);
+
signals:
void signalDroppedItems(const ImageInfoList&);
@ -77,6 +79,7 @
protected:
void resizeEvent(QResizeEvent* e);
+ void drawFrame(QPainter *p);
private slots:
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.cpp #663143:663144
@ -69,11 +69,11 @
{
d = new LightTableViewPriv;
- setFrameStyle(QFrame::GroupBoxPanel|QFrame::Plain);
+ setFrameStyle(QFrame::NoFrame);
setMargin(0);
- setLineWidth(1);
+ setLineWidth(0);
- d->grid = new QGridLayout(this, 1, 1, 0, KDialogBase::spacingHint());
+ d->grid = new QGridLayout(this, 1, 1, 0, 1);
d->leftPreview = new LightTablePreview(this);
d->rightPreview = new LightTablePreview(this);
@ -346,5 +346,37 @
emit signalToggleOnSyncPreview(d->syncPreview);
}
+void LightTableView::checkForSelection(ImageInfo* info)
+{
+ if (!info)
+ {
+ d->leftPreview->setSelected(false);
+ d->rightPreview->setSelected(false);
+ return;
+ }
+
+ if (d->leftPreview->getImageInfo())
+ {
+ KURL url1 = d->leftPreview->getImageInfo()->kurl();
+ KURL url2 = info->kurl();
+
+ if (url1 == url2)
+ d->leftPreview->setSelected(true);
+ else
+ d->leftPreview->setSelected(false);
+ }
+
+ if (d->rightPreview->getImageInfo())
+ {
+ KURL url1 = d->rightPreview->getImageInfo()->kurl();
+ KURL url2 = info->kurl();
+
+ if (url1 == url2)
+ d->rightPreview->setSelected(true);
+ else
+ d->rightPreview->setSelected(false);
+ }
+}
+
} // namespace Digikam
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttableview.h #663143:663144
@ -61,6 +61,8 @
void setLeftZoomFactor(double z);
void setRightZoomFactor(double z);
+ void checkForSelection(ImageInfo* info);
+
double leftZoomMax();
double leftZoomMin();
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #663143:663144
@ -341,10 +341,10 @
this, SLOT(slotToggleOnSyncPreview(bool)));
connect(d->previewView, SIGNAL(signalLeftPreviewLoaded(bool)),
- d->leftZoomBar, SLOT(setEnabled(bool)));
+ this, SLOT(slotLeftPreviewLoaded(bool)));
connect(d->previewView, SIGNAL(signalRightPreviewLoaded(bool)),
- d->rightZoomBar, SLOT(setEnabled(bool)));
+ this, SLOT(slotRightPreviewLoaded(bool)));
ImageAttributesWatch *watch = ImageAttributesWatch::instance();
@ -523,6 +523,18 @
}
}
+void LightTableWindow::slotLeftPreviewLoaded(bool b)
+{
+ d->leftZoomBar->setEnabled(b);
+ d->previewView->checkForSelection(d->barView->currentItemImageInfo());
+}
+
+void LightTableWindow::slotRightPreviewLoaded(bool b)
+{
+ d->rightZoomBar->setEnabled(b);
+ d->previewView->checkForSelection(d->barView->currentItemImageInfo());
+}
+
void LightTableWindow::slotFileMetadataChanged(const KURL &/*url*/)
{
// TODO ???
@ -544,6 +556,8 @
d->removeItemAction->setEnabled(false);
d->clearListAction->setEnabled(false);
}
+
+ d->previewView->checkForSelection(info);
}
void LightTableWindow::slotLeftDroppedItems(const ImageInfoList& list)
--- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.h #663143:663144
@ -92,14 +92,17 @
void slotLeftDroppedItems(const ImageInfoList&);
void slotRightDroppedItems(const ImageInfoList&);
+ void slotLeftPreviewLoaded(bool);
+ void slotRightPreviewLoaded(bool);
+
void slotLeftZoomFactorChanged(double);
void slotRightZoomFactorChanged(double);
void slotToggleOnSyncPreview(bool);
void slotToggleSyncPreview();
- void slotEditItem(ImageInfo* info);
- void slotDeleteItem(ImageInfo* info);
+ void slotEditItem(ImageInfo*);
+ void slotDeleteItem(ImageInfo*);
void slotItemSelected(ImageInfo*);
void slotClearItemsList();
More information about the Digikam-devel
mailing list