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

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

After working on the visual Yao script (called "configure"), some updates are made in the modinspace class (data are added in the Yao structures depending on the space or the operator.) Visual Yao.

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