fb2main.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 QThread;
  11. class QTreeView;
  12. QT_END_NAMESPACE
  13. class QsciScintilla;
  14. class Fb2MainDocument;
  15. class Fb2ReadThread;
  16. class Fb2WebView;
  17. class Fb2MainWindow : public QMainWindow
  18. {
  19. Q_OBJECT
  20. public:
  21. explicit Fb2MainWindow();
  22. explicit Fb2MainWindow(const QString &filename);
  23. explicit Fb2MainWindow(const QString &filename, Fb2MainDocument * document);
  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 treeActivated(const QModelIndex &index);
  36. void treeDestroyed();
  37. void logDestroyed();
  38. void logShowed();
  39. void viewQsci();
  40. void viewText();
  41. void textBold();
  42. void textItalic();
  43. void textStrike();
  44. void textSub();
  45. void textSup();
  46. void clipboardDataChanged();
  47. void selectionChanged();
  48. void undoChanged();
  49. void redoChanged();
  50. private:
  51. bool loadXML(const QString &filename);
  52. QIcon icon(const QString &name);
  53. private:
  54. void init();
  55. void createText();
  56. void createQsci();
  57. void createActions();
  58. void createStatusBar();
  59. void readSettings();
  60. void writeSettings();
  61. bool maybeSave();
  62. bool saveFile(const QString &fileName);
  63. void setCurrentFile(const QString &fileName, const QString &html = QString());
  64. Fb2MainWindow *findFb2MainWindow(const QString &fileName);
  65. Fb2ReadThread *thread;
  66. Fb2WebView *textEdit;
  67. QTextEdit *noteEdit;
  68. QTextEdit *messageEdit;
  69. QsciScintilla *qsciEdit;
  70. QTreeView * treeView;
  71. QString curFile;
  72. bool isUntitled;
  73. QAction
  74. *actionBack,
  75. *actionForward,
  76. *actionUndo,
  77. *actionRedo,
  78. *actionCut,
  79. *actionCopy,
  80. *actionPaste,
  81. *actionSelect,
  82. *actionTextBold,
  83. *actionTextItalic,
  84. *actionTextStrike,
  85. *actionTextSub,
  86. *actionTextSup,
  87. *actionZoomIn,
  88. *actionZoomOut,
  89. *actionZoomOrig
  90. ;
  91. };
  92. #endif // FB2MAIN_H