fb2main.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 Fb2Scintilla;
  15. class Fb2WebView;
  16. class Fb2MainWindow : public QMainWindow
  17. {
  18. Q_OBJECT
  19. public:
  20. enum ViewMode { FB2, XML };
  21. explicit Fb2MainWindow();
  22. explicit Fb2MainWindow(const QString &filename, ViewMode mode = FB2);
  23. protected:
  24. void closeEvent(QCloseEvent *event);
  25. public slots:
  26. void logMessage(const QString &message);
  27. private slots:
  28. void fileNew();
  29. void fileOpen();
  30. bool fileSave();
  31. bool fileSaveAs();
  32. void about();
  33. void documentWasModified();
  34. void checkScintillaUndo();
  35. void treeActivated(const QModelIndex &index);
  36. void treeDestroyed();
  37. void logDestroyed();
  38. void logShowed();
  39. void viewCode();
  40. void viewText();
  41. void viewHead();
  42. void viewTree();
  43. void clipboardDataChanged();
  44. void loadFinished(bool ok);
  45. void selectionChanged();
  46. void undoChanged();
  47. void redoChanged();
  48. void showInspector();
  49. void zoomOrig();
  50. void openSettings();
  51. private:
  52. bool loadXML(const QString &filename);
  53. QIcon icon(const QString &name);
  54. private:
  55. void init();
  56. void createHead();
  57. void createTree();
  58. void createActions();
  59. void createStatusBar();
  60. void readSettings();
  61. void writeSettings();
  62. bool maybeSave();
  63. bool saveFile(const QString &fileName);
  64. void setCurrentFile(const QString &fileName = QString());
  65. Fb2MainWindow *findFb2MainWindow(const QString &fileName);
  66. Fb2WebView *textEdit;
  67. QWebInspector *inspector;
  68. QTreeView *headTree;
  69. QTextEdit *noteEdit;
  70. QTextEdit *messageEdit;
  71. QDockWidget *dockTree;
  72. Fb2Scintilla *codeEdit;
  73. QTreeView *treeView;
  74. QString curFile;
  75. bool isUntitled;
  76. QToolBar *toolEdit;
  77. QMenu
  78. *menuEdit,
  79. *menuText,
  80. *menuView;
  81. QAction
  82. *actionBack,
  83. *actionForward,
  84. *actionUndo,
  85. *actionRedo,
  86. *actionCut,
  87. *actionCopy,
  88. *actionPaste,
  89. *actionSelect,
  90. *actionFind,
  91. *actionReplace,
  92. *actionInsert,
  93. *actionDelete,
  94. *actionImage,
  95. *actionNote,
  96. *actionLink,
  97. *actionBody,
  98. *actionTextBold,
  99. *actionTextItalic,
  100. *actionTextStrike,
  101. *actionTextSub,
  102. *actionTextSup,
  103. *actionInspect,
  104. *actionZoomIn,
  105. *actionZoomOut,
  106. *actionZoomOrig
  107. ;
  108. };
  109. #endif // FB2MAIN_H