fb2main.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef FB2MAIN_H
  2. #define FB2MAIN_H
  3. #include <QMainWindow>
  4. #include <QDockWidget>
  5. QT_BEGIN_NAMESPACE
  6. class QAction;
  7. class QFile;
  8. class QMenu;
  9. class QModelIndex;
  10. class QTextEdit;
  11. class QTreeView;
  12. class QWebInspector;
  13. QT_END_NAMESPACE
  14. class FbMainDock;
  15. class FbCodeEdit;
  16. class FbTreeView;
  17. class FbHeadEdit;
  18. class FbTextEdit;
  19. class FbTextFrame;
  20. class FbTextPage;
  21. class FbLogDock: public QDockWidget
  22. {
  23. Q_OBJECT
  24. public:
  25. explicit FbLogDock(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0)
  26. : QDockWidget(title, parent, flags) {}
  27. QSize sizeHint() const {
  28. QSize sh = QDockWidget::sizeHint();
  29. sh.setHeight(40);
  30. return sh;
  31. }
  32. };
  33. class FbMainWindow : public QMainWindow
  34. {
  35. Q_OBJECT
  36. public:
  37. enum ViewMode { FB2, XML };
  38. explicit FbMainWindow(const QString &filename = QString(), ViewMode mode = FB2);
  39. protected:
  40. void closeEvent(QCloseEvent *event);
  41. signals:
  42. void showInspectorChecked(bool);
  43. public slots:
  44. void logMessage(const QString &message);
  45. private slots:
  46. void fileNew();
  47. void fileOpen();
  48. bool fileSave();
  49. bool fileSaveAs();
  50. void about();
  51. void documentWasModified();
  52. void logDestroyed();
  53. void logShowed();
  54. void status(const QString &text);
  55. void clipboardDataChanged();
  56. void openSettings();
  57. private:
  58. QString appTitle() const;
  59. private:
  60. void createHead();
  61. void createTree();
  62. void createImgs();
  63. void createActions();
  64. void createStatusBar();
  65. void readSettings();
  66. void writeSettings();
  67. void setModified(bool modified);
  68. bool maybeSave();
  69. bool saveFile(const QString &fileName, const QString &codec = QString());
  70. void setCurrentFile(const QString &fileName = QString());
  71. FbMainWindow *findFbMainWindow(const QString &fileName);
  72. FbMainDock *mainDock;
  73. QTextEdit *noteEdit;
  74. QToolBar *toolEdit;
  75. QWebInspector *inspector;
  76. QTextEdit *messageEdit;
  77. QString curFile;
  78. bool isSwitched;
  79. bool isUntitled;
  80. };
  81. #endif // FB2MAIN_H