1
0

fb2main.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 QThread;
  10. class QTextEdit;
  11. class QTreeView;
  12. class QTextDocument;
  13. class QWebView;
  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 cursorPositionChanged();
  49. void clipboardDataChanged();
  50. private:
  51. bool loadXML(const QString &filename);
  52. void connectTextDocument(QTextDocument * document);
  53. QIcon icon(const QString &name);
  54. private:
  55. void init();
  56. void createText();
  57. void createQsci();
  58. void createActions();
  59. void createStatusBar();
  60. void readSettings();
  61. void writeSettings();
  62. bool maybeSave();
  63. bool saveFile(const QString &fileName);
  64. void setCurrentFile(const QString &fileName, const QString &html = QString());
  65. MainWindow *findMainWindow(const QString &fileName);
  66. Fb2ReadThread *thread;
  67. QWebView *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. *actionZoomOrig
  88. ;
  89. };
  90. #endif // FB2MAIN_H