| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. | 
|---|---|
| 2 | // | 
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later | 
| 4 | |
| 5 | #include "historydiffview.h" | 
| 6 | |
| 7 | #include "FileDiffView.h" | 
| 8 | |
| 9 | #include <QLabel> | 
| 10 | #include <QLineEdit> | 
| 11 | #include <QVBoxLayout> | 
| 12 | |
| 13 | HistoryDiffView::HistoryDiffView(const QString &title, QWidget *parent) | 
| 14 | : QWidget(parent) | 
| 15 | , vLayout (new QVBoxLayout) | 
| 16 | , titleLabel (new QLabel) | 
| 17 | , searchEdit (new QLineEdit) | 
| 18 | , diffView (new FileDiffView) | 
| 19 | { | 
| 20 | titleLabel->setText(title); | 
| 21 | searchEdit->setPlaceholderText(QLineEdit::tr( "Search Text")); | 
| 22 | vLayout->addWidget(titleLabel); | 
| 23 | vLayout->addWidget(searchEdit); | 
| 24 | vLayout->addWidget(diffView); | 
| 25 | vLayout->setSpacing(1); | 
| 26 | setLayout(vLayout); | 
| 27 | } | 
| 28 | |
| 29 | FileDiffView *HistoryDiffView::getDiffView() const | 
| 30 | { | 
| 31 | return diffView; | 
| 32 | } | 
| 33 | |
| 34 | void HistoryDiffView::setTitle(const QString &title) | 
| 35 | { | 
| 36 | titleLabel->setText(title); | 
| 37 | } | 
| 38 | |
| 39 | QString HistoryDiffView::getTitle() const | 
| 40 | { | 
| 41 | return titleLabel->text(); | 
| 42 | } | 
| 43 | 
