fb2main.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef FB2MAIN_H
  2. #define FB2MAIN_H
  3. #include <QMainWindow>
  4. #include <QTextCharFormat>
  5. QT_BEGIN_NAMESPACE
  6. class QAction;
  7. class QMenu;
  8. class QFile;
  9. class QModelIndex;
  10. class QThread;
  11. class QTextEdit;
  12. class QTreeView;
  13. class QTextDocument;
  14. class QWebView;
  15. QT_END_NAMESPACE
  16. class QsciScintilla;
  17. class Fb2MainDocument;
  18. class Fb2ReadThread;
  19. class MainWindow : public QMainWindow
  20. {
  21. Q_OBJECT
  22. public:
  23. explicit MainWindow();
  24. explicit MainWindow(const QString &filename);
  25. explicit MainWindow(const QString &filename, Fb2MainDocument * document);
  26. protected:
  27. void closeEvent(QCloseEvent *event);
  28. public slots:
  29. void logMessage(const QString &message);
  30. void sendDocument();
  31. private slots:
  32. void fileNew();
  33. void fileOpen();
  34. bool fileSave();
  35. bool fileSaveAs();
  36. void about();
  37. void documentWasModified();
  38. void treeActivated(const QModelIndex &index);
  39. void treeDestroyed();
  40. void logDestroyed();
  41. void logShowed();
  42. void viewQsci();
  43. void viewText();
  44. void textBold();
  45. void textItalic();
  46. void textStrike();
  47. void textSub();
  48. void textSup();
  49. void currentCharFormatChanged(const QTextCharFormat &format);
  50. void cursorPositionChanged();
  51. void clipboardDataChanged();
  52. private:
  53. bool loadXML(const QString &filename);
  54. void connectTextDocument(QTextDocument * document);
  55. QIcon icon(const QString &name);
  56. private:
  57. void init();
  58. void createText();
  59. void createQsci();
  60. void createActions();
  61. void createStatusBar();
  62. void readSettings();
  63. void writeSettings();
  64. bool maybeSave();
  65. bool saveFile(const QString &fileName);
  66. void setCurrentFile(const QString &fileName, const QString &html = QString());
  67. void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
  68. MainWindow *findMainWindow(const QString &fileName);
  69. Fb2ReadThread *thread;
  70. QWebView *textEdit;
  71. QTextEdit *noteEdit;
  72. QTextEdit *messageEdit;
  73. QsciScintilla *qsciEdit;
  74. QTreeView * treeView;
  75. QString curFile;
  76. bool isUntitled;
  77. QAction
  78. *actionUndo,
  79. *actionRedo,
  80. *actionCut,
  81. *actionCopy,
  82. *actionPaste,
  83. *actionTextBold,
  84. *actionTextItalic,
  85. *actionTextStrike,
  86. *actionTextSub,
  87. *actionTextSup,
  88. *actionZoomIn,
  89. *actionZoomOut
  90. ;
  91. };
  92. #endif // FB2MAIN_H