1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#include "amendswidget.h"
6#include "CommitInfo.h"
7#include "filesourceview.h"
8#include "filemodifyview.h"
9#include "CommitInfoPanel.h"
10
11#include <QBoxLayout>
12#include <QLabel>
13#include <QLineEdit>
14#include <QPushButton>
15#include <QTextEdit>
16
17const QString Description = QTextEdit::tr("Description");
18const QString Summary = QLineEdit::tr("Summary");
19const QString Commit = QPushButton::tr("Commit");
20const QString RevertAll = QPushButton::tr("Revert All");
21
22AmendsWidget::AmendsWidget(QWidget *parent)
23 : QSplitter (parent)
24 , modifyView(new FileModifyView)
25 , hLayPbt(new QHBoxLayout)
26 , pbtCommit(new QPushButton(Commit))
27 , pbtRevertAll(new QPushButton(RevertAll))
28 , descEdit(new QTextEdit)
29 , pbtWidget(new QFrame)
30{
31 setOrientation(Qt::Vertical);
32 pbtRevertAll->setObjectName("warningButton");
33 pbtCommit->setObjectName("applyActionBtn");
34 QObject::connect(pbtRevertAll, &QPushButton::clicked,
35 this, &AmendsWidget::revertAllClicked);
36 QObject::connect(pbtCommit, &QPushButton::clicked,
37 this, &AmendsWidget::commitClicked);
38 descEdit->setPlaceholderText(Description);
39 descEdit->setObjectName("teDescription");
40 addWidget(descEdit);
41 addWidget(modifyView);
42 setHandleWidth(2);
43 hLayPbt->addWidget(pbtRevertAll);
44 hLayPbt->addWidget(pbtCommit);
45 pbtWidget->setLayout(hLayPbt);
46 pbtWidget->setFixedHeight(45);
47 pbtWidget->setObjectName("teDescription");
48 addWidget(pbtWidget);
49}
50
51AmendsWidget::~AmendsWidget()
52{
53}
54
55QString AmendsWidget::description()
56{
57 return descEdit->toPlainText();
58}
59
60FileModifyView *AmendsWidget::modView()
61{
62 return modifyView;
63}
64