Debian Codegraph @

src/Gui/DemoMode.h

raw
1 /***************************************************************************
2 * Copyright (c) 2010 Werner Mayer <wmayer[at]users.sourceforge.net> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23 #ifndef GUI_DIALOG_DEMOMODE_H
24 #define GUI_DIALOG_DEMOMODE_H
25
26 #include <Inventor/SbVec3f.h>
27 #include <QDialog>
28 #include <FCGlobal.h>
29
30
31 class QTimer;
32 class SoCamera;
33 class SbVec3f;
34 class SbRotation;
35
36 namespace Gui
37 {
38 class View3DInventor;
39 namespace Dialog
40 {
41
42 /**
43 * @author Werner Mayer
44 */
45 class Ui_DemoMode;
46 class GuiExport DemoMode: public QDialog
47 {
48 Q_OBJECT
49
50 public:
51 explicit DemoMode(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags());
52 ~DemoMode() override;
53
54 void accept() override;
55 void reject() override;
56
57 protected:
58 void setupConnections();
59 void onPlayButtonToggled(bool);
60 void onFullscreenToggled(bool);
61 void onTimerCheckToggled(bool);
62 void onSpeedSliderValueChanged(int);
63 void onAngleSliderValueChanged(int);
64 void onTimeoutValueChanged(int);
65 void onAutoPlay();
66
67 private:
68 void reset();
69 float getSpeed(int) const;
70 void reorientCamera(SoCamera* cam, const SbRotation& rot);
71 SbVec3f getDirection(Gui::View3DInventor*) const;
72 Gui::View3DInventor* activeView() const;
73 void startAnimation(Gui::View3DInventor*);
74 void changeEvent(QEvent* e) override;
75 bool eventFilter(QObject*, QEvent*) override;
76 void showEvent(QShowEvent*) override;
77 void hideEvent(QHideEvent*) override;
78
79 private:
80 int oldvalue;
81 SbVec3f viewAxis;
82 bool wasHidden;
83 QPoint pnt;
84 QPoint oldPos;
85 Ui_DemoMode* ui;
86 QTimer* timer;
87 QTimer* showHideTimer;
88 };
89
90 } // namespace Dialog
91 } // namespace Gui
92
93 #endif // GUI_DIALOG_DEMOMODE_H