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 223846ab authored by Hossain Mahmud's avatar Hossain Mahmud
Browse files

initial draft codes for loading files into inspector widget

parent 882f4d50
......@@ -33,6 +33,7 @@ SET(CampvisApplicationToBeMocced
gui/datacontainerinspectorwidget.h
gui/datacontainertreewidget.h
gui/pipelinetreewidget.h
gui/propertyeditorwidget.h
gui/qtcolortools.h
gui/qtdatahandle.h
gui/logviewerwidget.h
......
......@@ -53,6 +53,8 @@
#include "application/gui/datacontainertreewidget.h"
#include "application/gui/qtdatahandle.h"
#include "application//gui/propertyeditorwidget.h"
#include "modules/io/processors/genericimagereader.h"
#include <QFileDialog>
......@@ -163,6 +165,11 @@ namespace campvis {
_btnSaveToFile = new QPushButton(tr("Save to File"), _infoWidget);
_infoWidgetLayout->addWidget(_btnSaveToFile);
// Added by Hossain Mahmud <mahmud@in.tum.de>
// Date: January 02, 2014
_btnLoadFile = new QPushButton(tr("Load File"), _infoWidget);
_infoWidgetLayout->addWidget(_btnLoadFile);
_canvas = new DataContainerInspectorCanvas(_infoWidget);
_canvas->setMinimumSize(QSize(100, 100));
_infoWidgetLayout->addWidget(_canvas, 1);
......@@ -186,6 +193,9 @@ namespace campvis {
connect(
_btnSaveToFile, SIGNAL(clicked()),
this, SLOT(onBtnSaveToFileClicked()));
connect(
_btnLoadFile, SIGNAL(clicked()),
this, SLOT(onBtnLoadFileClicked()));
}
void DataContainerInspectorWidget::updateColor(){
......@@ -442,4 +452,37 @@ namespace campvis {
}
void DataContainerInspectorWidget::onBtnLoadFileClicked() {
QString dialogCaption = QString::fromStdString("Select the file");
QString directory;
std::string fileTobeRead;
directory = tr("");
const QString fileFilter = tr("All files (*)");
QString filename;
filename = QFileDialog::getOpenFileName(QWidget::parentWidget(), dialogCaption, directory, fileFilter);
if (! filename.isEmpty()) {
fileTobeRead = filename.toStdString();
//emit modified();
}
GenericImageReader *imgReader = new GenericImageReader();
imgReader->setURL(fileTobeRead);
PropertyEditorWidget *propEditorWid = new PropertyEditorWidget();
propEditorWid->_propCollectionWidget->updatePropCollection(imgReader, _dataContainer);
propEditorWid->setDataContainer(_dataContainer);
propEditorWid->setVisible(true);
imgReader->process(*_dataContainer);
this->setDataContainer(_dataContainer);
//this->show();
//this->activateWindow();
//this->setDataContainer(_dataContainer);
}
}
\ No newline at end of file
......@@ -111,7 +111,7 @@ namespace campvis {
*/
void updateColor();
/**
/**
* Updates depth of the info widget
*/
void updateDepth();
......@@ -133,6 +133,12 @@ namespace campvis {
*/
void onBtnSaveToFileClicked();
/**
* Slot being called when the user clicks on the "Load File" button.
*/
void onBtnLoadFileClicked();
protected:
/**
* Setup the GUI stuff
......@@ -147,7 +153,7 @@ namespace campvis {
*/
protected:
protected:
static void saveToFile(DataHandle handle, std::string filename);
/**
......@@ -180,12 +186,15 @@ namespace campvis {
QLabel* _lblTimestamp;
QLabel* _lblSize;
QLabel* _lblBounds;
QWidget* _colorWidget; ///< The widget use to show the color value and the color in a single window
QWidget* _colorWidget; ///< The widget use to show the color value and the color in a single window
QHBoxLayout* _colorWidgetLayout; ///< Layout for the following widget
QLabel* _lblColorVal; ///< Color Label Value in text
QWidget* _colorValWidget; ///< Widget that shows the color value in color
QPalette* _ColorValWidgetPalette; ///< Palette which will be used to colorize the color widget
QPushButton* _btnSaveToFile;
// Added by Hossain Mahmud <mahmud@in.tum.de>
// Date: January 02, 2014
QPushButton* _btnLoadFile;
static const std::string loggerCat_;
};
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// 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
//
// 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.
//
// ================================================================================================
#include "propertyeditorwidget.h"
#include "tgt/assert.h"
#include "tgt/logmanager.h"
#include "tgt/filesystem.h"
#include "tgt/shadermanager.h"
#include "tgt/textureunit.h"
#include "tgt/qt/qtcontextmanager.h"
#include "tgt/qt/qtthreadedcanvas.h"
#ifdef CAMPVIS_HAS_MODULE_DEVIL
#include <IL/il.h>
#include <IL/ilu.h>
#endif
#include "core/tools/job.h"
#include "core/tools/opengljobprocessor.h"
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/datacontainer.h"
#include "core/datastructures/facegeometry.h"
#include "core/datastructures/geometrydata.h"
#include "core/datastructures/imagerepresentationgl.h"
#include "core/datastructures/renderdata.h"
#ifdef CAMPVIS_HAS_MODULE_COLUMBIA
#include "modules/columbia/datastructures/fiberdata.h"
#endif
#include "application/gui/datacontainertreewidget.h"
#include "application/gui/qtdatahandle.h"
#include <QFileDialog>
namespace campvis {
const std::string PropertyEditorWidget::loggerCat_ = "CAMPVis.application.PropertyEditorWidget";
PropertyEditorWidget::PropertyEditorWidget(QWidget* parent)
: QWidget(parent)
, _inited(false)
, _dataContainer(0)
//, _dctWidget(0)
, _canvas(0)
//, _pcWidget(0)
, _mainLayout(0)
//, _infoWidget(0)
, _pipelinePropertiesScrollArea(0)
, _propCollectionWidget(0)
//, _infoWidgetLayout(0)
{
setupGUI();
}
PropertyEditorWidget::~PropertyEditorWidget() {
if (_dataContainer != 0) {
_dataContainer->s_dataAdded.disconnect(this);
}
}
void PropertyEditorWidget::setDataContainer(DataContainer* dataContainer) {
if (_dataContainer != 0) {
//_dataContainer->s_dataAdded.disconnect(this);
}
_dataContainer = dataContainer;
//_dctWidget->update(dataContainer);
//updateInfoWidget();
if (_dataContainer != 0) {
//_dataContainer->s_dataAdded.connect(this, &PropertyEditorWidget::onDataContainerDataAdded);
}
}
void PropertyEditorWidget::onDataContainerDataAdded(const std::string& key, const DataHandle& dh) {
// copy QtDataHandle because signal will be handled by a different thread an indefinite amount of time later:
emit dataContainerChanged(QString::fromStdString(key), QtDataHandle(dh));
}
QSize PropertyEditorWidget::sizeHint() const {
return QSize(200, 300);
}
void PropertyEditorWidget::setupGUI() {
setWindowTitle(tr("Select Property Value"));
_mainLayout = new QVBoxLayout();
_mainLayout->setSpacing(4);
setLayout(_mainLayout);
_pipelinePropertiesScrollArea = new QScrollArea(this);
_pipelinePropertiesScrollArea->setWidgetResizable(true);
_pipelinePropertiesScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_pipelinePropertiesScrollArea->setFrameStyle(QScrollArea::NoFrame);
this->installEventFilter(this);
_propCollectionWidget = new PropertyCollectionWidget(_pipelinePropertiesScrollArea);
_mainLayout->addWidget(_propCollectionWidget);
//_mainLayout->addStretch();
_btnLoadFile = new QPushButton(tr("Load File"), this);
_mainLayout->addWidget(_btnLoadFile);
_btnCancel = new QPushButton(tr("Cancel"), this);
_mainLayout->addWidget(_btnCancel);
qRegisterMetaType<QtDataHandle>("QtDataHandle");
connect(
_btnCancel, SIGNAL(clicked()),
this, SLOT(onBtnCancelClicked()));
connect(
_btnLoadFile, SIGNAL(clicked()),
this, SLOT(onBtnLoadFileClicked()));
}
void PropertyEditorWidget::updateColor(){
const tgt::Color color = _canvas->getCapturedColor();
}
void PropertyEditorWidget::updateDepth(){
float depth = _canvas->getCapturedDepth();
}
QString PropertyEditorWidget::humanizeBytes(size_t numBytes) const {
QString units[5] = { tr(" Bytes"), tr(" KB"), tr(" MB"), tr(" GB"), tr(" TB") };
size_t index = 0;
size_t remainder = 0;
while (numBytes > 1024 && index < 4) {
remainder = numBytes % 1024;
numBytes /= 1024;
++index;
}
if (remainder != 0)
return QString::number(numBytes) + "." + QString::number(remainder) + units[index];
else
return QString::number(numBytes) + units[index];
}
void PropertyEditorWidget::init() {
//if (_canvas != 0)
//_canvas->init(this);
_inited = true;
}
void PropertyEditorWidget::deinit() {
_inited = false;
//if (_canvas != 0)
//_canvas->deinit();
//_pcWidget->updatePropCollection(0, 0);
if (_dataContainer != 0) {
//_dataContainer->s_dataAdded.disconnect(this);
}
//_dataContainer = 0;
//_dctWidget->update(0);
}
void PropertyEditorWidget::onBtnCancelClicked() {
}
void PropertyEditorWidget::onBtnLoadFileClicked() {
QString dialogCaption = QString::fromStdString("Select the file");
QString directory;
std::string fileTobeRead;
// use directory of current property value if any, default directory otherwise
directory = tr("");
const QString fileFilter = tr("All files (*)");
QString filename;
filename = QFileDialog::getOpenFileName(QWidget::parentWidget(), dialogCaption, directory, fileFilter);
if (! filename.isEmpty()) {
fileTobeRead = filename.toStdString();
//emit modified();
}
}
}
\ No newline at end of file
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// 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
//
// 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.
//
// ================================================================================================
#ifndef PROPERTYEDITORWIDGET_H_
#define PROPERTYEDITORWIDGET_H_
#include "sigslot/sigslot.h"
#include "tgt/painter.h"
#include "tgt/qt/qtcontextmanager.h"
#include "tgt/qt/qtthreadedcanvas.h"
#include "tbb/mutex.h"
#include "application/gui/qtdatahandle.h"
#include "application/gui/datacontainerinspectorcanvas.h"
#include "application/gui/properties/propertycollectionwidget.h"
#include "core/tools/opengljobprocessor.h"
#include <QLabel>
#include <QWidget>
#include <QScrollArea>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QString>
#include <QPushButton>
#include <QMetaObject>
class QModelIndex;
class QItemSelection;
namespace tgt {
class Texture;
class TextureUnit;
class Shader;
}
namespace campvis {
class AbstractPipeline;
//class DataContainer;
//class DataContainerTreeWidget;
//class FaceGeometry;
class PropertyEditorWidget : public QWidget, public sigslot::has_slots<> {
Q_OBJECT;
public:
/**
* Creates a new DataContainerInspectorWidget.
* \param parent Parent Qt widget, may be 0 (default)
*/
explicit PropertyEditorWidget(QWidget* parent = nullptr);
/**
* Destructor.
*/
~PropertyEditorWidget();
/**
* Set the DataContainer this widget is inspecting.
* \param dataContainer The DataContainer this widget shall inspect, may be 0.
*/
void setDataContainer(DataContainer* dataContainer);
/**
* Slot called when _dataContainer has changed and emitted the s_dataAdded signal.
*/
void onDataContainerDataAdded(const std::string&, const DataHandle&);
//void mousePressEvent(QMouseEvent*) {
// updateInfoWidget();
//}
/**
* Size hint for the default window size
* \return QSize(640, 480)
*/
QSize sizeHint() const;
/**
* Initializes the OpenGL stuff (e.g. shaders).
* Must be called with a valid and locked OpenGL context.
*/
virtual void init();
/**
* Deinitializes the OpenGL stuff (e.g. shaders).
* Must be called with a valid and locked OpenGL context.
*/
void deinit();
/**
* Updates color of the info widget
*/
void updateColor();
/**
* Updates depth of the info widget
*/
void updateDepth();
signals:
void dataContainerChanged(const QString&, QtDataHandle);
private slots:
/**
* Slot being called when the user clicks on the "Cancel" button.
*/
void onBtnCancelClicked();
/**
* Slot being called when the user clicks on the "Load File" button.
*/
void onBtnLoadFileClicked();
protected:
/**
* Setup the GUI stuff
*/
void setupGUI();
protected:
/**
* Returns a string with \a numBytes humanized (i.e. "numBytes/1024^n [KMG]Byte")
* \param numBytes Number of bytes to be converted.
* \return "numBytes/1024^n [KMG]Bytes
*/
QString humanizeBytes(size_t numBytes) const;
bool _inited;
DataContainer* _dataContainer; ///< The DataContainer this widget is inspecting
//DataContainerTreeWidget* _dctWidget; ///< The TreeWidget showing the DataHandles in _dataContainer
DataContainerInspectorCanvas* _canvas; ///< The OpenGL canvas for rendering the DataContainer's contents
//PropertyCollectionWidget* _pcWidget;
QVBoxLayout* _mainLayout; ///< Layout for this widget
//QWidget* _infoWidget; ///< Widget showing the information about the selected QtDataHandle
QVBoxLayout* rightLayout; ///< Layout for the _infoWidget
//QWidget* _pipelinePropertiesWidget; ///< Widget showing the selected pipeline's properties
QScrollArea* _pipelinePropertiesScrollArea; ///< Scroll area for _pipelinePropertiesWidget
public:
PropertyCollectionWidget* _propCollectionWidget; ///< Widget for browsing the PropertyCollection of the selected pipeline/processor
protected:
QPushButton* _btnCancel;
QPushButton* _btnLoadFile;
static const std::string loggerCat_;
};
}
#endif // PROPERTYEDITORWIDGET_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