fb2main.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef FB2MAIN_H
  2. #define FB2MAIN_H
  3. #include <QMainWindow>
  4. QT_BEGIN_NAMESPACE
  5. class QAction;
  6. class QMenu;
  7. class QFile;
  8. class QModelIndex;
  9. class QTextEdit;
  10. class QTreeView;
  11. QT_END_NAMESPACE
  12. class QsciScintilla;
  13. class Fb2MainDocument;
  14. class Fb2WebView;
  15. class Fb2MainWindow : public QMainWindow
  16. {
  17. Q_OBJECT
  18. public:
  19. enum ViewMode { FB2, XML };
  20. explicit Fb2MainWindow();
  21. explicit Fb2MainWindow(const QString &filename, ViewMode mode = FB2);
  22. protected:
  23. void closeEvent(QCloseEvent *event);
  24. public slots:
  25. void logMessage(const QString &message);
  26. private slots:
  27. void fileNew();
  28. void fileOpen();
  29. bool fileSave();
  30. bool fileSaveAs();
  31. void about();
  32. void documentWasModified();
  33. void treeActivated(const QModelIndex &index);
  34. void treeDestroyed();
  35. void logDestroyed();
  36. void logShowed();
  37. void viewQsci();
  38. void viewText();
  39. void clipboardDataChanged();
  40. void loadFinished(bool ok);
  41. void selectionChanged();
  42. void undoChanged();
  43. void redoChanged();
  44. void showInspector();
  45. private:
  46. bool loadXML(const QString &filename);
  47. QIcon icon(const QString &name);
  48. private:
  49. void init();
  50. void createTree();
  51. void createText();
  52. void createQsci();
  53. void createActions();
  54. void createStatusBar();
  55. void readSettings();
  56. void writeSettings();
  57. bool maybeSave();
  58. bool saveFile(const QString &fileName);
  59. void setCurrentFile(const QString &fileName = QString());
  60. Fb2MainWindow *findFb2MainWindow(const QString &fileName);
  61. Fb2WebView *textEdit;
  62. QTextEdit *noteEdit;
  63. QTextEdit *messageEdit;
  64. QsciScintilla *qsciEdit;
  65. QTreeView * treeView;
  66. QString curFile;
  67. bool isUntitled;
  68. QAction
  69. *actionBack,
  70. *actionForward,
  71. *actionUndo,
  72. *actionRedo,
  73. *actionCut,
  74. *actionCopy,
  75. *actionPaste,
  76. *actionSelect,
  77. *actionTextBold,
  78. *actionTextItalic,
  79. *actionTextStrike,
  80. *actionTextSub,
  81. *actionTextSup,
  82. *actionInspect,
  83. *actionZoomIn,
  84. *actionZoomOut,
  85. *actionZoomOrig
  86. ;
  87. };
  88. #endif // FB2MAIN_H