1
0

fb2main.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 Fb2CodeEdit;
  15. class Fb2TreeView;
  16. class Fb2HeadView;
  17. class Fb2TextFrame;
  18. class Fb2TextEdit;
  19. class Fb2MainWindow : public QMainWindow
  20. {
  21. Q_OBJECT
  22. public:
  23. enum ViewMode { FB2, XML };
  24. explicit Fb2MainWindow();
  25. explicit Fb2MainWindow(const QString &filename, ViewMode mode = FB2);
  26. protected:
  27. void closeEvent(QCloseEvent *event);
  28. public slots:
  29. void logMessage(const QString &message);
  30. private slots:
  31. void fileNew();
  32. void fileOpen();
  33. bool fileSave();
  34. bool fileSaveAs();
  35. void about();
  36. void documentWasModified();
  37. void checkScintillaUndo();
  38. void treeDestroyed();
  39. void logDestroyed();
  40. void logShowed();
  41. void viewCode();
  42. void viewText();
  43. void viewHead();
  44. void viewTree();
  45. void cleanChanged(bool clean);
  46. void canUndoChanged(bool canUndo);
  47. void canRedoChanged(bool canRedo);
  48. void status(const QString &text);
  49. void clipboardDataChanged();
  50. void selectionChanged();
  51. void undoChanged();
  52. void redoChanged();
  53. void openSettings();
  54. private:
  55. bool loadXML(const QString &filename);
  56. QString appTitle() const;
  57. private:
  58. void init();
  59. void createHead();
  60. void createTree();
  61. void createActions();
  62. void createStatusBar();
  63. void readSettings();
  64. void writeSettings();
  65. bool maybeSave();
  66. bool saveFile(const QString &fileName, const QString &codec = QString());
  67. void setCurrentFile(const QString &fileName = QString());
  68. Fb2MainWindow *findFb2MainWindow(const QString &fileName);
  69. Fb2TextFrame *textFrame;
  70. QWebInspector *inspector;
  71. Fb2HeadView *headTree;
  72. QTextEdit *noteEdit;
  73. QTextEdit *messageEdit;
  74. QDockWidget *dockTree;
  75. Fb2CodeEdit *codeEdit;
  76. QString curFile;
  77. bool isUntitled;
  78. QToolBar *toolEdit;
  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. *actionSubtitle,
  100. *actionDescr,
  101. *actionPoem,
  102. *actionStanza,
  103. *actionAuthor,
  104. *actionSection,
  105. *actionTextBold,
  106. *actionTextItalic,
  107. *actionTextStrike,
  108. *actionTextSub,
  109. *actionTextSup,
  110. *actionInspect,
  111. *actionZoomIn,
  112. *actionZoomOut,
  113. *actionZoomReset
  114. ;
  115. };
  116. #endif // FB2MAIN_H