]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/mvc/delegate.h
Bump copyright years.
[toast/confclerk.git] / src / mvc / delegate.h
index 67ea55ba6e32331ddf3e0c95d372cb1f296369a1..83c591d85eda570b660441791e1d4bd14f8d43c1 100644 (file)
@@ -1,27 +1,31 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
+ * Copyright (C) 2011-2024 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
- * This file is part of fosdem-schedule.
+ * This file is part of ConfClerk.
  *
- * fosdem-schedule is free software: you can redistribute it and/or modify it
+ * ConfClerk is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
  * Software Foundation, either version 2 of the License, or (at your option)
  * any later version.
  *
- * fosdem-schedule is distributed in the hope that it will be useful, but
+ * ConfClerk is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  *
  * You should have received a copy of the GNU General Public License along with
- * fosdem-schedule.  If not, see <http://www.gnu.org/licenses/>.
+ * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
  */
 #ifndef DELEGATE_H
 #define DELEGATE_H
 
-#include <QItemDelegate>
-#include <QTreeView>
-#include <QPointer>
+#include "qglobal.h"
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 class Delegate : public QItemDelegate
 {
@@ -32,11 +36,11 @@ class Delegate : public QItemDelegate
         enum ControlId
         {
             ControlNone = 0,
-            FavouriteControlOn,
-            FavouriteControlOff,
+            FavouriteControlStrong,
+            FavouriteControlWeak,
+            FavouriteControlNo,
             AlarmControlOn,
             AlarmControlOff,
-            MapControl,
             WarningControl
         };
 
@@ -53,6 +57,8 @@ class Delegate : public QItemDelegate
                 }
                 void paint(QPainter* painter, const QRect rect);
 
+                bool enabled() const { return mEnabled; }
+                void setEnabled(bool v) { mEnabled = v; }
             private:
                 inline QPoint drawPoint(const QRect &aRect = QRect()) const // for painter to draw Control
                 {
@@ -65,6 +71,7 @@ class Delegate : public QItemDelegate
                 ControlId mId;
                 QImage *mImage;
                 QPoint mDrawPoint; // relative 'start-drawing' position (may hold negative values)
+                bool mEnabled;
         };
 
         Delegate(QTreeView *aParent); // the delegate 'owner' has to be specified in the constructor - it's used to obtain visualRect of selected item/index
@@ -83,10 +90,10 @@ class Delegate : public QItemDelegate
         void defineControls();
         // TODO: the better place for these methods would be 'eventmodel'
         // they are used in 'paint' method and so it's better to obtain number of
-        // favourities/alarms once when the data has changed and not to call
+        // favourites/alarms once when the data has changed and not to call
         // these methods which iterate over all Events in corresponding group
         // every time it requires them
-        int numberOfFavourities(const QModelIndex &index) const;
+        int numberOfFavourites(const QModelIndex &index) const;
         int numberOfAlarms(const QModelIndex &index) const;
 
     private: