fb2main.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 openSettings();
  56. private:
  57. QString appTitle() const;
  58. private:
  59. void createHead();
  60. void createTree();
  61. void createImgs();
  62. void createActions();
  63. void createStatusBar();
  64. void readSettings();
  65. void writeSettings();
  66. void setModified(bool modified);
  67. bool maybeSave();
  68. bool saveFile(const QString &fileName, const QString &codec = QString());
  69. void setCurrentFile(const QString &fileName = QString());
  70. FbMainWindow *findFbMainWindow(const QString &fileName);
  71. FbMainDock *mainDock;
  72. QTextEdit *noteEdit;
  73. QToolBar *toolEdit;
  74. QWebInspector *inspector;
  75. QTextEdit *messageEdit;
  76. QString curFile;
  77. bool isSwitched;
  78. bool isUntitled;
  79. };
  80. #endif // FB2MAIN_H