Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fb2main.hpp « source - github.com/lintest/fb2edit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2001390336ecf8c8b677db224b419be1e511ed80 (plain)
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
#ifndef FB2MAIN_H
#define FB2MAIN_H

#include <QMainWindow>
#include <QDockWidget>

QT_BEGIN_NAMESPACE
class QAction;
class QFile;
class QMenu;
class QModelIndex;
class QStackedWidget;
class QTextEdit;
class QTreeView;
class QWebInspector;
QT_END_NAMESPACE

class FbCodeEdit;
class FbTreeView;
class FbHeadView;
class FbTextEdit;
class FbTextFrame;
class FbTextPage;

class FbLogDock: public QDockWidget
{
    Q_OBJECT

public:
    explicit FbLogDock(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0)
        : QDockWidget(title, parent, flags) {}

    QSize sizeHint() const {
        QSize sh = QDockWidget::sizeHint();
        sh.setHeight(40);
        return sh;
    }
};

class FbDockWidget : public QDockWidget
{
    Q_OBJECT
public:
    explicit FbDockWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
};

class FbMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    enum ViewMode { FB2, XML };
    explicit FbMainWindow(const QString &filename = QString(), ViewMode mode = FB2);

public:
    FbTextPage * page();

protected:
    void closeEvent(QCloseEvent *event);

signals:
    void showInspectorChecked(bool);

public slots:
    void logMessage(const QString &message);

private slots:
    void fileNew();
    void fileOpen();
    bool fileSave();
    bool fileSaveAs();

    void about();
    void createTextToolbar();
    void documentWasModified();
    void checkScintillaUndo();
    void treeDestroyed();
    void imgsDestroyed();
    void logDestroyed();
    void logShowed();
    void viewCode();
    void viewHtml();
    void viewText();
    void viewHead();
    void viewTree();
    void viewImgs();

    void cleanChanged(bool clean);
    void canUndoChanged(bool canUndo);
    void canRedoChanged(bool canRedo);
    void status(const QString &text);
    void clipboardDataChanged();
    void selectionChanged();
    void undoChanged();
    void redoChanged();
    void openSettings();

private:
    bool loadXML(const QString &filename);
    QString appTitle() const;

private:
    void createHead();
    void createTree();
    void createImgs();
    void createActions();
    void createStatusBar();
    void readSettings();
    void writeSettings();
    void setModified(bool modified);
    bool maybeSave();
    bool saveFile(const QString &fileName, const QString &codec = QString());
    void setCurrentFile(const QString &fileName = QString());
    FbMainWindow *findFbMainWindow(const QString &fileName);

    QStackedWidget *mainDock;
    FbTextFrame *textFrame;
    FbCodeEdit *codeEdit;
    FbHeadView *headTree;
    QTextEdit *noteEdit;
    QToolBar *toolEdit;
    QDockWidget *dockTree;
    QDockWidget *dockImgs;
    QWebInspector *inspector;
    QTextEdit *messageEdit;
    QString curFile;
    bool isSwitched;
    bool isUntitled;

    QMenu
        *menuEdit,
        *menuText,
        *menuView;

    QAction
        *actionBack,
        *actionForward,
        *actionUndo,
        *actionRedo,
        *actionCut,
        *actionCopy,
        *actionPaste,
        *actionPasteText,
        *actionSelect,
        *actionFind,
        *actionReplace,
        *actionImage,
        *actionNote,
        *actionLink,
        *actionBody,
        *actionTitle,
        *actionEpigraph,
        *actionSubtitle,
        *actionAnnot,
        *actionPoem,
        *actionDate,
        *actionStanza,
        *actionAuthor,
        *actionSection,
        *actionSimpleText,
        *actionParaSeparator,
        *actionLineSeparator,
        *actionClearFormat,
        *actionTextBold,
        *actionTextItalic,
        *actionTextStrike,
        *actionTextCode,
        *actionTextSub,
        *actionTextSup,
        *actionTextTitle,
        *actionSectionAdd,
        *actionSectionDel,
        *actionContents,
        *actionPictures,
        *actionInspect,
        *actionZoomIn,
        *actionZoomOut,
        *actionZoomReset
    ;
};

#endif // FB2MAIN_H