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@129
|
42
|
Chris@129
|
43 int column() const { return m_column; }
|
Chris@129
|
44 int row() const { return m_row; }
|
Chris@129
|
45 void setColumn(int c) { m_column = c; setX(c * 100); }
|
Chris@129
|
46 void setRow(int r) { m_row = r; setY(r * 90); }
|
Chris@129
|
47
|
Chris@129
|
48 bool isWide() const { return m_wide; }
|
Chris@129
|
49 void setWide(bool w) { m_wide = w; }
|
Chris@129
|
50
|
Chris@141
|
51 signals:
|
Chris@141
|
52 void commit();
|
Chris@141
|
53 void revert();
|
Chris@141
|
54 void diff();
|
Chris@168
|
55 void showSummary();
|
Chris@153
|
56 void showWork();
|
Chris@311
|
57 void newBranch();
|
Chris@311
|
58 void noBranch();
|
Chris@141
|
59
|
Chris@141
|
60 protected:
|
Chris@141
|
61 virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
|
Chris@153
|
62 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
|
Chris@141
|
63
|
Chris@129
|
64 private:
|
Chris@141
|
65 void activateMenu();
|
Chris@141
|
66
|
Chris@129
|
67 QString m_branch;
|
Chris@153
|
68 bool m_showBranch;
|
Chris@311
|
69 bool m_isNewBranch;
|
Chris@129
|
70 QFont m_font;
|
Chris@129
|
71 int m_column;
|
Chris@129
|
72 int m_row;
|
Chris@129
|
73 bool m_wide;
|
Chris@129
|
74 };
|
Chris@129
|
75
|
Chris@129
|
76 #endif // UNCOMMITTEDITEM_H
|