00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __MODULE_ITEM_H
00021 #define __MODULE_ITEM_H
00022
00023
00024 #include "RootItem.h"
00025 #include "Module.h"
00026
00027 class ModuleItem : public RootItem
00028 {
00029 public:
00030 enum Columns {COL_NAME =0, COL_NOMENCLATURE, COL_SEMESTER, COL_WEEKS
00031 ,COL_HOURS, COL_INSTITUTE, COL_PROGRAMME};
00032 public:
00033 ModuleItem(Module * ModuleObj, RootItem *parent = 0, int cc =0);
00034 ModuleItem(ModuleItem & mi);
00035 ~ModuleItem(){};
00036
00037 inline virtual Module * getItemData()const {return static_cast<Module * >(itemData);}
00038 inline Institute * getInstitute() {return getItemData()->getInst();}
00039 inline Programme * getProgramme() {return getItemData()->getProg();}
00040 inline Module * getModule() {return getItemData();}
00041 inline QString getDescription()const {return itemData->getDescription();}
00042 inline QString getInstName()const {return getItemData()->getInstName();}
00043 inline QString getProgName()const {return getItemData()->getName();}
00044 inline QString getModuName()const {return getItemData()->getName();}
00045 inline QString getModuNomenclature()const {return getItemData()->getNomenclature();}
00046 inline int getModuDuration()const {return getItemData()->getDuration();}
00047 inline int getModuWeeklyPeriods()const {return getItemData()->getWeeklyPeriods();}
00048 inline int getModuSemester()const {return getItemData()->getSemester();}
00049 QVariant data(int column) const;
00050
00051 inline bool setModuName(QString name){return getItemData()->setName(name);}
00052 inline bool setModuNomencatlure(QString n) {return getItemData()->setNomenclature(n);}
00053 inline bool setModuDuration(int duration) {return getItemData()->setDuration(duration);}
00054 inline bool setModuWeeklyPeriods(int p) {return getItemData()->setWeeklyPeriods(p);}
00055 inline bool setModuSemester(int s) {return getItemData()->setSemester(s);}
00056 bool setData(int column, const QVariant & value);
00057
00058 inline virtual QColor textColour(){return txtColour[(getModuSemester()-1)/2];}
00059 inline virtual QColor bgColour() {return backgroundColour[(getModuSemester()-1)/2];}
00060
00061 inline void dbSave();
00062 inline void dbDelete();
00063 };
00064
00065 inline void ModuleItem::dbSave()
00066 {
00067 getItemData()->save(Module::insertSQL, Module::updateSQL, Module::errorSQL);
00068 }
00069
00070 inline void ModuleItem::dbDelete()
00071 {
00072 getItemData()->remove(Module::deleteSQL, Module::errorSQL);
00073 }
00074
00075 #endif