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

ModuItem.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 "ModuItem.h"
00023 
00024 ModuleItem::ModuleItem(Module * ModuObj, RootItem *parent, int cc)
00025 :RootItem(parent, cc)
00026 {
00027         RTTI = MODULE_ITEM;
00028         itemData = ModuObj;
00029         setColumnOrder(4, COL_NAME, COL_NOMENCLATURE, COL_WEEKS, COL_HOURS);
00030         setTextColour(4
00031                      ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_TEXT,0)
00032                      ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_TEXT,1)
00033                      ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_TEXT,2)
00034                      ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_TEXT,3));
00035         setBGColour(4
00036                    ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_BG,0)
00037                    ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_BG,1)
00038                    ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_BG,2)
00039                    ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_BG,3));
00040 }
00041 
00042 ModuleItem::ModuleItem(ModuleItem & mi)
00043 :RootItem(mi)
00044 {
00045         setColumnOrder(4, COL_NAME, COL_NOMENCLATURE, COL_WEEKS, COL_HOURS);
00046         setTextColour(4
00047                      ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_TEXT,0)
00048                      ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_TEXT,1)
00049                      ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_TEXT,2)
00050                      ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_TEXT,3));
00051         setBGColour(4
00052                    ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_BG,0)
00053                    ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_BG,1)
00054                    ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_BG,2)
00055                    ,GUIPref::Instance()->getColour(GUIPref::CT_MODULE_BG,3));
00056 }
00057 
00058 QVariant ModuleItem::data(int column) const
00059 {
00060         if (column >= columnCount())
00061                 return "";
00062         switch (Columns(col_order[column]))
00063         {
00064                 case COL_NAME:
00065                         return getModuName();
00066                 case COL_NOMENCLATURE:
00067                         return getModuNomenclature();
00068                 case COL_SEMESTER:
00069                         return getModuSemester();
00070                 case COL_WEEKS:
00071                         return getModuDuration();
00072                 case COL_HOURS:
00073                         return getModuWeeklyPeriods();
00074                 case COL_INSTITUTE:
00075                         return getInstName();
00076                 case COL_PROGRAMME:
00077                         return getProgName();
00078         }
00079         return "";
00080 }
00081 
00082 bool ModuleItem::setData(int column, const QVariant & value)
00083 {
00084         switch (Columns(col_order[column]))
00085         {
00086                 case COL_NAME:
00087                         return setModuName(value.toString());
00088                 case COL_NOMENCLATURE:
00089                         return setModuNomencatlure(value.toString());
00090                 case COL_SEMESTER:
00091                         return setModuSemester(value.toInt());
00092                 case COL_WEEKS:
00093                         return setModuDuration(value.toInt());
00094                 case COL_HOURS:
00095                         return setModuWeeklyPeriods(value.toInt());
00096                 default:
00097                         return false;
00098         }
00099 }

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