File indexing completed on 2025-01-05 05:14:40
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_commitswidget.h" 0010 #include "widgetbase.h" 0011 0012 namespace Git 0013 { 0014 0015 class Branch; 0016 class LogsModel; 0017 }; 0018 0019 class BranchActions; 0020 class CommitActions; 0021 class TreeModel; 0022 class CommitsFilterModel; 0023 class CommitsWidget : public WidgetBase, private Ui::CommitsWidget 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 explicit CommitsWidget(Git::Manager *git, AppWindow *parent = nullptr); 0029 void reload() override; 0030 0031 void saveState(QSettings &settings) const override; 0032 void restoreState(QSettings &settings) override; 0033 void settingsUpdated() override; 0034 0035 private Q_SLOTS: 0036 void slotTreeViewRepoItemActivated(const QModelIndex &index); 0037 void slotTreeViewRepoCustomContextMenuRequested(const QPoint &pos); 0038 void slotTreeViewHistoryItemActivated(const QModelIndex &index); 0039 void slotTextBrowserHashClicked(const QString &hash); 0040 void slotTextBrowserFileClicked(const QString &file); 0041 void slotTreeViewHistoryCustomContextMenuRequested(const QPoint &pos); 0042 0043 void slotLineEditFilterTextChanged(const QString &arg1); 0044 0045 private: 0046 void init(); 0047 QMap<QString, QSharedPointer<Git::Branch>> mBranchesMap; 0048 TreeModel *mRepoModel{nullptr}; 0049 BranchActions *mActions{nullptr}; 0050 CommitActions *mCommitActions{nullptr}; 0051 Git::LogsModel *mHistoryModel{nullptr}; 0052 CommitsFilterModel *mFilterModel{nullptr}; 0053 QString mMainBranch; 0054 void setBranch(const QString &branchName); 0055 };