1
0

fb2main.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef FB2MAIN_H
  2. #define FB2MAIN_H
  3. #include <QMainWindow>
  4. QT_BEGIN_NAMESPACE
  5. class QAction;
  6. class QMenu;
  7. class QTextEdit;
  8. class QTextDocument;
  9. QT_END_NAMESPACE
  10. class MainWindow : public QMainWindow
  11. {
  12. Q_OBJECT
  13. public:
  14. MainWindow();
  15. MainWindow(const QString &filename, QTextDocument * document = NULL);
  16. static QTextDocument * LoadDocument(const QString &filename);
  17. protected:
  18. void closeEvent(QCloseEvent *event);
  19. private slots:
  20. void newFile();
  21. void open();
  22. bool save();
  23. bool saveAs();
  24. void about();
  25. void documentWasModified();
  26. private:
  27. void init();
  28. void createActions();
  29. void createMenus();
  30. void createToolBars();
  31. void createStatusBar();
  32. void readSettings();
  33. void writeSettings();
  34. bool maybeSave();
  35. bool saveFile(const QString &fileName);
  36. void setCurrentFile(const QString &fileName, QTextDocument * document = NULL);
  37. QString strippedName(const QString &fullFileName);
  38. MainWindow *findMainWindow(const QString &fileName);
  39. QTextEdit *textEdit;
  40. QString curFile;
  41. bool isUntitled;
  42. QMenu *fileMenu;
  43. QMenu *editMenu;
  44. QMenu *helpMenu;
  45. QToolBar *fileToolBar;
  46. QToolBar *editToolBar;
  47. QAction *newAct;
  48. QAction *openAct;
  49. QAction *saveAct;
  50. QAction *saveAsAct;
  51. QAction *closeAct;
  52. QAction *exitAct;
  53. QAction *cutAct;
  54. QAction *copyAct;
  55. QAction *pasteAct;
  56. QAction *aboutAct;
  57. QAction *aboutQtAct;
  58. };
  59. #endif // FB2MAIN_H