fb2main.h 2.5 KB

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