NCL Composer  0.1.5
 All Classes Functions Variables Pages
NCLTextEditorMainWindow.h
1 /*
2  * Copyright 2011 TeleMidia/PUC-Rio.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18 #ifndef MAINWINDOW_H
19 #define MAINWINDOW_H
20 
21 #include <stdio.h>
22 #include <stdlib.h>
23 using namespace std;
24 
25 #include <QMainWindow>
26 #include <QDockWidget>
27 #include <QListWidget>
28 #include <QDialog>
29 #include <QPushButton>
30 #include <QLineEdit>
31 
32 #include "NCLProblemsView.h"
33 
34 #ifdef NCLEDITOR_STANDALONE
35 #include "NCLTreeWidget.h"
36 #endif
37 
38 #include "NCLTextEditor.h"
39 //#include "LayoutView.h"
40 //#include "Preferences.h"
41 
42 #include "SearchLineEdit.h"
43 
44 class QAction;
45 class QMenu;
46 
50 class NCLTextEditorMainWindow : public QMainWindow
51 {
52  Q_OBJECT
53 
54 public:
55  explicit NCLTextEditorMainWindow(QWidget *parent = 0);
56  NCLTextEditor *getTextEditor() {return this->textEdit;}
57 
58 #ifdef NCLEDITOR_STANDALONE
59  NCLTreeWidget *getNCLTreeWidget() {return this->outlineView; }
60 #endif
61 
62 protected:
63  void closeEvent(QCloseEvent *event);
64 
65 private slots:
66  void newFile();
67  void open();
68  bool save();
69  bool saveAs();
70  void about();
71  void documentWasModified();
72  void showInFullScreen();
73  void insertElement();
74  void gotoLineOf(QTreeWidgetItem *item, int column);
75  void showPreferences();
76 
77  void showSearchBox();
78  void hideSearchBox();
79  void findNext();
80  void findNext(QString text);
81  void findPrevious();
82  void findPrevious(QString text);
83 
84 private:
85  void createActions();
86  void createMenus();
87  void createToolBars();
88  void createStatusBar();
89  void createTextView();
90  void createOutlineView();
91  void createProblemsView();
92  void createSearchBox();
93  void readSettings();
94  void writeSettings();
95  bool maybeSave();
96  void loadFile(const QString &fileName);
97  bool saveFile(const QString &fileName);
98  void setCurrentFile(const QString &fileName);
99  QString strippedName(const QString &fullFileName);
100 
101  QDockWidget *dockTextEdit, *dockTextEdit2;
102  NCLTextEditor *textEdit, *textEdit2;
103  QString curFile;
104 
105  QMenu *fileMenu;
106  QMenu *editMenu;
107  QMenu *helpMenu;
108  QToolBar *fileToolBar;
109  QToolBar *editToolBar;
110  QAction *newAct;
111  QAction *openAct;
112  QAction *saveAct;
113  QAction *saveAsAct;
114  QAction *exitAct;
115  QAction *cutAct;
116  QAction *copyAct;
117  QAction *pasteAct;
118  QAction *aboutAct;
119  QAction *aboutQtAct;
120  QAction *fullscreenAct;
121  QAction *editPreferencesAct;
122  QAction *synchronizeAct;
123  QAction *showSearchBoxAct;
124 
125  QFrame searchBox;
126  QPushButton doSearchButton;
127  QDockWidget *dockSearchBox;
128  SearchLineEdit searchBoxText;
129 
132 #ifdef NCLEDITOR_STANDALONE
133  QDockWidget *dockOutlineView;
134  NCLTreeWidget *outlineView;
135 #endif
136 
137  QMenu *nodeMenu;
138  QAction *insertNodeChildAct;
139 
141  NCLProblemsView *problemsView;
142 
143  /* QDockWidget *dockLayoutView;
144  LayoutView *layoutView; */
145 
146  /* Preferences *preferences;
147  PreferencesPage *textEditorPreferencesPage; */
148 
149 signals:
150  void elementAdded(QString, QString, QMap <QString, QString>&, bool);
151  void focusLosted();
152 };
153 
154 #endif