Warning icon (uncompleted)
authorfortefr <fortefr@localhost>
Wed, 20 Jan 2010 15:16:10 +0000 (15:16 +0000)
committerfortefr <fortefr@localhost>
Wed, 20 Jan 2010 15:16:10 +0000 (15:16 +0000)
src/icons.qrc
src/icons/exclamation-iconOff.png [new file with mode: 0644]
src/icons/exclamation-iconOn.png [new file with mode: 0644]
src/mvc/delegate.cpp
src/mvc/delegate.h
src/mvc/event.h

index 8bdaf13..110cf5d 100644 (file)
@@ -8,5 +8,7 @@
         <file>icons/compassBig.png</file>
         <file>icons/favourite-offBig.png</file>
         <file>icons/favourite-onBig.png</file>
+        <file>icons/exclamation-iconOn.png</file>
+        <file>icons/exclamation-iconOff.png</file>
     </qresource>
 </RCC>
diff --git a/src/icons/exclamation-iconOff.png b/src/icons/exclamation-iconOff.png
new file mode 100644 (file)
index 0000000..dc56ba8
Binary files /dev/null and b/src/icons/exclamation-iconOff.png differ
diff --git a/src/icons/exclamation-iconOn.png b/src/icons/exclamation-iconOn.png
new file mode 100644 (file)
index 0000000..91065fb
Binary files /dev/null and b/src/icons/exclamation-iconOn.png differ
index 80dcb7b..47bda7c 100644 (file)
@@ -123,6 +123,11 @@ void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option, cons
             painter->drawImage(mControls[AlarmControlOff]->drawPoint(option.rect),*mControls[AlarmControlOff]->image());
         // map
         painter->drawImage(mControls[MapControl]->drawPoint(option.rect),*mControls[MapControl]->image());
+        // Time conflict
+        if(static_cast<Event*>(index.internalPointer())->hasTimeConflict())
+            painter->drawImage(mControls[WarningControlOn]->drawPoint(option.rect),*mControls[WarningControlOn]->image());
+        else
+            painter->drawImage(mControls[WarningControlOff]->drawPoint(option.rect),*mControls[WarningControlOff]->image());
 
         // draw texts
         Event *event = static_cast<Event*>(index.internalPointer());
@@ -337,6 +342,20 @@ void Delegate::defineControls()
     p.setX(p.x()-control->image()->width()-SPACER);
     control->setDrawPoint(p);
     mControls.insert(MapControl,control);
+
+    // WARNING ICONs
+    // on
+    control = new Control(WarningControlOn,QString(":icons/exclamation-iconOn.png"));
+    p = mControls[MapControl]->drawPoint();
+    p.setX(p.x()-control->image()->width()-SPACER);
+    control->setDrawPoint(p);
+    mControls.insert(WarningControlOn,control);
+    // off
+    control = new Control(WarningControlOff,QString(":icons/exclamation-iconOff.png"));
+    p = mControls[MapControl]->drawPoint();
+    p.setX(p.x()-control->image()->width()-SPACER);
+    control->setDrawPoint(p);
+    mControls.insert(WarningControlOff,control);
 }
 
 bool Delegate::isPointFromRect(const QPoint &aPoint, const QRect &aRect) const
index 64fc406..269e35e 100644 (file)
@@ -18,7 +18,9 @@ class Delegate : public QItemDelegate
             FavouriteControlOff,
             AlarmControlOn,
             AlarmControlOff,
-            MapControl
+            MapControl,
+            WarningControlOn,
+            WarningControlOff
         };
 
         class Control
index 97d97a7..8c99f4f 100644 (file)
@@ -40,6 +40,7 @@ public:
     QString language() const { return value("language").toString(); }
     bool isFavourite() const { return value("favourite").toBool(); }
     bool hasAlarm() const { return value("alarm").toBool(); }
+    bool hasTimeConflict() const { return true; /*return value("warning").toBool()*/; } //TODO
     // Table 2 : virtual table for FTS (Full Text Search)
     QString tag() const { return value("tag").toString(); }
     QString title() const { return value("title").toString(); }