texteditor.h
Go to the documentation of this file.
1 /****************************************************************************
2 SocNetV: Social Network Visualizer
3 version: 2.2
4 Written in Qt
5 
6  texteditor.h
7  -------------------
8  copyright : (C) 2005-2017 by Dimitris B. Kalamaras
9  project site : http://socnetv.org
10 
11 *****************************************************************************/
12 
13 /*******************************************************************************
14 * This program is free software: you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation, either version 3 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
26 ********************************************************************************/
27 
28 #ifndef TEXTEDITOR_H
29 #define TEXTEDITOR_H
30 
31 #include <QMainWindow>
32 //#include <QMimeData>
33 
34 class QAction;
35 class QMenu;
36 class QTextEdit;
37 
38 class TextEditor : public QMainWindow
39 {
40  Q_OBJECT
41 
42 public:
43  TextEditor(const QString &fileName ,
44  QWidget *parent=0 , const bool &format=false);
45 
46 protected:
47  void closeEvent(QCloseEvent *event);
48 
49 private slots:
50  void newFile();
51  void open();
52  bool save();
53  bool saveAs();
54  void about();
55  void documentWasModified();
56 //protected:
57 // bool canInsertFromMimeData(const QMimeData *source) const;
58 // void insertFromMimeData(const QMimeData *source) ;
59 private:
60  void createActions();
61  void createMenus();
62  void createToolBars();
63  void createStatusBar();
64  void readSettings();
65  void writeSettings();
66  bool maybeSave();
67  void loadFile(const QString &fileName);
68  bool saveFile(const QString &fileName);
69  void setCurrentFile(const QString &fileName);
70  QString strippedName(const QString &fullFileName);
71 
72  QTextEdit *textEdit;
73  QString curFile;
74  bool formatHTML;
75  QMenu *fileMenu;
76  QMenu *editMenu;
77  QMenu *helpMenu;
78  QToolBar *fileToolBar;
79  QToolBar *editToolBar;
80  QAction *newAct;
81  QAction *openAct;
82  QAction *saveAct;
83  QAction *saveAsAct;
84  QAction *exitAct;
85  QAction *cutAct;
86  QAction *copyAct;
87  QAction *pasteAct;
88  QAction *aboutAct;
89  QAction *aboutQtAct;
90 
91 };
92 
93 
94 
95 #endif
QMenu * helpMenu
Definition: texteditor.h:77
QAction * aboutQtAct
Definition: texteditor.h:89
void createActions()
Definition: texteditor.cpp:112
QToolBar * editToolBar
Definition: texteditor.h:79
void createMenus()
Definition: texteditor.cpp:172
QAction * cutAct
Definition: texteditor.h:85
void createToolBars()
Definition: texteditor.cpp:194
void open()
Definition: texteditor.cpp:78
bool maybeSave()
Definition: texteditor.cpp:228
QAction * aboutAct
Definition: texteditor.h:88
void writeSettings()
Definition: texteditor.cpp:221
void createStatusBar()
Definition: texteditor.cpp:207
void setCurrentFile(const QString &fileName)
Definition: texteditor.cpp:295
void closeEvent(QCloseEvent *event)
Definition: texteditor.cpp:60
TextEditor(const QString &fileName, QWidget *parent=0, const bool &format=false)
Definition: texteditor.cpp:32
bool formatHTML
Definition: texteditor.h:74
QMenu * editMenu
Definition: texteditor.h:76
QTextEdit * textEdit
Definition: texteditor.h:72
void about()
Definition: texteditor.cpp:334
void readSettings()
Definition: texteditor.cpp:212
Definition: texteditor.h:38
void documentWasModified()
Definition: texteditor.cpp:107
QAction * pasteAct
Definition: texteditor.h:87
QAction * copyAct
Definition: texteditor.h:86
QAction * openAct
Definition: texteditor.h:81
QToolBar * fileToolBar
Definition: texteditor.h:78
void loadFile(const QString &fileName)
Definition: texteditor.cpp:244
QAction * newAct
Definition: texteditor.h:80
bool save()
Definition: texteditor.cpp:87
QString strippedName(const QString &fullFileName)
Definition: texteditor.cpp:310
QString curFile
Definition: texteditor.h:73
QAction * exitAct
Definition: texteditor.h:84
QAction * saveAct
Definition: texteditor.h:82
void newFile()
Definition: texteditor.cpp:70
QMenu * fileMenu
Definition: texteditor.h:75
bool saveFile(const QString &fileName)
Definition: texteditor.cpp:268
QAction * saveAsAct
Definition: texteditor.h:83
bool saveAs()
Definition: texteditor.cpp:96