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