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

Staff_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 __STAFF_DLG_H
00022 #define __STAFF_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 "DeptItem.h"
00031 #include "StaffItem.h"
00032 
00033 class StaffDlg : public RootDlg
00034 {
00035     Q_OBJECT
00036 
00037 public: // Methods
00038         StaffDlg(int btnAction, RootItem * dept, RootItem * faculty, QMainWindow *parent = 0);
00039         
00040         inline bool setStaff (RootItem * staff);
00041         inline StaffItem * getStaffItem(){return static_cast<StaffItem *>(dataItem);}
00042         inline DeptItem * getDeptItem(){return static_cast<DeptItem *>(parentItem);}
00043         
00044         inline QString getInstName ();
00045         inline void setInstName (QString instName) {in_wdgt->setName(instName);}
00046         inline QString getFacName ();
00047         inline void setFacName (QString facName) {fn_wdgt->setName(facName);}
00048 
00049         inline void setDeptName (QString deptName) {dn_wdgt->setName(deptName);}
00050         inline QString getDeptName ();
00051         
00052         inline QString getFName () {return sna_wdgt->getName();}
00053         inline void setFName (QString name) {sna_wdgt->setName(name);}
00054         inline QString getLName () {return sna_wdgt->getAbbrev();}
00055         inline void setLName (QString name) {sna_wdgt->setAbbrev(name);}
00056         
00057         inline QString getFNameOnDB();
00058         inline QString getLNameOnDB();
00059 
00060 private: // Properties
00061         NameWidget       * in_wdgt;     // Institute Name Widget
00062         NameWidget       * fn_wdgt;     // Faculty Name Widget
00063         NameWidget       * dn_wdgt;     // Department Name Widget
00064         NameAbbrevWidget * sna_wdgt;    // Staff First Name & Lsat Name Widget
00065 
00066 //      DeptItem * deptItem;
00067 //      StaffItem * staffItem;
00068         
00069 private: // Methods
00070         void createWidgets();
00071         void createActions();
00072         void initialise (int btnAction);
00073 
00074 private slots:
00075         void enableBtn();
00076         void okPressed();
00077 };
00078 
00079 inline bool StaffDlg::setStaff (RootItem * staff)
00080 {
00081         if (staff != 0)
00082                 if (staff->rtti() == RootItem::STAFF_ITEM)
00083                 {
00084                         dataItem = dynamic_cast<StaffItem*>(staff);
00085                         return true;
00086                 }
00087         return false;
00088 }
00089 
00090 inline QString StaffDlg::getInstName ()
00091 {
00092         if (getDeptItem() != 0) 
00093                 return getDeptItem()->getInstName();
00094         else
00095                 return QString();
00096 }
00097 
00098 inline QString StaffDlg::getFacName ()
00099 {
00100         if (getDeptItem() != 0) 
00101                 return getDeptItem()->getFacName();
00102         else
00103                 return QString();
00104 }
00105 
00106 inline QString StaffDlg::getDeptName ()
00107 {
00108         if (getDeptItem() != 0) 
00109                 return getDeptItem()->getDeptName();
00110         else
00111                 return QString();
00112 }
00113 
00114 inline QString StaffDlg::getFNameOnDB()
00115 {
00116         if (getStaffItem() == 0)
00117                 return "";
00118         else
00119                 return getStaffItem()->getStaffFName();
00120 }
00121 
00122 inline QString StaffDlg::getLNameOnDB()
00123 {
00124         if (getStaffItem() == 0)
00125                 return "";
00126         else
00127                 return getStaffItem()->getStaffLName();
00128 }
00129 
00130 #endif

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