diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-10-16 06:04:37 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2013-10-17 16:39:08 +0200 |
commit | 9ef8d71e2c62bb1d6cd2fad9f0d2408f10f5d459 (patch) | |
tree | 38aace70920b6017992c207b1bdf0f7dffbb0d74 /src/plugins/git/gitplugin.cpp | |
parent | 4e32babc447b1d7ce71db082c710b1c836bb1d8d (diff) | |
download | qt-creator-9ef8d71e2c62bb1d6cd2fad9f0d2408f10f5d459.tar.gz |
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>
Diffstat (limited to 'src/plugins/git/gitplugin.cpp')
-rw-r--r-- | src/plugins/git/gitplugin.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index e71f0a9fda..ea9bf53292 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -60,6 +60,7 @@ #include <coreplugin/editormanager/ieditor.h> #include <coreplugin/mimedatabase.h> #include <coreplugin/vcsmanager.h> +#include <coreplugin/coreconstants.h> #include <utils/qtcassert.h> #include <utils/parameteraction.h> @@ -802,6 +803,34 @@ void GitPlugin::undoUnstagedFileChanges() undoFileChanges(false); } +class ResetItemDelegate : public LogItemDelegate +{ +public: + ResetItemDelegate(LogChangeWidget *widget) : LogItemDelegate(widget) {} + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const + { + QStyleOptionViewItem o = option; + if (index.row() < currentRow()) + o.font.setStrikeOut(true); + QStyledItemDelegate::paint(painter, o, index); + } +}; + +class RebaseItemDelegate : public IconItemDelegate +{ +public: + RebaseItemDelegate(LogChangeWidget *widget) + : IconItemDelegate(widget, QLatin1String(Core::Constants::ICON_UNDO)) + { + } + +protected: + bool hasIcon(int row) const + { + return row <= currentRow(); + } +}; + void GitPlugin::resetRepository() { if (!ensureAllDocumentsSaved()) @@ -811,6 +840,7 @@ void GitPlugin::resetRepository() QString topLevel = state.topLevel(); LogChangeDialog dialog(true); + ResetItemDelegate delegate(dialog.widget()); dialog.setWindowTitle(tr("Undo Changes to %1").arg(QDir::toNativeSeparators(topLevel))); if (dialog.runDialog(topLevel)) m_gitClient->reset(topLevel, dialog.resetFlag(), dialog.commit()); @@ -828,6 +858,7 @@ void GitPlugin::startRebase() if (!m_gitClient->beginStashScope(topLevel, QLatin1String("Rebase-i"))) return; LogChangeDialog dialog(false); + RebaseItemDelegate delegate(dialog.widget()); dialog.setWindowTitle(tr("Interactive Rebase")); if (dialog.runDialog(topLevel, QString(), false)) m_gitClient->interactiveRebase(topLevel, dialog.commit(), false); |