source: trunk/yao/src/interface/src/include/MainWindow.hpp @ 476

Last change on this file since 476 was 476, checked in by yerima, 14 years ago

In some class, the class predefined method is implemented. This will reduce the compilation time.

File size: 7.9 KB
Line 
1#ifndef MAINWINDOW_HPP
2#define MAINWINDOW_HPP
3
4#include <cstring>
5#include <exception>
6#include <cstdlib>
7#include <sstream>
8#include <iostream>
9 
10#include "../YAOObjects/Modul.hpp"
11
12#include <QtGui>
13#include <QMainWindow>
14#include <iostream>
15//#include <QStringList>
16
17#include "ConstantWindow.hpp"
18#include "InsertFCTWindow.hpp"
19#include "InstructionWindow.hpp"
20#include "ModulWindow.hpp"
21#include "NetwardWindow.hpp"
22#include "SpaceController.hpp"
23#include "SpaceWindow.hpp"
24#include "TrajectoryWindow.hpp"
25#include "OperaWindow.hpp"
26#include "ContextWindow.hpp"
27#include "OrderWindow.hpp"
28#include "ConnectionWindow.hpp"
29#include "NewProjectWindow.hpp"
30#include "editor.h"
31
32
33class QDateEdit;
34class QTextCodec;
35class FilesViewer;
36class QTableView;
37class QTextCodec;
38class QWorkspace;
39class QStringList;
40class QStringListModel;
41
42class HatNameWindow;
43/*!
44 * \class MainWindow
45 * \brief MainWindow class for visual_YAO.
46 */
47
48class MainWindow : public QMainWindow  {
49        Q_OBJECT
50
51        public :
52            /*!
53             *  \brief Constructor
54             *
55             *  Constructor of the class MainWindow
56             *
57             */
58
59                        MainWindow(QWidget *parent = 0);
60                        MainWindow(yao::Table <yao::Constant> aConstantTable);
61                       
62                        void toolBarActions(QWorkspace &espace);
63                        void createActions();
64                        void createToolBar();
65                        void createMenus();
66                        void setProjectName(std::string chaine);                 //!< Sets project's name.
67                        std::string getProjectName();                            //!< Gets project's name.
68                        void setProjectPath(string aPath);
69                        std::string getProjectPath(); 
70                        void directivesManager();
71                        void setActiveProject(const bool aBool);
72                        bool isActiveProject();
73                        bool contextTest;
74
75                        /*template <class R, class S> void createDefvalWindow(R *directive, S *espace) {
76         
77                          if (directive == NULL) { //to test if the object is already created.
78         
79                                  directive = new directive ;
80                                  espace->addWindow(directive)->move(0, 0); //Put the object in the workspace
81                                  directive->show();// shows the object.
82                          }
83         
84                          connect(directive, SIGNAL(rowIsAdded()), this, SLOT(hatUpdate()));
85                          connect(directive, SIGNAL(rowIsDeleted(QString )), this, SLOT(hatUpdate(QString )));
86                          connect(directive, SIGNAL(windowIsClosed(int )), this, SLOT(initializeWindow(int )));
87 
88                         }*/
89
90                        //~MainWindow();
91        protected :
92                        //void closeEvent(QCloseEvent *event);
93        //private slots:
94                       
95        public slots:
96
97                        void clearAllStructures(); 
98                        void activateToolBarButtons();
99                        void cacherBarreOutils();
100                        void desactivateToolBarButtons();
101                        void generateDFile(std::string destination = "projects/");
102                        void callGenerateDFile();// used only for the execution button
103                        void generateIFile(std::string destination = "projects/");
104                        void instructionFileManager();
105                        void montrerActionCompilation();
106                        void montrerActionGenererD();
107                        void createNewProjectWindow();
108                        void openProject();
109                        //void helpMessage();
110                        void createDefvalWindow();
111                        void createHatNameWindow();
112                        void createContextWindow();
113                        void createTrajectoryWindow();
114                        void createSpaceWindow();
115                        void createOperaWindow();
116                        void createNetwardWindow();
117                        void createModulWindow();
118                        void createCtinWindow();
119                        void createOrderWindow();
120                        void createInsertFCTWindow();
121                        void initializeWindow(int anInt);
122                        void changeButtonColor(QPushButton *aButton); 
123                        void changeColorConstantButton();
124                        void changeColorHatButton();
125                        void changeColorContextButton();
126                        void changeColorTrajButton();
127                        void changeColorSpaceButton();
128                        void changeColorOperaButton();
129                        void changeColorModulButton();
130                        void changeColorCtinButton();
131                        void changeColorNetwardButton();
132                        void changeColorInsertFCTButton();
133                        void changeColorOrderButton();
134                        //void createProjectDirectory();
135                        //void openPathWindow();
136                        void setTitle();
137                        void hatUpdate();
138                        void hatUpdate(QString choix );
139                        void trajUpdate(); 
140                        //void contextUpdate();
141                        void mainWindowIsModified();
142                        void saveAs();
143                        void save();
144                        void enableIAction();
145
146        signals :
147                        void modified();
148                        void newProjectIsCreated();
149                        void newProjectIsCreated(QString chaine);
150                        void WindowTitleChanged();
151                        //void activeTheIAction();
152
153        private :
154                       
155                        MainWindowController the_mwc;
156                        InstructionWindow *iw;
157                    // Les attributs des menus
158                        QMenu *menuFichier;
159                        QMenu *menuEdition;
160                        QMenu *menuAffichage;
161                        QMenu *menuExecution;
162                        QMenu *menuConfig;
163                        QMenu *menuAide;
164
165                    // Les actions du menu Fichier
166                        QAction *actionFichierDescription;
167                        QAction *actionFichierHat;
168                        QAction *actionModule;
169                        QAction *actionFichierInstruction;
170                        QAction *actionGrapheModulaire;
171                        QAction *actionInfosProjet;
172                        QAction *actionNouveauProjet;
173                        QAction *actionOuvrirProjet;
174                        QAction *actionOuvrirProjetsRecents;
175                        QAction *actionImporterProjet;
176                        QAction *actionSaveProject;
177                        QAction *actionSaveAsProject;
178                        QAction *actionImprimerProjet;
179                        QAction *actionSortieProjet;
180
181                    // Les actions du menu edition
182                        //QAction *actionAnnuler;
183                        //QAction *actionRevenir;
184                        //QAction *actionCouper;
185                        //QAction *actionCopier;
186                        //QAction *actionColler;
187                        //QAction *actionSelectionnerTout;
188
189                    // Les actions du menu affichage
190                        QAction *actionCacherBarreOutils;
191                        QAction *actionCacherFenetreApercu;
192                        QAction *actionCacherFenetreProjet;
193                        QAction *actionCacherFenetreDialog;
194                        //QAction *actionPleinEcran;
195
196                    // Les actions du menu Execution
197                        QAction *actionGenerationD;
198                        QAction *actionGenerationI;
199                        QAction *actionCompilation;
200                        QAction *actionExecution;
201
202                    // Les actions du menu configuration
203                        QAction *actionEditeur;
204
205                    // Les actions du menu aide
206                        QAction *actionDocYao;
207                        QAction *actionRapport;
208
209                    // La barre d'outils
210                        QPushButton *m_constantButton;
211                        QPushButton *m_hatNameButton;
212                        QPushButton *m_contextButton;
213                        QPushButton *m_trajButton;
214                        QPushButton *m_spaceButton;
215                        QPushButton *m_operaButton;
216                        QPushButton *m_netwardButton;
217                        QPushButton *m_modulButton;
218                        QPushButton *m_ctinButton;
219                        QPushButton *m_orderButton;
220                        QPushButton *m_insertFCTButton;
221
222                        QToolBar *yaoToolBar; //Crée une barre d'outils
223                        QStatusBar *barreEtat;
224                        QWorkspace espace;
225                        QWorkspace *pt_espace;
226                        QTableWidget *tableWidget;
227                        QString curFile;
228                        QDockWidget *fenetreProjet;
229                        ConstantWindow *m_constantWindow;
230                        HatNameWindow *m_hatnameWindow;
231                        ContextWindow *m_contextWindow;
232                        TrajectoryWindow *m_trajectoryWindow;
233                        SpaceWindow *m_spaceWindow;
234                        OperaWindow *m_operaWindow;
235                        NetwardWindow *m_netwardWindow;
236                        ModulWindow *m_modulWindow;
237                        ConnectionWindow *m_ctinWindow;
238                        OrderWindow *m_orderWindow;
239                        InsertFCTWindow *m_insertFCTWindow;
240                       
241                        NewProjectWindow *m_newProjectWindow;
242                        NewProjectWindow *m_newProjectWindow2;
243
244                        FilesViewer *fv;
245                        std::string filename;
246                        std::string filepath;
247                    //!< les onglets
248                        QTabWidget *tabWidget;
249                        QWidget *page1;
250                        QWidget *page2; 
251                        QLineEdit *m_lineDirName;
252                        QLineEdit *m_linePath;
253                        QTextEdit *ligneInfos;
254                        //QDialog *newProjectWindow;
255                        std::string m_newProjectName; 
256                        std::string m_projectPath;
257
258                        // Yao structures are follow:
259                        yao::Constant m_theConstant;
260                        yao::Table <yao::Constant> theConstantTable;                   
261                        yao::Table <yao::Constant> &theConstantTablePt;                 
262                       
263                        std::vector <string> theHeaderList;
264                        yao::Context theContext;
265                        //yao::Modul theModul;
266                        yao::Table <yao::Trajectory> theTrajectoryTable;
267                        yao::Table <yao::Space> theSpaceTable;
268                        yao::Table <yao::Operator> theOperaTable;
269                        yao::Table <yao::Neuron> theNeuronTable;
270                        yao::Table <yao::Modul> theModulTable;
271                        yao::Table <yao::Connection> theConnectionTable;
272                        yao::Table <yao::Order> theOrderTable;
273                        yao::Table <yao::Function> theFunctionTable;   
274                       
275                        std::string theContextData;
276                       
277                        std::vector <std::string> theInstructionData;
278
279                        bool m_activeProject;
280                        bool confirmationFlag;
281                               
282                        QDateEdit *date;
283                       
284};
285#endif // FENETREPRINCIPALE_HPP
Note: See TracBrowser for help on using the repository browser.