Commit 35bc218b authored by Hossain Mahmud's avatar Hossain Mahmud
Browse files

PropertyEditorWidget rename, cleaned leftovers, window title, GridLayout implemented

parent 06ba6dde
......@@ -31,9 +31,9 @@ SET(CampvisApplicationToBeMocced
gui/mainwindow.h
gui/datacontainerinspectorcanvas.h
gui/datacontainerinspectorwidget.h
gui/datacontainerfileloaderwidget.h
gui/datacontainertreewidget.h
gui/pipelinetreewidget.h
gui/propertyeditorwidget.h
gui/qtcolortools.h
gui/qtdatahandle.h
gui/logviewerwidget.h
......
......@@ -22,143 +22,90 @@
//
// ================================================================================================
#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/datacontainerinspectorwidget.h"
#include "application/gui/datacontainertreewidget.h"
#include "application/gui/qtdatahandle.h"
#include "modules/io/processors/genericimagereader.h"
#include <QFileDialog>
#include "datacontainerfileloaderwidget.h"
namespace campvis {
const std::string PropertyEditorWidget::loggerCat_ = "CAMPVis.application.PropertyEditorWidget";
const std::string DataContainerFileLoaderWidget::loggerCat_ = "CAMPVis.application.DataContainerFileLoaderWidget";
PropertyEditorWidget::PropertyEditorWidget(DataContainerInspectorWidget* parentDataInspector, QWidget* parent)
DataContainerFileLoaderWidget::DataContainerFileLoaderWidget(DataContainerInspectorWidget* parentDataInspector, QWidget* parent)
: QWidget(parent)
, _inited(false)
, _dataContainer(0)
, _canvas(0)
, _mainLayout(0)
, _layout(0)
, _pipelinePropertiesScrollArea(0)
, _propCollectionWidget(0)
, _fileName("fileName", "Image URL", "")
{
_parent = parentDataInspector;
_dataContainer = _parent->getDataContainer();
_imgReader = new GenericImageReader();
_imgReader->setVisibibility(".mhd", true);
this->_parent = parentDataInspector;
this->_dataContainer = this->_parent->getDataContainer();
this->_imgReader = new GenericImageReader();
this->_imgReader->setVisibibility(".mhd", true);
setupGUI();
}
PropertyEditorWidget::~PropertyEditorWidget() {
if (_dataContainer != 0) {
_dataContainer->s_dataAdded.disconnect(this);
DataContainerFileLoaderWidget::~DataContainerFileLoaderWidget() {
if (this->_dataContainer != 0) {
this->_dataContainer->s_dataAdded.disconnect(this);
}
}
void PropertyEditorWidget::setDataContainer(DataContainer* dataContainer) {
if (_dataContainer != 0) {
}
_dataContainer = dataContainer;
if (_dataContainer != 0) {
}
void DataContainerFileLoaderWidget::setDataContainer(DataContainer* dataContainer) {
this->_dataContainer = dataContainer;
}
QSize PropertyEditorWidget::sizeHint() const {
return QSize(200, 300);
QSize DataContainerFileLoaderWidget::sizeHint() const {
return QSize(300, 350);
}
void PropertyEditorWidget::setupGUI() {
setWindowTitle(tr("Select Property Value"));
void DataContainerFileLoaderWidget::setupGUI() {
setWindowTitle(tr("Browse File"));
_mainLayout = new QVBoxLayout();
_mainLayout->setSpacing(4);
setLayout(_mainLayout);
this->_layout = new QGridLayout();
this->_layout->setSpacing(2);
setLayout(_layout);
_pipelinePropertiesScrollArea = new QScrollArea(this);
_pipelinePropertiesScrollArea->setWidgetResizable(true);
_pipelinePropertiesScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_pipelinePropertiesScrollArea->setFrameStyle(QScrollArea::NoFrame);
this->_pipelinePropertiesScrollArea = new QScrollArea(this);
this->_pipelinePropertiesScrollArea->setWidgetResizable(true);
this->_pipelinePropertiesScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
this->_pipelinePropertiesScrollArea->setFrameStyle(QScrollArea::NoFrame);
this->installEventFilter(this);
_propCollectionWidget = new PropertyCollectionWidget(_pipelinePropertiesScrollArea);
_mainLayout->addWidget(_propCollectionWidget);
this->_propCollectionWidget = new PropertyCollectionWidget(this->_pipelinePropertiesScrollArea);
this->_layout->addWidget(this->_propCollectionWidget, 0, 0, 1, 2);
this->_propCollectionWidget->updatePropCollection(this->_imgReader, this->_dataContainer);
_btnLoadFile = new QPushButton(tr("Load File"), this);
_mainLayout->addWidget(_btnLoadFile);
_btnCancel = new QPushButton(tr("Cancel"), this);
_mainLayout->addWidget(_btnCancel);
this->_btnLoadFile = new QPushButton(tr("Load"), this);
this->_layout->addWidget(this->_btnLoadFile, 1, 0, 1, 1);
this->_btnCancel = new QPushButton(tr("Cancel"), this);
this->_layout->addWidget(this->_btnCancel, 1, 1, 1, 1);
qRegisterMetaType<QtDataHandle>("QtDataHandle");
connect(
_btnCancel, SIGNAL(clicked()),
this->_btnCancel, SIGNAL(clicked()),
this, SLOT(onBtnCancelClicked()));
connect(
_btnLoadFile, SIGNAL(clicked()),
this->_btnLoadFile, SIGNAL(clicked()),
this, SLOT(onBtnLoadFileClicked()));
}
void PropertyEditorWidget::updateColor(){
const tgt::Color color = _canvas->getCapturedColor();
}
void PropertyEditorWidget::updateDepth(){
float depth = _canvas->getCapturedDepth();
}
void PropertyEditorWidget::init() {
_inited = true;
void DataContainerFileLoaderWidget::init() {
}
void PropertyEditorWidget::deinit() {
_inited = false;
if(nullptr != _imgReader)
delete _imgReader;
void DataContainerFileLoaderWidget::deinit() {
delete _imgReader;
this->_imgReader = nullptr;
}
void PropertyEditorWidget::onBtnCancelClicked() {
if(nullptr != _imgReader)
delete _imgReader;
void DataContainerFileLoaderWidget::onBtnCancelClicked() {
delete _imgReader;
this->_imgReader = nullptr;
this->close();
}
void PropertyEditorWidget::onBtnLoadFileClicked() {
_imgReader->process(*_dataContainer);
void DataContainerFileLoaderWidget::onBtnLoadFileClicked() {
this->_imgReader->process(*_dataContainer);
this->_parent->setDataContainer(_dataContainer);
this->close();
}
......
......@@ -22,57 +22,36 @@
//
// ================================================================================================
#ifndef PROPERTYEDITORWIDGET_H_
#define PROPERTYEDITORWIDGET_H_
#ifndef DATACONTAINERFILELOADERWIDGET_H
#define DATACONTAINERFILELOADERWIDGET_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 "application/gui/properties/stringpropertywidget.h"
#include "core/tools/opengljobprocessor.h"
#include "modules/io/processors/genericimagereader.h"
#include "application/gui/datacontainerinspectorwidget.h"
#include <QLabel>
#include <QWidget>
#include <QScrollArea>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QString>
#include <QGridLayout>
#include <QPushButton>
#include <QMetaObject>
class QModelIndex;
class QItemSelection;
namespace tgt {
class Texture;
class TextureUnit;
class Shader;
}
namespace campvis {
class PropertyEditorWidget : public QWidget, public sigslot::has_slots<> {
class DataContainerFileLoaderWidget : public QWidget, public sigslot::has_slots<> {
Q_OBJECT;
public:
/**
* Creates a new DataContainerInspectorWidget.
* Creates a new DataContainerFileLoaderWidget.
* \param treeModel Parent DataContainerInspectorWidget. Method Overridden to keep the widget floating.
* \param parent Parent Qt widget, may be 0 (default)
*/
explicit PropertyEditorWidget(DataContainerInspectorWidget* treeModel, QWidget* parent = nullptr);
explicit DataContainerFileLoaderWidget(DataContainerInspectorWidget* treeModel, QWidget* parent = nullptr);
/**
* Destructor.
*/
~PropertyEditorWidget();
~DataContainerFileLoaderWidget();
/**
* Set the DataContainer this widget is inspecting.
......@@ -82,7 +61,7 @@ namespace campvis {
/**
* Size hint for the default window size
* \return QSize(640, 480)
* \return QSize(300, 350)
*/
QSize sizeHint() const;
......@@ -98,18 +77,6 @@ namespace campvis {
*/
void deinit();
/**
* Updates color of the info widget
*/
void updateColor();
/**
* Updates depth of the info widget
*/
void updateDepth();
signals:
private slots:
/**
* Slot being called when the user clicks on the "Cancel" button.
......@@ -129,11 +96,8 @@ namespace campvis {
protected:
bool _inited;
DataContainer* _dataContainer; ///< The DataContainer this widget is inspecting
DataContainerInspectorCanvas* _canvas; ///< The OpenGL canvas for rendering the DataContainer's contents
QVBoxLayout* _mainLayout; ///< Layout for this widget
QVBoxLayout* rightLayout; ///< Layout for the _infoWidget
QGridLayout* _layout; ///< Layout for the _infoWidget
QScrollArea* _pipelinePropertiesScrollArea; ///< Scroll area for _pipelinePropertiesWidget
protected:
......@@ -152,4 +116,4 @@ namespace campvis {
};
}
#endif // PROPERTYEDITORWIDGET_H_
#endif // DATACONTAINERFILELOADERWIDGET_H
......@@ -53,7 +53,7 @@
#include "application/gui/datacontainertreewidget.h"
#include "application/gui/qtdatahandle.h"
#include "application//gui/propertyeditorwidget.h"
#include "application//gui/datacontainerfileloaderwidget.h"
#include "modules/io/processors/genericimagereader.h"
#include <QFileDialog>
......@@ -462,9 +462,9 @@ namespace campvis {
// delete previous PropertyEditor, then create a new one
// the final one will be deleted with deinit()
if(nullptr != _propEditorWid)
delete _propEditorWid;
_propEditorWid->deinit();
_propEditorWid = new PropertyEditorWidget(this, nullptr);
_propEditorWid = new DataContainerFileLoaderWidget(this, nullptr);
_propEditorWid->setVisible(true);
}
......
......@@ -57,7 +57,7 @@ namespace campvis {
class DataContainer;
class DataContainerTreeWidget;
class FaceGeometry;
class PropertyEditorWidget;
class DataContainerFileLoaderWidget;
class DataContainerInspectorWidget : public QWidget, public sigslot::has_slots<> {
Q_OBJECT;
......@@ -202,7 +202,7 @@ namespace campvis {
// Added by Hossain Mahmud <mahmud@in.tum.de>
// Date: January 02, 2014
QPushButton* _btnLoadFile;
PropertyEditorWidget* _propEditorWid;
DataContainerFileLoaderWidget* _propEditorWid;
static const std::string loggerCat_;
};
......
Supports Markdown
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