Chris@57: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@57: Chris@57: /* Chris@57: EasyMercurial Chris@57: Chris@57: Based on HgExplorer by Jari Korhonen Chris@57: Copyright (c) 2010 Jari Korhonen Chris@644: Copyright (c) 2013 Chris Cannam Chris@644: Copyright (c) 2013 Queen Mary, University of London Chris@57: Chris@57: This program is free software; you can redistribute it and/or Chris@57: modify it under the terms of the GNU General Public License as Chris@57: published by the Free Software Foundation; either version 2 of the Chris@57: License, or (at your option) any later version. See the file Chris@57: COPYING included with this distribution for more information. Chris@57: */ Chris@57: Chris@43: #ifndef CHANGESETITEM_H Chris@43: #define CHANGESETITEM_H Chris@43: Chris@168: #include Chris@53: #include Chris@43: Chris@43: class Changeset; Chris@117: class ChangesetDetailItem; Chris@43: Chris@153: class QAction; Chris@390: class QImage; Chris@153: Chris@168: class ChangesetItem : public QGraphicsObject Chris@43: { Chris@119: Q_OBJECT Chris@119: Chris@43: public: Chris@53: ChangesetItem(Changeset *cs); Chris@600: ~ChangesetItem(); Chris@43: Chris@43: virtual QRectF boundingRect() const; Chris@43: virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); Chris@43: Chris@53: Changeset *getChangeset() { return m_changeset; } Chris@141: QString getId(); Chris@53: Chris@44: int column() const { return m_column; } Chris@44: int row() const { return m_row; } Chris@46: void setColumn(int c) { m_column = c; setX(c * 100); } Chris@53: void setRow(int r) { m_row = r; setY(r * 90); } Chris@44: Chris@55: bool isWide() const { return m_wide; } Chris@55: void setWide(bool w) { m_wide = w; } Chris@55: Chris@128: bool isCurrent() const { return m_current; } Chris@128: void setCurrent(bool c) { m_current = c; } Chris@128: Chris@508: // Closed is true if this changeset is on a closed branch Chris@510: bool isClosed() const; Chris@506: Chris@508: // Closing is true if this changeset is the commit that closed its Chris@508: // branch (i.e. is at the end of a closed branch) Chris@508: bool isClosingCommit() const { return m_closing; } Chris@508: void setClosingCommit(bool c) { m_closing = c; } Chris@508: Chris@133: bool isNew() const { return m_new; } Chris@133: void setNew(bool n) { m_new = n; } Chris@133: Chris@153: bool showBranch() const { return m_showBranch; } Chris@74: void setShowBranch(bool s) { m_showBranch = s; } Chris@74: Chris@566: bool matchSearchText(QString text); // return true and records the match if it matches Chris@555: Chris@119: signals: Chris@119: void detailShown(); Chris@119: void detailHidden(); Chris@119: Chris@141: void updateTo(QString); Chris@141: void diffToCurrent(QString); Chris@148: void diffToParent(QString child, QString parent); Chris@289: void showSummary(Changeset *); Chris@141: void mergeFrom(QString); Chris@278: void newBranch(QString); Chris@514: void closeBranch(QString); Chris@141: void tag(QString); Chris@141: Chris@119: public slots: Chris@119: void showDetail(); Chris@119: void hideDetail(); Chris@119: Chris@141: private slots: Chris@153: void copyIdActivated(); Chris@141: void updateActivated(); Chris@153: void diffToParentActivated(); Chris@289: void showSummaryActivated(); Chris@141: void diffToCurrentActivated(); Chris@141: void mergeActivated(); Chris@141: void tagActivated(); Chris@278: void newBranchActivated(); Chris@514: void closeBranchActivated(); Chris@141: Chris@117: protected: Chris@117: virtual void mousePressEvent(QGraphicsSceneMouseEvent *); Chris@474: virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *); Chris@117: Chris@43: private: Chris@140: void activateMenu(); Chris@140: Chris@53: QFont m_font; Chris@43: Changeset *m_changeset; Chris@117: ChangesetDetailItem *m_detail; Chris@600: bool m_detailVisible; Chris@74: bool m_showBranch; Chris@44: int m_column; Chris@44: int m_row; Chris@55: bool m_wide; Chris@128: bool m_current; Chris@508: bool m_closing; Chris@133: bool m_new; Chris@555: QString m_searchText; Chris@555: bool m_searchMatches; Chris@153: Chris@153: QMap m_parentDiffActions; Chris@288: QMap m_summaryActions; Chris@387: Chris@390: static QImage *m_star; Chris@390: Chris@387: bool isMerge() const; Chris@399: void paintNormal(QPainter *); Chris@508: void paintSimple(QPainter *); Chris@43: }; Chris@43: Chris@43: #endif // CHANGESETITEM_H