forked from qt-creator/qt-creator
Git: add reload button for 'git blame' and 'git log' windows
Change-Id: I64685e779bed91d41e38bdc1454571dbbcd7f177 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -65,6 +65,7 @@
|
|||||||
#include <diffeditor/diffeditorconstants.h>
|
#include <diffeditor/diffeditorconstants.h>
|
||||||
#include <diffeditor/diffeditorcontroller.h>
|
#include <diffeditor/diffeditorcontroller.h>
|
||||||
#include <diffeditor/diffutils.h>
|
#include <diffeditor/diffutils.h>
|
||||||
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -372,6 +373,8 @@ public:
|
|||||||
mapSetting(addToggleButton("-w", tr("Ignore Whitespace"),
|
mapSetting(addToggleButton("-w", tr("Ignore Whitespace"),
|
||||||
tr("Ignore whitespace only changes.")),
|
tr("Ignore whitespace only changes.")),
|
||||||
settings.boolPointer(GitSettings::ignoreSpaceChangesInBlameKey));
|
settings.boolPointer(GitSettings::ignoreSpaceChangesInBlameKey));
|
||||||
|
|
||||||
|
addButton(tr("Reload"), Utils::Icons::RELOAD.icon());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -402,6 +405,8 @@ public:
|
|||||||
QAction *graphButton = addToggleButton(graphArguments, tr("Graph"),
|
QAction *graphButton = addToggleButton(graphArguments, tr("Graph"),
|
||||||
tr("Show textual graph log."));
|
tr("Show textual graph log."));
|
||||||
mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey));
|
mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey));
|
||||||
|
|
||||||
|
addButton(tr("Reload"), Utils::Icons::RELOAD.icon());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,14 @@ void VcsBaseEditorConfig::setBaseArguments(const QStringList &b)
|
|||||||
d->m_baseArguments = b;
|
d->m_baseArguments = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAction *VcsBaseEditorConfig::addButton(const QString &label, const QIcon &icon)
|
||||||
|
{
|
||||||
|
auto action = new QAction(icon, label, d->m_toolBar);
|
||||||
|
connect(action, &QAction::triggered, this, &VcsBaseEditorConfig::argumentsChanged);
|
||||||
|
addAction(action);
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList VcsBaseEditorConfig::arguments() const
|
QStringList VcsBaseEditorConfig::arguments() const
|
||||||
{
|
{
|
||||||
// Compile effective arguments
|
// Compile effective arguments
|
||||||
@@ -156,9 +164,7 @@ QAction *VcsBaseEditorConfig::addToggleButton(const QStringList &options,
|
|||||||
action->setToolTip(tooltip);
|
action->setToolTip(tooltip);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
connect(action, &QAction::toggled, this, &VcsBaseEditorConfig::argumentsChanged);
|
connect(action, &QAction::toggled, this, &VcsBaseEditorConfig::argumentsChanged);
|
||||||
const QList<QAction *> actions = d->m_toolBar->actions();
|
addAction(action);
|
||||||
// Insert the action before line/column and split actions.
|
|
||||||
d->m_toolBar->insertAction(actions.at(qMax(actions.count() - 2, 0)), action);
|
|
||||||
d->m_optionMappings.append(OptionMapping(options, action));
|
d->m_optionMappings.append(OptionMapping(options, action));
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
@@ -293,4 +299,11 @@ void VcsBaseEditorConfig::updateMappedSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VcsBaseEditorConfig::addAction(QAction *action)
|
||||||
|
{
|
||||||
|
const QList<QAction *> actions = d->m_toolBar->actions();
|
||||||
|
// Insert the action before line/column and split actions.
|
||||||
|
d->m_toolBar->insertAction(actions.at(qMax(actions.count() - 2, 0)), action);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace VcsBase
|
} // namespace VcsBase
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public:
|
|||||||
QStringList baseArguments() const;
|
QStringList baseArguments() const;
|
||||||
void setBaseArguments(const QStringList &);
|
void setBaseArguments(const QStringList &);
|
||||||
|
|
||||||
|
QAction *addButton(const QString &label, const QIcon &icon);
|
||||||
QAction *addToggleButton(const QString &option, const QString &label,
|
QAction *addToggleButton(const QString &option, const QString &label,
|
||||||
const QString &tooltip = QString());
|
const QString &tooltip = QString());
|
||||||
QAction *addToggleButton(const QStringList &options, const QString &label,
|
QAction *addToggleButton(const QStringList &options, const QString &label,
|
||||||
@@ -102,6 +103,8 @@ protected:
|
|||||||
void updateMappedSettings();
|
void updateMappedSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void addAction(QAction *action);
|
||||||
|
|
||||||
friend class Internal::VcsBaseEditorConfigPrivate;
|
friend class Internal::VcsBaseEditorConfigPrivate;
|
||||||
Internal::VcsBaseEditorConfigPrivate *const d;
|
Internal::VcsBaseEditorConfigPrivate *const d;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user