fb2main.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. public slots:
  34. void logMessage(const QString &message);
  35. private slots:
  36. void fileNew();
  37. void fileOpen();
  38. bool fileSave();
  39. bool fileSaveAs();
  40. void about();
  41. void documentWasModified();
  42. void checkScintillaUndo();
  43. void treeDestroyed();
  44. void imgsDestroyed();
  45. void logDestroyed();
  46. void logShowed();
  47. void viewCode();
  48. void viewText();
  49. void viewHead();
  50. void viewTree();
  51. void viewImgs();
  52. void cleanChanged(bool clean);
  53. void canUndoChanged(bool canUndo);
  54. void canRedoChanged(bool canRedo);
  55. void status(const QString &text);
  56. void clipboardDataChanged();
  57. void selectionChanged();
  58. void undoChanged();
  59. void redoChanged();
  60. void openSettings();
  61. private:
  62. bool loadXML(const QString &filename);
  63. QString appTitle() const;
  64. private:
  65. void createHead();
  66. void createTree();
  67. void createImgs();
  68. void createActions();
  69. void createStatusBar();
  70. void readSettings();
  71. void writeSettings();
  72. void setModified(bool modified);
  73. bool maybeSave();
  74. bool saveFile(const QString &fileName, const QString &codec = QString());
  75. void setCurrentFile(const QString &fileName = QString());
  76. FbMainWindow *findFbMainWindow(const QString &fileName);
  77. FbTextFrame *textFrame;
  78. FbCodeEdit *codeEdit;
  79. FbHeadView *headTree;
  80. QTextEdit *noteEdit;
  81. QToolBar *toolEdit;
  82. QDockWidget *dockTree;
  83. QDockWidget *dockImgs;
  84. QWebInspector *inspector;
  85. QTextEdit *messageEdit;
  86. QString curFile;
  87. bool isSwitched;
  88. bool isUntitled;
  89. QMenu
  90. *menuEdit,
  91. *menuText,
  92. *menuView;
  93. QAction
  94. *actionBack,
  95. *actionForward,
  96. *actionUndo,
  97. *actionRedo,
  98. *actionCut,
  99. *actionCopy,
  100. *actionPaste,
  101. *actionSelect,
  102. *actionFind,
  103. *actionReplace,
  104. *actionImage,
  105. *actionNote,
  106. *actionLink,
  107. *actionBody,
  108. *actionTitle,
  109. *actionEpigraph,
  110. *actionSubtitle,
  111. *actionAnnot,
  112. *actionPoem,
  113. *actionDate,
  114. *actionStanza,
  115. *actionAuthor,
  116. *actionSection,
  117. *actionTextBold,
  118. *actionTextItalic,
  119. *actionTextStrike,
  120. *actionTextCode,
  121. *actionTextSub,
  122. *actionTextSup,
  123. *actionInspect,
  124. *actionZoomIn,
  125. *actionZoomOut,
  126. *actionZoomReset
  127. ;
  128. };
  129. #endif // FB2MAIN_H