fb2main.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 QThread;
  10. class QTextEdit;
  11. class QTreeView;
  12. class QTextDocument;
  13. QT_END_NAMESPACE
  14. class QsciScintilla;
  15. class Fb2MainDocument;
  16. class Fb2ReadThread;
  17. class MainWindow : public QMainWindow
  18. {
  19. Q_OBJECT
  20. public:
  21. explicit MainWindow();
  22. explicit MainWindow(const QString &filename);
  23. explicit MainWindow(const QString &filename, Fb2MainDocument * document);
  24. protected:
  25. void closeEvent(QCloseEvent *event);
  26. public slots:
  27. void logMessage(const QString &message);
  28. void sendDocument();
  29. private slots:
  30. void fileNew();
  31. void fileOpen();
  32. bool fileSave();
  33. bool fileSaveAs();
  34. void about();
  35. void documentWasModified();
  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 currentCharFormatChanged(const QTextCharFormat &format);
  47. void cursorPositionChanged();
  48. void clipboardDataChanged();
  49. private:
  50. bool loadXML(const QString &filename);
  51. void connectTextDocument(QTextDocument * document);
  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, QTextDocument * document = NULL);
  64. void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
  65. MainWindow *findMainWindow(const QString &fileName);
  66. Fb2ReadThread *thread;
  67. QTextEdit *textEdit;
  68. QTextEdit *noteEdit;
  69. QTextEdit *messageEdit;
  70. QsciScintilla *qsciEdit;
  71. QTreeView * treeView;
  72. QString curFile;
  73. bool isUntitled;
  74. QAction
  75. *actionUndo,
  76. *actionRedo,
  77. *actionCut,
  78. *actionCopy,
  79. *actionPaste,
  80. *actionTextBold,
  81. *actionTextItalic,
  82. *actionTextStrike,
  83. *actionTextSub,
  84. *actionTextSup,
  85. *actionZoomIn,
  86. *actionZoomOut
  87. ;
  88. };
  89. #endif // FB2MAIN_H