mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-19 06:29:10 +03:00
Adds "Hide Untracked Files" option to DoubleTreeWidget
Merge pull request #591 from pablovacatello/hideUntrackedFiles
This commit is contained in:
commit
34625fb981
@ -309,8 +309,11 @@ Diff Repository::status(const Index &index, Diff::Callbacks *callbacks,
|
|||||||
Diff Repository::diffTreeToIndex(const Tree &tree, const Index &index,
|
Diff Repository::diffTreeToIndex(const Tree &tree, const Index &index,
|
||||||
bool ignoreWhitespace) const {
|
bool ignoreWhitespace) const {
|
||||||
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
||||||
opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED | GIT_DIFF_RECURSE_UNTRACKED_DIRS |
|
opts.flags |= GIT_DIFF_INCLUDE_TYPECHANGE;
|
||||||
GIT_DIFF_INCLUDE_TYPECHANGE;
|
|
||||||
|
if (!appConfig().value<bool>("untracked.hide", false))
|
||||||
|
opts.flags |= GIT_DIFF_INCLUDE_UNTRACKED | GIT_DIFF_RECURSE_UNTRACKED_DIRS;
|
||||||
|
|
||||||
if (ignoreWhitespace)
|
if (ignoreWhitespace)
|
||||||
opts.flags |= GIT_DIFF_IGNORE_WHITESPACE;
|
opts.flags |= GIT_DIFF_IGNORE_WHITESPACE;
|
||||||
|
|
||||||
@ -323,8 +326,11 @@ Diff Repository::diffIndexToWorkdir(const Index &index,
|
|||||||
Diff::Callbacks *callbacks,
|
Diff::Callbacks *callbacks,
|
||||||
bool ignoreWhitespace) const {
|
bool ignoreWhitespace) const {
|
||||||
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
||||||
opts.flags |= (GIT_DIFF_INCLUDE_UNTRACKED | GIT_DIFF_RECURSE_UNTRACKED_DIRS |
|
opts.flags |= (GIT_DIFF_DISABLE_MMAP | GIT_DIFF_INCLUDE_TYPECHANGE);
|
||||||
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)
|
if (ignoreWhitespace)
|
||||||
opts.flags |= GIT_DIFF_IGNORE_WHITESPACE;
|
opts.flags |= GIT_DIFF_IGNORE_WHITESPACE;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "conf/Settings.h"
|
#include "conf/Settings.h"
|
||||||
#include "DiffView/DiffView.h"
|
#include "DiffView/DiffView.h"
|
||||||
#include "git/Index.h"
|
#include "git/Index.h"
|
||||||
|
#include "git/Config.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@ -102,8 +103,19 @@ DoubleTreeWidget::DoubleTreeWidget(const git::Repository &repo, QWidget *parent)
|
|||||||
checked);
|
checked);
|
||||||
RepoView::parentView(this)->refresh();
|
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(singleTree);
|
||||||
contextMenu->addAction(listView);
|
contextMenu->addAction(listView);
|
||||||
|
contextMenu->addAction(hideUntrackedFiles);
|
||||||
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
||||||
buttonLayout->addStretch();
|
buttonLayout->addStretch();
|
||||||
buttonLayout->addWidget(segmentedButton);
|
buttonLayout->addWidget(segmentedButton);
|
||||||
|
Loading…
Reference in New Issue
Block a user