00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <QStringList>
00021
00022 #include "TimeSlotItem.h"
00023 #include <QPushButton>
00024
00025 TimeSlotItem::TimeSlotItem(TimeSlot * TSlotObj, RootItem *parent, int cc)
00026 :RootItem(parent, cc)
00027 {
00028 RTTI = TIME_SLOT_ITEM;
00029 itemData = TSlotObj;
00030 setColumnOrder(1, COL_WIDGET);
00031 GUIPref * pref = GUIPref::Instance();
00032 setTextColour(1
00033 ,pref->getColour(GUIPref::CT_TIMESLOT_TEXT,0));
00034 setBGColour(1
00035 ,pref->getColour(GUIPref::CT_TIMESLOT_BG,0));
00036 }
00037
00038 QVariant TimeSlotItem::data(int column) const
00039 {
00040
00041 int id;
00042 if (itemData == 0)
00043 id = -1;
00044 else
00045 id = getID();
00046 if (column >= columnCount())
00047 return "Too many columns" + QString::number(column);
00048 switch ((Columns)(col_order[column]))
00049 {
00050 case COL_WIDGET:
00051 return id;
00052 case COL_INSTITUTE:
00053 return getInstName();
00054 case COL_DOW:
00055 case COL_START_TIME:
00056 case COL_FINISH_TIME:
00057 case COL_DURATION:
00058 return "Unsupported type";
00059 }
00060 return "Unknown column";
00061 }
00062
00063 bool TimeSlotItem::setData(int column, const QVariant & value)
00064 {
00065 if (column >= columnCount())
00066 return false;
00067 switch ((Columns)(col_order[column]))
00068 {
00069 case COL_WIDGET:
00070 case COL_INSTITUTE:
00071 case COL_DOW:
00072 case COL_START_TIME:
00073 case COL_FINISH_TIME:
00074 case COL_DURATION:
00075 return false;
00076 }
00077 }