fb2main.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef FB2MAIN_H
  2. #define FB2MAIN_H
  3. #include <QMainWindow>
  4. #include <QDockWidget>
  5. #include <QListView>
  6. #include <QXmlParseException>
  7. QT_BEGIN_NAMESPACE
  8. class QAction;
  9. class QFile;
  10. class QMenu;
  11. class QModelIndex;
  12. class QTextEdit;
  13. class QTreeView;
  14. class QWebInspector;
  15. QT_END_NAMESPACE
  16. class FbLogDock;
  17. class FbMainDock;
  18. class FbMainWindow : public QMainWindow
  19. {
  20. Q_OBJECT
  21. public:
  22. enum ViewMode { FB2, XML };
  23. explicit FbMainWindow(const QString &filename = QString(), ViewMode mode = FB2);
  24. protected:
  25. void closeEvent(QCloseEvent *event);
  26. signals:
  27. void showInspectorChecked(bool);
  28. public slots:
  29. void warning(int row, int col, const QString &msg);
  30. void error(int row, int col, const QString &msg);
  31. void fatal(int row, int col, const QString &msg);
  32. void logMessage(const QString &message);
  33. void status(const QString &text);
  34. private slots:
  35. void fileNew();
  36. void fileOpen();
  37. bool fileSave();
  38. bool fileSaveAs();
  39. void about();
  40. void documentWasModified();
  41. void logDestroyed();
  42. void openSettings();
  43. private:
  44. QString appTitle() const;
  45. private:
  46. void createHead();
  47. void createTree();
  48. void createImgs();
  49. void createActions();
  50. void createStatusBar();
  51. void readSettings();
  52. void writeSettings();
  53. void setModified(bool modified);
  54. bool maybeSave();
  55. bool saveFile(const QString &fileName, const QString &codec = QString());
  56. void setCurrentFile(const QString &fileName = QString());
  57. FbMainWindow *findFbMainWindow(const QString &fileName);
  58. FbMainDock *mainDock;
  59. QTextEdit *noteEdit;
  60. QToolBar *toolEdit;
  61. FbLogDock *logDock;
  62. QString curFile;
  63. bool isSwitched;
  64. bool isUntitled;
  65. };
  66. #endif // FB2MAIN_H