00001 /*************************************************************************** 00002 * Copyright (C) 2006 by Graeme Foster * 00003 * email foster.graeme@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef __MODULE_MODEL_H 00022 #define __MODULE_MODEL_H 00023 00024 #include <QModelIndex> 00025 #include <QVariant> 00026 00027 #include "sql.h" 00028 00029 #include "RootModel.h" 00030 #include "RootItem.h" 00031 #include "ProgItem.h" 00032 #include "ModuItem.h" 00033 00034 class ModuleModel : public RootModel 00035 { 00036 Q_OBJECT 00037 00038 public: // Methods 00039 // Constructor destructor 00040 ModuleModel(dbListManager * dataLists, Programme* prog, bool evenSem, QObject *parent = 0); 00041 ~ModuleModel(){}; 00042 00043 // Inherited from QAbstractItemModel 00044 int columnCount(const QModelIndex &parent) const; 00045 QVariant headerData(int section, Qt::Orientation orientation, 00046 int role = Qt::DisplayRole) const; 00047 inline int findModule(Module * mod){return rootItem->findChildPos(mod->getID());} 00048 void dump(); 00049 private: // Methods 00050 virtual void setupData(dbListManager &dataLists, RootItem * parent); 00051 void setupModData(dbListManager &dataLists, Programme * prog, RootItem * parent,bool evenSem); 00052 }; 00053 00054 inline void ModuleModel::dump() 00055 { 00056 std::cout << "This: " << (void *)this; 00057 getRootItem()->dump(); 00058 std::cout << "\n"; 00059 } 00060 #endif