1
0

fb2main.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #include "fb2logs.hpp"
  19. class FbMainWindow : public QMainWindow
  20. {
  21. Q_OBJECT
  22. public:
  23. enum ViewMode { FB2, XML };
  24. explicit FbMainWindow(const QString &filename = QString(), ViewMode mode = FB2);
  25. protected:
  26. void closeEvent(QCloseEvent *event);
  27. signals:
  28. void showInspectorChecked(bool);
  29. public slots:
  30. void warning(int row, int col, const QString &msg);
  31. void error(int row, int col, const QString &msg);
  32. void fatal(int row, int col, const QString &msg);
  33. void logMessage(QtMsgType type, const QString &message);
  34. void status(const QString &text);
  35. private slots:
  36. void fileNew();
  37. void fileOpen();
  38. bool fileSave();
  39. bool fileSaveAs();
  40. void about();
  41. void textChanged(bool modified);
  42. void logDestroyed();
  43. void openSettings();
  44. private:
  45. QString appTitle() const;
  46. private:
  47. void createHead();
  48. void createTree();
  49. void createImgs();
  50. void createActions();
  51. void createStatusBar();
  52. void readSettings();
  53. void writeSettings();
  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