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 "ProgItem.h"
00023 #include "ModuItem.h"
00024
00025 ProgItem::ProgItem(Programme * ProgObj, RootItem *parent, int cc, int sem)
00026 :RootItem(parent, cc)
00027 {
00028 RTTI = PROG_ITEM;
00029 itemData = ProgObj;
00030 semester = sem;
00031 setColumnOrder(2,COL_NAME, COL_ABBREV);
00032 GUIPref * pref = GUIPref::Instance();
00033 setTextColour(2
00034 ,pref->getColour(GUIPref::CT_PROGRAMME_TEXT,0)
00035 ,pref->getColour(GUIPref::CT_PROGRAMME_TEXT,1));
00036 setBGColour(2
00037 ,pref->getColour(GUIPref::CT_PROGRAMME_BG,0)
00038 ,pref->getColour(GUIPref::CT_PROGRAMME_BG,1));
00039 }
00040
00041 ProgItem::ProgItem(ProgItem & pi)
00042 :RootItem(pi)
00043 {
00044 semester = pi.semester;
00045 setColumnOrder(2,COL_NAME, COL_ABBREV);
00046 GUIPref * pref = GUIPref::Instance();
00047 setTextColour(2
00048 ,pref->getColour(GUIPref::CT_PROGRAMME_TEXT,0)
00049 ,pref->getColour(GUIPref::CT_PROGRAMME_TEXT,1));
00050 setBGColour(2
00051 ,pref->getColour(GUIPref::CT_PROGRAMME_BG,0)
00052 ,pref->getColour(GUIPref::CT_PROGRAMME_BG,1));
00053 }
00054
00055 QVariant ProgItem::data(int column) const
00056 {
00057 if (column >= columnCount())
00058 return "";
00059 switch ((Columns)(col_order[column]))
00060 {
00061 case COL_NAME:
00062 return getProgName();
00063 case COL_ABBREV:
00064 return getProgAbbrev();
00065 case COL_SEMESTER:
00066 return "Sem " + QString::number(semester);
00067 case COL_INSTITUTE:
00068 return getInstName();
00069 }
00070 return "";
00071 }
00072
00073 bool ProgItem::setData(int column, const QVariant & value)
00074 {
00075 if (column >= columnCount())
00076 return false;
00077 switch ((Columns)(col_order[column]))
00078 {
00079 case COL_NAME:
00080 return setProgName(value.toString());
00081 case COL_ABBREV:
00082 return setProgAbbrev(value.toString());
00083 default:
00084 return false;
00085 }
00086 }
00087
00088