Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

TimeSlotItem.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Graeme Foster                                   *
00003  *   email    foster.graeme@gmail.com                                      *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
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         //QPushButton * btn;
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 }

Generated on Thu Apr 6 16:27:17 2006 for time-table by  doxygen 1.4.4