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 "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 }