1 /*
2 *
3 * Vulkan hardware capability viewer
4 *
5 * Submit report dialog
6 *
7 * Copyright (C) 2016-2021 by Sascha Willems (www.saschawillems.de)
8 *
9 * This code is free software, you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 3 as published by the Free Software Foundation.
12 *
13 * Please review the following information to ensure the GNU Lesser
14 * General Public License version 3 requirements will be met:
15 * http://opensource.org/licenses/lgpl-3.0.html
16 *
17 * The code is distributed WITHOUT ANY WARRANTY; without even the
18 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 * PURPOSE.  See the GNU LGPL 3.0 for more details.
20 *
21 */
22 
23 #include "submitDialog.h"
24 
25 #include <QFormLayout>
26 #include <QMessageBox>
27 #include <QLabel>
28 #include <QLineEdit>
29 #include <QLine>
30 #include <QSettings>
31 #include <QDialogButtonBox>
32 
SubmitDialog(QString submitter,QString caption)33 SubmitDialog::SubmitDialog(QString submitter, QString caption)
34 {
35 	QFormLayout *formLayout = new QFormLayout;
36 
37     // QDialogBox doesn't appear modal on Android which makes it hard to see
38     #ifdef ANDROID
39         QLabel *labelCaption = new QLabel();
40         labelCaption->setText(caption);
41         formLayout->addRow(labelCaption);
42         setStyleSheet("QDialog{ border: 2px solid black; border-style: solid; border-radius: 4px; }");
43     #endif
44 
45 	editSubmitter = new QLineEdit();
46 	editSubmitter->setObjectName("submitter");
47 	editSubmitter->setPlaceholderText("Can be left empty");
48 	editSubmitter->setText(submitter);
49 	editSubmitter->setMinimumWidth(200);
50 	formLayout->addRow("Submitter:", editSubmitter);
51 
52 	editComment = new QLineEdit();
53 	editComment->setObjectName("comment");
54 	editComment->setPlaceholderText("Can be left empty");
55 	editComment->setMinimumWidth(200);
56 	editComment->setMaxLength(32);
57 	formLayout->addRow("Comment:", editComment);
58 
59 	QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
60 	connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept()));
61 	connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel()));
62 
63 	formLayout->addWidget(buttonBox);
64 
65 	setLayout(formLayout);
66 	setWindowTitle(caption);
67 }
68 
69 
~SubmitDialog()70 SubmitDialog::~SubmitDialog()
71 {
72 }
73 
slotAccept()74 void SubmitDialog::slotAccept()
75 {
76 	this->accept();
77 }
78 
slotCancel()79 void SubmitDialog::slotCancel()
80 {
81 	this->reject();
82 }
83 
getSubmitter()84 QString SubmitDialog::getSubmitter()
85 {
86 	return editSubmitter->text();
87 }
88 
getComment()89 QString SubmitDialog::getComment()
90 {
91 	return editComment->text();
92 }
93