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

FacItem.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 "FacItem.h"
00023 #include "DeptItem.h"
00024 
00025 #include "Faculty.h"
00026 #include "Department.h"
00027 
00028 FacItem::FacItem(Faculty * FacObj, RootItem *parent, int cc)
00029 :RootItem(parent, cc)
00030 {
00031         RTTI = FACULTY_ITEM;
00032         itemData = FacObj;
00033         setColumnOrder(2, COL_NAME, COL_ABBREV);
00034         GUIPref * pref = GUIPref::Instance();
00035         setTextColour(2
00036                      ,pref->getColour(GUIPref::CT_FACULTY_TEXT,0)
00037                      ,pref->getColour(GUIPref::CT_FACULTY_TEXT,1));
00038         setBGColour(2
00039                    ,pref->getColour(GUIPref::CT_FACULTY_BG,0)
00040                    ,pref->getColour(GUIPref::CT_FACULTY_BG,1));
00041 }
00042 
00043 FacItem::FacItem(FacItem& fi)
00044 :RootItem(fi)
00045 {
00046         setColumnOrder(2, COL_NAME, COL_ABBREV);
00047         GUIPref * pref = GUIPref::Instance();
00048         setTextColour(2
00049                      ,pref->getColour(GUIPref::CT_FACULTY_TEXT,0)
00050                      ,pref->getColour(GUIPref::CT_FACULTY_TEXT,1));
00051         setBGColour(2
00052                    ,pref->getColour(GUIPref::CT_FACULTY_BG,0)
00053                    ,pref->getColour(GUIPref::CT_FACULTY_BG,1));
00054 }
00055 
00056 QVariant FacItem::data(int column) const
00057 {
00058         if (column >= columnCount())
00059                 return "";
00060         switch ((Columns)(col_order[column]))
00061         {
00062                 case COL_NAME:
00063                         return getFacName();
00064                 case COL_ABBREV:
00065                         return getFacAbbrev();
00066                 case COL_INSTITUTE:
00067                         return getInstName();
00068         }
00069         return "";
00070 }
00071 
00072 bool FacItem::setData(int column, const QVariant & value)
00073 {
00074         if (column >= columnCount())
00075                 return false;
00076         switch ((Columns)(col_order[column]))
00077         {
00078                 case COL_NAME:
00079                         return setFacName(value.toString());
00080                 case COL_ABBREV:
00081                         return setFacAbbrev(value.toString());
00082                 default:
00083                         return false;
00084         }
00085 }

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