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

MLAllocItem.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 "MLAllocItem.h"
00023 
00024 MLAllocItem::MLAllocItem(ModLecAlloc * MLAllocObj, RootItem *parent, int cc)
00025 :RootItem(parent, cc)
00026 {
00027         RTTI = ML_ALLOC_ITEM;
00028         itemData = MLAllocObj;
00029         setColumnOrder(2, COL_MODULE, COL_LECTURER);
00030         GUIPref * pref = GUIPref::Instance();
00031         setTextColour(2
00032                      ,pref->getColour(GUIPref::CT_MOD_LEC_ALLOC_TEXT,0)
00033                      ,pref->getColour(GUIPref::CT_MOD_LEC_ALLOC_TEXT,1));
00034         setBGColour(2
00035                    ,pref->getColour(GUIPref::CT_MOD_LEC_ALLOC_BG,0)
00036                    ,pref->getColour(GUIPref::CT_MOD_LEC_ALLOC_BG,1));
00037 }
00038 
00039 MLAllocItem::MLAllocItem(MLAllocItem & mlai)
00040 :RootItem(mlai)
00041 {
00042         setColumnOrder(2, COL_MODULE, COL_LECTURER);
00043         GUIPref * pref = GUIPref::Instance();
00044         setTextColour(2
00045                      ,pref->getColour(GUIPref::CT_MOD_LEC_ALLOC_TEXT,0)
00046                      ,pref->getColour(GUIPref::CT_MOD_LEC_ALLOC_TEXT,1));
00047         setBGColour(2
00048                    ,pref->getColour(GUIPref::CT_MOD_LEC_ALLOC_BG,0)
00049                    ,pref->getColour(GUIPref::CT_MOD_LEC_ALLOC_BG,1));
00050 }
00051 
00052 QVariant MLAllocItem::data(int column) const
00053 {
00054         if (column >= columnCount())
00055                 return "";
00056         switch (Columns(col_order[column]))
00057         {
00058                 case COL_MODULE:
00059                         return getModuleDesc();
00060                 case COL_LECTURER:
00061                         return getLecturerDesc();
00062                 case COL_HOURS:
00063                         return getHoursDesc()+" hrs";
00064                 case COL_SEMESTER:
00065                         return getSemesterDesc();
00066                 case COL_CLASS_SIZE:
00067                         return getClassSizeDesc();
00068                 case COL_GROUPS:
00069                         return getGroupsDesc();
00070                 case COL_LAB_HOURS:
00071                         return getLabHoursDesc()+" hrs";
00072                 case COL_LAB_GROUPS:
00073                         return getLabGroupsDesc();
00074         }
00075         return "";
00076 }
00077 
00078 Module * MLAllocItem::getModule()
00079 {
00080         Module * mod;
00081         DataClass * dc = getItemData();
00082         ModLecAlloc* mlAlloc = dynamic_cast<ModLecAlloc*>(dc);
00083         mod = mlAlloc->getModule();
00084         return mod;
00085 }

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