qrailway 0.9

cMainWindow.h

gehe zur Dokumentation dieser Datei
00001 #ifndef CMAINWINDOW_H
00002 #define CMAINWINDOW_H
00003 
00004 #include "cConstants.h"
00005 #include "ui_qrailwayMainWindow.h"
00006 #include <qmainwindow.h>
00007 #include <qtabwidget.h>
00008 #include <qsplitter.h>
00009 #include <qtextedit.h>
00010 #include <qmessagebox.h>
00011 #include <qsqlquery.h>
00012 #include <qcursor.h>
00013 #include <qtoolbar.h>
00014 #include <qtoolbutton.h>
00015 #include <QMouseEvent>
00016 #include <QTimerEvent>
00017 #include <math.h>
00018 #include <QProcess>
00019 #include <QSettings>
00020 #include <QGraphicsScene>
00021 #include <QGraphicsView>
00022 #include "cSektion.h"
00023 #include "cKonnektor.h"
00024 #include "cIntelligenz.h"
00025 
00026 class cFensterLokWizard;
00027 class cFensterLokSteuerung;
00028 class cFensterSektion;
00029 class cFensterCheckHardware;
00030 class cFensterBahnhof1;
00031 class cFensterBahnhof2;
00032 
00034 
00035 class cAnlage : public QGraphicsView
00036 {
00037  Q_OBJECT
00038 public:
00040   cAnlage(cIntelligenz * Intelligenz, QGraphicsScene * canvas, QWidget * parent=0);
00042  void cDebug(int prioritaet,const QString & meldung);
00044  void setEditModus(bool editmodustmp) { editmodus=editmodustmp; };
00046  bool getEditModus(void) { return(editmodus); };
00048  void setClearModus(bool clearmodustmp) { clearmodus=clearmodustmp; };
00050  bool getClearModus(void) { return(clearmodus); };
00051 protected:
00053   void mousePressEvent( QMouseEvent* e );
00055   void mouseReleaseEvent( QMouseEvent* e );
00057   void mouseMoveEvent( QMouseEvent* e ); 
00059   void mouseDoubleClickEvent( QMouseEvent* e );
00061   void timerEvent( QTimerEvent *e );
00062 
00063 signals:
00065   void SignalMouseAktion(int,Qt::ButtonState);
00067   void SignalKonnektorMoved(int,double,double);
00069   void SignalNeuerKonnektor(int,double,double);
00071   void SignalKonnektorLoeschen(int);
00073   void SignalKonnektorMovedFinished(int);
00075   void message(const QString &);  
00077   void barmessage(const QString &,int);  
00078 
00079 private:
00081   bool editmodus;
00083   bool clearmodus;
00085   int nr;
00087   QPointF altpos;
00089   int timernummer;
00091   int tmp;
00093   bool bewegen;
00095   bool streckefestlegen;
00097   cIntelligenz *Intelligenz;
00099   int *laufplanung;
00101   int laufplanunganz;
00103   int laufplanungzug;
00104 };
00105 
00107 
00113 class cMainWindow : public QMainWindow, public Ui::qrailwayMainWindow
00114 {
00115     Q_OBJECT
00116 
00117 protected:
00119     void closeEvent(QCloseEvent *event);
00120 
00121 public:
00123     cMainWindow(QString* commandline=0,QSplashScreen* splash=0,QApplication* app=0,QWidget* parent=0,const char* name=0,Qt::WFlags fl=0);
00125     ~cMainWindow();
00127     void cDebug(int prioritaet,const QString & meldung);
00129     QAction *bInsert;
00131       QAction *bClear;
00133       QAction *bNotaus;
00135       QAction *bLicht1;
00137       QAction *bLicht2;
00139       QAction *bLicht3;
00141       QAction *bShowInfo;
00143       QAction *bAutomatik;
00145       QAction *bHardware;
00147       QAction *bHbf;
00149       QAction *bSbf;
00151       QAction *bFensterLokWizard;
00153       QAction *bFensterLokRemove;
00155     QAction *bFensterLok;
00157     QAction *bMultiplier;
00159     int multiplier;
00160 
00161 signals:
00163   void barmessage(const QString &,int); 
00165   void SignalUpdateLokSteuerung(int);
00166 
00167 public slots:
00169     void SlotLicht1(void);
00171     void SlotLicht2(void); 
00173     void SlotLicht3(void);
00175     void SlotMultiplier(void);
00177     void SlotFensterLok(int trainid);
00178     //    void SlotFensterLokOhne(void) { SlotFensterLok(0); };
00180     void SlotFensterHardware(void);
00182     void SlotStatusReport(const QString & report);
00184     void SlotStatusBar(const QString & report,int zeit);
00186     void SlotMouseAktion(int sigg,Qt::ButtonState b);
00188     void SlotKonnektorMoved(int sigg,double x,double y);
00190     void SlotKonnektorMovedFinished(int sigg);
00192     void SlotWeicheLinks(int welche);
00194     void SlotWeicheRechts(int welche);
00196     void SlotInsertModus(void);
00198     void SlotClearModus(void);
00200     void SlotNotaus(void);
00202     void SlotShowInfo(void);
00204     void SlotBackupLogs(void);
00206     void SlotBackupSql(void);
00208     void SlotRemoveLogs(void);
00210     void SlotNeuerKonnektor(int secid,double xx,double yy);
00212     void SlotKonnektorLoeschen(int conid);
00214     void SlotUpdateLokSteuerung(int trainid) { emit SignalUpdateLokSteuerung(trainid); };
00216     void SlotLokWizardClosed();
00218     void SlotLokRemove();
00220     void SlotLokWizard();
00222     void SlotLokEinstellung(void);
00224     void SlotSektionClosed();
00226     void SlotLokClosed(int i);
00228     void SlotHardwareClosed();
00230     void SlotCanvasUpdate(void);
00232     void SlotFensterSchattenbahnhof(void);
00234     void SlotFensterHauptbahnhof(void);
00236     void SlotFensterSchattenbahnhofClosed(void);
00238     void SlotFensterHauptbahnhofClosed(void);
00240     void SlotLokEinstellungClosed(void);
00242     void SlotAlarm(int alarmtype);
00244     void SlotAutomatik(void);
00245  
00246 private:
00248     int letztesmalentfernen;
00250     QString alarmcommand_loksteht;
00252     QString alarmcommand_kurzschluss;
00254     QTabWidget *tabWidget;
00256     QSplitter *splitterWidget;
00258     QTextEdit *status;
00260     QGraphicsScene *canvas;
00262     cAnlage *anlage;
00264     QToolBar *Toolbar;
00266     double gridsize;
00268     cFensterSektion *FensterSektion;
00270     cFensterLokSteuerung *FensterLok[maxFensterLokSteuerung];
00272     cFensterLok *FensterLokEinstellung;
00274     cFensterBahnhof1 *FensterSchattenbahnhof;
00276     cFensterBahnhof2 *FensterHauptbahnhof;
00278     cFensterCheckHardware *FensterHardware;
00280     cFensterLokWizard *FensterLokWizard;
00282     cIntelligenz *Intelligenz;
00284     bool editmodus;
00285 };
00286 
00287 #endif // CMAINWINDOW_H   
00288 
00289 #include "cFensterLokSteuerung.h"
00290 #include "cFensterLokWizard.h"
00291 #include "cFensterSektion.h"
00292 #include "cFensterCheckHardware.h"
00293 #include "cFensterBahnhof1.h"
00294 #include "cFensterBahnhof2.h"