/home/docs/checkouts/readthedocs.org/user_builds/mathvizanimator/checkouts/latest/libs/mva_gui/include/windows/mainwindowhandler.h Source File

MathVizAnimator: /home/docs/checkouts/readthedocs.org/user_builds/mathvizanimator/checkouts/latest/libs/mva_gui/include/windows/mainwindowhandler.h Source File
MathVizAnimator  0.0.1
mainwindowhandler.h
1 /* mathvizanimator
2  * Copyright (C) 2023 codingwithmagga
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef LIBS_MVA_GUI_INCLUDE_WINDOWS_MAINWINDOWHANDLER_H_
19 #define LIBS_MVA_GUI_INCLUDE_WINDOWS_MAINWINDOWHANDLER_H_
20 
21 #include <QFileInfo>
22 #include <QObject>
23 #include <QQuickItem>
24 
25 #include "basic_item.h"
26 
27 class MainWindowHandler : public QObject {
28  Q_OBJECT
29 
30  Q_PROPERTY(QSize project_size READ projectSize WRITE setProjectSize NOTIFY projectSizeChanged)
31  Q_PROPERTY(qint32 fps READ fps WRITE setFPS NOTIFY fpsChanged)
32  Q_PROPERTY(qint32 video_length READ videoLength WRITE setVideoLength NOTIFY videoLengthChanged)
33  Q_PROPERTY(QColor background_color READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
34 
35  public:
36  explicit MainWindowHandler(QObject* parent = Q_NULLPTR);
37 
38  qint32 fps() const;
39  void setFPS(const qint32 new_fps);
40 
41  qint32 videoLength() const;
42  void setVideoLength(const qint32 new_video_length);
43 
44  QSize projectSize() const;
45  void setProjectSize(const QSize& new_project_size);
46 
47  QColor backgroundColor() const;
48  void setBackgroundColor(const QColor& newBackground_color);
49 
50  public slots:
51 
52  void snapshot(const QVariant& file);
53  void render(const QVariant& file);
54 
55  void newProject();
56  void saveProject(const QVariant& file);
57  void loadProject(const QVariant& file);
58 
59  void openSVGFolder() const;
60 
61  void addItem(QQuickItem* item);
62 
63  void removeCurrentItem();
64  void removeAnimation(const qint32 animation_number);
65 
66  void itemClickedByUser(const QString& itemName);
67  void setTimeByUser(const QVariant& time);
68  void propertyChangedByUser(const QString& item_name, const QByteArray& property, const QVariant& value);
69 
70  void updateProjectSettings(const QVariantList& new_project_settings);
71  void updateProjectSettings(const QList<qint32>& new_project_settings, const QColor& new_background_color);
72 
73  void addAnimation(
74  const QString& item_name, const QString& animation_type, const qreal start_time, const qreal duration);
75 
76  signals:
77  void fpsChanged(const qint32 new_fps);
78  void videoLengthChanged(const qint32 new_video_length);
79  void projectSizeChanged();
80  void backgroundColorChanged(const QColor& new_background_color);
81 
82  void snapshotRequested(const QFileInfo& snapshot_file_info);
83  void renderingRequested(const QFileInfo& video_file_info);
84 
85  void newProjectRequested();
86  void saveProjectRequested(const QFileInfo& save_file_info);
87  void loadProjectRequested(const QFileInfo& load_file_info);
88 
89  void removeCurrentItemRequested();
90  void removeAnimationRequested(const qint32 animation_number);
91 
92  void itemAdded(BasicItem* item);
93  void itemClicked(const QString& name);
94  void timeChanged(const qreal time);
95  void propertyChanged(const QString& item_name, const QByteArray& property, const QVariant& value);
96 
97  void renderingVideoFinished(const QFileInfo& video_file);
98 
99  void addAnimationSignal(
100  const QString& item_name, const QString& animation_type, const qreal start_time, const qreal duration);
101 
102  private:
103  QObject* m_qml_creation_area;
104 
105  QSize m_project_size = QSize(1024, 768);
106  qint32 m_fps = 24;
107  qint32 m_video_length = 5;
108  QColor m_background_color = QColor("black");
109 };
110 
111 #endif // LIBS_MVA_GUI_INCLUDE_WINDOWS_MAINWINDOWHANDLER_H_
Definition: basic_item.h:28
Definition: mainwindowhandler.h:27