30 #include "../../../core/property/Properties.h"
31 #include "../../../core/enum/Enums.h"
32 #include "../../../core/Font.h"
33 #include "../../../core/AbstractBuildGraphicsOutside.h"
34 #include "../../../core/pattern/singleton/Context.h"
35 #include "../BuildGraphicsOutside.h"
36 #include "../../outside/GridSettingsOutside.h"
37 #include "../../../outside/GridSettingsModel.h"
38 #include "../ItemUtils.h"
44 #include <QImageReader>
45 #include <QFileDialog>
46 #include <QMessageBox>
47 #include <QDesktopWidget>
48 #include <QApplication>
61 m_strDlgManager(manager),
62 m_dlgEditorFactory(factory)
78 delete m_strDlgManager;
82 if(m_dlgEditorFactory)
84 delete m_dlgEditorFactory;
85 m_dlgEditorFactory = 0;
91 m_strDlgManager =
new QtStringPropertyManager;
93 m_dlgEditorFactory =
new QtDlgEditorFactory;
96 connect(m_dlgEditorFactory, SIGNAL(internalDlg(QWidget *, QtProperty *)),
this, SLOT(onSetDlg(QWidget *, QtProperty *)));
103 if(!dataType || !parent)
108 std::string name = prop->propertyName().toStdString();
110 Property propt = findDlgProperty(name);
112 m_currentPropertyClicked = propt;
119 connect(parent, SIGNAL(showDlg()),
this, SLOT(onShowGridSettingsDlg()));
123 connect(parent, SIGNAL(showDlg()),
this, SLOT(onShowImageDlg()));
127 connect(parent, SIGNAL(showDlg()),
this, SLOT(onShowTextGridSettingsDlg()));
133 return m_strDlgManager;
138 return m_dlgEditorFactory;
148 m_changeProperty =
true;
155 m_changeProperty =
false;
162 QtProperty* qproperty = 0;
175 qproperty = m_strDlgManager->addProperty(tr(property.
getName().c_str()));
176 m_strDlgManager->setValue(qproperty, property.
getValue().
toString().c_str());
177 addPropertyItem(qproperty, QLatin1String(property.
getName().c_str()));
180 m_dlgProps.insert(std::pair<std::string, Property>(property.
getName(),property));
205 std::string propName;
206 std::map<std::string, Property>::iterator it;
208 for (it = m_dlgProps.begin(); it != m_dlgProps.end(); ++it) {
209 propName = it->first;
210 if(name.compare(propName) == 0)
225 std::map<std::string, Property>::iterator it;
227 for (it = m_dlgProps.begin(); it != m_dlgProps.end(); ++it) {
246 QSet<QtProperty*> list = m_strDlgManager->properties();
247 foreach( QtProperty* prop, list)
249 if(prop->propertyName().toStdString().compare(name))
251 m_strDlgManager->setValue(prop, variant.toString());
276 connect(gridSettings, SIGNAL(updateProperty(
Property)),
this, SLOT(updateOutside(
Property)));
294 gridSettings->show();
300 QString filter = tr(
"Images") +
" ( ";
301 QList<QByteArray> formats = QImageReader::supportedImageFormats();
302 for(
int i = 0; i < formats.size() - 1; ++i)
303 filter +=
"*." + formats[i] +
" ";
306 QDesktopWidget* wg = QApplication::desktop();
310 QRect screen = wg->screenGeometry();
311 dialog.move( screen.center() - dialog.rect().center() );
313 QString path = dialog.getOpenFileName(wg, tr(
"Select an Image File"),
"", filter);
321 QMessageBox::critical(wg, tr(
"Error"), tr(
"The selected image cannot be loaded."));
328 Property prop = m_currentPropertyClicked;
332 changeValueQtPropertyDlg(prop.
getName(), v);
334 emit changeDlgProperty(prop);
355 QVariant variant = findPropertyValue(name);
357 if(variant.isNull() || !variant.isValid())
392 if(name.compare(
"") != 0)
394 prop = findDlgProperty(name);
418 int type = QVariant::Invalid;
437 type = QVariant::Invalid;
445 std::string name =
property.getName();
446 QtProperty* qprop = findProperty(name);
457 return changeQtPropertyValue(qprop, property);
497 emit changeDlgProperty(prop);
std::string getName()
Method that returns the name of this property.
Class to represent a graphic object (MVC component) and widget object (MVC widget) type enumeration...
SimpleData< std::string, STRING_TYPE > String
virtual Property findDlgProperty(std::string name)
virtual EnumType * getGridSettings() const
Returns value that represents GridSettings window (MVC dialog) type belonging to enumeration.
Variant getValue()
Returns stored value.
virtual EnumDataType * getEnumDataType()
Returns data type enumeration.
virtual std::vector< Properties * > getGridMapProperties()
Get properties of all GridMapItem, children of a MapItem.
QWidget * createOuside(te::layout::EnumType *type)
Method to create a widget from the type.
virtual void closeAllWindows()
virtual EnumType * getDataTypeNone() const
Returns value that represents type none belonging to enumeration.
virtual void changeValueQtPropertyDlg(std::string name, QVariant variant)
QtDlgEditorFactory * getDlgEditorFactory()
virtual EnumObjectType * getEnumObjectType()
Returns graphic object (MVC component) and widget object (MVC widget) type enumeration.
Manage properties dialogs values.
Abstract class for build MVC widgets.
static Enums & getInstance()
It returns a reference to the singleton instance.
Class responsible for creating or building widgets. All objects are children of Qwidget and OutsideOb...
virtual EnumType * getDataTypeGridSettings() const
Returns value that represents type GridSettings (string) belonging to enumeration.
Class to represent a data type enumeration. Ex.: int, double, bool, te::color::RGBAColor (color)...
bool isNull()
Returns true if no value has been set, false otherwise.
Window (QDialog) map grid setting (MapItem).
virtual bool changeQtPropertyValue(QtProperty *pproperty, Property property)
virtual void onShowTextGridSettingsDlg()
virtual void createManager()
virtual void onShowImageDlg()
ItemUtils * getItemUtils()
Returns pointer for manipulating items in the scene and vectorization of text and legend...
virtual void onSetDlg(QWidget *parent, QtProperty *prop)
virtual void onShowGridSettingsDlg()
Utility class for manipulating items in the scene and vectorization of text and legend.
virtual EnumType * getDataTypeTextGridSettings() const
Returns value that represents type TextGridSettings (string) belonging to enumeration.
virtual Observable * getModel()
Returns the "Model" part of the MVC.
DialogPropertiesBrowser(QObject *parent=0)
virtual EnumType * getLayoutType(QVariant::Type type, std::string name="")
AbstractBuildGraphicsOutside * getAbstractBuildGraphicsOutside()
Returns pointer for build graphics MVC components.
void setValue(ValueType value, EnumType *type)
Stores a copy of value.
virtual int getVariantType(EnumType *dataType)
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
virtual QtProperty * addProperty(Property property)
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
QtDlgEditorFactory * m_dlgEditorFactory
std::string toString()
Returns the value of string type. (The setValue method received a string)
virtual void setProperties(std::vector< te::layout::Properties * > properties)
virtual bool updateProperty(Property property)
void setName(std::string name)
Sets the name of this property.
virtual ~DialogPropertiesBrowser()
virtual void updateOutside(Property prop)
virtual EnumType * getDataTypeString() const
Returns value that represents type string belonging to enumeration.
std::map< std::string, Property > getDlgProps()
virtual Property getProperty(std::string name)
Manage properties variants values.
virtual bool checkDlgType(Property prop)
virtual EnumType * getDataTypeImage() const
Returns value that represents type image (string) belonging to enumeration.
QtStringPropertyManager * getStringPropertyManager()
EnumType * getType()
Returns the type of this property.
A property acts like a attribute member of a object and stores the state of this attribute. A set of properties stores the state of an object. Any data type, not included in the convertValue method in the class te::layout::Variant, it will be by default "std::string" value.
virtual QWidget * createOutside(EnumType *enumType)