Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

visualization/ScheduleWin.h

Go to the documentation of this file.
00001 /* #start# ***********************************************************
00002 
00003                              Scheduling Simulator
00004                     Lehrstuhl f"ur Effiziente Algorithmen
00005                        Technische Universit"at M"unchen
00006 
00007  File    : $Id: ScheduleWin.h,v 1.8 2003/01/24 10:05:09 hall Exp $
00008 
00009  Purpose : This is the main window of the application. It contains the 
00010            tasksystem and creates the different views. It is responsible
00011      for opening/closing the different views, navigating through
00012      the tasksystem (start/stop/reset the simulation). The logger
00013      and the algorithm for the tasksystem is set in this class. You
00014      can load a tasksystem from file or create a new tasksystem with
00015      the generator.
00016 
00017  RCS-Log:
00018  $Log: ScheduleWin.h,v $
00019  Revision 1.8  2003/01/24 10:05:09  hall
00020  brdCast stuff
00021 
00022  Revision 1.7  2003/01/09 17:10:58  taeubig
00023  replaced leda_string by string or QString
00024 
00025  Revision 1.6  2003/01/08 18:57:15  meierb
00026  added randomized release times
00027 
00028  Revision 1.4  2002/12/22 22:10:14  meierb
00029  *** empty log message ***
00030 
00031  Revision 1.3  2002/12/20 14:57:15  meierb
00032  *** empty log message ***
00033 
00034  Revision 1.2  2002/12/19 22:29:27  meierb
00035  *** empty log message ***
00036 
00037  Revision 1.1.1.1  2002/12/02 22:26:19  meierb
00038  my_schedule
00039 
00040  Revision 1.4  2002/11/11 16:19:36  taeubig
00041  changes in header inclusion
00042 
00043  Revision 1.3  2002/11/07 12:05:23  taeubig
00044  Added standard namespace (std::)
00045 
00046  Revision 1.2  2002/09/17 07:30:25  woerster
00047  add a menu to open recently opened files
00048 
00049  Revision 1.1  2002/08/29 12:59:59  taeubig
00050  Added the sources
00051 
00052  Revision 1.40  2001/07/17 12:26:29  taeubig
00053  LeaBib/Bib changes
00054 
00055  Revision 1.39  2001/05/16 13:20:04  taeubig
00056  QT headers are included last because of "slots" conflict
00057 
00058  Revision 1.38  2000/08/26 02:12:17  taeubig
00059  Changes for LeaBibWin
00060 
00061  Revision 1.37  2000/08/25 09:54:19  schickin
00062  added LCD Frame and new Layout-algorithm
00063 
00064  Revision 1.36  2000/08/20 23:10:50  taeubig
00065  Added Hybrid GA
00066 
00067  Revision 1.35  2000/07/27 03:44:36  taeubig
00068  Added Permutation Genetic Algorithm for Open Shop Problems
00069 
00070  Revision 1.34  2000/07/11 01:40:55  taeubig
00071  Added REJECT-TOTAL-PENALTY (RTP) algorithm
00072  for Scheduling with Rejection
00073 
00074  Revision 1.33  2000/07/10 09:10:09  mayerh
00075  added button to view algorithm dictionary
00076 
00077  Revision 1.32  2000/07/02 23:26:45  taeubig
00078  Added BALANCED PARALLEL algorithm
00079 
00080  Revision 1.31  2000/06/25 01:16:28  taeubig
00081  Added CLUSTERS algorithm for lines (without dependencies)
00082 
00083  Revision 1.30  2000/06/14 19:02:26  taeubig
00084  Added algorithm runtime comments support and
00085  meshview enable/disable & preferences
00086 
00087  Revision 1.29  2000/06/13 14:02:36  hall
00088  no real changes ...
00089 
00090  Revision 1.28  2000/06/07  11:39:30  taeubig
00091  Updated for new MeshView
00092 
00093  Revision 1.27  2000/05/31 14:56:02  taeubig
00094  Changes for new hypercube algorithm
00095 
00096  Revision 1.26  2000/05/27 01:02:49  taeubig
00097  Removed #undef event
00098 
00099  Revision 1.25  2000/05/24 13:02:58  taeubig
00100  New compiler (gcc-2.95) and new Qt (2.1)
00101  Replaced "list" by "leda_list" etc.
00102 
00103  Revision 1.24  2000/05/15 09:37:36  mayerh
00104  added function getTasksystem
00105 
00106  Revision 1.23  2000/05/08 20:02:33  mayerh
00107  deleted function setClassification()
00108 
00109  Revision 1.22  2000/05/07 22:27:27  taeubig
00110  Minor changes to avoid warnings and make it compile with gcc 2.95.2
00111 
00112  Revision 1.21  2000/04/19 20:10:53  mayerh
00113  added array _matching[]
00114 
00115  Revision 1.20  2000/04/18  00:22:00  taeubig
00116  Considered new algorithms,
00117  improved presentation of set topology environments
00118 
00119  Revision 1.19  2000/04/14 10:04:48  mayerh
00120  added function setClassification()
00121 
00122  Revision 1.18  2000/04/12 22:19:31  mayerh
00123  *** empty log message ***
00124 
00125  Revision 1.17  2000/04/12 20:53:32  mayerh
00126  added some attributes and methods to implement a algorithm-array
00127 
00128  Revision 1.16  2000/01/19 11:30:44  kern
00129  views can be opened at any time now
00130 
00131  Revision 1.15  2000/01/16 18:43:06  kern
00132  java docs
00133 
00134  Revision 1.14  2000/01/13 11:51:28  kern
00135  added sample dialog
00136 
00137  Revision 1.13  2000/01/12 09:27:48  kern
00138  added javadocs
00139 
00140  Revision 1.12  2000/01/05 14:35:25  kern
00141  added schedFilter and editFilter for text logger
00142 
00143  Revision 1.11  2000/01/03 11:26:02  kern
00144  added coffmangraham
00145 
00146  Revision 1.10  1999/12/27 10:11:23  kern
00147  change in logger prefs
00148 
00149  Revision 1.9  1999/12/22 10:50:37  kern
00150  added McNaughton
00151 
00152  Revision 1.8  1999/12/21 10:24:51  kern
00153  moved machine settings from preferences to machineview
00154 
00155  Revision 1.7  1999/12/20 10:45:29  kern
00156  changed logger settings
00157 
00158  Revision 1.6  1999/12/14 09:16:31  kern
00159  added window placement and reactivated loggers
00160 
00161  Revision 1.5  1999/12/10 10:29:55  kern
00162  added machine view
00163 
00164  Revision 1.4  1999/12/06 14:10:49  kern
00165  added gantt view
00166 
00167  Revision 1.3  1999/12/01 09:47:29  kern
00168  added preferences
00169 
00170  Revision 1.2  1999/11/29 11:45:34  kern
00171  added comments
00172 
00173 
00174  * #end# ************************************************************* */   
00175 
00176 #ifndef SCHEDULEWIN_H
00177 #define SCHEDULEWIN_H
00178 
00179 // system header files
00180 #include <string>
00181 #include <typeinfo>
00182 #include <LEDA/list.h>
00183 #include <LEDA/string.h>
00184 
00185 // project header files
00186 #include "../model/STaskSystem.h"
00187 #include "../general/SObserver.h"
00188 #include "../logging/SPlayerLog.h"
00189 #include "../logging/STextLog.h"
00190 #include "../algorithms/SSchedAlgorithm.h"
00191 #include "SDAGViewWin.h"
00192 #include "SMachineViewWin.h"
00193 #include "SGanttViewWin.h"
00194 #include "SPrefDialog.h"
00195 #include "SMeshViewWin.h"
00196 #include "SBibView.h"
00197 
00198 // QT header files
00199 #include <qapplication.h>
00200 #include <qfiledialog.h>
00201 #include <qkeycode.h>
00202 #include <qlabel.h>
00203 #include <qmenubar.h>
00204 #include <qmessagebox.h>
00205 #include <qpopupmenu.h>
00206 #include <qstatusbar.h>
00207 #include <qslider.h>
00208 #include <qstring.h>
00209 #include <qtimer.h>
00210 #include <qtoolbar.h>
00211 #include <qtoolbutton.h>
00212 #include <qtooltip.h>
00213 #include <qwhatsthis.h>
00214 #include <qmultilineedit.h>
00215 #include <qlcdnumber.h>
00216 
00217 
00227 class ScheduleWindow : public QMainWindow, public SObserver
00228 {
00229   Q_OBJECT
00230 
00231 public:
00236   ScheduleWindow();
00238   ~ScheduleWindow();
00239 
00241   void setupActions();  
00243   void setupMenuBar();
00245   void setupToolBar();
00247   void setupStatusBar();
00248 
00249   // functions to update the matching attributes corresponding to a classification-object
00250   void updateMatching(const SClassification &classif);
00251   void updateMatching();
00252   // function to get the number of algorithms in the array
00253   int getNumberOfAlgorithms();
00254   // the actual array
00255   const SSchedAlgorithm* const* getAlgArray() const { return _pAlgorithmArray; };
00256   // returns a LEDA-list that contains the names of all matching algorithms
00257   leda_list<leda_string> getNamesOfAlgorithms();
00258   leda_list<leda_string> getNamesOfIncompatibleAlgorithms();
00259   STaskSystem &getTaskSystem();
00260 signals:
00266   void sload();
00267   
00268 protected:
00274   virtual void showEvent( QShowEvent* );
00279   virtual void hideEvent( QHideEvent* );
00286   virtual void closeEvent( QCloseEvent* );
00293   void update( const class SEvent & );
00294 
00295 private:
00302   void dagViewWin(); 
00309   void ganttViewWin();
00316   void machineViewWin();
00317   void meshViewWin();
00321   void setAlgorithm(); 
00326   void removeLoggers();
00330   void setLogger();
00331 
00337   void toggleTextLabels( bool enable );
00341   void saveWinPos();
00346   void load( const char* filename );
00347   // function to initialize the algorithm array
00348   void initAlgorithmArray();
00353   void addToRecentFiles(string filename);
00356   void updateRecentFileMenu();
00357 
00358   // the list of recently opened files
00359   leda_list<string> _recentFiles;
00360 
00361   // menubar and different menus
00362   QMenuBar   *_pMenuBar;
00363   QPopupMenu *_pFileMenu;
00364   QPopupMenu *_pRecentFileMenu;
00365   QPopupMenu *_pViewMenu;
00366   QPopupMenu *_pNavMenu; 
00367   QPopupMenu *_pOptionMenu;
00368   QPopupMenu *_pHelpMenu;
00369   // if you want to refer to a menu entry later on (after its construction)
00370   // you can do this by using the IDs of the menu entries.
00371   int _viewdag, _viewmachine, _viewmesh, _viewgantt, _viewbib;
00372   int _ftb, _ntb, _sb, _btnsig;
00373   int _navplay, _navstop, _navstep, _navreset; 
00374   // child widgets of the statusbar.
00375   QLabel *_pJobLabel, *_pMachLabel, *_pStatusLabel, *_pSimTimeLabel; 
00376   // toolbar widgets. 
00377   QToolBar    *_pFileToolBar, *_pNavToolBar, *_pTimeToolBar, *_pViewToolBar;
00378   QToolButton *_pFileNewBtn, *_pFileOpenBtn, *_pFileSaveBtn;
00379   QToolButton *_pNavPlayBtn, *_pNavStopBtn, *_pNavStepBtn, *_pNavResetBtn;
00380   QToolButton /* *_pViewDAGBtn, *_pViewMachineBtn, *_pViewMeshBtn,
00381     *_pViewGanttBtn, */ *_pViewBibBtn;
00382 
00383   // The actions --------------------------------------------------------------
00384   QAction *fileNew;
00385   QAction *fileOpen;
00386   QAction *fileSave;
00387   QAction *fileSaveAs;
00388   QAction *fileClose;
00389   QAction *filePrint;
00390   QAction *fileQuit;
00391 
00392   QAction *editCut;
00393   QAction *editCopy;
00394   QAction *editPaste;
00395 
00396   QAction *viewToolBar;
00397   QAction *viewStatusBar;
00398   QAction *viewPrecDAG;
00399   QAction *viewMachines;
00400   QAction *viewMesh;
00401   QAction *viewGantt;
00402   QAction *viewBib;
00403 
00404   QAction *helpAboutApp;
00405   // -------------------------------------------------------------------------
00406     
00407   QLabel      *_pTimeLabel;
00408   QSlider     *_pTimeSlider;
00409   QLCDNumber *_pSimTimeLCD;
00410   // contains the description text of the current algorithm.
00411   QMultiLineEdit *_pAlgDescrEdit;
00412   QMultiLineEdit *_pActionDescr;
00413   // This variable indicates whether the simulation has to be stopped.
00414   // It is set by STaskSystem::doSimStep().
00415   bool _stopIt; 
00416   // delay time between two steps in play mode. 
00417   int _waittime;    
00418   // timer for the play mode.
00419   QTimer *_pNavTimer;
00420   // view for displaying a directed acyclic graph.
00421   SDAGViewWin *_pDAGViewWin;
00424   SMachineViewWin *_pMachineViewWin;
00425   SMeshViewWin *_pMeshViewWin;
00428   SGanttViewWin *_pGanttViewWin;
00434   SPrefDialog *_pPrefDlg;
00437   QString _defaultPath;
00440   SSchedAlgorithm *_pAlgorithm;
00443   STaskSystem _ts; 
00444   // Logger stuff( streams, filenames, pointer ).
00445   STextLog *_pTextLogger;
00446   std::ofstream _textLogStream;
00447   string _textLogFilename;
00448   int _textLogSchedFilter, _textLogEditFilter;
00449   SPlayerLog *_pPlayerLogger;
00450   std::ofstream _playerLogStream;
00451   string _playerLogFilename;
00452   //number of algorithms
00453   int _numberOfAlgorithms;
00454   //array which contains all algorithm-objects
00455   SSchedAlgorithm** _pAlgorithmArray;
00456   bool* _matchingArray;
00457   SBibView *_pBibView;
00458 private slots:
00462   void about();
00466   void aboutQt();
00470   void preferences();
00476   void prefClosed();
00481   void restoreWinPos();
00486   void toggleBtnSignatures();
00490   void toggleStatusBar();
00494   void toggleFileToolBar(); 
00498   void toggleNavToolBar(); 
00503   void toggleDAGViewWin(bool on); 
00508   void toggleMachineViewWin(bool on); 
00513   void toggleMeshViewWin(bool on);
00518   void toggleGanttViewWin(bool on);
00519   void toggleBibWin();
00525   void play();
00530   void stop();
00536   void reset(); 
00541   void step();
00545   void setTimer();
00549   void setTimeLabel( int );
00553   void newTaskSystem();
00557   void load();
00561   void save();
00567   void showBibEntry();
00570   void loadRecentFile(int index);
00571 };
00572 
00573 #endif

Generated on Thu May 22 16:48:09 2003 for Sketch-it! by doxygen1.2.18