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 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
35
#include "application/tools/qtexteditlog.h"
#include "application/ui_mainwindow.h"
36
37

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

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

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

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

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

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

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

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

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

93
94
95
96
97
98
99
100
    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);

101
    signals:
102
        /// Qt signal for updating the PipelineWidget.
103
104
        void updatePipelineWidget(const std::vector<DataContainer*>&, const std::vector<AbstractPipeline*>&);

105
        /// Qt signal for updating the PropertyCollectionWidget
106
        void updatePropCollectionWidget(HasPropertyCollection*, DataContainer*);
107

108
109
110
111
112
113
    private slots:
        /**
         * Slot to be called by the PipelineWidget when the selected item changes.
         * \param   index   Index of the selected item
         */
        void onPipelineWidgetItemClicked(const QModelIndex& index);
114

115
116
117
118
119
120
121
122
123
124
        /**
         * Slot to be called when _btnExecute was clicked.
         */
        void onBtnExecuteClicked();

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

125
126
127
        /// Slot to be called when _btnPipelineFactory was clicked;
        void onBtnPipelineFactoryClicked();

128
129
130
        /// Slot to be called when all shaders shall be rebuilt.
        void onRebuildShadersClicked();

131
    private:
132
133
134
135
136
137
138
139
140
141
142

        /**
         * 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
143
144
145
        /**
         * Setup Qt GUI stuff
         */
146
147
        void setup();

148
149
150
151
152
        /**
         * Create and populate the application's main menu.
         */
        void populateMainMenu();

153
154
155
156
157
158
159
160
161
162
163
164
        /**
         * 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);

165
166
        Ui::MainWindow ui;                                  ///< Interface definition of the MainWindow

167
        CampVisApplication* _application;                    ///< Pointer to the application hosting the whole stuff
168

169
        MdiDockArea* _mdiArea;                              ///< MDI area (the window's central widget)
170
171
172
        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
173
        PipelineTreeWidget* _pipelineWidget;                ///< Widget for browsing the active pipelines
174
175
        QWidget* _pipelinePropertiesWidget;                 ///< Widget showing the selected pipeline's properties
        QScrollArea* _pipelinePropertiesScrollArea;         ///< Scroll area for _pipelinePropertiesWidget
176
        PropertyCollectionWidget* _propCollectionWidget;    ///< Widget for brosing the PropertyCollection of the selected pipeline/processor
177
        DataContainerInspectorWidget* _dcInspectorWidget;   ///< Widget for inspecting the DataContainer of the selected pipeline.
178
        MdiDockableWindow* _dcInspectorWindow;              ///< Window displaying the above DataContainerInspectorWidget instance.
179
180
181
182
183
184

        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
185
186
        DataContainer* _selectedDataContainer;              ///< currently selected DataContainer

187
188
        LogViewerWidget* _logViewer;                        ///< Widget displaying log messages
        std::vector<QDockWidget*> _primaryDocks;            ///< Docks located in top docking area of the main window
189
190
191
    };
}

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