1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "historylogwidget.h"
6#include "historyview.h"
7#include "filemodifyview.h"
8
9#include <QTextBrowser>
10
11HistoryLogWidget::HistoryLogWidget(QWidget *parent)
12 : QSplitter (parent)
13 , descBrowse(new QTextBrowser)
14 , hisView(new HistoryView)
15 , changedView(new FileModifyView)
16{
17 descBrowse->setMinimumHeight(60);
18 descBrowse->setPlaceholderText(QTextBrowser::tr("Description from revision log"));
19 hisView->setMinimumHeight(300);
20 changedView->setMinimumHeight(300);
21 setOrientation(Qt::Vertical);
22 addWidget(descBrowse);
23 setCollapsible(0, false);
24 addWidget(changedView);
25 addWidget(hisView);
26 setCollapsible(1, false);
27 setHandleWidth(2);
28 QObject::connect(hisView, &HistoryView::clicked, [=](const QModelIndex &index){
29 descBrowse->setText(hisView->description(index.row()));
30 changedView->setFiles(hisView->revisionFiles(index.row()));
31 });
32}
33
34QTextBrowser *HistoryLogWidget::descriptionBrowse()
35{
36 return descBrowse;
37}
38
39HistoryView *HistoryLogWidget::historyView()
40{
41 return hisView;
42}
43
44FileModifyView *HistoryLogWidget::fileChangedView()
45{
46 return changedView;
47}
48