The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

mainwindow.h 8.99 KB
Newer Older
1
2
// ================================================================================================
// 
schultezub's avatar
schultezub committed
3
// This file is part of the CAMPVis Software Framework.
4
// 
5
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
schultezub's avatar
schultezub committed
6
//      Christian Schulte zu Berge <christian.szb@in.tum.de>
7
//      Chair for Computer Aided Medical Procedures
8
9
//      Technische Universitaet Muenchen
//      Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
10
// 
schultezub's avatar
schultezub committed
11
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
12
// 
13
14
15
16
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 
// except in compliance with the License. You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
17
// 
18
19
20
21
// Unless required by applicable law or agreed to in writing, software distributed under the 
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
// either express or implied. See the License for the specific language governing permissions 
// and limitations under the License.
22
23
24
// 
// ================================================================================================

schultezub's avatar
schultezub committed
25
26
#ifndef CAMPVISMAINWINDOW_H__
#define CAMPVISMAINWINDOW_H__
27
28

#include "sigslot/sigslot.h"
schultezub's avatar
schultezub committed
29
#include "application/campvisapplication.h"
30
#include "application/gui/mdi/mdidockarea.h"
31
#include "application/gui/pipelinetreewidget.h"
schultezub's avatar
schultezub committed
32
#include "application/gui/properties/propertycollectionwidget.h"
33
#include "application/gui/logviewerwidget.h"
34
#include "application/gui/scriptingwidget.h"
35
#include "application/gui/workflowcontrollerwidget.h"
36
37
#include "application/tools/qtexteditlog.h"
#include "application/ui_mainwindow.h"
38
39

#include <QMainWindow>
40
41
#include <QVBoxLayout>
#include <QHBoxLayout>
42
#include <QPushButton>
Christian Schulte zu Berge's avatar
Christian Schulte zu Berge committed
43
#include <QComboBox>
44
#include <QScrollArea>
45
46
#include <vector>

schultezub's avatar
schultezub committed
47
namespace campvis {
48
    class DataContainerInspectorWidget;
49
    class DataContainerInspectorCanvas;
50
    class MdiDockableWindow;
51

schultezub's avatar
schultezub committed
52
    /**
schultezub's avatar
schultezub committed
53
     * Main Window for the CAMPVis application.
54
     * Wraps a nice Qt GUI around the CampVisApplication instance given during creation.
schultezub's avatar
schultezub committed
55
     */
56
    class MainWindow : public QMainWindow, public sigslot::has_slots {
57
        Q_OBJECT
58
59

    public:
schultezub's avatar
schultezub committed
60
61
        /**
         * Creates a new TumVis Main window for \a application.
62
         * \param   application     CampVisApplication to create a GUI for.
schultezub's avatar
schultezub committed
63
         */
64
        explicit MainWindow(CampVisApplication* application);
65

schultezub's avatar
schultezub committed
66
67
68
        /**
         * Destructor, make sure to call before destroying the application
         */
69
70
        ~MainWindow();

71
72
73
74
75
76
77
78
79
80
        
        /**
         * Initializes all OpenGL related stuff
         */
        void init();

        /**
         * Deinitializes all OpenGL related stuff
         */
        void deinit();
81

82
83
84
85
        /**
         * Size hint for the default window size
         * \return QSize(800, 450)
         */
86
87
        QSize sizeHint() const;

88
89
        /**
         * Adds a widget of a visualization pipeline to the main window.
90
91
         * \param   name       the name of the visualization pipeline
         * \param   canvas     the pipeline's canvas
92
         */
93
        MdiDockableWindow * addVisualizationPipelineWidget(const std::string& name, QWidget* canvas);
94

95
96
97
98
99
100
101

        /**
         * Sets the workflow of this Mainwindow to \a w.
         * \param   w   The workflow to display for this window.
         */
        void setWorkflow(AbstractWorkflow* w);

102
103
104
105
106
107
108
109
    protected:
        /**
         * Listens to resize events on _pipelinePropertiesWidget and resizes _pipelinePropertiesScrollArea accordingly
         * \param   watched    the object that caused the event
         * \param   event      the event to be filtered
         */
        bool eventFilter(QObject* watched, QEvent* event);

110
    signals:
111
        /// Qt signal for updating the PipelineWidget.
112
113
        void updatePipelineWidget(const std::vector<DataContainer*>&, const std::vector<AbstractPipeline*>&);

114
        /// Qt signal for updating the PropertyCollectionWidget
115
        void updatePropCollectionWidget(HasPropertyCollection*, DataContainer*);
116

117
    public slots:
118
119
120
121
122
        /**
         * Slot to be called by the PipelineWidget when the selected item changes.
         * \param   index   Index of the selected item
         */
        void onPipelineWidgetItemClicked(const QModelIndex& index);
Hossain Mahmud's avatar
stuck!    
Hossain Mahmud committed
123
        
124
125
126
127
128
129
130
131
132
133
        /**
         * Slot to be called when _btnExecute was clicked.
         */
        void onBtnExecuteClicked();

        /**
         * Slot to be called when _btnShowDataContainerInspector was clicked.
         */
        void onBtnShowDataContainerInspectorClicked();

Hossain Mahmud's avatar
stuck!    
Hossain Mahmud committed
134
135
136
137
138
139
140
141
142
143
        /**
         * Slot to be called when _btnExecute was clicked.
         */
        void onBtnLuaLoadClicked();

        /**
         * Slot to be called when _btnShowDataContainerInspector was clicked.
         */
        void onBtnLuaSaveClicked();

144
145
146
        /// Slot to be called when _btnPipelineFactory was clicked;
        void onBtnPipelineFactoryClicked();

147
148
149
        /// Slot to be called when all shaders shall be rebuilt.
        void onRebuildShadersClicked();

150
151
152
        /// Slot to be called when a Lua command shall be executed.
        void onLuaCommandExecuted(const QString& cmd);

153
    private:
154
155
156
157
158
159
160
161
162
163
164

        /**
         * Slot to be called by the application when its collection of pipelines has changed.
         */
        void onPipelinesChanged();

        /**
         * Slot to be called by the application when its collection of DataContainers has changed.
         */
        void onDataContainersChanged();

schultezub's avatar
schultezub committed
165
166
167
        /**
         * Setup Qt GUI stuff
         */
168
169
        void setup();

170
171
172
173
174
        /**
         * Create and populate the application's main menu.
         */
        void populateMainMenu();

175
176
177
178
179
180
181
182
183
184
185
186
        /**
         * Adds a widget to the top docking area of the main window.
         * This method creates a new dock with the specified name,
         * sets its widget to the given widget, and docks it in top
         * docking area of the main window. If there are already
         * other docks there, they're tabified with the new dock.
         * \param   name       the name that will be given to the created dock
         * \param   widget     the widget to add to the top docking area of the main window
         * \return  the dock created to store the provided widget
         */
        QDockWidget* dockPrimaryWidget(const std::string& name, QWidget* widget);

187
188
        Ui::MainWindow ui;                                  ///< Interface definition of the MainWindow

189
        CampVisApplication* _application;                    ///< Pointer to the application hosting the whole stuff
190

191
        MdiDockArea* _mdiArea;                              ///< MDI area (the window's central widget)
192
193
194
        QWidget* _containerWidget;                          ///< Widget to manage the app's DataContainers and pipelines
        QComboBox* _cbPipelineFactory;                      ///< Combobox for selecting the Pipelines from the PipelineFactory
        QPushButton* _btnPipelineFactory;                   ///< Button to add a Pipeline from the factory
195
        PipelineTreeWidget* _pipelineWidget;                ///< Widget for browsing the active pipelines
196
197
        QWidget* _pipelinePropertiesWidget;                 ///< Widget showing the selected pipeline's properties
        QScrollArea* _pipelinePropertiesScrollArea;         ///< Scroll area for _pipelinePropertiesWidget
198
        PropertyCollectionWidget* _propCollectionWidget;    ///< Widget for brosing the PropertyCollection of the selected pipeline/processor
199
        DataContainerInspectorWidget* _dcInspectorWidget;   ///< Widget for inspecting the DataContainer of the selected pipeline.
200
        MdiDockableWindow* _dcInspectorWindow;              ///< Window displaying the above DataContainerInspectorWidget instance.
201
202
203
204
205
206

        QPushButton* _btnExecute;                           ///< Button to execute the selected pipeline/processor
        QPushButton* _btnShowDataContainerInspector;        ///< Button to show the DataContainerInspector for the selected pipeline

        AbstractPipeline* _selectedPipeline;                ///< currently selected pipeline
        AbstractProcessor* _selectedProcessor;              ///< currently selected processor
207
208
        DataContainer* _selectedDataContainer;              ///< currently selected DataContainer

209
        LogViewerWidget* _logViewer;                        ///< Widget displaying log messages
210
        ScriptingWidget* _scriptingConsoleWidget;           ///< Widget showing the scripting console (if available)
211
        WorkflowControllerWidget* _workflowWidget;          ///< Widget showing the workflow controller
212

Hossain Mahmud's avatar
stuck!    
Hossain Mahmud committed
213
214
215
        QPushButton* _btnLuaLoad;
        QPushButton* _btnLuaSave;

216
        std::vector<QDockWidget*> _primaryDocks;            ///< Docks located in top docking area of the main window
217
218
219
    };
}

schultezub's avatar
schultezub committed
220
#endif // CAMPVISMAINWINDOW_H__