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

pipelinetreewidget.h 5.95 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
32
33
34
35
36
37
38
#ifndef PIPELINETREEWIDGET_H__
#define PIPELINETREEWIDGET_H__

#include <QAbstractItemModel>
#include <QTreeWidget>
#include <QList>
#include <QVariant>

#include "core/pipeline/abstractpipeline.h"
#include "core/pipeline/abstractprocessor.h"
39
#include "application/tools/treeitem.h"
40
41
#include <vector>

schultezub's avatar
schultezub committed
42
namespace campvis {
43
44

// = TreeModel items ==============================================================================
45
    
schultezub's avatar
schultezub committed
46
47
48
    /**
     * Specialization for root TreeItems.
     */
49
    class PipelineTreeRootItem : public TreeItem {
50
    public:
51
52
        PipelineTreeRootItem(TreeItem* parent = 0);
        virtual ~PipelineTreeRootItem();
53

schultezub's avatar
schultezub committed
54
        /// \see TreeItem::getData()
55
        virtual QVariant getData(int column, int role) const;
56
57
    };

schultezub's avatar
schultezub committed
58
59
60
    /**
     * Specialization for TreeItems hosting an AbstracPipeline.
     */
61
62
63
64
65
    class PipelineTreeItem : public TreeItem {
    public:
        PipelineTreeItem(AbstractPipeline* pipeline, TreeItem* parent);
        virtual ~PipelineTreeItem();

schultezub's avatar
schultezub committed
66
        /// \see TreeItem::getData()
67
        virtual QVariant getData(int column, int role) const;
68

69
70
71
        /// \see TreeItem::setData()
        virtual bool setData(int column, int role, const QVariant& value) const;

72
    private:
schultezub's avatar
schultezub committed
73
        AbstractPipeline* _pipeline;        ///< Base pipeline
74
75
    };

schultezub's avatar
schultezub committed
76
77
78
    /**
     * Specialization for TreeItems hosting an AbstractProcessor.
     */
79
80
81
82
83
    class ProcessorTreeItem : public TreeItem {
    public:
        ProcessorTreeItem(AbstractProcessor* processor, TreeItem* parent);
        virtual ~ProcessorTreeItem();

schultezub's avatar
schultezub committed
84
        /// \see TreeItem::getData()
85
        virtual QVariant getData(int column, int role) const;
86

87
88
89
        /// \see TreeItem::setData()
        virtual bool setData(int column, int role, const QVariant& value) const;

90
    private:
schultezub's avatar
schultezub committed
91
        AbstractProcessor* _processor;      ///< Base processor
92
93
94
95
    };

// = TreeModel ====================================================================================

schultezub's avatar
schultezub committed
96
97
98
    /**
     * QItemModel for displaying a list of pipelines and their processors in the PipelineTreeWidget.
     */
99
100
101
102
103
104
105
106
107
108
    class PipelineTreeModel : public QAbstractItemModel {
        Q_OBJECT

    public:
        PipelineTreeModel(QObject *parent = 0);
        ~PipelineTreeModel();

        void setData(const std::vector<AbstractPipeline*>& pipelines);

        QVariant data(const QModelIndex &index, int role) const;
109
110
111
112
113
114
115
116
117

        /**
         * Sets the data at index \a index to \a value.
         * \param   index   position where to set data
         * \param   value   new data
         * \param   role    edit role
         **/
        bool setData(const QModelIndex& index, const QVariant& value, int role);

118
119
120
121
122
123
124
125
126
127
128
129
130
131
        Qt::ItemFlags flags(const QModelIndex &index) const;
        QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
        QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
        QModelIndex parent(const QModelIndex &index) const;

        int rowCount(const QModelIndex &parent = QModelIndex()) const;
        int columnCount(const QModelIndex &parent = QModelIndex()) const;

    private:
        TreeItem* _rootItem;
    };

// = Widget =======================================================================================

schultezub's avatar
schultezub committed
132
133
134
    /**
     * Qt widget for showing a list of pipelines and their processors in a QTreeView.
     */
135
136
137
138
    class PipelineTreeWidget : public QTreeView {
        Q_OBJECT;

    public:
schultezub's avatar
schultezub committed
139
140
141
142
        /**
         * Creates a new PipelineTreeWidget.
         * \param   parent  Parent widget
         */
143
144
        PipelineTreeWidget(QWidget* parent = 0);

schultezub's avatar
schultezub committed
145
146
147
        /**
         * Destructor
         */
148
149
150
151
        virtual ~PipelineTreeWidget();


    public slots:
schultezub's avatar
schultezub committed
152
153
154
155
        /**
         * Updates the data in the tree view by the given collection of pipelines \a pipelines.
         * \param   pipelines   
         */
156
157
158
159
        void update(const std::vector<AbstractPipeline*>& pipelines);


    private:
schultezub's avatar
schultezub committed
160
161
162
        /**
         * Sets up the widget.
         */
163
164
        void setupWidget();

schultezub's avatar
schultezub committed
165
        PipelineTreeModel* _treeModel;      ///< Data model for the TreeView.
166
167
168
169
170

    };
}

#endif // PIPELINETREEWIDGET_H__