Skip to content
Snippets Groups Projects
Commit b428af2e authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Method selectMaterialProperty removed from MaterialSvc

parent 8c56756a
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include "MaterialSvc.h" #include "MaterialSvc.h"
#include "ParticleItem.h" #include "ParticleItem.h"
#include "LayerItem.h" #include "LayerItem.h"
#include "MaterialEditorDialog.h"
#include "AppSvc.h"
QColor MaterialItemUtils::suggestMaterialColor(const QString &name) QColor MaterialItemUtils::suggestMaterialColor(const QString &name)
...@@ -94,3 +96,14 @@ MaterialProperty MaterialItemUtils::materialProperty(const SessionItem& material ...@@ -94,3 +96,14 @@ MaterialProperty MaterialItemUtils::materialProperty(const SessionItem& material
return result; return result;
} }
MaterialProperty MaterialItemUtils::selectMaterialProperty(const MaterialProperty& previousMaterial)
{
MaterialEditorDialog dialog(AppSvc::materialModel());
dialog.setInitialMaterialProperty(previousMaterial);
if(dialog.exec() == QDialog::Accepted) {
return dialog.getSelectedMaterialProperty();
}
return MaterialProperty();
}
...@@ -39,6 +39,10 @@ BA_CORE_API_ QString materialTag(const SessionItem &item); ...@@ -39,6 +39,10 @@ BA_CORE_API_ QString materialTag(const SessionItem &item);
//! Constructs material property corresponding to given material. //! Constructs material property corresponding to given material.
BA_CORE_API_ MaterialProperty materialProperty(const SessionItem& materialItem); BA_CORE_API_ MaterialProperty materialProperty(const SessionItem& materialItem);
//! Calls material selector dialog.
BA_CORE_API_ MaterialProperty selectMaterialProperty(const MaterialProperty &previousMaterial=MaterialProperty());
} }
......
...@@ -41,27 +41,6 @@ MaterialSvc *MaterialSvc::instance() ...@@ -41,27 +41,6 @@ MaterialSvc *MaterialSvc::instance()
} }
MaterialProperty
MaterialSvc::selectMaterialProperty(const MaterialProperty &previousMaterial)
{
Q_ASSERT(m_instance);
return m_instance->this_selectMaterialProperty(previousMaterial);
}
MaterialProperty
MaterialSvc::this_selectMaterialProperty(const MaterialProperty &previousMaterial)
{
MaterialEditorDialog dialog(AppSvc::materialModel());
dialog.setInitialMaterialProperty(previousMaterial);
if(dialog.exec() == QDialog::Accepted) {
return dialog.getSelectedMaterialProperty();
}
return MaterialProperty();
}
MaterialProperty MaterialSvc::getDefaultMaterialProperty() MaterialProperty MaterialSvc::getDefaultMaterialProperty()
{ {
Q_ASSERT(m_instance); Q_ASSERT(m_instance);
......
...@@ -35,13 +35,11 @@ public: ...@@ -35,13 +35,11 @@ public:
static MaterialSvc *instance(); static MaterialSvc *instance();
static MaterialProperty selectMaterialProperty(const MaterialProperty &previousMaterial=MaterialProperty());
static MaterialProperty getDefaultMaterialProperty(); static MaterialProperty getDefaultMaterialProperty();
static MaterialItem *getMaterial(const MaterialProperty &property); static MaterialItem *getMaterial(const MaterialProperty &property);
private: private:
MaterialProperty this_selectMaterialProperty(const MaterialProperty &previousMaterial);
MaterialProperty this_getDefaultMaterialProperty(); MaterialProperty this_getDefaultMaterialProperty();
MaterialItem *this_getMaterial(const MaterialProperty &property); MaterialItem *this_getMaterial(const MaterialProperty &property);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "GroupProperty.h" #include "GroupProperty.h"
#include "ComboProperty.h" #include "ComboProperty.h"
#include "ColorProperty.h" #include "ColorProperty.h"
#include "MaterialItemUtils.h"
#include <QBoxLayout> #include <QBoxLayout>
#include <QLabel> #include <QLabel>
#include <QToolButton> #include <QToolButton>
...@@ -87,7 +88,7 @@ void MaterialPropertyEditor::buttonClicked() ...@@ -87,7 +88,7 @@ void MaterialPropertyEditor::buttonClicked()
// temporarily installing filter to prevent loss of focus caused by too insistent dialog // temporarily installing filter to prevent loss of focus caused by too insistent dialog
installEventFilter(m_focusFilter); installEventFilter(m_focusFilter);
MaterialProperty materialProperty = m_data.value<MaterialProperty>(); MaterialProperty materialProperty = m_data.value<MaterialProperty>();
MaterialProperty mat = MaterialSvc::selectMaterialProperty(materialProperty); MaterialProperty mat = MaterialItemUtils::selectMaterialProperty(materialProperty);
removeEventFilter(m_focusFilter); removeEventFilter(m_focusFilter);
if(mat.isDefined() ) if(mat.isDefined() )
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "ObsoletePropertyBrowserUtils.h" #include "ObsoletePropertyBrowserUtils.h"
#include "MaterialSvc.h" #include "MaterialSvc.h"
#include "CustomEventFilters.h" #include "CustomEventFilters.h"
#include "MaterialItemUtils.h"
#include <QColorDialog> #include <QColorDialog>
#include <QComboBox> #include <QComboBox>
#include <QDoubleValidator> #include <QDoubleValidator>
...@@ -70,7 +71,7 @@ void ObsoleteMaterialPropertyEdit::buttonClicked() ...@@ -70,7 +71,7 @@ void ObsoleteMaterialPropertyEdit::buttonClicked()
{ {
// temporarily installing filter to prevent loss of focus caused by too insistent dialog // temporarily installing filter to prevent loss of focus caused by too insistent dialog
installEventFilter(m_focusFilter); installEventFilter(m_focusFilter);
MaterialProperty mat = MaterialSvc::selectMaterialProperty(m_materialProperty); MaterialProperty mat = MaterialItemUtils::selectMaterialProperty(m_materialProperty);
removeEventFilter(m_focusFilter); removeEventFilter(m_focusFilter);
if(mat.isDefined() ) { if(mat.isDefined() ) {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "DesignerView.h" #include "DesignerView.h"
#include "MaterialProperty.h" #include "MaterialProperty.h"
#include "MaterialSvc.h" #include "MaterialSvc.h"
#include "MaterialItemUtils.h"
#include <QAction> #include <QAction>
#include <QButtonGroup> #include <QButtonGroup>
#include <QComboBox> #include <QComboBox>
...@@ -142,5 +143,5 @@ void SampleToolBar::onScaleComboChanged(const QString &scale_string) ...@@ -142,5 +143,5 @@ void SampleToolBar::onScaleComboChanged(const QString &scale_string)
void SampleToolBar::onMaterialEditorCall() void SampleToolBar::onMaterialEditorCall()
{ {
MaterialProperty mp = MaterialSvc::selectMaterialProperty(); MaterialProperty mp = MaterialItemUtils::selectMaterialProperty();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment