File indexing completed on 2025-01-05 05:14:51

0001 /*
0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com>
0003 
0004 SPDX-License-Identifier: GPL-3.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_difftreeview.h"
0010 
0011 #include "libkommitwidgets_export.h"
0012 
0013 class QSortFilterProxyModel;
0014 class DiffTreeModel;
0015 class FilesModel;
0016 class LIBKOMMITWIDGETS_EXPORT DiffTreeView : public QWidget, private Ui::DiffTreeView
0017 {
0018     Q_OBJECT
0019     Q_PROPERTY(bool hideUnchangeds READ hideUnchangeds WRITE setHideUnchangeds NOTIFY hideUnchangedsChanged)
0020 
0021 public:
0022     explicit DiffTreeView(QWidget *parent = nullptr);
0023 
0024     DiffTreeModel *diffModel() const;
0025     void setModels(DiffTreeModel *newDiffModel, FilesModel *filesModel);
0026 
0027     bool hideUnchangeds() const;
0028     void setHideUnchangeds(bool newHideUnchangeds);
0029     bool eventFilter(QObject *watched, QEvent *event) override;
0030 
0031 Q_SIGNALS:
0032     void fileSelected(const QString &file);
0033     void hideUnchangedsChanged();
0034 
0035 private:
0036     void slotTreeViewClicked(const QModelIndex &index);
0037     void slotListViewClicked(const QModelIndex &index);
0038     void lineEditFilterTextChanged(const QString &text);
0039     DiffTreeModel *mDiffModel{nullptr};
0040     QSortFilterProxyModel *const mFilterModel;
0041     FilesModel *mFilesModel = nullptr;
0042 };