Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MainWindow.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_UI_MAINWINDOW_H_
21 #define OMNI_UI_MAINWINDOW_H_
22 
23 #include <set>
24 #include <QMainWindow>
25 #include <QOpenGLContext>
26 #include <QComboBox>
27 #include <QModelIndex>
28 #include <QMessageBox>
29 #include <omni/util.h>
30 #include <omni/Session.h>
32 
33 namespace omni {
34  namespace ui {
35  namespace Ui {
36  class MainWindow;
37  }
38  class SceneViewer;
39  class ScreenSetup;
40  class Export;
41  class TuningGLView;
42  class ToolBar;
43  class RecentSessions;
44 
45  class MainWindow :
46  public QMainWindow {
47  Q_OBJECT
48 
49  public:
50  MainWindow(QMainWindow *parent = nullptr);
51  ~MainWindow();
52 
53  public slots:
54  /// Initiaties a new session after dialog was confirmed
55  void newProjection();
56 
57  /// Save current session
58  void saveProjection();
59 
60  /// Set current session under a new filename
61  void saveProjectionAs();
62 
63  /// Open a new session
64  void openProjection();
65 
66  /// Open a new session from filename
67  bool openProjection(const QString& _filename);
68 
69  /// Edit current session with a new filename
70  void editAsNew();
71 
72  /// Update all OpenGL views
73  void updateAllViews();
74 
75  /// Sets modified flag to true
76  void modified();
77 
78  protected:
79  void closeEvent(QCloseEvent *_event);
80  void showEvent(QShowEvent *_event);
81 
82  private slots:
83  /// Sets enabled state of toolbar buttons
84  void buttonState();
85 
86  /// Set current tuning index
87  void setTuningIndex();
88 
89  void addProjector(QAction *_action);
90 
91  /// Sets session mode
92  void setMode();
93 
94  private:
95  void readSettings();
96 
97  /// Makes a new session
98  void setupSession(std::shared_ptr<Session>& _session);
99 
100  /// Message Box for changing changes
101  QMessageBox::StandardButton saveChangesPrompt();
102 
103  /// Current filename
104  QString filename_;
105 
106  /// Current projection session
107  std::shared_ptr<Session> session_;
108 
109  /// Modified flag
110  bool modified_ = false;
111 
112  /// Locked flag
113  bool locked_;
114 
115  /// Screen Setup page
116  QUniquePtr<ScreenSetup> screenSetup_;
117 
118  /// ProjectionSetup/Canvas arrangement and live view page
119  QUniquePtr<SceneViewer> sceneViewer_;
120 
121  /// Page for warp grid, blend mask and color correction
122  QUniquePtr<TuningGLView> tuningView_;
123 
124  /// Page for exporting projection
125  QUniquePtr<Export> export_;
126 
127  /// Store recent sessions
128  QUniquePtr<RecentSessions> recentSessions_;
129 
130  /// MainWindow toolbar
131  QUniquePtr<ToolBar> toolBar_;
132 
133  /// UI containing designed widgets of this window
134  std::unique_ptr<Ui::MainWindow> ui_;
135  };
136  }
137 }
138 
139 #endif /* OMNI_UI_MAINWINDOW_H_ */
QUniquePtr< ToolBar > toolBar_
MainWindow toolbar.
Definition: MainWindow.h:131
QUniquePtr< ScreenSetup > screenSetup_
Screen Setup page.
Definition: MainWindow.h:116
QUniquePtr< SceneViewer > sceneViewer_
ProjectionSetup/Canvas arrangement and live view page.
Definition: MainWindow.h:119
void showEvent(QShowEvent *_event)
Definition: MainWindow.cpp:446
~MainWindow()
Definition: MainWindow.cpp:266
void readSettings()
Definition: MainWindow.cpp:269
void setMode()
Sets session mode.
Definition: MainWindow.cpp:514
QMessageBox::StandardButton saveChangesPrompt()
Message Box for changing changes.
Definition: MainWindow.cpp:591
QString filename_
Current filename.
Definition: MainWindow.h:104
QUniquePtr< TuningGLView > tuningView_
Page for warp grid, blend mask and color correction.
Definition: MainWindow.h:122
bool modified_
Modified flag.
Definition: MainWindow.h:110
void saveProjection()
Save current session.
Definition: MainWindow.cpp:328
std::shared_ptr< Session > session_
Current projection session.
Definition: MainWindow.h:107
void buttonState()
Sets enabled state of toolbar buttons.
Definition: MainWindow.cpp:469
MainWindow(QMainWindow *parent=nullptr)
Definition: MainWindow.cpp:53
void newProjection()
Initiaties a new session after dialog was confirmed.
Definition: MainWindow.cpp:314
Definition: MainWindow.h:45
std::unique_ptr< Ui::MainWindow > ui_
UI containing designed widgets of this window.
Definition: MainWindow.h:134
void saveProjectionAs()
Set current session under a new filename.
Definition: MainWindow.cpp:342
void modified()
Sets modified flag to true.
Definition: MainWindow.cpp:437
QUniquePtr< RecentSessions > recentSessions_
Store recent sessions.
Definition: MainWindow.h:128
void addProjector(QAction *_action)
Definition: MainWindow.cpp:499
bool locked_
Locked flag.
Definition: MainWindow.h:113
void updateAllViews()
Update all OpenGL views.
Definition: MainWindow.cpp:419
void editAsNew()
Edit current session with a new filename.
Definition: MainWindow.cpp:404
void closeEvent(QCloseEvent *_event)
Definition: MainWindow.cpp:449
QUniquePtr< Export > export_
Page for exporting projection.
Definition: MainWindow.h:125
void openProjection()
Open a new session.
Definition: MainWindow.cpp:367
void setupSession(std::shared_ptr< Session > &_session)
Makes a new session.
Definition: MainWindow.cpp:285
void setTuningIndex()
Set current tuning index.
Definition: MainWindow.cpp:487