fb2main.hpp 3.3 KB

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