added GrayScale versions (inactive/OFF) of the icons
authorpavelpa <pavelpa@localhost>
Mon, 18 Jan 2010 13:49:08 +0000 (13:49 +0000)
committerpavelpa <pavelpa@localhost>
Mon, 18 Jan 2010 13:49:08 +0000 (13:49 +0000)
src/icons/alarm-off.png
src/icons/favourite-off.png
src/mvc/delegate.cpp
src/mvc/delegate.h

index acb7b5c..854661b 100644 (file)
Binary files a/src/icons/alarm-off.png and b/src/icons/alarm-off.png differ
index 1b42daf..c10db21 100644 (file)
Binary files a/src/icons/favourite-off.png and b/src/icons/favourite-off.png differ
index f8fac79..507fae4 100644 (file)
@@ -207,30 +207,40 @@ Delegate::ControlId Delegate::whichControlClicked(const QModelIndex &aIndex, con
 void Delegate::defineControls()
 {
     Control *control;
+    QPoint p(0,0);
     // FAVOURITE ICONs
     // on
     control = new Control(FavouriteControlOn,QString(":icons/favourite-on.png"));
-    control->setDrawPoint(QPoint(-control->image()->width()-SPACER,SPACER));
+    p = QPoint(0,0);
+    p.setX(p.x()-control->image()->width()-SPACER);
+    control->setDrawPoint(p);
     mControls.insert(FavouriteControlOn,control);
     // off
     control = new Control(FavouriteControlOff,QString(":icons/favourite-off.png"));
-    control->setDrawPoint(QPoint(-control->image()->width()-SPACER,SPACER));
+    p = QPoint(0,0);
+    p.setX(p.x()-control->image()->width()-SPACER);
+    control->setDrawPoint(p);
     mControls.insert(FavouriteControlOff,control);
 
     // ALARM ICONs
     // on
-    control = new Control(AlarmControlOn,QString(":icons/alarm-on.png"));
-    control->setDrawPoint(QPoint(-mControls[FavouriteControlOn]->image()->width()-control->image()->width()-2*SPACER,SPACER));
+    control = new Control(AlarmControlOn,QString(":icons/alarm-off.png"));
+    p = mControls[FavouriteControlOn]->drawPoint();
+    p.setX(p.x()-control->image()->width()-SPACER);
+    control->setDrawPoint(p);
     mControls.insert(AlarmControlOn,control);
     // off
     control = new Control(AlarmControlOff,QString(":icons/alarm-off.png"));
-    control->setDrawPoint(QPoint(-mControls[FavouriteControlOff]->image()->width()-control->image()->width()-2*SPACER,SPACER));
+    p = mControls[FavouriteControlOff]->drawPoint();
+    p.setX(p.x()-control->image()->width()-SPACER);
+    control->setDrawPoint(p);
     mControls.insert(AlarmControlOff,control);
 
     // MAP ICON
     control = new Control(MapControl,QString(":icons/compass.png"));
-    control->setDrawPoint(QPoint(-mControls[AlarmControlOn]->image()->width()-control->image()->width()
-                                 -mControls[FavouriteControlOn]->image()->width()-3*SPACER,SPACER));
+    p = mControls[AlarmControlOn]->drawPoint();
+    p.setX(p.x()-control->image()->width()-SPACER);
+    control->setDrawPoint(p);
     mControls.insert(MapControl,control);
 }
 
index 63c74dc..5d7adac 100644 (file)
@@ -31,9 +31,12 @@ class Delegate : public QItemDelegate
                 { }
                 inline QImage *image() const { return mImage; }
                 inline void setDrawPoint(const QPoint &aPoint) { mDrawPoint = aPoint; }
-                inline QPoint drawPoint(const QRect &aRect) const // for painter to draw Control
+                inline QPoint drawPoint(const QRect &aRect = QRect()) const // for painter to draw Control
                 {
-                    return QPoint(aRect.x()+aRect.width(),aRect.y()) + mDrawPoint;
+                    if(aRect == QRect()) // null rectangle
+                        return mDrawPoint; // returns relative drawing point
+                    else
+                        return QPoint(aRect.x()+aRect.width(),aRect.y()) + mDrawPoint; // returns absolute drawing point
                 }
                 inline QRect drawRect(const QRect &aRect) const // helper for determining if Control was clicked
                 {