lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] frame plasmoid: Switch photo when the user clicks on it
- Date: Fri, 4 Jul 2008 14:39:49 +0200
- From: "Éric ALBER" <eric.alber@xxxxxxxxx>
- Subject: [PATCH] frame plasmoid: Switch photo when the user clicks on it
Hi,
I wrote a litte patch for the frame plasmoid.
The idea is that if you click on the photo in the frame, it switches immediately to the next photo in slideshow mode
I have also fixed two compiler warnings (misuse of uint and a missing Q_UNUSED).
I attached the patch to this mail. It applies to
trunk/KDE/kdeplasmoids/applets/frame/frame.cpp
trunk/KDE/kdeplasmoids/applets/frame/frame.h
trunk/KDE/kdeplasmoids/applets/frame/slideshow.cpp
I created the patch in the kdeplasmoids directory
I also noticed that void mousePressEvent (QGraphicsSceneMouseEvent
*event) and other methods are not declared virtual in Plasma/Applet but
the same methods are virtual in QGraphicsItem. I also noticed that the
destructor of the Applet class is not virtual either. Is this a design
choice or has it just been forgotten ?
Regards,
Eric
Index: applets/frame/frame.h
===================================================================
--- applets/frame/frame.h (révision 827814)
+++ applets/frame/frame.h (copie de travail)
@@ -64,6 +64,7 @@
protected:
void constraintsEvent(Plasma::Constraints constraints);
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
private:
void paintCache(const QStyleOptionGraphicsItem *option,
Index: applets/frame/slideshow.cpp
===================================================================
--- applets/frame/slideshow.cpp (révision 827814)
+++ applets/frame/slideshow.cpp (copie de travail)
@@ -82,7 +82,7 @@
KRandomSequence randomSequence;
indexList.clear();
//get the number of sounds then shuffle it: each number will be taken once then the sequence will come back
- for (uint j = 0; j < m_pictures.count(); j++)
+ for (int j = 0; j < m_pictures.count(); j++)
indexList.append(j);
randomSequence.randomize(indexList);
}
Index: applets/frame/frame.cpp
===================================================================
--- applets/frame/frame.cpp (révision 827814)
+++ applets/frame/frame.cpp (copie de travail)
@@ -67,6 +67,8 @@
void Frame::dataUpdated( const QString &name, const Plasma::DataEngine::Data &data )
{
+ Q_UNUSED(name);
+
QDate mCurrentDate = QDate::currentDate();
const QString identifier = m_potdProvider + ':' + mCurrentDate.toString( Qt::ISODate );
@@ -128,6 +130,15 @@
}
}
+void Frame::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ Applet::mousePressEvent(event);
+ if (m_slideShow && event->buttons() & Qt::LeftButton) {
+ m_slideShowTimer->start();
+ updatePicture();
+ }
+}
+
QSizeF Frame::contentSizeHint() const {
if (!m_picture.isNull()) {
QSizeF sizeHint;
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<