-
Notifications
You must be signed in to change notification settings - Fork 5
/
contenteditor.h
148 lines (137 loc) · 4.17 KB
/
contenteditor.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
/****************************************************************************
** Copyright (C) 2017 Olaf Japp
**
** This file is part of FlatSiteBuilder.
**
** FlatSiteBuilder 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.
**
** FlatSiteBuilder 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 FlatSiteBuilder. If not, see <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#ifndef CONTENTEDITOR_H
#define CONTENTEDITOR_H
#include <QWidget>
#include <QScrollArea>
#include <QLabel>
#include <QTextEdit>
#include <QLineEdit>
#include <QUndoStack>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QComboBox>
#include "content.h"
#include "interfaces.h"
#include "site.h"
#include "sectioneditor.h"
#include "rowpropertyeditor.h"
#include "sectionpropertyeditor.h"
#include "interfaces.h"
class QStatusBar;
class MainWindow;
class QXmlStreamReader;
class ContentEditor : public AnimateableEditor
{
Q_OBJECT
public:
ContentEditor(MainWindow *win, Site *site, Content *content);
~ContentEditor();
bool eventFilter(QObject *watched, QEvent *event);
void elementEdit(ElementEditor *);
void rowEdit(RowEditor *);
void sectionEdit(SectionEditor *);
Content *getContent() {return m_content;}
Site *site() {return m_site;}
QString filename() {return m_filename;}
void load();
void setContent(QString) {/* not used */}
public slots:
void editChanged(QString text);
void save();
void closeEditor() override;
void contentRenamed(QString name);
private slots:
void preview();
void editorClose();
void rowEditorClose();
void sectionEditorClose();
void animationFineshedZoomIn();
void animationFineshedZoomOut();
void titleChanged();
void titleChanged(QString title);
void sourceChanged();
void excerptChanged();
void dateChanged();
void authorChanged();
void keywordsChanged();
void menuChanged(QString);
void layoutChanged(QString);
void siteLoaded(Site *);
void canUndoChanged(bool can);
void canRedoChanged(bool can);
void undoTextChanged(QString text);
void redoTextChanged(QString text);
void undo();
void redo();
signals:
void preview(Content *);
void contentChanged(Content *content);
private:
Site *m_site;
Content *m_content;
QLabel *m_titleLabel;
QLabel *m_labelTitle;
QLabel *m_labelPermalink;
QTextEdit *m_text;
QString m_filename;
QLineEdit *m_title;
QLineEdit *m_source;
QLineEdit *m_excerpt;
QLineEdit *m_date;
QScrollArea *m_scroll;
QGridLayout *m_layout;
QVBoxLayout *m_vbox;
QLabel *m_excerptLabel;
QLabel *m_datelabel;
Hyperlink *m_previewLink;
QWidget *m_animationPanel;
AnimateableEditor *m_editor;
QParallelAnimationGroup *m_animationgroup;
QPropertyAnimation *m_animx;
QPropertyAnimation *m_animy;
QPropertyAnimation *m_animw;
QPropertyAnimation *m_animh;
ElementEditor *m_elementEditor;
RowEditor *m_rowEditor;
SectionEditor *m_sectionEditor;
QUndoStack *m_undoStack;
FlatButton *m_close;
FlatButton *m_undo;
FlatButton *m_redo;
QWidget *m_sourcewidget;
MainWindow *m_win;
QLabel *m_labelKeyword;
QLabel *m_labelAuthor;
QLabel *m_labelMenu;
QLabel *m_labelLayout;
QLineEdit *m_keywords;
QLineEdit *m_author;
QComboBox *m_menus;
QComboBox *m_layouts;
bool m_isNew;
void init();
void loadRows(QXmlStreamReader *stream, SectionEditor *se);
void loadColumns(QXmlStreamReader *stream, RowEditor *re);
void loadElements(QXmlStreamReader *stream, ColumnEditor *ce);
void animate(QWidget *widget);
void editorClosed();
};
#endif // CONTENTEDITOR_H