Line data Source code
1 : /// Including DBE
2 : #include "dbe/CommitDialog.hpp"
3 :
4 0 : dbe::CommitDialog::~CommitDialog() = default;
5 :
6 0 : dbe::CommitDialog::CommitDialog ( QWidget * parent )
7 : : QDialog ( parent ),
8 0 : ui ( new Ui::CommitDialog )
9 : {
10 : /// Setting Ui
11 0 : setupUi ( this );
12 :
13 : /// Setting initial values
14 0 : setModal ( true );
15 0 : setSizePolicy ( QSizePolicy::Preferred, QSizePolicy::Preferred );
16 0 : setToolTip ( "Enter a commit message (optional) and press the ok button." );
17 0 : show();
18 :
19 : /// Setting Controller
20 0 : SetController();
21 0 : }
22 :
23 0 : void dbe::CommitDialog::SetController()
24 : {
25 0 : connect ( OkButton, SIGNAL ( clicked() ), this, SLOT ( OkCommitMessage() ),
26 : Qt::UniqueConnection );
27 0 : connect ( CancelButton, SIGNAL ( clicked() ), this, SLOT ( CancelCommitMessage() ),
28 : Qt::UniqueConnection );
29 0 : }
30 :
31 0 : QString dbe::CommitDialog::GetCommitMessage() const
32 : {
33 0 : return CommitMessageLine->text();
34 : }
35 :
36 0 : void dbe::CommitDialog::CommitMessageEdited ()
37 : {
38 0 : if ( !CommitMessageLine->text().isEmpty() )
39 : {
40 0 : OkButton->setEnabled ( true );
41 : }
42 : else
43 : {
44 0 : OkButton->setEnabled ( false );
45 : }
46 0 : }
47 :
48 0 : void dbe::CommitDialog::OkCommitMessage()
49 : {
50 0 : accept();
51 0 : }
52 :
53 0 : void dbe::CommitDialog::CancelCommitMessage()
54 : {
55 0 : reject();
56 0 : }
|