Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
mainwidget.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
23 #ifndef MAINWIDGET_H
24 #define MAINWIDGET_H
25 
26 #include <QWidget>
27 #include "diagramrenderer.h"
28 #include "toolbar.h"
29 
30 namespace Ui {
31 class MainWidget;
32 }
33 
34 class MainWidget : public QWidget
35 {
36  Q_OBJECT
37 
38  friend class MainWindow;
39 
40 public:
41  explicit MainWidget(
42  QString const &nameFile,
43  QWidget *parent = nullptr);
44  explicit MainWidget(QWidget *parent = nullptr);
45  ~MainWidget() override;
46 
47  void setupUi();
48  void setupConnections();
49 
50  void keyPressEvent(QKeyEvent *event) override;
51  bool eventFilter(QObject *, QEvent *) override
52  {
53  return true;
54  }
55 
56 public slots:
57 
58  void setSessionMode();
59  void setDiagramMode();
60 
61  void newDiagram();
62  void newSession();
63  void open();
64  void loadFile(QString const &fileName);
65 
66  void setCurrentFile(QString const&);
67  bool maybeSave();
68  bool save();
69  bool saveAs();
70  bool saveFile(QString const &fileName);
71 
72  void exportPNG();
73 
74  void latexSource();
75  void latexSourceToClipboard();
76  void latexExportPNG();
77  void latexExportPDF();
78 
79  void setNormalMode(bool checked = true);
80  void setInsertMode(bool checked = true);
81  void setSelectMode(bool checked = true);
82 
83  void resetGrid();
84  void resetZoom();
85  void resetRotation();
86 
87  void modif();
88 
89  void setSaved(bool);
90 
91 signals:
92 
93  void sessionMode();
94  void diagramMode();
95 
96  void normalMode();
97  void selectMode();
98  void insertMode();
99 
100  void isChanged();
101  void isSaved();
102 
103 private:
104  Ui::MainWidget *ui;
105  DiagramRenderer *renderer;
106  ToolBar *toolBar;
107  QString currentFile;
108  bool saved;
109 };
110 
111 #endif // MAINWIDGET_H
Definition: diagramrenderer.h:34
Definition: diagramrenderer.h:40
Definition: toolbar.h:32
Definition: mainwindow.h:33
Definition: mainwidget.h:34