annotate connectionitem.h @ 145:644bd31e8301

* Include the uncommitted item in general graph layout (in case it is not at the head, when other items will need to avoid it)
author Chris Cannam
date Wed, 01 Dec 2010 17:41:14 +0000
parents f583e44d9d31
children 8fd71f570884
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@57 2
Chris@57 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@57 6 Based on HgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@57 8 Copyright (c) 2010 Chris Cannam
Chris@57 9 Copyright (c) 2010 Queen Mary, University of London
Chris@57 10
Chris@57 11 This program is free software; you can redistribute it and/or
Chris@57 12 modify it under the terms of the GNU General Public License as
Chris@57 13 published by the Free Software Foundation; either version 2 of the
Chris@57 14 License, or (at your option) any later version. See the file
Chris@57 15 COPYING included with this distribution for more information.
Chris@57 16 */
Chris@57 17
Chris@46 18 #ifndef CONNECTIONITEM_H
Chris@46 19 #define CONNECTIONITEM_H
Chris@46 20
Chris@46 21 #include <QGraphicsItem>
Chris@46 22
Chris@46 23 class Connection;
Chris@46 24
Chris@46 25 class ChangesetItem;
Chris@145 26 class UncommittedItem;
Chris@46 27
Chris@46 28 class ConnectionItem : public QGraphicsItem
Chris@46 29 {
Chris@46 30 public:
Chris@53 31 enum Type {
Chris@53 32 Normal,
Chris@53 33 Split,
Chris@53 34 Merge
Chris@53 35 };
Chris@53 36
Chris@53 37 ConnectionItem() : m_type(Normal), m_parent(0), m_child(0) { }
Chris@46 38
Chris@46 39 virtual QRectF boundingRect() const;
Chris@46 40 virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
Chris@46 41
Chris@53 42 Type connectionType() const { return m_type; }
Chris@53 43 void setConnectionType(Type t) { m_type = t; }
Chris@53 44
Chris@145 45 //!!! deletion signals from parent/child?
Chris@46 46
Chris@46 47 ChangesetItem *parent() { return m_parent; }
Chris@46 48 ChangesetItem *child() { return m_child; }
Chris@46 49
Chris@46 50 void setParent(ChangesetItem *p) { m_parent = p; }
Chris@46 51 void setChild(ChangesetItem *c) { m_child = c; }
Chris@145 52 void setChild(UncommittedItem *u) { m_uncommitted = u; }
Chris@46 53
Chris@46 54 private:
Chris@53 55 Type m_type;
Chris@46 56 ChangesetItem *m_parent;
Chris@46 57 ChangesetItem *m_child;
Chris@145 58 UncommittedItem *m_uncommitted;
Chris@46 59 };
Chris@46 60
Chris@46 61 #endif // CONNECTIONITEM_H