Git: Move filter widget to GitEditor

and make it a QToolBar.

Change-Id: I6a16b1a828bfabaace8e14ef39344f7f2bac7e8a
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2020-02-19 21:20:41 +02:00
committed by Orgad Shaneh
parent d21f72d0dd
commit 2110be00ab
3 changed files with 59 additions and 62 deletions

View File

@@ -60,7 +60,6 @@
#include <coreplugin/vcsmanager.h>
#include <aggregation/aggregate.h>
#include <utils/fancylineedit.h>
#include <utils/parameteraction.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
@@ -85,7 +84,6 @@
#include <QAction>
#include <QApplication>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QMenu>
#include <QVBoxLayout>
@@ -146,29 +144,15 @@ public:
class GitLogEditorWidget : public QWidget
{
Q_DECLARE_TR_FUNCTIONS(Git::Internal::GitLogEditorWidget);
public:
GitLogEditorWidget(GitEditorWidget *gitEditor)
{
auto vlayout = new QVBoxLayout;
auto hlayout = new QHBoxLayout;
vlayout->setSpacing(0);
vlayout->setContentsMargins(0, 0, 0, 0);
auto grepLineEdit = addLineEdit(tr("Filter by message"),
tr("Filter log entries by text in the commit message."));
auto pickaxeLineEdit = addLineEdit(tr("Filter by content"),
tr("Filter log entries by added or removed string."));
hlayout->setSpacing(20);
hlayout->setContentsMargins(0, 0, 0, 0);
hlayout->addWidget(new QLabel(tr("Filter:")));
hlayout->addWidget(grepLineEdit);
hlayout->addWidget(pickaxeLineEdit);
hlayout->addStretch();
vlayout->addLayout(hlayout);
vlayout->addWidget(gitEditor->addFilterWidget());
vlayout->addWidget(gitEditor);
setLayout(vlayout);
gitEditor->setGrepLineEdit(grepLineEdit);
gitEditor->setPickaxeLineEdit(pickaxeLineEdit);
auto textAgg = Aggregation::Aggregate::parentAggregate(gitEditor);
auto agg = textAgg ? textAgg : new Aggregation::Aggregate;
@@ -176,17 +160,6 @@ public:
agg->add(gitEditor);
setFocusProxy(gitEditor);
}
private:
FancyLineEdit *addLineEdit(const QString &placeholder, const QString &tooltip)
{
auto lineEdit = new FancyLineEdit;
lineEdit->setFiltering(true);
lineEdit->setToolTip(tooltip);
lineEdit->setPlaceholderText(placeholder);
lineEdit->setMaximumWidth(200);
return lineEdit;
}
};
template<class Editor>