2008-10-08 22:11:27 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* Copyright (C) 2008 by Peter Dahlberg *
|
|
|
|
|
* pdahlberg@gmail.com *
|
|
|
|
|
* *
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef LSIM_H
|
|
|
|
|
#define LSIM_H
|
|
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include <QCloseEvent>
|
|
|
|
|
#include <graphicsview.h>
|
|
|
|
|
|
|
|
|
|
//Hauptfenster
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@author Peter Dahlberg <pdahlberg@gmail.com>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class QAction;
|
|
|
|
|
class QMenu;
|
|
|
|
|
class QTextEdit;
|
|
|
|
|
class QDockWidget;
|
|
|
|
|
class SimulScene;
|
|
|
|
|
class QActionGroup;
|
|
|
|
|
|
|
|
|
|
class lsim: public QMainWindow {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2008-11-23 13:45:09 +00:00
|
|
|
enum WindowMode {EditMode,SimulationMode};
|
2008-10-08 22:11:27 +00:00
|
|
|
lsim();
|
|
|
|
|
~lsim();
|
|
|
|
|
|
2008-11-23 13:45:09 +00:00
|
|
|
void setMode ( const WindowMode& theValue );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lsim::WindowMode getMode() const;
|
|
|
|
|
|
|
|
|
|
|
2008-10-08 22:11:27 +00:00
|
|
|
protected:
|
|
|
|
|
void closeEvent (QCloseEvent *event);
|
2008-12-09 22:01:57 +00:00
|
|
|
public slots:
|
|
|
|
|
void goToFullscreen(bool yesno);
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void about();
|
|
|
|
|
void actModeSwitcher(QAction *action);
|
2008-11-23 13:45:09 +00:00
|
|
|
void actWindowModeSwitcher(QAction *action);
|
2008-10-08 22:11:27 +00:00
|
|
|
void setSceneMode(int mode);
|
|
|
|
|
void updateDockFieldWidget();
|
2008-11-15 13:55:29 +00:00
|
|
|
void startCalculation();
|
|
|
|
|
void startTimer();
|
2008-11-16 22:18:15 +00:00
|
|
|
void handleDockLocationChange();
|
2008-11-17 21:54:18 +00:00
|
|
|
void handleUpDownActionChanges();
|
2008-11-23 13:45:09 +00:00
|
|
|
void initWindowMode(WindowMode newMode);
|
2008-12-06 22:54:33 +00:00
|
|
|
void clearAnyFocus();
|
|
|
|
|
void resetAll();
|
2008-10-08 22:11:27 +00:00
|
|
|
|
2008-12-07 22:11:41 +00:00
|
|
|
void timeLineDurationChangeWrapperToSec(int length);
|
|
|
|
|
void timeLineDurationSetWrapperToMsec(double length);
|
|
|
|
|
|
2008-10-08 22:11:27 +00:00
|
|
|
private:
|
|
|
|
|
void createActions();
|
|
|
|
|
void createMenus();
|
|
|
|
|
void createToolBars();
|
|
|
|
|
void createStatusBar();
|
|
|
|
|
void createDocks();
|
|
|
|
|
void createScene();
|
|
|
|
|
|
|
|
|
|
GraphicsView *gview;
|
|
|
|
|
|
|
|
|
|
QMenu *fileMenu;
|
|
|
|
|
QMenu *editMenu;
|
|
|
|
|
QMenu *helpMenu;
|
2008-11-13 22:10:20 +00:00
|
|
|
QMenu *viewMenu;
|
2008-10-08 22:11:27 +00:00
|
|
|
|
2008-11-23 13:45:09 +00:00
|
|
|
QToolBar *timerControlBar;
|
|
|
|
|
QToolBar *sceneModeBar;
|
|
|
|
|
QToolBar *upDownBar;
|
|
|
|
|
QToolBar *windowModeBar;
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
struct Actions {
|
|
|
|
|
QAction *aboutAct;
|
|
|
|
|
QAction *exitAct;
|
|
|
|
|
QAction *aboutQtAct;
|
|
|
|
|
QAction *oglEnable;
|
|
|
|
|
QAction *oglDisable;
|
2008-11-13 22:10:20 +00:00
|
|
|
QAction *calculate;
|
2008-10-08 22:11:27 +00:00
|
|
|
QAction *timerStart;
|
2008-11-02 20:34:58 +00:00
|
|
|
QAction *timerStop;
|
2008-12-06 22:54:33 +00:00
|
|
|
QAction *timerPause;
|
2008-10-08 22:11:27 +00:00
|
|
|
|
2008-11-16 22:18:15 +00:00
|
|
|
QAction *moveItemDown;
|
|
|
|
|
QAction *moveItemUp;
|
2008-11-17 15:56:27 +00:00
|
|
|
QAction *moveItemOnTop;
|
|
|
|
|
QAction *moveItemOnBottom;
|
2008-11-16 22:18:15 +00:00
|
|
|
|
2008-11-23 13:45:09 +00:00
|
|
|
QAction *editModeAct;
|
|
|
|
|
QAction *simulationModeAct;
|
|
|
|
|
|
2008-10-08 22:11:27 +00:00
|
|
|
QAction *itemEditModeAct;
|
|
|
|
|
QAction *insertEFieldItemAct;
|
2008-10-14 19:31:02 +00:00
|
|
|
QAction *insertBFieldItemAct;
|
2008-11-21 23:56:10 +00:00
|
|
|
QAction *insertStopperItemAct;
|
2008-11-15 13:55:29 +00:00
|
|
|
QAction *probeChargeItemPlaceAct;
|
2008-12-06 22:54:33 +00:00
|
|
|
|
|
|
|
|
QAction *resetAct;
|
2008-12-09 22:01:57 +00:00
|
|
|
QAction *fullScreenAct;
|
2008-12-16 21:59:25 +00:00
|
|
|
QAction *centerOnProbeAct;
|
2008-10-08 22:11:27 +00:00
|
|
|
};
|
|
|
|
|
Actions acts;
|
|
|
|
|
|
|
|
|
|
QActionGroup *modeChangeActGroup;
|
2008-11-23 13:45:09 +00:00
|
|
|
QActionGroup *windowModeActGroup;
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QDockWidget *fieldItemEditDock;
|
|
|
|
|
QDockWidget *probeItemDock;
|
2008-11-13 22:10:20 +00:00
|
|
|
QDockWidget *sceneDock;
|
2008-11-23 13:45:09 +00:00
|
|
|
QDockWidget *simulOptDock;
|
2008-10-08 22:11:27 +00:00
|
|
|
|
|
|
|
|
SimulScene *simulscene;
|
2008-11-23 13:45:09 +00:00
|
|
|
|
|
|
|
|
WindowMode myMode;
|
|
|
|
|
signals:
|
|
|
|
|
void windowModeChanged(WindowMode mode);
|
2008-12-07 22:11:41 +00:00
|
|
|
void timeLineDurationChangedSec(double duration);
|
2008-12-09 22:01:57 +00:00
|
|
|
void fullScreenModeChanged(bool mode);
|
2008-10-08 22:11:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|