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 PROGRAMME_DLG_H 00022 #define PROGRAMME_DLG_H 00023 00024 #include <QtGui> 00025 00026 //#include "ui_Programme_dlg.h" 00027 00028 #include "Name_Abbrev_Root_dlg.h" 00029 #include "Name_Root_dlg.h" 00030 00031 #include "InstItem.h" 00032 #include "ProgItem.h" 00033 00034 class ProgrammeDlg : public NameRootDlg 00035 , public NameAbbrevRootDlg 00036 { 00037 Q_OBJECT 00038 00039 public: // Methods 00040 ProgrammeDlg(int btnAction, RootItem * programme, RootItem * institute, QMainWindow *parent = 0); 00041 00042 inline bool setProgramme (RootItem * programme); 00043 inline ProgItem * getProgItem(){return dynamic_cast<ProgItem*>(dataItem);} 00044 inline void setInstitute (InstItem * inst) {parentItem = inst;} 00045 inline InstItem * getInstItem(){return dynamic_cast<InstItem*>(parentItem);} 00046 00047 inline QString getInstName (); 00048 inline void setInstName (QString instName) {n_wdgt->setName(instName);} 00049 inline QString getNameOnDB(); 00050 inline QString getAbbrevOnDB(); 00051 00052 private: // Properties 00053 // InstItem * instItem; 00054 // ProgItem * progItem; 00055 00056 private: // Methods 00057 void createActions(); 00058 void initialise (int btnAction); 00059 00060 private slots: 00061 void enableBtn(); 00062 void okPressed(); 00063 }; 00064 00065 inline bool ProgrammeDlg::setProgramme (RootItem * data) 00066 { 00067 if (data != 0) 00068 if (data->rtti() == RootItem::PROG_ITEM) 00069 { 00070 dataItem = data; 00071 return true; 00072 } 00073 return false; 00074 } 00075 00076 inline QString ProgrammeDlg::getInstName () 00077 { 00078 if (getInstItem() != 0) 00079 return getInstItem()->getInstName(); 00080 else 00081 return QString(); 00082 } 00083 00084 inline QString ProgrammeDlg::getNameOnDB() 00085 { 00086 if (dataItem == 0) 00087 return ""; 00088 else 00089 return getProgItem()->getProgName(); 00090 } 00091 00092 inline QString ProgrammeDlg::getAbbrevOnDB() 00093 { 00094 if (dataItem == 0) 00095 return ""; 00096 else 00097 return getProgItem()->getProgAbbrev(); 00098 } 00099 00100 #endif