-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
submitDialog.cpp
92 lines (77 loc) · 2.46 KB
/
submitDialog.cpp
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
*
* Vulkan hardware capability viewer
*
* Submit report dialog
*
* Copyright (C) 2016-2021 by Sascha Willems (www.saschawillems.de)
*
* This code is free software, you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 3 as published by the Free Software Foundation.
*
* Please review the following information to ensure the GNU Lesser
* General Public License version 3 requirements will be met:
* http://opensource.org/licenses/lgpl-3.0.html
*
* The code is distributed WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU LGPL 3.0 for more details.
*
*/
#include "submitDialog.h"
#include <QFormLayout>
#include <QMessageBox>
#include <QLabel>
#include <QLineEdit>
#include <QLine>
#include <QSettings>
#include <QDialogButtonBox>
SubmitDialog::SubmitDialog(QString submitter, QString caption)
{
QFormLayout *formLayout = new QFormLayout;
// QDialogBox doesn't appear modal on Android which makes it hard to see
#ifdef ANDROID
QLabel *labelCaption = new QLabel();
labelCaption->setText(caption);
formLayout->addRow(labelCaption);
setStyleSheet("QDialog{ border: 2px solid black; border-style: solid; border-radius: 4px; }");
#endif
editSubmitter = new QLineEdit();
editSubmitter->setObjectName("submitter");
editSubmitter->setPlaceholderText("Can be left empty");
editSubmitter->setText(submitter);
editSubmitter->setMinimumWidth(200);
formLayout->addRow("Submitter:", editSubmitter);
editComment = new QLineEdit();
editComment->setObjectName("comment");
editComment->setPlaceholderText("Can be left empty");
editComment->setMinimumWidth(200);
editComment->setMaxLength(32);
formLayout->addRow("Comment:", editComment);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel()));
formLayout->addWidget(buttonBox);
setLayout(formLayout);
setWindowTitle(caption);
}
SubmitDialog::~SubmitDialog()
{
}
void SubmitDialog::slotAccept()
{
this->accept();
}
void SubmitDialog::slotCancel()
{
this->reject();
}
QString SubmitDialog::getSubmitter()
{
return editSubmitter->text();
}
QString SubmitDialog::getComment()
{
return editComment->text();
}