blob: 0e7bf75d41bd7df434001f44f79582dbe6795cb3 (
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
|
#ifndef FB2MAIN_H
#define FB2MAIN_H
#include <QMainWindow>
#include <QDockWidget>
QT_BEGIN_NAMESPACE
class QAction;
class QFile;
class QMenu;
class QModelIndex;
class QTextEdit;
class QTreeView;
class QWebInspector;
QT_END_NAMESPACE
class FbMainDock;
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 FbMainWindow : public QMainWindow
{
Q_OBJECT
public:
enum ViewMode { FB2, XML };
explicit FbMainWindow(const QString &filename = QString(), ViewMode mode = FB2);
protected:
void closeEvent(QCloseEvent *event);
signals:
void showInspectorChecked(bool);
public slots:
void logMessage(const QString &message);
void status(const QString &text);
private slots:
void fileNew();
void fileOpen();
bool fileSave();
bool fileSaveAs();
void about();
void documentWasModified();
void logDestroyed();
void logShowed();
void openSettings();
private:
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);
FbMainDock *mainDock;
QTextEdit *noteEdit;
QToolBar *toolEdit;
QWebInspector *inspector;
QTextEdit *messageEdit;
QString curFile;
bool isSwitched;
bool isUntitled;
};
#endif // FB2MAIN_H
|