1 /* This file is part of Step.
2    Copyright (C) 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com>
3 
4    Step is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8 
9    Step is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with Step; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18 
19 #ifndef STEP_MAINWINDOW_H
20 #define STEP_MAINWINDOW_H
21 
22 #include <QUrl>
23 
24 #include <KXmlGuiWindow>
25 
26 class WorldModel;
27 class WorldBrowser;
28 class WorldScene;
29 class WorldGraphicsView;
30 class PropertiesBrowser;
31 class InfoBrowser;
32 class UndoBrowser;
33 class ItemPalette;
34 
35 class KToolBarPopupAction;
36 class KRecentFilesAction;
37 
38 class QAction;
39 class QActionGroup;
40 
41 class MainWindow : public KXmlGuiWindow
42 {
43     Q_OBJECT
44 
45 public:
46     MainWindow();
47     ~MainWindow();
48 
49 public slots:
50     bool newFile();
51     bool openFile(const QUrl& url = QUrl(), const QUrl& startUrl = QUrl());
52     bool saveFileAs(const QUrl& url = QUrl(), const QUrl& startUrl = QUrl());
53     bool saveFile();
54 
55     void openTutorial();
56     void openExample();
57     void openLocalExample();
58     void uploadExample();
59     void downloadExamples();
60 
61     void configureStep();
62 
63     void simulationStartStop();
64     void simulationStart();
65     void simulationStop();
66     void simulationStopped(int result);
67 
68     void setRunSpeed(int);
69 
setFullSpeed()70     void setFullSpeed()     { setRunSpeed(0); }
setSlowSpeed()71     void setSlowSpeed()     { setRunSpeed(1); }
setSlowerSpeed()72     void setSlowerSpeed()   { setRunSpeed(2); }
setSlowestSpeed()73     void setSlowestSpeed()  { setRunSpeed(3); }
setStepSpeed()74     void setStepSpeed()     { setRunSpeed(4); }
75 
76 
77 protected slots:
78     void updateCaption();
79     void undoTextChanged(const QString& undoText);
80     void redoTextChanged(const QString& redoText);
81     void worldSelectionChanged();
82 
83     /*
84 protected slots:
85     void on_actionNew_triggered(bool checked);
86     void on_actionOpen_triggered(bool checked);
87     void on_actionSave_triggered(bool checked);
88     void on_actionSaveAs_triggered(bool checked);
89 
90     void on_actionStep_triggered(bool checked);
91     void on_actionSimulation_triggered(bool checked);
92 
93     void on_actionAboutStep_triggered(bool checked);
94 
95     void on_simulationTimer_timeout();
96     */
97 
98 protected:
99     void setupActions();
100     bool queryClose() override;
101     bool maybeSave();
102 
103 protected:
104     WorldModel*         worldModel;
105     WorldBrowser*       worldBrowser;
106     PropertiesBrowser*  propertiesBrowser;
107     InfoBrowser*        infoBrowser;
108     UndoBrowser*        undoBrowser;
109     ItemPalette*        itemPalette;
110     WorldScene*         worldScene;
111     WorldGraphicsView*  worldGraphicsView;
112 
113     QAction* actionUndo;
114     QAction* actionRedo;
115     QAction* actionDelete;
116     QAction* actionCut;
117     QAction* actionCopy;
118     QAction* actionPaste;
119 
120     KRecentFilesAction* actionRecentFiles;
121 
122     QUrl currentFileUrl;
123 
124     //The following members are needed for the setting of the timeScale
125     int runSpeed;
126     KToolBarPopupAction *runSpeedAction;
127     QAction *fullSpeedAct;
128     QAction *slowSpeedAct;
129     QAction *slowerSpeedAct;
130     QAction *slowestSpeedAct;
131     QAction *stepSpeedAct;
132     QActionGroup *runSpeedGroup;
133 
134 };
135 
136 #endif
137 
138