Skip to content

Commit

Permalink
Fixed the identation of libobjrenderes source
Browse files Browse the repository at this point in the history
  • Loading branch information
rkhaotix committed Feb 22, 2016
1 parent 63b8177 commit 40f9960
Show file tree
Hide file tree
Showing 22 changed files with 1,568 additions and 1,568 deletions.
356 changes: 178 additions & 178 deletions libobjrenderer/src/baseobjectview.cpp

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions libobjrenderer/src/baseobjectview.h
Expand Up @@ -35,12 +35,12 @@ class BaseObjectView: public QObject, public QGraphicsItemGroup {
private:
Q_OBJECT

protected:
/*! brief Indicates if the placeholder object must be used when moving objects.
Place holder objects when enabled causes a significant performance gain mainly when
moving tables linked to relationships because the relationships will be updated only
when the table moviment ends and not during it */
static bool use_placeholder;
protected:
/*! brief Indicates if the placeholder object must be used when moving objects.
Place holder objects when enabled causes a significant performance gain mainly when
moving tables linked to relationships because the relationships will be updated only
when the table moviment ends and not during it */
static bool use_placeholder;

/*! \brief Stores the global selection order of objects. This attributes
is incremented each time an object is selected. */
Expand All @@ -57,28 +57,28 @@ class BaseObjectView: public QObject, public QGraphicsItemGroup {
QGraphicsSimpleTextItem *pos_info_txt;

//! \brief Graphical object (rectangle) of the position info
QGraphicsRectItem *pos_info_rect;
QGraphicsRectItem *pos_info_rect;

//! \brief Stores the objects bounding rect
QRectF bounding_rect;

//! \brief Graphical object that represents the object selection
QGraphicsItem *obj_selection;
QGraphicsItem *obj_selection;

//! \brief Icon that represent the object protection
QGraphicsItemGroup *protected_icon;

//! \brief Graphical object that represents the current object shadow
QGraphicsItem *obj_shadow;
QGraphicsItem *obj_shadow;

//! brief Graphical object that represents the placeholder when the object is being moved
RoundedRectItem *placeholder;
//! brief Graphical object that represents the placeholder when the object is being moved
RoundedRectItem *placeholder;

//! \brief Graphical object of the sql disabled info
QGraphicsRectItem *sql_disabled_box;
//! \brief Graphical object of the sql disabled info
QGraphicsRectItem *sql_disabled_box;

//! \brief Graphical text for the sql disabled info
QGraphicsSimpleTextItem *sql_disabled_txt;
//! \brief Graphical text for the sql disabled info
QGraphicsSimpleTextItem *sql_disabled_txt;

//! \brief Stores the object font configuration
static map<QString, QTextCharFormat> font_config;
Expand All @@ -98,23 +98,23 @@ class BaseObjectView: public QObject, public QGraphicsItemGroup {
//! \brief Configures the polygons used to show the current object position
void configurePositionInfo(QPointF pos);

//! \brief Configures the rectangle used to show the sql disabled status
void configureSQLDisabledInfo(void);
//! \brief Configures the rectangle used to show the sql disabled status
void configureSQLDisabledInfo(void);

//! \brief Configures the icon that denotes the object's protection
void configureProtectedIcon(void);

void configurePlaceholder(void);
void configurePlaceholder(void);

void mousePressEvent(QGraphicsSceneMouseEvent *event);

void setSelectionOrder(bool selected);
void setSelectionOrder(bool selected);

public:
static constexpr double VERT_SPACING=2.0f,
HORIZ_SPACING=2.0f,
DEFAULT_FONT_SIZE=9.0f,
OBJ_BORDER_WIDTH=0.80f;
static constexpr double VERT_SPACING=2.0f,
HORIZ_SPACING=2.0f,
DEFAULT_FONT_SIZE=9.0f,
OBJ_BORDER_WIDTH=0.80f;

BaseObjectView(BaseObject *object=nullptr);
virtual ~BaseObjectView(void);
Expand Down Expand Up @@ -147,34 +147,34 @@ class BaseObjectView: public QObject, public QGraphicsItemGroup {
//! \brief Returns the font style for the specified element id
static QTextCharFormat getFontStyle(const QString &id);

static void setPlaceholderEnabled(bool value);
static void setPlaceholderEnabled(bool value);

static bool isPlaceholderEnabled(void);
static bool isPlaceholderEnabled(void);

//! \brief Sets the font style for the specified element id
static void setFontStyle(const QString &id, QTextCharFormat font_fmt);

//! \brief Sets the color for the specified element id (used to set color for objects and font)
static void setElementColor(const QString &id, QColor color, unsigned color_id);

//! \brief Returns the color for the specified element id (used to get color for objects and font)
static QColor getElementColor(const QString &id, unsigned color_id);
//! \brief Returns the color for the specified element id (used to get color for objects and font)
static QColor getElementColor(const QString &id, unsigned color_id);

//! \brief Defines the object that the view represents
void setSourceObject(BaseObject *object);
//! \brief Defines the object that the view represents
void setSourceObject(BaseObject *object);

//! \brief Pure virtual object (the derived classes must implement it)
//! \brief Pure virtual object (the derived classes must implement it)
virtual void configureObject(void)=0;

/*! \brief Returns the center point of the whole object.
Note: this is not the same as calling boundingRect()->center(). Instead, this
method calculates the center point based upon the current object's position */
virtual QPointF getCenter(void);

//! brief Toggles the wireframe display
virtual void togglePlaceholder(bool visible);
//! brief Toggles the wireframe display
virtual void togglePlaceholder(bool visible);

protected slots:
protected slots:
//! \brief Make the basic object operations
void __configureObject(void);

Expand Down
156 changes: 78 additions & 78 deletions libobjrenderer/src/basetableview.cpp
Expand Up @@ -26,48 +26,48 @@ BaseTableView::BaseTableView(BaseTable *base_tab) : BaseObjectView(base_tab)
if(!base_tab)
throw Exception(ERR_ASG_NOT_ALOC_OBJECT, __PRETTY_FUNCTION__, __FILE__, __LINE__);

body=new RoundedRectItem;
body->setRoundedCorners(RoundedRectItem::BOTTOMLEFT_CORNER | RoundedRectItem::BOTTOMRIGHT_CORNER);
body=new RoundedRectItem;
body->setRoundedCorners(RoundedRectItem::BOTTOMLEFT_CORNER | RoundedRectItem::BOTTOMRIGHT_CORNER);

title=new TableTitleView;
title=new TableTitleView;

ext_attribs_body=new RoundedRectItem;
ext_attribs_body->setRoundedCorners(RoundedRectItem::BOTTOMLEFT_CORNER | RoundedRectItem::BOTTOMRIGHT_CORNER);
ext_attribs_body=new RoundedRectItem;
ext_attribs_body->setRoundedCorners(RoundedRectItem::BOTTOMLEFT_CORNER | RoundedRectItem::BOTTOMRIGHT_CORNER);

ext_attribs=new QGraphicsItemGroup;
ext_attribs->setZValue(1);
ext_attribs=new QGraphicsItemGroup;
ext_attribs->setZValue(1);

columns=new QGraphicsItemGroup;
columns->setZValue(1);
columns=new QGraphicsItemGroup;
columns->setZValue(1);

tag_name=new QGraphicsSimpleTextItem;
tag_name->setZValue(3);
tag_name=new QGraphicsSimpleTextItem;
tag_name->setZValue(3);

tag_body=new QGraphicsPolygonItem;
tag_body->setZValue(2);
tag_body=new QGraphicsPolygonItem;
tag_body->setZValue(2);

obj_shadow=new RoundedRectItem;
obj_shadow->setZValue(-1);
obj_shadow=new RoundedRectItem;
obj_shadow->setZValue(-1);

obj_selection=new RoundedRectItem;
obj_selection->setVisible(false);
obj_selection->setZValue(4);
obj_selection=new RoundedRectItem;
obj_selection->setVisible(false);
obj_selection->setZValue(4);

this->addToGroup(obj_selection);
this->addToGroup(obj_shadow);
this->addToGroup(columns);
this->addToGroup(obj_selection);
this->addToGroup(obj_shadow);
this->addToGroup(columns);
this->addToGroup(body);
this->addToGroup(title);
this->addToGroup(tag_name);
this->addToGroup(tag_body);
this->addToGroup(tag_name);
this->addToGroup(tag_body);
this->addToGroup(ext_attribs);
this->addToGroup(ext_attribs_body);

this->setAcceptHoverEvents(true);
sel_child_obj=nullptr;
connected_rels=0;

configurePlaceholder();
configurePlaceholder();
}

BaseTableView::~BaseTableView(void)
Expand All @@ -77,35 +77,35 @@ BaseTableView::~BaseTableView(void)
this->removeFromGroup(ext_attribs_body);
this->removeFromGroup(ext_attribs);
this->removeFromGroup(columns);
this->removeFromGroup(tag_name);
this->removeFromGroup(tag_body);
this->removeFromGroup(tag_name);
this->removeFromGroup(tag_body);
delete(ext_attribs_body);
delete(ext_attribs);
delete(body);
delete(title);
delete(columns);
delete(tag_name);
delete(tag_body);
delete(tag_name);
delete(tag_body);
}

void BaseTableView::setHideExtAttributes(bool value)
{
hide_ext_attribs=value;
hide_ext_attribs=value;
}

void BaseTableView::setHideTags(bool value)
{
hide_tags=value;
hide_tags=value;
}

bool BaseTableView::isExtAttributesHidden(void)
{
return(hide_ext_attribs);
return(hide_ext_attribs);
}

bool BaseTableView::isTagsHidden(void)
{
return(hide_tags);
return(hide_tags);
}

QVariant BaseTableView::itemChange(GraphicsItemChange change, const QVariant &value)
Expand All @@ -130,7 +130,7 @@ void BaseTableView::mousePressEvent(QGraphicsSceneMouseEvent *event)
if(!this->isSelected() && event->buttons()==Qt::RightButton && sel_child_obj)
{
if(this->scene())
this->scene()->clearSelection();
this->scene()->clearSelection();

/* Deactivate the table in order not to hide the child object selection.
The table object is reativated when the context menu is hidden */
Expand Down Expand Up @@ -183,16 +183,16 @@ void BaseTableView::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
}
else if(!items.isEmpty())
{
//QPolygonF pol;
//QPolygonF pol;
BaseObjectView *item=dynamic_cast<TableObjectView *>(items[item_idx]);

//Configures the selection with the item's dimension
if(obj_selection->boundingRect().height()!=item->boundingRect().height())
{
dynamic_cast<RoundedRectItem *>(obj_selection)->setBorderRadius(2);
dynamic_cast<RoundedRectItem *>(obj_selection)->setRect(QRectF(0,0,
title->boundingRect().width() - (2.5 * HORIZ_SPACING),
item->boundingRect().height()));
dynamic_cast<RoundedRectItem *>(obj_selection)->setBorderRadius(2);
dynamic_cast<RoundedRectItem *>(obj_selection)->setRect(QRectF(0,0,
title->boundingRect().width() - (2.5 * HORIZ_SPACING),
item->boundingRect().height()));
}

//Sets the selection position as same as item's position
Expand All @@ -210,61 +210,61 @@ void BaseTableView::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
void BaseTableView::updateConnectedRelsCount(int inc)
{
connected_rels+=inc;
if(connected_rels < 0) connected_rels=0;
if(connected_rels < 0) connected_rels=0;
}

void BaseTableView::configureTag(void)
{
BaseTable *tab=dynamic_cast<BaseTable *>(this->getSourceObject());
Tag *tag=tab->getTag();

tag_body->setVisible(tag!=nullptr && !hide_tags);
tag_name->setVisible(tag!=nullptr && !hide_tags);

if(!hide_tags && tag)
{
QPolygonF pol;
QPointF p1, p2;
double bottom;
QFont fnt=BaseObjectView::getFontStyle(ParsersAttributes::TAG).font();

fnt.setPointSizeF(fnt.pointSizeF() * 0.80f);
tag_name->setFont(fnt);
tag_name->setText(tag->getName());
tag_name->setBrush(BaseObjectView::getFontStyle(ParsersAttributes::TAG).foreground());

p1=tag_name->boundingRect().topLeft(),
p2=tag_name->boundingRect().bottomRight();
bottom=this->boundingRect().bottom();

pol.append(QPointF(p1.x()-BaseObjectView::HORIZ_SPACING, p1.y() - BaseObjectView::VERT_SPACING));
pol.append(QPointF(p2.x(), p1.y() - BaseObjectView::VERT_SPACING));
pol.append(QPointF(p2.x() + BaseObjectView::HORIZ_SPACING + 5, p2.y()/2));
pol.append(QPointF(p2.x(), p2.y() + BaseObjectView::VERT_SPACING));
pol.append(QPointF(p1.x(), p2.y() + BaseObjectView::VERT_SPACING));
pol.append(QPointF(p1.x()-BaseObjectView::HORIZ_SPACING, p2.y() + BaseObjectView::VERT_SPACING));

tag_body->setPolygon(pol);
tag_body->setPen(BaseObjectView::getBorderStyle(ParsersAttributes::TAG));
tag_body->setBrush(BaseObjectView::getFillStyle(ParsersAttributes::TAG));

tag_name->setPos(-5, bottom - 1.5f);
tag_body->setPos(-5, bottom - 1.5f);
}
BaseTable *tab=dynamic_cast<BaseTable *>(this->getSourceObject());
Tag *tag=tab->getTag();

tag_body->setVisible(tag!=nullptr && !hide_tags);
tag_name->setVisible(tag!=nullptr && !hide_tags);

if(!hide_tags && tag)
{
QPolygonF pol;
QPointF p1, p2;
double bottom;
QFont fnt=BaseObjectView::getFontStyle(ParsersAttributes::TAG).font();

fnt.setPointSizeF(fnt.pointSizeF() * 0.80f);
tag_name->setFont(fnt);
tag_name->setText(tag->getName());
tag_name->setBrush(BaseObjectView::getFontStyle(ParsersAttributes::TAG).foreground());

p1=tag_name->boundingRect().topLeft(),
p2=tag_name->boundingRect().bottomRight();
bottom=this->boundingRect().bottom();

pol.append(QPointF(p1.x()-BaseObjectView::HORIZ_SPACING, p1.y() - BaseObjectView::VERT_SPACING));
pol.append(QPointF(p2.x(), p1.y() - BaseObjectView::VERT_SPACING));
pol.append(QPointF(p2.x() + BaseObjectView::HORIZ_SPACING + 5, p2.y()/2));
pol.append(QPointF(p2.x(), p2.y() + BaseObjectView::VERT_SPACING));
pol.append(QPointF(p1.x(), p2.y() + BaseObjectView::VERT_SPACING));
pol.append(QPointF(p1.x()-BaseObjectView::HORIZ_SPACING, p2.y() + BaseObjectView::VERT_SPACING));

tag_body->setPolygon(pol);
tag_body->setPen(BaseObjectView::getBorderStyle(ParsersAttributes::TAG));
tag_body->setBrush(BaseObjectView::getFillStyle(ParsersAttributes::TAG));

tag_name->setPos(-5, bottom - 1.5f);
tag_body->setPos(-5, bottom - 1.5f);
}
}

int BaseTableView::getConnectRelsCount(void)
{
return(connected_rels);
return(connected_rels);
}

void BaseTableView::requestRelationshipsUpdate(void)
{
emit s_relUpdateRequest();
emit s_relUpdateRequest();
}

void BaseTableView::togglePlaceholder(bool value)
{
BaseObjectView::togglePlaceholder(connected_rels > 0 && value);
BaseObjectView::togglePlaceholder(connected_rels > 0 && value);
}

0 comments on commit 40f9960

Please sign in to comment.