annotate uncommitteditem.h @ 129:4986642800f0

* Initial work on showing uncommitted changes (as dashed box) in history graph
author Chris Cannam
date Mon, 29 Nov 2010 20:53:34 +0000
parents
children e6c6b88d19b9
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@129 46 private:
Chris@129 47 QString m_branch;
Chris@129 48 QFont m_font;
Chris@129 49 int m_column;
Chris@129 50 int m_row;
Chris@129 51 bool m_wide;
Chris@129 52 };
Chris@129 53
Chris@129 54 #endif // UNCOMMITTEDITEM_H