I have made the following changes intended for :
  CE:UX:MTF / lipstick

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/6999

Thank You,
Marko Saukko

[This message was auto-generated]

---

Request # 6999:

Messages from BOSS:

State: review at 2012-10-13T16:58:02 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: Project:MTF:UX / lipstick -> CE:UX:MTF / lipstick
  
changes files:
--------------
--- lipstick.changes
+++ lipstick.changes
@@ -0,0 +1,5 @@
+* Sat Oct 13 2012 Robin Burchell <[email protected]> - 0.4.1
+- Slight performance improvement to scanning desktop files on change (from 
Robin)
+- Allow smoothing of SwitcherPixmapItem (from Robin)
+- Allow setting a radius to round borders of SwitcherPixmapItem (from Robin)
+

old:
----
  lipstick-0.4.0.tar.bz2

new:
----
  lipstick-0.4.1.tar.bz2

spec files:
-----------
--- lipstick.spec
+++ lipstick.spec
@@ -9,7 +9,7 @@
 # << macros
 
 Summary:    QML toolkit for homescreen creation
-Version:    0.4.0
+Version:    0.4.1
 Release:    1
 Group:      System/Libraries
 License:    LGPLv2.1

other changes:
--------------

++++++ lipstick-0.4.0.tar.bz2 -> lipstick-0.4.1.tar.bz2
--- src/components/launchermodel.cpp
+++ src/components/launchermodel.cpp
@@ -48,9 +48,10 @@
     QDir directory(changedPath);
     directory.setFilter(QDir::Files);
     QFileInfoList fileInfoList = directory.entryInfoList();
+    QList<LauncherItem *> *currentLauncherList = getList<LauncherItem>();
 
     // Finding removed desktop entries
-    foreach (LauncherItem *item, *(this->getList<LauncherItem>())) {
+    foreach (LauncherItem *item, *currentLauncherList) {
         if (!item->filePath().startsWith(changedPath))
             continue;
 
@@ -63,13 +64,14 @@
 
     // Finding newly added desktop entries
     foreach (const QFileInfo &fileInfo, fileInfoList) {
-        if (this->getList<LauncherItem>()->end() == std::find_if(
-            this->getList<LauncherItem>()->begin(),
-            this->getList<LauncherItem>()->end(),
+        // Skip files which are not desktop entries
+        if (!fileInfo.fileName().endsWith(".desktop"))
+            continue;
+
+        if (currentLauncherList->end() == std::find_if(
+            currentLauncherList->begin(),
+            currentLauncherList->end(),
             [fileInfo](LauncherItem* item) -> bool { return item->filePath() 
== fileInfo.fileName(); })) {
-            // Skip files which are not desktop entries
-            if (!fileInfo.fileName().endsWith(".desktop"))
-                continue;
 
             LAUNCHER_DEBUG("Creating LauncherItem for desktop entry" << 
fileInfo.absoluteFilePath());
             LauncherItem *item = new LauncherItem(fileInfo.absoluteFilePath(), 
this);
--- src/components/switcherpixmapitem.cpp
+++ src/components/switcherpixmapitem.cpp
@@ -55,6 +55,7 @@
         , xWindowPixmap(0)
         , xWindowPixmapDamage(0)
         , windowId(0)
+        , radius(0)
     {}
 
     bool xWindowPixmapIsValid;
@@ -62,6 +63,7 @@
     Damage xWindowPixmapDamage;
     QPixmap qWindowPixmap;
     WId windowId;
+    int radius;
 };
 
 SwitcherPixmapItem::SwitcherPixmapItem(QDeclarativeItem *parent)
@@ -192,6 +194,19 @@
     return d->windowId;
 }
 
+void SwitcherPixmapItem::setRadius(int radius)
+{
+    d->radius = radius;
+    emit radiusChanged();
+
+    update();
+}
+
+int SwitcherPixmapItem::radius() const
+{
+    return d->radius;
+}
+
 void SwitcherPixmapItem::paint(QPainter *painter, const 
QStyleOptionGraphicsItem *option,
                                QWidget *widget)
 {
@@ -202,11 +217,31 @@
         updateXWindowPixmap();
     }
 
+    QPen oldPen = painter->pen();
+    QBrush oldBrush = painter->brush();
+    QPainter::RenderHints oldHints = painter->renderHints();
+    if (smooth())
+        painter->setRenderHint(QPainter::SmoothPixmapTransform);
+
     QT_TRY {
-        painter->drawPixmap(QRect(0, 0, width(), height()), d->qWindowPixmap);
+        QBrush brush(d->qWindowPixmap);
+
+        // TODO: take clipping of statusbar (if any) into account here
+        qreal xScale = width() / d->qWindowPixmap.width();
+        qreal yScale = height() / d->qWindowPixmap.height();
+        brush.setTransform(QTransform().scale(xScale, yScale));
+
+        painter->setPen(Qt::NoPen);
+        painter->setBrush(brush);
+        painter->drawRoundedRect(QRect(0, 0, width(), height()), d->radius, 
d->radius);
     } QT_CATCH (std::bad_alloc e) {
         // XGetImage failed, the window has been already unmapped
     }
+
+    if (smooth())
+        painter->setRenderHints(oldHints);
+    painter->setPen(oldPen);
+    painter->setBrush(oldBrush);
 }
 
 bool SwitcherPixmapItem::handleXEvent(const XEvent &event)
--- src/components/switcherpixmapitem.h
+++ src/components/switcherpixmapitem.h
@@ -28,7 +28,6 @@
 {
     Q_OBJECT
     Q_DISABLE_COPY(SwitcherPixmapItem)
-    Q_PROPERTY(int windowId READ windowId WRITE setWindowId)
 
     struct Private;
     Private * const d;
@@ -41,10 +40,24 @@
     explicit SwitcherPixmapItem(QDeclarativeItem *parent = 0);
     virtual ~SwitcherPixmapItem();
 
+    /*! The window ID to draw pixmaps for.
+     */
+    Q_PROPERTY(int windowId READ windowId WRITE setWindowId)
     int windowId() const;
     void setWindowId(int windowId);
+
+    /*! Setting a radius draws the pixmap item with a rounded corner.
+     * Essentially, this has the same effect as Rectangle::radius.
+     */
+    Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged)
+    int radius() const;
+    void setRadius(int radius);
+
     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
 
+signals:
+    void radiusChanged();
+
 private slots:
     void damageEvent(Qt::HANDLE &damage, short &x, short &y, unsigned short 
&width, unsigned short &height);
     void toggleDamage();

++++++ lipstick.yaml
--- lipstick.yaml
+++ lipstick.yaml
@@ -1,6 +1,6 @@
 Name: lipstick
 Summary: QML toolkit for homescreen creation
-Version: 0.4.0
+Version: 0.4.1
 Release: 1
 Group: System/Libraries
 License: LGPLv2.1



Reply via email to