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@43
|
18 #ifndef CHANGESETITEM_H
|
Chris@43
|
19 #define CHANGESETITEM_H
|
Chris@43
|
20
|
Chris@43
|
21 #include <QGraphicsItem>
|
Chris@53
|
22 #include <QFont>
|
Chris@43
|
23
|
Chris@43
|
24 class Changeset;
|
Chris@117
|
25 class ChangesetDetailItem;
|
Chris@43
|
26
|
Chris@119
|
27 class ChangesetItem : public QObject, public QGraphicsItem
|
Chris@43
|
28 {
|
Chris@119
|
29 Q_OBJECT
|
Chris@119
|
30 Q_INTERFACES(QGraphicsItem)
|
Chris@119
|
31
|
Chris@43
|
32 public:
|
Chris@53
|
33 ChangesetItem(Changeset *cs);
|
Chris@43
|
34
|
Chris@43
|
35 virtual QRectF boundingRect() const;
|
Chris@43
|
36 virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
Chris@43
|
37
|
Chris@53
|
38 Changeset *getChangeset() { return m_changeset; }
|
Chris@53
|
39
|
Chris@44
|
40 int column() const { return m_column; }
|
Chris@44
|
41 int row() const { return m_row; }
|
Chris@46
|
42 void setColumn(int c) { m_column = c; setX(c * 100); }
|
Chris@53
|
43 void setRow(int r) { m_row = r; setY(r * 90); }
|
Chris@44
|
44
|
Chris@55
|
45 bool isWide() const { return m_wide; }
|
Chris@55
|
46 void setWide(bool w) { m_wide = w; }
|
Chris@55
|
47
|
Chris@74
|
48 bool shouldShowBranch() const { return m_showBranch; }
|
Chris@74
|
49 void setShowBranch(bool s) { m_showBranch = s; }
|
Chris@74
|
50
|
Chris@119
|
51 signals:
|
Chris@119
|
52 void detailShown();
|
Chris@119
|
53 void detailHidden();
|
Chris@119
|
54
|
Chris@119
|
55 public slots:
|
Chris@119
|
56 void showDetail();
|
Chris@119
|
57 void hideDetail();
|
Chris@119
|
58
|
Chris@117
|
59 protected:
|
Chris@117
|
60 virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
|
Chris@117
|
61
|
Chris@43
|
62 private:
|
Chris@53
|
63 QFont m_font;
|
Chris@43
|
64 Changeset *m_changeset;
|
Chris@117
|
65 ChangesetDetailItem *m_detail;
|
Chris@74
|
66 bool m_showBranch;
|
Chris@44
|
67 int m_column;
|
Chris@44
|
68 int m_row;
|
Chris@55
|
69 bool m_wide;
|
Chris@43
|
70 };
|
Chris@43
|
71
|
Chris@43
|
72 #endif // CHANGESETITEM_H
|