mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-11 10:45:39 +03:00
Adds "Hide Untracked Files" option to DoubleTreeWidget cogwheel context menu
This commit is contained in:
parent
d3acf745e5
commit
3c92cc0f98
@ -309,8 +309,11 @@ Diff Repository::status(const Index &index, Diff::Callbacks *callbacks,
|
||||
Diff Repository::diffTreeToIndex(const Tree &tree, const Index &index,
|
||||
bool ignoreWhitespace) const {
|
||||
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
||||
opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED | GIT_DIFF_RECURSE_UNTRACKED_DIRS |
|
||||
GIT_DIFF_INCLUDE_TYPECHANGE;
|
||||
opts.flags |= GIT_DIFF_INCLUDE_TYPECHANGE;
|
||||
|
||||
if (!appConfig().value<bool>("untracked.hide", false))
|
||||
opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED | GIT_DIFF_RECURSE_UNTRACKED_DIRS;
|
||||
|
||||
if (ignoreWhitespace)
|
||||
opts.flags |= GIT_DIFF_IGNORE_WHITESPACE;
|
||||
|
||||
@ -323,8 +326,11 @@ Diff Repository::diffIndexToWorkdir(const Index &index,
|
||||
Diff::Callbacks *callbacks,
|
||||
bool ignoreWhitespace) const {
|
||||
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
||||
opts.flags |= (GIT_DIFF_INCLUDE_UNTRACKED | GIT_DIFF_RECURSE_UNTRACKED_DIRS |
|
||||
GIT_DIFF_DISABLE_MMAP | GIT_DIFF_INCLUDE_TYPECHANGE);
|
||||
opts.flags |= (GIT_DIFF_DISABLE_MMAP | GIT_DIFF_INCLUDE_TYPECHANGE);
|
||||
|
||||
if (!appConfig().value<bool>("untracked.hide", false))
|
||||
opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED | GIT_DIFF_RECURSE_UNTRACKED_DIRS;
|
||||
|
||||
if (ignoreWhitespace)
|
||||
opts.flags |= GIT_DIFF_IGNORE_WHITESPACE;
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "conf/Settings.h"
|
||||
#include "DiffView/DiffView.h"
|
||||
#include "git/Index.h"
|
||||
#include "git/Config.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
@ -102,8 +103,16 @@ DoubleTreeWidget::DoubleTreeWidget(const git::Repository &repo, QWidget *parent)
|
||||
checked);
|
||||
RepoView::parentView(this)->refresh();
|
||||
});
|
||||
QAction *hideUntrackedFiles = new QAction(tr("Hide Untracked Files"));
|
||||
hideUntrackedFiles->setCheckable(true);
|
||||
hideUntrackedFiles->setChecked(RepoView::parentView(parent)->repo().appConfig().value<bool>("untracked.hide", false));
|
||||
connect(hideUntrackedFiles, &QAction::triggered, this, [this](bool checked) {
|
||||
RepoView::parentView(this)->repo().appConfig().setValue("untracked.hide", checked);
|
||||
RepoView::parentView(this)->refresh();
|
||||
});
|
||||
contextMenu->addAction(singleTree);
|
||||
contextMenu->addAction(listView);
|
||||
contextMenu->addAction(hideUntrackedFiles);
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
||||
buttonLayout->addStretch();
|
||||
buttonLayout->addWidget(segmentedButton);
|
||||
|
Loading…
Reference in New Issue
Block a user