[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: [PATCH] frame plasmoid: Switch photo when the user clicks on it
From: "=?UTF-8?Q?=C3=89ric_ALBER?=" <eric.alber () gmail ! com>
Date: 2008-07-04 12:39:49
Message-ID: 676e80e0807040539x7ffbc5bdi8f2a6997c4b9f45d () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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
[Attachment #5 (text/html)]
Hi,<br><br>I wrote a litte patch for the frame plasmoid.<br>The idea is that if you \
click on the photo in the frame, it switches immediately to the next photo in \
slideshow mode<br><br>I have also fixed two compiler warnings (misuse of uint and a \
missing Q_UNUSED).<br>
<br>I attached the patch to this mail. It applies \
to<br>trunk/KDE/kdeplasmoids/applets<div>/frame/frame.cpp<br>trunk/KDE/kdeplasmoids/applets/frame/frame.h<br>trunk/KDE/kdeplasmoids/applets/frame/slideshow.cpp<br>
I created the patch in the kdeplasmoids directory<br>
<br>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 ?<br>
<br>Regards,<br><br>Eric</div>
["click-switch-photo.patch" (text/x-patch)]
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 <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic