comparison src/changesetitem.h @ 370:b9c153e00e84

Move source files to src/
author Chris Cannam
date Thu, 24 Mar 2011 10:27:51 +0000
parents changesetitem.h@5b4aa1c24407
children ce6a70970808
comparison
equal deleted inserted replaced
369:19cce6d2c470 370:b9c153e00e84
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 EasyMercurial
5
6 Based on HgExplorer by Jari Korhonen
7 Copyright (c) 2010 Jari Korhonen
8 Copyright (c) 2011 Chris Cannam
9 Copyright (c) 2011 Queen Mary, University of London
10
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version. See the file
15 COPYING included with this distribution for more information.
16 */
17
18 #ifndef CHANGESETITEM_H
19 #define CHANGESETITEM_H
20
21 #include <QGraphicsObject>
22 #include <QFont>
23
24 class Changeset;
25 class ChangesetDetailItem;
26
27 class QAction;
28
29 class ChangesetItem : public QGraphicsObject
30 {
31 Q_OBJECT
32
33 public:
34 ChangesetItem(Changeset *cs);
35
36 virtual QRectF boundingRect() const;
37 virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
38
39 Changeset *getChangeset() { return m_changeset; }
40 QString getId();
41
42 int column() const { return m_column; }
43 int row() const { return m_row; }
44 void setColumn(int c) { m_column = c; setX(c * 100); }
45 void setRow(int r) { m_row = r; setY(r * 90); }
46
47 bool isWide() const { return m_wide; }
48 void setWide(bool w) { m_wide = w; }
49
50 bool isCurrent() const { return m_current; }
51 void setCurrent(bool c) { m_current = c; }
52
53 bool isNew() const { return m_new; }
54 void setNew(bool n) { m_new = n; }
55
56 bool showBranch() const { return m_showBranch; }
57 void setShowBranch(bool s) { m_showBranch = s; }
58
59 signals:
60 void detailShown();
61 void detailHidden();
62
63 void updateTo(QString);
64 void diffToCurrent(QString);
65 void diffToParent(QString child, QString parent);
66 void showSummary(Changeset *);
67 void mergeFrom(QString);
68 void newBranch(QString);
69 void tag(QString);
70
71 public slots:
72 void showDetail();
73 void hideDetail();
74
75 private slots:
76 void copyIdActivated();
77 void updateActivated();
78 void diffToParentActivated();
79 void showSummaryActivated();
80 void diffToCurrentActivated();
81 void mergeActivated();
82 void tagActivated();
83 void newBranchActivated();
84
85 protected:
86 virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
87
88 private:
89 void activateMenu();
90
91 QFont m_font;
92 Changeset *m_changeset;
93 ChangesetDetailItem *m_detail;
94 bool m_showBranch;
95 int m_column;
96 int m_row;
97 bool m_wide;
98 bool m_current;
99 bool m_new;
100
101 QMap<QAction *, QString> m_parentDiffActions;
102 QMap<QAction *, QString> m_summaryActions;
103 };
104
105 #endif // CHANGESETITEM_H