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

Commit 2d967f2e authored by schultezub's avatar schultezub
Browse files

* added PropertyCollectionWidget stub with dummy implementation

* AbstractPipeline and AbstractProcessor inherit both from HasPropertyCollection

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@206 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent d22a03ba
......@@ -23,6 +23,7 @@ FILE(GLOB TUMVIS_APPLICATION_HEADERS
SET(TUMVIS_APPLICATION_TO_BE_MOCCED
gui/mainwindow.h
gui/pipelinetreewidget.h
gui/propertycollectionwidget.h
)
#
......
......@@ -2,6 +2,8 @@
#include "tgt/assert.h"
#include "application/tumvisapplication.h"
#include "core/pipeline/abstractpipeline.h"
#include "core/pipeline/abstractprocessor.h"
namespace TUMVis {
......@@ -19,10 +21,27 @@ namespace TUMVis {
}
void MainWindow::setup() {
_pipelineWidget = new PipelineTreeWidget(this);
setCentralWidget(_pipelineWidget);
_centralWidget = new QWidget(this);
QHBoxLayout* boxLayout = new QHBoxLayout();
connect(this, SIGNAL(updatePipelineWidget(const std::vector<AbstractPipeline*>&)), _pipelineWidget, SLOT(update(const std::vector<AbstractPipeline*>&)));
_pipelineWidget = new PipelineTreeWidget(_centralWidget);
boxLayout->addWidget(_pipelineWidget);
_propCollectionWidget = new PropertyCollectionWidget(_centralWidget);
boxLayout->addWidget(_propCollectionWidget);
_centralWidget->setLayout(boxLayout);
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(
this, SIGNAL(updatePropCollectionWidget(PropertyCollection*)),
_propCollectionWidget, SLOT(updatePropCollection(PropertyCollection*)));
_application->s_PipelinesChanged.connect(this, &MainWindow::onPipelinesChanged);
}
......@@ -30,4 +49,21 @@ namespace TUMVis {
emit updatePipelineWidget(_application->_pipelines);
}
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*>());
if (ptr != 0) {
emit updatePropCollectionWidget(&(ptr->getPropertyCollection()));
}
else {
emit updatePropCollectionWidget(0);
}
}
else {
emit updatePropCollectionWidget(0);
}
}
}
\ No newline at end of file
......@@ -4,8 +4,11 @@
#include "sigslot/sigslot.h"
#include "application/tumvisapplication.h"
#include "application/gui/pipelinetreewidget.h"
#include "application/gui/propertycollectionwidget.h"
#include <QMainWindow>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <vector>
namespace TUMVis {
......@@ -35,9 +38,17 @@ namespace TUMVis {
void onPipelinesChanged();
signals:
/// Qt signal for updating the PipelineWidget.
/// Qt signal for updating the PipelineWidget.
void updatePipelineWidget(const std::vector<AbstractPipeline*>&);
/// Qt signal for updating the PropertyCollectionWidget
void updatePropCollectionWidget(PropertyCollection*);
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);
private:
/**
......@@ -45,10 +56,11 @@ namespace TUMVis {
*/
void setup();
TumVisApplication* _application; ///< Pointer to the application hosting the whole stuff
PipelineTreeWidget* _pipelineWidget; ///< Widget for browsing the active pipelines
TumVisApplication* _application; ///< Pointer to the application hosting the whole stuff
QWidget* _centralWidget; ///< Central widget of the MainWindow
PipelineTreeWidget* _pipelineWidget; ///< Widget for browsing the active pipelines
PropertyCollectionWidget* _propCollectionWidget; ///< Widget for brosing the PropertyCollection of the selected pipeline/processor
};
}
......
......@@ -45,11 +45,16 @@ namespace TUMVis {
tgtAssert(_pipeline != 0, "Pipeline must not be 0.");
}
QVariant PipelineTreeItem::getData(int column) const {
if (column == 0)
return QVariant(QString::fromStdString(_pipeline->getName()));
return QVariant();
QVariant PipelineTreeItem::getData(int column, int role) const {
switch (role) {
case Qt::DisplayRole:
if (column == 0)
return QVariant(QString::fromStdString(_pipeline->getName()));
case Qt::UserRole:
return qVariantFromValue(static_cast<void*>(_pipeline));
default:
return QVariant();
}
}
PipelineTreeItem::~PipelineTreeItem() {
......@@ -63,11 +68,16 @@ namespace TUMVis {
tgtAssert(_processor != 0, "Processor must not be 0.");
}
QVariant ProcessorTreeItem::getData(int column) const {
if (column == 0)
return QVariant(QString::fromStdString(_processor->getName()));
return QVariant();
QVariant ProcessorTreeItem::getData(int column, int role) const {
switch (role) {
case Qt::DisplayRole:
if (column == 0)
return QVariant(QString::fromStdString(_processor->getName()));
case Qt::UserRole:
return qVariantFromValue(static_cast<void*>(_processor));
default:
return QVariant();
}
}
ProcessorTreeItem::~ProcessorTreeItem() {
......@@ -77,11 +87,13 @@ namespace TUMVis {
: TreeItem(parent)
{}
QVariant RootTreeItem::getData(int column) const {
if (column == 0)
return QVariant(QString("Pipeline/Processor"));
else if (column == 1)
return QVariant(QString("Description"));
QVariant RootTreeItem::getData(int column, int role) const {
if (role == Qt::DisplayRole) {
if (column == 0)
return QVariant(QString("Pipeline/Processor"));
else if (column == 1)
return QVariant(QString("Description"));
}
return QVariant();
}
......@@ -106,11 +118,8 @@ namespace TUMVis {
if (!index.isValid())
return QVariant();
if (role != Qt::DisplayRole)
return QVariant();
TreeItem* item = static_cast<TreeItem*>(index.internalPointer());
return item->getData(index.column());
return item->getData(index.column(), role);
}
Qt::ItemFlags PipelineTreeModel::flags(const QModelIndex &index) const {
......@@ -122,7 +131,7 @@ namespace TUMVis {
QVariant PipelineTreeModel::headerData(int section, Qt::Orientation orientation, int role /*= Qt::DisplayRole*/) const {
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return _rootItem->getData(section);
return _rootItem->getData(section, role);
return QVariant();
}
......
......@@ -36,7 +36,7 @@ namespace TUMVis {
* \param column Column
* \return The data of this item at \a column.
*/
virtual QVariant getData(int column) const = 0;
virtual QVariant getData(int column, int role) const = 0;
/**
* Returns the parent TreeItem
......@@ -77,7 +77,7 @@ namespace TUMVis {
virtual ~RootTreeItem();
/// \see TreeItem::getData()
virtual QVariant getData(int column) const;
virtual QVariant getData(int column, int role) const;
};
/**
......@@ -89,7 +89,7 @@ namespace TUMVis {
virtual ~PipelineTreeItem();
/// \see TreeItem::getData()
virtual QVariant getData(int column) const;
virtual QVariant getData(int column, int role) const;
private:
AbstractPipeline* _pipeline; ///< Base pipeline
......@@ -104,7 +104,7 @@ namespace TUMVis {
virtual ~ProcessorTreeItem();
/// \see TreeItem::getData()
virtual QVariant getData(int column) const;
virtual QVariant getData(int column, int role) const;
private:
AbstractProcessor* _processor; ///< Base processor
......
#include "propertycollectionwidget.h"
#include "core/properties/abstractproperty.h"
#include "core/properties/propertycollection.h"
#include <QPushButton>
namespace TUMVis {
PropertyCollectionWidget::PropertyCollectionWidget(QWidget* parent /*= 0*/)
: QWidget(parent)
, _propCollection(0)
, _layout(0)
{
setupWidget();
}
PropertyCollectionWidget::~PropertyCollectionWidget() {
qDeleteAll(_widgetList);
}
void PropertyCollectionWidget::updatePropCollection(PropertyCollection* propertyCollection) {
// just some dummy implementation for property widget listing:
for (QList<QWidget*>::iterator it = _widgetList.begin(); it != _widgetList.end(); ++it) {
_layout->removeWidget(*it);
}
qDeleteAll(_widgetList);
_widgetList.clear();
for (std::vector<AbstractProperty*>::const_iterator it = propertyCollection->getProperties().begin(); it != propertyCollection->getProperties().end(); ++it) {
QPushButton* propWidget = new QPushButton(QString::fromStdString((*it)->getTitle()));
_widgetList.push_back(propWidget);
_layout->addWidget(propWidget);
}
}
void PropertyCollectionWidget::setupWidget() {
_layout = new QVBoxLayout();
setLayout(_layout);
}
}
\ No newline at end of file
#ifndef PROPERTYCOLLECTIONWIDGET_H__
#define PROPERTYCOLLECTIONWIDGET_H__
#include <QList>
#include <QVBoxLayout>
#include <QWidget>
namespace TUMVis {
class PropertyCollection;
/**
* Main Window for the TUMVis application.
* Wraps a nice Qt GUI around the TumVisApplication instance given during creation.
*/
class PropertyCollectionWidget : public QWidget {
Q_OBJECT;
public:
/**
* Creates a new PropertyCollectionWidget.
* \param parent Parent widget, may be 0.
*/
PropertyCollectionWidget(QWidget* parent = 0);
/**
* Destructor.
*/
~PropertyCollectionWidget();
public slots:
/**
* Updates the property collection this widget works on.
* \param propertyCollection New PropertyCollection for this widget, may be 0.
*/
void updatePropCollection(PropertyCollection* propertyCollection);
private:
/**
* Sets up this widget
*/
void setupWidget();
PropertyCollection* _propCollection; ///< The PropertyCollection this widget is currently working on.
QVBoxLayout* _layout;
QList<QWidget*> _widgetList;
};
}
#endif // PROPERTYCOLLECTIONWIDGET_H__
......@@ -7,16 +7,13 @@ namespace TUMVis {
const std::string AbstractPipeline::loggerCat_ = "TUMVis.core.datastructures.AbstractPipeline";
AbstractPipeline::AbstractPipeline()
: HasPropertyCollection()
{
}
AbstractPipeline::~AbstractPipeline() {
}
PropertyCollection& AbstractPipeline::getPropertyCollection() {
return _properties;
}
void AbstractPipeline::init() {
// initialize all processors:
for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
......
......@@ -20,7 +20,7 @@ namespace TUMVis {
* Abstract base class for TUMVis Pipelines.
*
*/
class AbstractPipeline : public GenericObserver<ProcessorObserverArgs> {
class AbstractPipeline : public HasPropertyCollection, public GenericObserver<ProcessorObserverArgs> {
friend class PipelineEvaluator;
public:
......@@ -54,12 +54,6 @@ namespace TUMVis {
**/
virtual void execute() = 0;
/**
* Returns the PropertyCollection of this pipeline.
* \return _properties
*/
PropertyCollection& getPropertyCollection();
/**
* Returns the DataContainer of this pipeline
* \return _data
......@@ -100,7 +94,6 @@ namespace TUMVis {
DataContainer _data; ///< DataContainer containing local working set of data for this Pipeline
std::vector<AbstractProcessor*> _processors; ///< List of all processors of this pipeline
PropertyCollection _properties; ///< PropertyCollection of this pipeline, put in here all properties you want to be publicly accessible
InvalidationLevel _invalidationLevel; ///< current invalidation level
tbb::spin_mutex _localMutex; ///< mutex for altering local members
......
......@@ -5,7 +5,9 @@ namespace TUMVis {
const std::string AbstractProcessor::loggerCat_ = "TUMVis.core.datastructures.Processor";
AbstractProcessor::AbstractProcessor() {
AbstractProcessor::AbstractProcessor()
: HasPropertyCollection()
{
}
AbstractProcessor::~AbstractProcessor() {
......@@ -29,10 +31,6 @@ namespace TUMVis {
applyInvalidationLevel(poa._invalidationLevel);
}
PropertyCollection& AbstractProcessor::getPropertyCollection() {
return _properties;
}
void AbstractProcessor::init() {
}
......
......@@ -44,7 +44,7 @@ namespace TUMVis {
*
* \sa AbstractPipeline
*/
class AbstractProcessor : public GenericObserver<PropertyObserverArgs>, public GenericObservable<ProcessorObserverArgs> {
class AbstractProcessor : public HasPropertyCollection, public GenericObserver<PropertyObserverArgs>, public GenericObservable<ProcessorObserverArgs> {
/**
* We have to find a trade-off:
......@@ -94,12 +94,6 @@ namespace TUMVis {
*/
const InvalidationLevel& getInvalidationLevel() const;
/**
* Returns the PropertyCollection of this processor.
* \return _properties
*/
PropertyCollection& getPropertyCollection();
/**
* Gets the name of this very processor. To be defined by every subclass.
* \return The name of this processor.
......@@ -137,7 +131,6 @@ namespace TUMVis {
protected:
InvalidationLevel _invalidationLevel; ///< current invalidation level of this processor
PropertyCollection _properties; ///< PropertyCollection of this processor
static const std::string loggerCat_;
......
......@@ -8,7 +8,6 @@
namespace TUMVis {
/**
* Wrapper for a vector of Properties.
* Properties can be registered and then accessed via their names.
......@@ -79,6 +78,21 @@ namespace TUMVis {
std::vector<AbstractProperty*> _properties; ///< list of all registered properties
};
class HasPropertyCollection {
public:
HasPropertyCollection() {};
virtual ~HasPropertyCollection() = 0 {};
/**
* Returns the PropertyCollection of this processor.
* \return _properties
*/
PropertyCollection& getPropertyCollection() { return _properties; };
protected:
PropertyCollection _properties; ///< PropertyCollection of this object
};
}
#endif // PROPERTYCOLLECTION_H__
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment