annotate uncommitteditem.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 e6c6b88d19b9
children 70fe12873106
rev   line source
Chris@129 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@129 2
Chris@129 3 /*
Chris@129 4 EasyMercurial
Chris@129 5
Chris@129 6 Based on HgExplorer by Jari Korhonen
Chris@129 7 Copyright (c) 2010 Jari Korhonen
Chris@129 8 Copyright (c) 2010 Chris Cannam
Chris@129 9 Copyright (c) 2010 Queen Mary, University of London
Chris@129 10
Chris@129 11 This program is free software; you can redistribute it and/or
Chris@129 12 modify it under the terms of the GNU General Public License as
Chris@129 13 published by the Free Software Foundation; either version 2 of the
Chris@129 14 License, or (at your option) any later version. See the file
Chris@129 15 COPYING included with this distribution for more information.
Chris@129 16 */
Chris@129 17
Chris@129 18 #ifndef UNCOMMITTEDITEM_H
Chris@129 19 #define UNCOMMITTEDITEM_H
Chris@129 20
Chris@129 21 #include <QGraphicsItem>
Chris@129 22 #include <QFont>
Chris@129 23
Chris@129 24 class UncommittedItem : public QObject, public QGraphicsItem
Chris@129 25 {
Chris@129 26 Q_OBJECT
Chris@129 27 Q_INTERFACES(QGraphicsItem)
Chris@129 28
Chris@129 29 public:
Chris@129 30 UncommittedItem();
Chris@129 31
Chris@129 32 virtual QRectF boundingRect() const;
Chris@129 33 virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
Chris@129 34
Chris@129 35 QString branch() const { return m_branch; }
Chris@129 36 void setBranch(QString b) { m_branch = b; }
Chris@129 37
Chris@129 38 int column() const { return m_column; }
Chris@129 39 int row() const { return m_row; }
Chris@129 40 void setColumn(int c) { m_column = c; setX(c * 100); }
Chris@129 41 void setRow(int r) { m_row = r; setY(r * 90); }
Chris@129 42
Chris@129 43 bool isWide() const { return m_wide; }
Chris@129 44 void setWide(bool w) { m_wide = w; }
Chris@129 45
Chris@141 46 signals:
Chris@141 47 void commit();
Chris@141 48 void revert();
Chris@141 49 void diff();
Chris@141 50
Chris@141 51 protected:
Chris@141 52 virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
Chris@141 53
Chris@129 54 private:
Chris@141 55 void activateMenu();
Chris@141 56
Chris@129 57 QString m_branch;
Chris@129 58 QFont m_font;
Chris@129 59 int m_column;
Chris@129 60 int m_row;
Chris@129 61 bool m_wide;
Chris@129 62 };
Chris@129 63
Chris@129 64 #endif // UNCOMMITTEDITEM_H