Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Department_dlg.h

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 __DEPARTMENT_DLG_H
00022 #define __DEPARTMENT_DLG_H
00023 
00024 #include <QtGui>
00025 #include "Root_dlg.h"
00026 
00027 #include "Name_wdgt.h"
00028 #include "Name_Abbrev_wdgt.h"
00029 
00030 #include "InstItem.h"
00031 #include "FacItem.h"
00032 #include "DeptItem.h"
00033 
00034 class DepartmentDlg : public RootDlg
00035 {
00036     Q_OBJECT
00037 
00038 public: // Methods
00039         DepartmentDlg(int btnAction, RootItem * dept, RootItem * faculty, QMainWindow *parent = 0);
00040         
00041         inline bool setDept (RootItem * dept);
00042         inline DeptItem * getDeptItem(){return static_cast<DeptItem *>(dataItem);}
00043         inline FacItem * getFacItem(){return static_cast<FacItem *>(parentItem);}
00044         
00045         inline QString getInstName ();
00046         inline void setFacName (QString facName) {fn_wdgt->setName(facName);}
00047         inline QString getFacName ();
00048         inline void setInstName (QString instName) {in_wdgt->setName(instName);}
00049         
00050         inline QString getName () {return dna_wdgt->getName();}
00051         inline void setName (QString name) {dna_wdgt->setName(name);}
00052         inline QString getAbbrev () {return dna_wdgt->getAbbrev();}
00053         inline void setAbbrev (QString name) {dna_wdgt->setAbbrev(name);}
00054 
00055         inline QString getNameOnDB();
00056         inline QString getAbbrevOnDB();
00057 
00058 private: // Properties
00059 //      Ui::Department_dlg ui;
00060         NameWidget       * in_wdgt;     // Institute Name Widget
00061         NameWidget       * fn_wdgt;     // Faculty Name Widget
00062         NameAbbrevWidget * dna_wdgt;    // Department Name & Abbreviation Widget
00063         
00064 //      FacItem * facultyItem;
00065 //      DeptItem * deptItem;
00066         
00067 private: // Methods
00068         void createWidgets();
00069         void createActions();
00070         void initialise (int btnAction);
00071 
00072 private slots:
00073         void enableBtn();
00074         void okPressed();
00075 };
00076 
00077 inline bool DepartmentDlg::setDept (RootItem * dept)
00078 {
00079         if (dept != 0)
00080                 if (dept->rtti() == RootItem::DEPT_ITEM)
00081                 {
00082                         dataItem = dynamic_cast<DeptItem*>(dept);
00083                         return true;
00084                 }
00085         return false;
00086 }
00087 
00088 inline QString DepartmentDlg::getInstName ()
00089 {
00090         if (getFacItem() != 0) 
00091                 return getFacItem()->getInstName();
00092         else
00093                 return QString();
00094 }
00095 
00096 inline QString DepartmentDlg::getFacName ()
00097 {
00098         if (getFacItem() != 0) 
00099                 return getFacItem()->getFacName();
00100         else
00101                 return QString();
00102 }
00103 
00104 inline QString DepartmentDlg::getNameOnDB()
00105 {
00106         if (getDeptItem() == 0)
00107                 return "";
00108         else
00109                 return getDeptItem()->getDeptName();
00110 }
00111 
00112 inline QString DepartmentDlg::getAbbrevOnDB()
00113 {
00114         if (getDeptItem() == 0)
00115                 return "";
00116         else
00117                 return getDeptItem()->getDeptAbbrev();
00118 }
00119 
00120 
00121 #endif

Generated on Thu Apr 6 16:27:16 2006 for time-table by  doxygen 1.4.4