fb2main.h 2.3 KB

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