1
0

fb2main.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. QT_END_NAMESPACE
  13. class QsciScintilla;
  14. class Fb2MainDocument;
  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 treeActivated(const QModelIndex &index);
  35. void treeDestroyed();
  36. void logDestroyed();
  37. void logShowed();
  38. void viewQsci();
  39. void viewText();
  40. void clipboardDataChanged();
  41. void loadFinished(bool ok);
  42. void selectionChanged();
  43. void undoChanged();
  44. void redoChanged();
  45. void showInspector();
  46. private:
  47. bool loadXML(const QString &filename);
  48. QIcon icon(const QString &name);
  49. private:
  50. void init();
  51. void createTree();
  52. void createText();
  53. void createQsci();
  54. void createActions();
  55. void createStatusBar();
  56. void readSettings();
  57. void writeSettings();
  58. bool maybeSave();
  59. bool saveFile(const QString &fileName);
  60. void setCurrentFile(const QString &fileName = QString());
  61. Fb2MainWindow *findFb2MainWindow(const QString &fileName);
  62. Fb2WebView *textEdit;
  63. QTextEdit *noteEdit;
  64. QTextEdit *messageEdit;
  65. QDockWidget *dockTree;
  66. QsciScintilla *qsciEdit;
  67. QTreeView * treeView;
  68. QString curFile;
  69. bool isUntitled;
  70. QAction
  71. *actionBack,
  72. *actionForward,
  73. *actionUndo,
  74. *actionRedo,
  75. *actionCut,
  76. *actionCopy,
  77. *actionPaste,
  78. *actionSelect,
  79. *actionTextBold,
  80. *actionTextItalic,
  81. *actionTextStrike,
  82. *actionTextSub,
  83. *actionTextSup,
  84. *actionInspect,
  85. *actionZoomIn,
  86. *actionZoomOut,
  87. *actionZoomOrig
  88. ;
  89. };
  90. #endif // FB2MAIN_H