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 "RoomItem.h"
00023
00024 RoomItem::RoomItem(Room * RoomObj, RootItem *parent, int cc)
00025 :RootItem(parent, cc)
00026 {
00027 RTTI = ROOM_ITEM;
00028 parentItem = parent;
00029 itemData = RoomObj;
00030 setColumnOrder(3, COL_NAME, COL_CODE, COL_CAPACITY);
00031 GUIPref * pref = GUIPref::Instance();
00032 setTextColour(2
00033 ,pref->getColour(GUIPref::CT_ROOM_TEXT,0)
00034 ,pref->getColour(GUIPref::CT_ROOM_TEXT,1));
00035 setBGColour(2
00036 ,pref->getColour(GUIPref::CT_ROOM_BG,0)
00037 ,pref->getColour(GUIPref::CT_ROOM_BG,1));
00038 }
00039
00040 RoomItem::RoomItem(RoomItem & ri)
00041 :RootItem(ri)
00042 {
00043 setColumnOrder(3, COL_NAME, COL_CODE, COL_CAPACITY);
00044 GUIPref * pref = GUIPref::Instance();
00045 setTextColour(2
00046 ,pref->getColour(GUIPref::CT_ROOM_TEXT,0)
00047 ,pref->getColour(GUIPref::CT_ROOM_TEXT,1));
00048 setBGColour(2
00049 ,pref->getColour(GUIPref::CT_ROOM_BG,0)
00050 ,pref->getColour(GUIPref::CT_ROOM_BG,1));
00051 }
00052
00053 QVariant RoomItem::data(int column) const
00054 {
00055 if (column >= columnCount())
00056 return "";
00057 switch (Columns(col_order[column]))
00058 {
00059 case COL_NAME:
00060 return getRoomName();
00061 case COL_CODE:
00062 return getRoomCode();
00063 case COL_CAPACITY:
00064 return getRoomCapacity();
00065 case COL_INSTITUTE:
00066 return getInstName();
00067 }
00068 return "";
00069 }
00070
00071 bool RoomItem::setData(int column, const QVariant & value)
00072 {
00073 if (column >= columnCount())
00074 return false;
00075 switch (Columns(col_order[column]))
00076 {
00077 case COL_NAME:
00078 return setRoomName(value.toString());
00079 case COL_CODE:
00080 return setRoomCode(value.toString());
00081 case COL_CAPACITY:
00082 return setRoomCapacity(value.toInt());
00083 default:
00084 return false;
00085 }
00086 }
00087