fb2main.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 Fb2WebView;
  18. class Fb2MainWindow : public QMainWindow
  19. {
  20. Q_OBJECT
  21. public:
  22. enum ViewMode { FB2, XML };
  23. explicit Fb2MainWindow();
  24. explicit Fb2MainWindow(const QString &filename, 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 init();
  58. void createHead();
  59. void createTree();
  60. void createActions();
  61. void createStatusBar();
  62. void readSettings();
  63. void writeSettings();
  64. bool maybeSave();
  65. bool saveFile(const QString &fileName, const QString &codec = QString());
  66. void setCurrentFile(const QString &fileName = QString());
  67. Fb2MainWindow *findFb2MainWindow(const QString &fileName);
  68. Fb2WebView *textEdit;
  69. QWebInspector *inspector;
  70. Fb2HeadView *headTree;
  71. QTextEdit *noteEdit;
  72. QTextEdit *messageEdit;
  73. QDockWidget *dockTree;
  74. Fb2CodeEdit *codeEdit;
  75. QString curFile;
  76. bool isUntitled;
  77. QToolBar *toolEdit;
  78. QMenu
  79. *menuEdit,
  80. *menuText,
  81. *menuView;
  82. QAction
  83. *actionBack,
  84. *actionForward,
  85. *actionUndo,
  86. *actionRedo,
  87. *actionCut,
  88. *actionCopy,
  89. *actionPaste,
  90. *actionSelect,
  91. *actionFind,
  92. *actionReplace,
  93. *actionImage,
  94. *actionNote,
  95. *actionLink,
  96. *actionBody,
  97. *actionTitle,
  98. *actionSubtitle,
  99. *actionDescr,
  100. *actionPoem,
  101. *actionStanza,
  102. *actionAuthor,
  103. *actionSection,
  104. *actionTextBold,
  105. *actionTextItalic,
  106. *actionTextStrike,
  107. *actionTextSub,
  108. *actionTextSup,
  109. *actionInspect,
  110. *actionZoomIn,
  111. *actionZoomOut,
  112. *actionZoomReset
  113. ;
  114. };
  115. #endif // FB2MAIN_H