fb2main.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #ifndef FB2MAIN_H
  2. #define FB2MAIN_H
  3. #include <QMainWindow>
  4. #include <QDockWidget>
  5. QT_BEGIN_NAMESPACE
  6. class QAction;
  7. class QFile;
  8. class QMenu;
  9. class QModelIndex;
  10. class QTextEdit;
  11. class QTreeView;
  12. class QWebInspector;
  13. QT_END_NAMESPACE
  14. class FbCodeEdit;
  15. class FbTreeView;
  16. class FbHeadView;
  17. class FbTextEdit;
  18. class FbTextFrame;
  19. class FbTextPage;
  20. class FbDockWidget : public QDockWidget
  21. {
  22. Q_OBJECT
  23. public:
  24. explicit FbDockWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
  25. };
  26. class FbMainWindow : public QMainWindow
  27. {
  28. Q_OBJECT
  29. public:
  30. enum ViewMode { FB2, XML };
  31. explicit FbMainWindow(const QString &filename = QString(), ViewMode mode = FB2);
  32. public:
  33. FbTextPage * page();
  34. protected:
  35. void closeEvent(QCloseEvent *event);
  36. signals:
  37. void showInspectorChecked(bool);
  38. public slots:
  39. void logMessage(const QString &message);
  40. private slots:
  41. void fileNew();
  42. void fileOpen();
  43. bool fileSave();
  44. bool fileSaveAs();
  45. void about();
  46. void createTextToolbar();
  47. void documentWasModified();
  48. void checkScintillaUndo();
  49. void treeDestroyed();
  50. void imgsDestroyed();
  51. void logDestroyed();
  52. void logShowed();
  53. void viewCode();
  54. void viewText();
  55. void viewHead();
  56. void viewTree();
  57. void viewImgs();
  58. void cleanChanged(bool clean);
  59. void canUndoChanged(bool canUndo);
  60. void canRedoChanged(bool canRedo);
  61. void status(const QString &text);
  62. void clipboardDataChanged();
  63. void selectionChanged();
  64. void undoChanged();
  65. void redoChanged();
  66. void openSettings();
  67. private:
  68. bool loadXML(const QString &filename);
  69. QString appTitle() const;
  70. private:
  71. void createHead();
  72. void createTree();
  73. void createImgs();
  74. void createActions();
  75. void createStatusBar();
  76. void readSettings();
  77. void writeSettings();
  78. void setModified(bool modified);
  79. bool maybeSave();
  80. bool saveFile(const QString &fileName, const QString &codec = QString());
  81. void setCurrentFile(const QString &fileName = QString());
  82. FbMainWindow *findFbMainWindow(const QString &fileName);
  83. FbTextFrame *textFrame;
  84. FbCodeEdit *codeEdit;
  85. FbHeadView *headTree;
  86. QTextEdit *noteEdit;
  87. QToolBar *toolEdit;
  88. QDockWidget *dockTree;
  89. QDockWidget *dockImgs;
  90. QWebInspector *inspector;
  91. QTextEdit *messageEdit;
  92. QString curFile;
  93. bool isSwitched;
  94. bool isUntitled;
  95. QMenu
  96. *menuEdit,
  97. *menuText,
  98. *menuView;
  99. QAction
  100. *actionBack,
  101. *actionForward,
  102. *actionUndo,
  103. *actionRedo,
  104. *actionCut,
  105. *actionCopy,
  106. *actionPaste,
  107. *actionPasteText,
  108. *actionSelect,
  109. *actionFind,
  110. *actionReplace,
  111. *actionImage,
  112. *actionNote,
  113. *actionLink,
  114. *actionBody,
  115. *actionTitle,
  116. *actionEpigraph,
  117. *actionSubtitle,
  118. *actionAnnot,
  119. *actionPoem,
  120. *actionDate,
  121. *actionStanza,
  122. *actionAuthor,
  123. *actionSection,
  124. *actionParaSeparator,
  125. *actionLineSeparator,
  126. *actionClearFormat,
  127. *actionTextBold,
  128. *actionTextItalic,
  129. *actionTextStrike,
  130. *actionTextCode,
  131. *actionTextSub,
  132. *actionTextSup,
  133. *actionContents,
  134. *actionPictures,
  135. *actionInspect,
  136. *actionZoomIn,
  137. *actionZoomOut,
  138. *actionZoomReset
  139. ;
  140. };
  141. #endif // FB2MAIN_H