-
Notifications
You must be signed in to change notification settings - Fork 22
/
mainwindow.h
204 lines (180 loc) · 5.19 KB
/
mainwindow.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/****************************************************************************
** **
** Copyright (C) 2009-2014 Victor Zinkevich. All rights reserved. **
** Contact: vicking@yandex.ru **
** **
** This file is part of the Algorithm Flowchart Editor project. **
** **
** This file may be used under the terms of the GNU **
** General Public License versions 2.0 or 3.0 as published by the Free **
** Software Foundation and appearing in the file LICENSE included in **
** the packaging of this file. **
** You can find license at http://www.gnu.org/licenses/gpl.html **
** **
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "thelpwindow.h"
#include "zvflowchart.h"
#include <QtGui>
#include <QMainWindow>
#include <QScrollArea>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QToolButton>
#include <QComboBox>
#include <QLabel>
#include <QApplication>
#include <QTextCodec>
class AfcScrollArea : public QScrollArea
{
Q_OBJECT
protected:
virtual void mousePressEvent(QMouseEvent *event);
virtual void wheelEvent(QWheelEvent *event);
signals:
void mouseDown();
void zoomStepped(int);
void scrollStepped(int);
public:
explicit AfcScrollArea(QWidget* parent=0) : QScrollArea(parent) { }
~AfcScrollArea() { }
};
class MainWindow : public QMainWindow
{
Q_OBJECT
signals:
void rootChanged();
private:
// TAlgorithmBlock *fRoot;
QFlowChart *fDocument;
bool isSaved;
QVBoxLayout *fVLayout;
QHBoxLayout *fHLayout;
AfcScrollArea *saScheme;
QDockWidget *dockTools;
QDockWidget *dockCode;
QFrame *toolsWidget, *codeWidget;
QToolButton *tbArrow;
QToolButton *tbProcess;
QToolButton *tbIf;
QToolButton *tbFor;
QToolButton *tbWhilePre;
QToolButton *tbWhilePost;
QToolButton *tbIo;
QToolButton *tbOu;
// QToolButton *tbCase;
QToolButton *tbForCStyle;
QToolButton *tbAssign;
QComboBox *codeLanguage;
QTextEdit *codeText;
QAction *actNew;
QAction *actOpen;
QAction *actSave;
QAction *actSaveAs;
QAction *actExit;
QAction *actUndo;
QAction *actRedo;
QAction *actCut;
QAction *actCopy;
QAction *actPaste;
QAction *actDelete;
QAction *actHelp;
QAction *actAbout;
QAction *actAboutQt;
QAction *actExport;
QAction *actExportSVG;
QAction *actPrint;
QAction *actTools;
QAction *actCode;
QAction *acteng;
QAction *actrus;
QList<QAction *> actLanguages;
// QAction *actPageSetup;
QMenu *menuFile;
QMenu *menuEdit;
QMenu *menuHelp;
QMenu *menuWindow;
QMenu *menuLanguage;
QString fileName;
QToolBar *toolBar;
QLabel *codeLabel;
QLabel *zoomLabel;
QLabel *labelMenu;
QSlider *zoomSlider;
//QLabel *labelFile;
THelpWindow *helpWindow;
QStack<QString> undoStack;
QStack<QString> redoStack;
void setupUi();
void readSettings();
void writeSettings();
void createMenu();
void createActions();
void createToolbox();
void createToolBar();
//void closeEvent(QCloseEvent *event);
bool okToContinue();
protected:
void closeEvent(QCloseEvent *event);
public:
MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
~MainWindow();
// TAlgorithmBlock *root() const;
// void setRoot(TAlgorithmBlock *aRoot);
QFlowChart * document() const { return fDocument; }
void setDocument(QFlowChart * aDocument);
static QString getFilterFor(const QString & fileExt);
static QString getWriteFormatFilter();
static QHash<QString, QString> enumLanguages();
public slots:
void retranslateUi();
void slotFileOpen();
void slotFileNew();
void slotFileSave();
void slotFileSaveAs();
void slotFileExport();
void slotFileExportSVG();
void slotFilePrint();
void slotEditCopy();
void slotEditCut();
void slotEditPaste();
void slotEditDelete();
void slotHelpAbout();
void slotHelpAboutQt();
void slotToolArrow();
void slotToolProcess();
void slotToolIf();
void slotToolFor();
void slotToolWhilePre();
void slotToolWhilePost();
void slotToolIo();
void slotToolOu();
void slotToolCase();
void slotToolForCStyle();
void slotToolAssign();
void slotDocumentSaved();
void slotDocumentChanged();
void slotDocumentLoaded();
void slotChangeLanguage();
void slotReloadGenerators();
void setZoom(int quarts);
void shiftZoom(int step);
void shiftScrollY(int step);
void slotStatusChanged();
void slotEditBlock(QBlock *aBlock);
void updateActions();
void generateCode();
void codeLangChanged(int index);
void docToolsVisibilityChanged(bool visible);
void docCodeVisibilityChanged(bool visible);
void slotOpenDocument(const QString &fn);
signals:
void documentLoaded();
void documentSaved();
void documentChanged();
void documentUnloaded();
};
QString afceVersion();
void setApplicationLocale(const QString &localeName);
#endif // MAINWINDOW_H