gitsubmiteditorwidget.h 3.49 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
con's avatar
con committed
2
**
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
con's avatar
con committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
con's avatar
con committed
7
**
hjk's avatar
hjk committed
8
9
10
11
12
13
14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
15
**
16
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17
18
19
20
21
22
23
24
25
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
hjk's avatar
hjk committed
29

con's avatar
con committed
30
31
32
33
#ifndef GITSUBMITEDITORWIDGET_H
#define GITSUBMITEDITORWIDGET_H

#include "ui_gitsubmitpanel.h"
34
#include "gitsettings.h"
35
#include "commitdata.h"
36

37
#include <texteditor/syntaxhighlighter.h>
38
#include <vcsbase/submiteditorwidget.h>
con's avatar
con committed
39

40
41
42
#include <QRegExp>
#include <QSyntaxHighlighter>

43
44
45
46
QT_BEGIN_NAMESPACE
class QValidator;
QT_END_NAMESPACE

con's avatar
con committed
47
48
49
50
51
namespace Git {
namespace Internal {

struct GitSubmitEditorPanelInfo;
struct GitSubmitEditorPanelData;
52
class LogChangeWidget;
con's avatar
con committed
53
54
55
56
57
58
59
60
61

/* Submit editor widget with 2 additional panes:
 * 1) Info with branch, description, etc
 * 2) Data, with author and email to edit.
 * The file contents is the submit message.
 * The previously added files will be added 'checked' to the file list, the
 * remaining un-added and untracked files will be added 'unchecked' for the
 * user to click. */

62
class GitSubmitEditorWidget : public VcsBase::SubmitEditorWidget
con's avatar
con committed
63
{
64
    Q_OBJECT
con's avatar
con committed
65
66
67
68
69

public:
    explicit GitSubmitEditorWidget(QWidget *parent = 0);

    GitSubmitEditorPanelData panelData() const;
70
    QString amendSHA1() const;
71
    void setHasUnmerged(bool e);
72
73
74
75
    void initialize(CommitType commitType,
                    const QString &repository,
                    const GitSubmitEditorPanelData &data,
                    const GitSubmitEditorPanelInfo &info);
76
    void refreshLog(const QString &repository);
con's avatar
con committed
77

78
79
protected:
    bool canSubmit() const;
80
    QString cleanupDescription(const QString &) const;
81
    QString commitName() const;
82

83
84
85
signals:
    void show(const QString &commit);

86
87
private slots:
    void authorInformationChanged();
88
89
90
    void commitOnlySlot();
    void commitAndPushSlot();
    void commitAndPushToGerritSlot();
91

con's avatar
con committed
92
private:
93
    bool emailIsValid() const;
94
95
    void setPanelData(const GitSubmitEditorPanelData &data);
    void setPanelInfo(const GitSubmitEditorPanelInfo &info);
96

97
    PushAction m_pushAction;
con's avatar
con committed
98
    QWidget *m_gitSubmitPanel;
99
    LogChangeWidget *m_logChangeWidget;
con's avatar
con committed
100
    Ui::GitSubmitPanel m_gitSubmitPanelUi;
101
    QValidator *m_emailValidator;
102
    bool m_hasUnmerged;
103
    bool m_isInitialized;
con's avatar
con committed
104
105
106
};

} // namespace Internal
107
} // namespace Git
con's avatar
con committed
108
109

#endif // GITSUBMITEDITORWIDGET_H