-
Notifications
You must be signed in to change notification settings - Fork 0
/
Project.h
164 lines (129 loc) · 4.91 KB
/
Project.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// Interface Editor: a basic circuit editor
// Copyright (C) 2004 David Yuste Romero ([email protected])
//
// 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 3 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, see <http://www.gnu.org/licenses/>.
// Interface Editor: a basic circuit editor
// Copyright (C) 2004 David Yuste Romero ([email protected])
//
// 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 3 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, see <http://www.gnu.org/licenses/>.
// Project.h: interface for the Project class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(_PROJECT_H_)
#define _PROJECT_H_
#include <qworkspace.h>
class Document;
class IAInterface;
class QDir;
#define VHDL_PROJECT_FOLDER "vhdl"
#define BIN_PROJECT_FOLDER "bin"
#define SIM_PROJECT_FOLDER "sim"
class Project : public QWorkspace
{
Q_OBJECT
public:
enum{ MagicNumber=0xDA2EB735 };
Project( QWidget * parent=0, const char * name = 0 );
bool mayBeSave() const;
// Atributos del proyecto
QString path() const;
bool setPath( const QString & pth );
void setName( const QString & nm );
QString autor() const;
void setAutor( const QString & at );
// Busca el documento docName entre los documentos activos.
// Además, si se especifica mustLoad (por defecto=FALSE), el documento se
// intentará instanciar. En caso de éxito, si está activo mustShowWhenLoad
// el documento será visible, en otro caso permanecerá oculto.
//
// Devuelve NULL si en ningún caso se consigue cargar el documento
Document * findDocument( const QString& docName, bool mustLoad=false, bool mustShowWhenLoad=false );
protected:
QStringList& documents();
public slots:
// Proyecto
bool newProject();
bool closeProject();
bool queryCloseProject();
bool openProject();
bool openProject( const QString & filePath, const QString & fileName );
bool loadProject( QIODevice * device );
bool saveProject();
// Documentos
bool newDocument();
bool newDocument( const IAInterface & iface );
bool openDocument();
// Configuración visual de documentos
void zoomIn();
void zoomOut();
Document * showDocument( const QString& docName );
void renameDocument( const QString& oldName, const QString &newName );
bool removeDocument( const QString& docName );
// Compilación (HDL)
bool buildActiveModelHDL();
bool buildAllHDL();
// Compilación (Binaria)
bool compileActiveModel();
bool compileAll();
bool compileDependences();
signals:
// Eventos por manipulación del proyecto
void projectCreated();
void projectCreated( const QString& docName );
void projectOpened();
void projectOpened( const QString& docName );
void projectSaved();
void projectClosed();
// Eventos por manipulación de documentos
void documentInstancied( Document * doc );
void documentCreated( const QString& docName );
void documentRenamed( const QString& oldName, const QString &newName );
void documentRemoved( const QString& docName );
// Mensajes
void errorMessage(const QString&);
void outputMessage(const QString&);
void indentMessage(int indentation);
protected:
// Construcción de HDL y listas de señales
// Construcción efectiva
bool buildModelSignalsFile( Document * doc );
bool buildModelHDLFile( Document * doc );
bool buildModelHDL( const QString & doc );
bool buildModelsHDL( const QStringList & docs );
// Compilación (Binaria)
bool compileModels( const QStringList & docs );
bool compileModel( const QString & doc );
// Comprobación de cambios entre ficheros
bool checkHDLuptoDate(const QString & doc);
bool checkBINuptoDate(const QString & doc);
// Utilidades: Manejo de directorios
bool tryEnterDir( const QString& where, const QString& dirName, QDir * dir=0 );
private:
bool saveProjectFile();
bool isChanged;
QString pth, at;
QStringList docs;
};
#endif