Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing 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.cpp 6.86 KB
Newer Older
1
2
// ================================================================================================
// 
schultezub's avatar
schultezub committed
3
// This file is part of the CAMPVis Visualization Framework.
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
//      Christian Schulte zu Berge (christian.szb@in.tum.de)
//      Chair for Computer Aided Medical Procedures
//      Technische Universitt Mnchen
//      Boltzmannstr. 3, 85748 Garching b. Mnchen, Germany
// 
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
// 
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// 
// ================================================================================================

29
30
31
#include "mainwindow.h"

#include "tgt/assert.h"
schultezub's avatar
schultezub committed
32
#include "application/campvisapplication.h"
33
#include "application/gui/datacontainerinspectorwidget.h"
34
#include "application/gui/datacontainerinspectorcanvas.h"
35
#include "application/gui/qtdatahandle.h"
36
37
#include "core/pipeline/abstractpipeline.h"
#include "core/pipeline/abstractprocessor.h"
38

schultezub's avatar
schultezub committed
39
namespace campvis {
40

41
    MainWindow::MainWindow(CampVisApplication* application)
42
43
        : QMainWindow()
        , _application(application)
44
        , _centralWidget(0)
45
        , _pipelineWidget(0)
46
47
        , _propCollectionWidget(0)
        , _dcInspectorWidget(0)
48
        , _dcInspectorCanvas(0)
49
50
51
52
        , _btnExecute(0)
        , _btnShowDataContainerInspector(0)
        , _selectedPipeline(0)
        , _selectedProcessor(0)
53
54
55
56
57
58
    {
        tgtAssert(_application != 0, "Application must not be 0.");
        setup();
    }

    MainWindow::~MainWindow() {
schultezub's avatar
schultezub committed
59
        _application->s_PipelinesChanged.disconnect(this);
60
61
        delete _dcInspectorCanvas;
        delete _dcInspectorWidget;
62
63
64
    }

    void MainWindow::setup() {
65
66
        qRegisterMetaType<QtDataHandle>("QtDataHandle");

67
68
69
        _dcInspectorCanvas = new DataContainerInspectorCanvas();
        _dcInspectorCanvas->show();

70
        _centralWidget = new QWidget(this);
71
72
        QHBoxLayout* mainLayout = new QHBoxLayout();
        mainLayout->setSpacing(4);
73

74
        _pipelineWidget = new PipelineTreeWidget(_centralWidget);
75
76
77
78
79
80
81
82
83
84
85
86
87
88
        mainLayout->addWidget(_pipelineWidget);

        QWidget* rightWidget = new QWidget(_centralWidget);
        mainLayout->addWidget(rightWidget);

        QVBoxLayout* rightLayout = new QVBoxLayout();
        rightLayout->setSpacing(4);
        rightWidget->setLayout(rightLayout);

        _btnExecute = new QPushButton("Execute Selected Pipeline/Processor", rightWidget);
        rightLayout->addWidget(_btnExecute);

        _btnShowDataContainerInspector = new QPushButton("Inspect DataContainer of Selected Pipeline", rightWidget);
        rightLayout->addWidget(_btnShowDataContainerInspector);
89
90

        _propCollectionWidget = new PropertyCollectionWidget(_centralWidget);
91
        rightLayout->addWidget(_propCollectionWidget);
92

93
        _centralWidget->setLayout(mainLayout);
94
95
96
97
98
99
100
101
102
        setCentralWidget(_centralWidget);

        connect(
            this, SIGNAL(updatePipelineWidget(const std::vector<AbstractPipeline*>&)), 
            _pipelineWidget, SLOT(update(const std::vector<AbstractPipeline*>&)));
        connect(
            _pipelineWidget, SIGNAL(clicked(const QModelIndex&)), 
            this, SLOT(onPipelineWidgetItemClicked(const QModelIndex&)));
        connect(
schultezub's avatar
schultezub committed
103
104
            this, SIGNAL(updatePropCollectionWidget(HasPropertyCollection*)),
            _propCollectionWidget, SLOT(updatePropCollection(HasPropertyCollection*)));
105
106
107
108
109
110
        connect(
            _btnExecute, SIGNAL(clicked()), 
            this, SLOT(onBtnExecuteClicked()));
        connect(
            _btnShowDataContainerInspector, SIGNAL(clicked()), 
            this, SLOT(onBtnShowDataContainerInspectorClicked()));
111
112
113
114
115
116
117
        _application->s_PipelinesChanged.connect(this, &MainWindow::onPipelinesChanged);
    }

    void MainWindow::onPipelinesChanged() {
        emit updatePipelineWidget(_application->_pipelines);
    }

118
119
120
121
122
    void MainWindow::onPipelineWidgetItemClicked(const QModelIndex& index) {
        if (index.isValid()) {
            // Yak, this is so ugly - another reason why GUI programming sucks...
            QVariant item = index.data(Qt::UserRole);
            HasPropertyCollection* ptr = static_cast<HasPropertyCollection*>(item.value<void*>());
123
            emit updatePropCollectionWidget(ptr);
124
125
126
127

            if (AbstractPipeline* pipeline = dynamic_cast<AbstractPipeline*>(ptr)) {
            	_selectedPipeline = pipeline;
                _selectedProcessor = 0;
128
129
                _dcInspectorCanvas->setDataContainer(&_selectedPipeline->getDataContainer());

130
131
132
                if (_dcInspectorWidget != 0)
                    onBtnShowDataContainerInspectorClicked();
            }
133
134
135
136
137
138
        }
        else {
            emit updatePropCollectionWidget(0);
        }
    }

139
140
141
142
    QSize MainWindow::sizeHint() const {
        return QSize(800, 450);
    }

143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
    void MainWindow::onBtnExecuteClicked() {
        if (_selectedProcessor != 0 && _selectedPipeline != 0) {
            // this is not as trivial as it seems:
            // We need the pipeline, probably an OpenGL context...
        }
        else if (_selectedPipeline != 0) {
            
        }
    }

    void MainWindow::onBtnShowDataContainerInspectorClicked() {
        if (_selectedPipeline != 0) {
            if (_dcInspectorWidget == 0) {
                _dcInspectorWidget = new DataContainerInspectorWidget();
            }
            _dcInspectorWidget->setDataContainer(&(_selectedPipeline->getDataContainer()));
            _dcInspectorWidget->show();
        }
    }

163
164
165
166
167
168
169
170
171
172
    void MainWindow::init() {
        if (_dcInspectorCanvas != 0)
            _dcInspectorCanvas->init();
    }

    void MainWindow::deinit() {
        if (_dcInspectorCanvas != 0)
            _dcInspectorCanvas->deinit();
    }

173
}