fb2main.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 clipboardDataChanged();
  45. void selectionChanged();
  46. void undoChanged();
  47. void redoChanged();
  48. void openSettings();
  49. private:
  50. bool loadXML(const QString &filename);
  51. QString appTitle() const;
  52. private:
  53. void init();
  54. void createHead();
  55. void createTree();
  56. void createActions();
  57. void createStatusBar();
  58. void readSettings();
  59. void writeSettings();
  60. bool maybeSave();
  61. bool saveFile(const QString &fileName, const QString &codec = QString());
  62. void setCurrentFile(const QString &fileName = QString());
  63. Fb2MainWindow *findFb2MainWindow(const QString &fileName);
  64. Fb2WebView *textEdit;
  65. QWebInspector *inspector;
  66. Fb2HeadView *headTree;
  67. QTextEdit *noteEdit;
  68. QTextEdit *messageEdit;
  69. QDockWidget *dockTree;
  70. Fb2CodeEdit *codeEdit;
  71. Fb2TreeView *treeView;
  72. QString curFile;
  73. bool isUntitled;
  74. QToolBar *toolEdit;
  75. QMenu
  76. *menuEdit,
  77. *menuText,
  78. *menuView;
  79. QAction
  80. *actionBack,
  81. *actionForward,
  82. *actionUndo,
  83. *actionRedo,
  84. *actionCut,
  85. *actionCopy,
  86. *actionPaste,
  87. *actionSelect,
  88. *actionFind,
  89. *actionReplace,
  90. *actionInsert,
  91. *actionDelete,
  92. *actionImage,
  93. *actionNote,
  94. *actionLink,
  95. *actionBody,
  96. *actionTtile,
  97. *actionDescr,
  98. *actionPoem,
  99. *actionStanza,
  100. *actionAuthor,
  101. *actionSection,
  102. *actionTextBold,
  103. *actionTextItalic,
  104. *actionTextStrike,
  105. *actionTextSub,
  106. *actionTextSup,
  107. *actionInspect,
  108. *actionZoomIn,
  109. *actionZoomOut,
  110. *actionZoomReset
  111. ;
  112. };
  113. #endif // FB2MAIN_H