fb2main.hpp 2.8 KB

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