/**
    05Robot - Object Manipulation GUI Module

    @author P.Kaczmarek,J.Tomczynski,T.Mankowski
    @version 1.0 2017
*/
#ifndef OBJECTMANIPULATIONPROPERTIES_H
#define OBJECTMANIPULATIONPROPERTIES_H

#include <QWidget>

#include "ObjectManipulationWindow.h"
#include "cxmlio.h"

/** \addtogroup ObjectManipulationGUIModule
 *  @{
 */
/**
 @brief Object manipulation properties
 
 Wrapper class for all ObjectManipulationWindow settings as cXmlIO-derived XML reader/writer.
 
 */
class ObjectManipulationProperties : public cXmlIO
{
	Q_OBJECT
    /**
     @brief Base button size in pixels
     */
    Q_PROPERTY(int Interface_size READ interface_size WRITE set_interface_size DESIGNABLE true USER true)
    Q_CLASSINFO("Interface_size", "minimum=20;maximum=300;singleStep=1;");
    /**
     @brief Initial rotation in degrees units
     */
    Q_PROPERTY(int Initial_rotation READ initial_rotation WRITE set_initial_rotation DESIGNABLE true USER true)
    Q_CLASSINFO("Initial_rotation", "minimum=0;maximum=359;singleStep=1;");
    /**
     @brief Rotation step in degrees
     */
    Q_PROPERTY(int Rotation_step READ rotation_step WRITE set_rotation_step DESIGNABLE true USER true)
    Q_CLASSINFO("Rotation_step", "minimum=90;maximum=270;singleStep=90;");
    /**
     @brief View scroll step (fraction of view window)
     */
    Q_PROPERTY(float View_scroll_step READ view_scroll_step WRITE set_view_scroll_step DESIGNABLE true USER true)
    Q_CLASSINFO("View_scroll_step", "minimum=0.01;maximum=1;singleStep=0.01;");
    /**
     @brief Zoom in/out factor
     */
    Q_PROPERTY(float Zoom_in_out_factor READ zoom_in_out_factor WRITE set_zoom_in_out_factor DESIGNABLE true USER true)
    Q_CLASSINFO("Zoom_in_out_factor", "minimum=0.01;maximum=10.0;singleStep=0.1;");
    /**
     @brief Bin descriptors
     */
    Q_PROPERTY(QString Bin_descriptors READ bin_descriptors WRITE set_bin_descriptors DESIGNABLE true USER true)
    /**
     @brief Static image file to display, disables live camera input and switches to object manipulation mode
     */
    Q_PROPERTY(QString Image_file READ image_file WRITE set_image_file DESIGNABLE true USER true)
    /**
     @brief Object list file
     */
    Q_PROPERTY(QString Object_list_file READ object_list_file WRITE set_object_list_file DESIGNABLE true USER true)
    
    
public:
    /**
     @brief Default constructor, initializes wrapper object
     
     @param parent pointer to parent widget
     */
    ObjectManipulationProperties(ObjectManipulationWindow* managed_window, QObject *parent = 0);
    /**
     @brief Gets base button size in pixels
     */
    int interface_size() const;
    /**
     @brief Sets base button size in pixels
     */
    void set_interface_size(int interface_size);
    /**
     @brief Gets initial rotation in degrees
     */
    int initial_rotation() const;
    /**
     @brief Sets initial rotation in degrees
     */
    void set_initial_rotation(int initial_rotation);
    /**
     @brief Gets rotation step in degrees
     */
    int rotation_step() const;
    /**
     @brief Sets rotation step in degrees
     */
    void set_rotation_step(int rotation_step);
    /**
     @brief Gets view scroll step (fraction of view window)
     */
    float view_scroll_step() const;
    /**
     @brief Sets view scroll step (fraction of view window)
     */
    void set_view_scroll_step(float view_scroll_step);
    /**
     @brief Gets zoom in/out factor
     */
    float zoom_in_out_factor() const;
    /**
     @brief Sets zoom in/out factor
     */
    void set_zoom_in_out_factor(float zoom_in_out_factor);
    /**
     @brief Gets bin descriptors
     */
    QString bin_descriptors() const;
    /**
     @brief Sets bin descriptors
     */
    void set_bin_descriptors(const QString &bin_descriptors);
    /**
     @brief Gets image file
     */
    QString image_file() const;
    /**
     @brief Sets image file
     */
    void set_image_file(const QString &image_file);
    /**
     @brief Gets object list file
     */
    QString object_list_file() const;
    /**
     @brief Sets object list file
     */
    void set_object_list_file(const QString &object_list_file);
    /**
     * @brief reads XML file TODO
     * @param stream XML stream
     */
    virtual void readXml(QXmlStreamReader& stream) {
        while(!(stream.tokenType() == QXmlStreamReader::EndElement && stream.name() == sXmlKey())) {
            cXmlIO::readXml(stream);
            stream.readNext();
        }
    }

private:
    ObjectManipulationWindow* managed_window_ = NULL;
};
/** @}*/
#endif // OBJECTMANIPULATIONPROPERTIES_H
