aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/fossil/fossilcommitwidget.h
blob: 1d3bc1d4e0fb2ad0e1225ae6459c9e6200533564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) 2018 Artur Shepilko
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <vcsbase/submiteditorwidget.h>

QT_BEGIN_NAMESPACE
class QCheckBox;
class QLabel;
class QLineEdit;
class QValidator;
QT_END_NAMESPACE

namespace Utils {
class FilePath;
class InfoLabel;
}

namespace Fossil {
namespace Internal {

class BranchInfo;

/*submit editor widget based on git SubmitEditor
  Some extra fields have been added to the standard SubmitEditorWidget,
  to help to conform to the commit style that is used by both git and Fossil*/

class FossilCommitWidget final : public VcsBase::SubmitEditorWidget
{
    Q_OBJECT

public:
    FossilCommitWidget();

    void setFields(const Utils::FilePath &repoPath, const BranchInfo &newBranch,
                   const QStringList &tags, const QString &userName);

    QString newBranch() const;
    QStringList tags() const;
    QString committer() const;
    bool isPrivateOptionEnabled() const;

private:
    bool canSubmit(QString *whyNot = nullptr) const final;

    void branchChanged();
    bool isValidBranch() const;

    QWidget *m_commitPanel;
    QValidator *m_branchValidator;

    QLineEdit *m_localRootLineEdit;
    QLineEdit *m_currentBranchLineEdit;
    QLineEdit *m_currentTagsLineEdit;
    QLineEdit *m_branchLineEdit;
    Utils::InfoLabel *m_invalidBranchLabel;
    QCheckBox *m_isPrivateCheckBox;
    QLineEdit *m_tagsLineEdit;
    QLineEdit *m_authorLineEdit;
};

} // namespace Internal
} // namespace Fossil