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@244
|
8 Copyright (c) 2011 Chris Cannam
|
Chris@244
|
9 Copyright (c) 2011 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@168
|
21 #include <QGraphicsObject>
|
Chris@129
|
22 #include <QFont>
|
Chris@129
|
23
|
Chris@168
|
24 class UncommittedItem : public QGraphicsObject
|
Chris@129
|
25 {
|
Chris@129
|
26 Q_OBJECT
|
Chris@129
|
27
|
Chris@129
|
28 public:
|
Chris@129
|
29 UncommittedItem();
|
Chris@129
|
30
|
Chris@129
|
31 virtual QRectF boundingRect() const;
|
Chris@129
|
32 virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
Chris@129
|
33
|
Chris@129
|
34 QString branch() const { return m_branch; }
|
Chris@129
|
35 void setBranch(QString b) { m_branch = b; }
|
Chris@153
|
36
|
Chris@153
|
37 bool showBranch() const { return m_showBranch; }
|
Chris@153
|
38 void setShowBranch(bool s) { m_showBranch = s; }
|
Chris@311
|
39
|
Chris@311
|
40 bool isNewBranch() const { return m_isNewBranch; }
|
Chris@311
|
41 void setIsNewBranch(bool s) { m_isNewBranch = s; }
|
Chris@399
|
42
|
Chris@399
|
43 bool isMerge() const { return m_isMerge; }
|
Chris@399
|
44 void setIsMerge(bool m) { m_isMerge = m; }
|
Chris@129
|
45
|
Chris@129
|
46 int column() const { return m_column; }
|
Chris@129
|
47 int row() const { return m_row; }
|
Chris@129
|
48 void setColumn(int c) { m_column = c; setX(c * 100); }
|
Chris@129
|
49 void setRow(int r) { m_row = r; setY(r * 90); }
|
Chris@129
|
50
|
Chris@129
|
51 bool isWide() const { return m_wide; }
|
Chris@129
|
52 void setWide(bool w) { m_wide = w; }
|
Chris@129
|
53
|
Chris@141
|
54 signals:
|
Chris@141
|
55 void commit();
|
Chris@141
|
56 void revert();
|
Chris@141
|
57 void diff();
|
Chris@168
|
58 void showSummary();
|
Chris@153
|
59 void showWork();
|
Chris@311
|
60 void newBranch();
|
Chris@311
|
61 void noBranch();
|
Chris@141
|
62
|
Chris@141
|
63 protected:
|
Chris@141
|
64 virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
|
Chris@153
|
65 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
|
Chris@141
|
66
|
Chris@129
|
67 private:
|
Chris@141
|
68 void activateMenu();
|
Chris@141
|
69
|
Chris@129
|
70 QString m_branch;
|
Chris@153
|
71 bool m_showBranch;
|
Chris@311
|
72 bool m_isNewBranch;
|
Chris@399
|
73 bool m_isMerge;
|
Chris@129
|
74 QFont m_font;
|
Chris@129
|
75 int m_column;
|
Chris@129
|
76 int m_row;
|
Chris@129
|
77 bool m_wide;
|
Chris@399
|
78
|
Chris@399
|
79 void paintNormal(QPainter *);
|
Chris@399
|
80 void paintMerge(QPainter *);
|
Chris@129
|
81 };
|
Chris@129
|
82
|
Chris@129
|
83 #endif // UNCOMMITTEDITEM_H
|