00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 }