[Digikam-devel] [Bug 120963] optional album date change
Tom Albers
tomalbers at kde.nl
Sun Feb 12 19:00:43 GMT 2006
------- 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=120963
tomalbers kde nl changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From tomalbers kde nl 2006-02-12 20:00 -------
SVN commit 508790 by toma:
Add two other buttons to the property settings of the album. Lowest and Highest date.
BUG: 120963
M +20 -0 digikam/albumdb.cpp
M +16 -2 digikam/albumdb.h
M +48 -8 digikam/albumpropsedit.cpp
M +3 -1 digikam/albumpropsedit.h
M +2 -0 showfoto/showfoto.cpp
--- trunk/extragear/graphics/digikam/digikam/albumdb.cpp #508789:508790
@ -1074,6 +1074,26 @
return values[0];
}
+QDate AlbumDB::getAlbumLowestDate(int albumID)
+{
+ QStringList values;
+ execSql( QString("SELECT MIN(datetime) FROM Images "
+ "WHERE dirid=%1 GROUP BY dirid")
+ .arg( albumID ), &values);
+ QDate itemDate = QDate::fromString( values[0], Qt::ISODate );
+ return itemDate;
+}
+
+QDate AlbumDB::getAlbumHighestDate(int albumID)
+{
+ QStringList values;
+ execSql( QString("SELECT MAX(datetime) FROM Images "
+ "WHERE dirid=%1 GROUP BY dirid")
+ .arg( albumID ), &values);
+ QDate itemDate = QDate::fromString( values[0], Qt::ISODate );
+ return itemDate;
+}
+
QDate AlbumDB::getAlbumAverageDate(int albumID)
{
QStringList values;
--- trunk/extragear/graphics/digikam/digikam/albumdb.h #508789:508790
@ -453,9 +453,23 @
QString getAlbumURL(int albumID);
/**
+ * Returns the lowest/oldest date of all images for that album.
+ * param albumID the id of the album to calculate
+ * return the date.
+ */
+ QDate getAlbumLowestDate(int albumID);
+
+ /**
+ * Returns the highest/newest date of all images for that album.
+ * param albumID the id of the album to calculate
+ * return the date.
+ */
+ QDate getAlbumHighestDate(int albumID);
+
+ /**
* Returns the average date of all images for that album.
- * param albumID the id of the album to calculate the average in
- * return the average date.
+ * param albumID the id of the album to calculate
+ * return the date.
*/
QDate getAlbumAverageDate(int albumID);
--- trunk/extragear/graphics/digikam/digikam/albumpropsedit.cpp #508789:508790
@ -33,6 +33,7 @
#include <qlistview.h>
#include <qframe.h>
#include <qheader.h>
+#include <qhbox.h>
#include <qpushbutton.h>
// KDE includes.
@ -134,11 +135,22 @
topLayout->addWidget( datePicker_, 5, 1 );
dateLabel->setBuddy( datePicker_ );
- QPushButton *avgButton = new QPushButton(
- i18n("This is a button which calculates "
- "the average date",
- "&Average" ), plainPage( ) );
- topLayout->addWidget( avgButton, 6, 1);
+ QHBox *buttonRow = new QHBox( plainPage( ) );
+ QPushButton *dateLowButton = new QPushButton(
+ i18n("Button to select the date of the first image",
+ "&Lowest" ),
+ buttonRow );
+ QPushButton *dateAvgButton = new QPushButton(
+ i18n("This is a button which calculates the average date",
+ "&Average" ),
+ buttonRow );
+ QPushButton *dateHighButton = new QPushButton(
+ i18n("Button to select the date of the last image",
+ "&Highest" ),
+ buttonRow );
+
+
+ topLayout->addWidget( buttonRow, 6, 1);
setTabOrder(titleEdit_, collectionCombo_);
setTabOrder(collectionCombo_, commentsEdit_);
@ -179,8 +191,12 @
connect(titleEdit_, SIGNAL(textChanged(const QString&)),
SLOT(slotTitleChanged(const QString&)));
- connect(avgButton, SIGNAL( clicked() ),
- SLOT( slotAverageButtonClicked()));
+ connect(dateLowButton, SIGNAL( clicked() ),
+ SLOT( slotDateLowButtonClicked()));
+ connect(dateAvgButton, SIGNAL( clicked() ),
+ SLOT( slotDateAverageButtonClicked()));
+ connect(dateHighButton, SIGNAL( clicked() ),
+ SLOT( slotDateHighButtonClicked()));
adjustSize();
}
@ -277,11 +293,35 @
enableButtonOK(!newtitle.isEmpty());
}
-void AlbumPropsEdit::slotAverageButtonClicked()
+void AlbumPropsEdit::slotDateLowButtonClicked()
{
setCursor( KCursor::waitCursor() );
AlbumDB* db = AlbumManager::instance()->albumDB();
+ QDate avDate = db->getAlbumLowestDate( album_->id() );
+ setCursor( KCursor::arrowCursor() );
+
+ if ( avDate.isValid() )
+ datePicker_->setDate( avDate );
+}
+
+void AlbumPropsEdit::slotDateHighButtonClicked()
+{
+ setCursor( KCursor::waitCursor() );
+
+ AlbumDB* db = AlbumManager::instance()->albumDB();
+ QDate avDate = db->getAlbumHighestDate( album_->id() );
+ setCursor( KCursor::arrowCursor() );
+
+ if ( avDate.isValid() )
+ datePicker_->setDate( avDate );
+}
+
+void AlbumPropsEdit::slotDateAverageButtonClicked()
+{
+ setCursor( KCursor::waitCursor() );
+
+ AlbumDB* db = AlbumManager::instance()->albumDB();
QDate avDate = db->getAlbumAverageDate( album_->id() );
setCursor( KCursor::arrowCursor() );
--- trunk/extragear/graphics/digikam/digikam/albumpropsedit.h #508789:508790
@ -89,7 +89,9 @
private slots:
void slotTitleChanged(const QString& newtitle);
- void slotAverageButtonClicked();
+ void slotDateLowButtonClicked();
+ void slotDateAverageButtonClicked();
+ void slotDateHighButtonClicked();
};
} // namespace Digikam
--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #508789:508790
@ -1,10 +1,12 @
/* ============================================================
* Author: Renchi Raju <renchi pooh tam uiuc edu>
* Gilles Caulier <caulier dot gilles at free.fr>
+ * Tom Albers <tomalbers kde nl>
* Date : 2004-11-22
* Description : stand alone digiKam image editor GUI
*
* Copyright 2004-2005 by Renchi Raju, Gilles Caulier
+ * Copyright 2005-2006 by Tom Albers
* Copyright 2006 by Gilles Caulier
*
* This program is free software; you can redistribute it
More information about the Digikam-devel
mailing list