Git: Indicate affected commits for range operations

* Reset: Strikethrough discarded commits
* Interactive Rebase: Mark included commits
* Push to Gerrit: Mark pushed commits

Change-Id: I5599a72055fd94b88c55b74b3a1116c07e35c113
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-10-16 06:04:37 +03:00
committed by Orgad Shaneh
parent 4e32babc44
commit 9ef8d71e2c
4 changed files with 149 additions and 0 deletions

View File

@@ -31,6 +31,8 @@
#define LOGCHANGEDDIALOG_H
#include <QDialog>
#include <QIcon>
#include <QStyledItemDelegate>
#include <QTreeView>
QT_BEGIN_NAMESPACE
@@ -57,6 +59,7 @@ public:
QString commit() const;
int commitIndex() const;
QString earliestCommit() const;
void setItemDelegate(QAbstractItemDelegate *delegate);
signals:
void doubleClicked(const QString &commit);
@@ -65,10 +68,12 @@ private slots:
void emitDoubleClicked(const QModelIndex &index);
private:
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
bool populateLog(const QString &repository, const QString &commit, bool includeRemote);
const QStandardItem *currentItem(int column = 0) const;
QStandardItemModel *m_model;
bool m_hasCustomDelegate;
};
class LogChangeDialog : public QDialog
@@ -83,6 +88,7 @@ public:
QString commit() const;
int commitIndex() const;
QString resetFlag() const;
LogChangeWidget *widget() const;
private:
LogChangeWidget *m_widget;
@@ -90,6 +96,33 @@ private:
QComboBox *m_resetTypeComboBox;
};
class LogItemDelegate : public QStyledItemDelegate
{
protected:
LogItemDelegate(LogChangeWidget *widget);
int currentRow() const;
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const = 0;
private:
LogChangeWidget *m_widget;
};
class IconItemDelegate : public LogItemDelegate
{
public:
IconItemDelegate(LogChangeWidget *widget, const QString &icon);
virtual bool hasIcon(int row) const = 0;
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
private:
QIcon m_icon;
};
} // namespace Internal
} // namespace Git