[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/plasma/applets/peachydock
From:       Méven Car <meven29 () gmail ! com>
Date:       2008-10-29 21:52:13
Message-ID: 1225317133.054991.525.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 877604 by meven:

adding support for hoverLeaveEvent to the applet so the icons are minimised when the \
mouse leave the appletAnd clicking on an icon make the task corresponding active

 M  +7 -0      peachy_animator.cpp  
 M  +2 -1      peachy_animator.h  
 M  +8 -1      peachy_applet.cpp  
 M  +4 -1      peachy_applet.h  
 M  +5 -0      peachy_icon.cpp  
 M  +3 -1      peachy_icon.h  
 M  +1 -2      peachy_layout.cpp  
 M  +3 -3      peachy_layout.h  


--- trunk/playground/base/plasma/applets/peachydock/peachy_animator.cpp \
#877603:877604 @@ -77,3 +77,10 @@
 	}
 	emit needsRelayout();
 }
+void PeachyAnimator::reinit()
+{
+	foreach(PeachyIcon* icon, m_icons) {
+		icon->setScaling(m_minimumScaling);
+	}
+	emit needsRelayout();
+}
--- trunk/playground/base/plasma/applets/peachydock/peachy_animator.h #877603:877604
@@ -36,6 +36,7 @@
 		void remove(PeachyIcon* icon);
 		void clear();
 		void setMinimumScaling(qreal scaling);
+		void reinit();
 	private slots:
 		void iconGotHover(PeachyIcon* icon, qreal across);
 	signals:
@@ -45,4 +46,4 @@
 		qreal m_minimumScaling;
 };
 
-#endif
\ No newline at end of file
+#endif
--- trunk/playground/base/plasma/applets/peachydock/peachy_applet.cpp #877603:877604
@@ -35,7 +35,7 @@
 PeachyApplet::PeachyApplet(QObject *parent, const QVariantList &args)
 	: Plasma::Applet(parent, args)
 {
-	setBackgroundHints(TranslucentBackground);
+    setBackgroundHints(TranslucentBackground);
 }
 
 
@@ -109,4 +109,11 @@
 	}
 }
 
+void PeachyApplet::hoverLeaveEvent(QGraphicsSceneHoverEvent* e)
+{
+	kDebug() << "hover leaved";
+	m_animator->reinit();
+	activate();
+}
+
 #include "peachy_applet.moc"
--- trunk/playground/base/plasma/applets/peachydock/peachy_applet.h #877603:877604
@@ -41,16 +41,19 @@
 		PeachyApplet(QObject *parent, const QVariantList &args);
 		~PeachyApplet();
 		void init();
+		void hoverLeaveEvent(QGraphicsSceneHoverEvent* e);
 	private slots:
 		void addWindowTask(TaskPtr task);
 		void removeWindowTask(TaskPtr task);
 		void updateLayout();
+		
 		//void loadTasksForDesktop(int desktop);
 	private:
 		PeachyLayout* m_layout;
 		PeachyAnimator* m_animator;
 		void reload();
 		QHash<TaskPtr, PeachyIcon*> m_tasksHash;
+		
 };
 
-#endif
\ No newline at end of file
+#endif
--- trunk/playground/base/plasma/applets/peachydock/peachy_icon.cpp #877603:877604
@@ -86,3 +86,8 @@
 	//}
 	QGraphicsWidget::hoverMoveEvent(e);
 }
+void PeachyIcon::mousePressEvent( QGraphicsSceneMouseEvent * event)
+{
+	kDebug() << "got clicked";
+	m_task->toggleIconified();
+}
--- trunk/playground/base/plasma/applets/peachydock/peachy_icon.h #877603:877604
@@ -54,8 +54,10 @@
 		TaskPtr m_task;
 		qreal m_maximumIconSize;
 		qreal m_scaling;
+	private slots:
+		void mousePressEvent( QGraphicsSceneMouseEvent * event);
 	signals:
 		void gotHover(PeachyIcon* icon, qreal across);
 };
 
-#endif
\ No newline at end of file
+#endif
--- trunk/playground/base/plasma/applets/peachydock/peachy_layout.cpp #877603:877604
@@ -29,7 +29,7 @@
 #include <KDebug>
 
 PeachyLayout::PeachyLayout(PeachyApplet* parent)
-	: QGraphicsLayout(parent),
+	: QGraphicsLinearLayout(parent),
 	m_borderSpacing(5),
 	m_maximumIconSize(0)
 {
@@ -114,4 +114,3 @@
 {
 	return QSizeF(-1, -1);
 }
-
--- trunk/playground/base/plasma/applets/peachydock/peachy_layout.h #877603:877604
@@ -20,7 +20,7 @@
 #ifndef PEACHY_LAYOUT
 #define PEACHY_LAYOUT
 
-#include <QGraphicsLayout>
+#include <QGraphicsLinearLayout>
 #include <QList>
 
 class PeachyIcon;
@@ -29,7 +29,7 @@
 class QSizeF;
 class QGraphicsLayoutItem;
 
-class PeachyLayout : public QGraphicsLayout
+class PeachyLayout : public QGraphicsLinearLayout
 {
 	public:
 		PeachyLayout(PeachyApplet* parent);
@@ -49,4 +49,4 @@
 		qreal m_maximumIconSize;
 };
 
-#endif
\ No newline at end of file
+#endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic