author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 28 Oct 2019 18:58:13 +0100 | |
changeset 15494 | 3c0a3c824c49 |
parent 14841 | b9437746bffb |
permissions | -rw-r--r-- |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
1 |
/* |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
4 |
* |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
8 |
* |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
13 |
* |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
17 |
*/ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
18 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
19 |
#include <QHBoxLayout> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
20 |
#include <QLineEdit> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
21 |
#include <QTextBrowser> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
22 |
#include <QLabel> |
12902
fc47fc4af6bd
Finish porting. Seems to work, but no thorough testing has been performed
unc0rr
parents:
12041
diff
changeset
|
23 |
#include <QNetworkAccessManager> |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
24 |
#include <QSysInfo> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
25 |
#include <QDebug> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
26 |
#include <QBuffer> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
27 |
#include <QApplication> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
28 |
#include <QDesktopWidget> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
29 |
#include <QNetworkReply> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
30 |
#include <QProcess> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
31 |
#include <QMessageBox> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
32 |
#include <QCheckBox> |
8721 | 33 |
#include <QByteArray> |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
34 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
35 |
#include <string> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
36 |
|
9163
67334acaaac7
port all Q_WS_* to Q_OS_* so that we are forward compatible with Qt5
koda
parents:
9080
diff
changeset
|
37 |
#ifdef Q_OS_WIN |
11808 | 38 |
#ifndef WINVER |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
39 |
#define WINVER 0x0500 |
11808 | 40 |
#endif |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
41 |
#include <windows.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
42 |
#else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
43 |
#include <unistd.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
44 |
#include <sys/types.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
45 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
46 |
|
9163
67334acaaac7
port all Q_WS_* to Q_OS_* so that we are forward compatible with Qt5
koda
parents:
9080
diff
changeset
|
47 |
#ifdef Q_OS_MAC |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
48 |
#include <sys/sysctl.h> |
8930 | 49 |
#ifndef _SC_NPROCESSORS_ONLN |
50 |
#define _SC_NPROCESSORS_ONLN 58 |
|
51 |
#endif |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
52 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
53 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
54 |
#include <stdint.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
55 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
56 |
#include "AbstractPage.h" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
57 |
#include "hwconsts.h" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
58 |
#include "feedbackdialog.h" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
59 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
60 |
FeedbackDialog::FeedbackDialog(QWidget * parent) : QDialog(parent) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
61 |
{ |
8434 | 62 |
setModal(true); |
63 |
setWindowFlags(Qt::Sheet); |
|
64 |
setWindowModality(Qt::WindowModal); |
|
11495
fb7817a5c2b1
Add window titles for title-less windows
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
65 |
setWindowTitle(tr("Feedback")); |
8434 | 66 |
resize(700, 460); |
67 |
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
68 |
|
8434 | 69 |
netManager = NULL; |
70 |
GenerateSpecs(); |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
71 |
|
8434 | 72 |
/* Top layout */ |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
73 |
|
8434 | 74 |
QVBoxLayout * pageLayout = new QVBoxLayout(); |
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
75 |
QGridLayout * feedbackLayout = new QGridLayout(); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
76 |
|
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
77 |
setStyleSheet("QPushButton { padding: 5px }"); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
78 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
79 |
info = new QLabel(); |
8820
9cc4a057473f
feedback page: allow translations for main text; added link to known bugs in order to reduce the future number of bug report duplicates a bit (We can all hope, right? :P)
sheepluva
parents:
8725
diff
changeset
|
80 |
info->setText(QString( |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
81 |
"<style type=\"text/css\">" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
82 |
"a { color: #fc0; }" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
83 |
"b { color: #0df; }" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
84 |
"</style>" |
8820
9cc4a057473f
feedback page: allow translations for main text; added link to known bugs in order to reduce the future number of bug report duplicates a bit (We can all hope, right? :P)
sheepluva
parents:
8725
diff
changeset
|
85 |
"<div align=\"center\"><h1>%1</h1>" |
9cc4a057473f
feedback page: allow translations for main text; added link to known bugs in order to reduce the future number of bug report duplicates a bit (We can all hope, right? :P)
sheepluva
parents:
8725
diff
changeset
|
86 |
"<h3>%2<h3>" |
11630
9d3e32623567
change all URLs of feedback dialog to use https
sheepluva
parents:
11520
diff
changeset
|
87 |
"<h4>%3 <a href=\"https://hedgewars.org/kb/KnownBugs\">known bugs</a><h4>" |
8820
9cc4a057473f
feedback page: allow translations for main text; added link to known bugs in order to reduce the future number of bug report duplicates a bit (We can all hope, right? :P)
sheepluva
parents:
8725
diff
changeset
|
88 |
"<h4>%4<h4>" |
9cc4a057473f
feedback page: allow translations for main text; added link to known bugs in order to reduce the future number of bug report duplicates a bit (We can all hope, right? :P)
sheepluva
parents:
8725
diff
changeset
|
89 |
"</div>") |
8868 | 90 |
.arg(tr("Send us feedback!")) |
8820
9cc4a057473f
feedback page: allow translations for main text; added link to known bugs in order to reduce the future number of bug report duplicates a bit (We can all hope, right? :P)
sheepluva
parents:
8725
diff
changeset
|
91 |
.arg(tr("We are always happy about suggestions, ideas, or bug reports.")) |
8868 | 92 |
.arg(tr("If you found a bug, you can see if it's already been reported here: ")) |
93 |
.arg(tr("Your email address is optional, but necessary if you want us to get back at you.")) |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
94 |
); |
8820
9cc4a057473f
feedback page: allow translations for main text; added link to known bugs in order to reduce the future number of bug report duplicates a bit (We can all hope, right? :P)
sheepluva
parents:
8725
diff
changeset
|
95 |
info->setOpenExternalLinks(true); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
96 |
pageLayout->addWidget(info); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
97 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
98 |
label_email = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
99 |
label_email->setText(QLabel::tr("Your Email")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
100 |
email = new QLineEdit(); |
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
101 |
feedbackLayout->addWidget(label_email, 0, 0); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
102 |
feedbackLayout->addWidget(email, 0, 1); |
8434 | 103 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
104 |
label_summary = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
105 |
label_summary->setText(QLabel::tr("Summary")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
106 |
summary = new QLineEdit(); |
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
107 |
feedbackLayout->addWidget(label_summary, 1, 0); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
108 |
feedbackLayout->addWidget(summary, 1, 1); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
109 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
110 |
CheckSendSpecs = new QCheckBox(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
111 |
CheckSendSpecs->setText(QLabel::tr("Send system information")); |
13405
6476721e1a38
Feedback dialog: Disable "send system information" checkbox by default
Wuzzy <Wuzzy2@mail.ru>
parents:
13193
diff
changeset
|
112 |
CheckSendSpecs->setChecked(false); |
6476721e1a38
Feedback dialog: Disable "send system information" checkbox by default
Wuzzy <Wuzzy2@mail.ru>
parents:
13193
diff
changeset
|
113 |
CheckSendSpecs->setToolTip(tr("This is optional, but this information might help us to resolve bugs and other technical problems.")); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
114 |
BtnViewInfo = new QPushButton(tr("View")); |
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
115 |
BtnViewInfo->setFixedHeight(40); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
116 |
feedbackLayout->addWidget(CheckSendSpecs, 0, 2, 2, 1); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
117 |
feedbackLayout->addWidget(BtnViewInfo, 0, 3, 2, 1); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
118 |
connect(BtnViewInfo, SIGNAL(clicked()), this, SLOT(ShowSpecs())); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
119 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
120 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
121 |
label_description = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
122 |
label_description->setText(QLabel::tr("Description")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
123 |
description = new QTextBrowser(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
124 |
description->setReadOnly(false); |
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
125 |
feedbackLayout->addWidget(label_description, 2, 0); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
126 |
feedbackLayout->addWidget(description, 2, 1, 1, 3); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
127 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
128 |
/* Bottom layout */ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
129 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
130 |
QHBoxLayout * captchaLayout = new QHBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
131 |
QVBoxLayout * captchaInputLayout = new QVBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
132 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
133 |
QPushButton * BtnCancel = new QPushButton(tr("Cancel")); |
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
134 |
feedbackLayout->addWidget(BtnCancel, 3, 0); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
135 |
BtnCancel->setFixedHeight(40); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
136 |
connect(BtnCancel, SIGNAL(clicked()), this, SLOT(reject())); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
137 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
138 |
label_captcha = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
139 |
label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px"); |
12905
a9e4e8fa852c
Fix various typos in translatable strings
Wuzzy <Wuzzy2@mail.ru>
parents:
12041
diff
changeset
|
140 |
label_captcha->setText(QLabel::tr("Loading<br>CAPTCHA ...")); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
141 |
label_captcha->setFixedSize(200, 50); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
142 |
captchaLayout->addWidget(label_captcha); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
143 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
144 |
label_captcha_input = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
145 |
label_captcha_input->setText(QLabel::tr("Type the security code:")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
146 |
captchaInputLayout->addWidget(label_captcha_input); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
147 |
captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
148 |
captcha_code = new QLineEdit(); |
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
149 |
captcha_code->setFixedHeight(30); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
150 |
captchaInputLayout->addWidget(captcha_code); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
151 |
captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
152 |
captchaLayout->addLayout(captchaInputLayout); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
153 |
captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
154 |
|
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
155 |
QWidget * captchaLayoutWidget = new QWidget(); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
156 |
captchaLayoutWidget->setContentsMargins(0, 0, 0, 0); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
157 |
captchaLayoutWidget->setLayout(captchaLayout); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
158 |
feedbackLayout->addWidget(captchaLayoutWidget, 3, 1, 1, 2); |
8434 | 159 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
160 |
BtnSend = new QPushButton(tr("Send Feedback")); |
12041
3957a6653c10
Add icon to “Send Feedback” button, do some TODO tasks in pagevideo.cpp
Wuzzy <almikes@aol.com>
parents:
11808
diff
changeset
|
161 |
BtnSend->setStyleSheet("qproperty-icon: url(:/res/Start.png);"); |
3957a6653c10
Add icon to “Send Feedback” button, do some TODO tasks in pagevideo.cpp
Wuzzy <almikes@aol.com>
parents:
11808
diff
changeset
|
162 |
|
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
163 |
feedbackLayout->addWidget(BtnSend, 3, 3); |
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
164 |
BtnSend->setFixedHeight(40); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
165 |
connect(BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback())); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
166 |
|
11670
30bbbde590ce
Fix bad layouting of feedback dialog, fixes #58
Wuzzy <almikes@aol.com>
parents:
11630
diff
changeset
|
167 |
pageLayout->addLayout(feedbackLayout); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
168 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
169 |
QVBoxLayout * dialogLayout = new QVBoxLayout(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
170 |
dialogLayout->addLayout(pageLayout, 1); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
171 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
172 |
LoadCaptchaImage(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
173 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
174 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
175 |
void FeedbackDialog::GenerateSpecs() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
176 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
177 |
// Gather some information about the system and embed it into the report |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
178 |
QDesktopWidget* screen = QApplication::desktop(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
179 |
QString os_version = "Operating system: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
180 |
QString qt_version = QString("Qt version: ") + QT_VERSION_STR + QString("\n"); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
181 |
QString total_ram = "Total RAM: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
182 |
QString number_of_cores = "Number of cores: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
183 |
QString compiler_bits = "Compiler architecture: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
184 |
QString compiler_version = "Compiler version: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
185 |
QString kernel_line = "Kernel: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
186 |
QString screen_size = "Size of the screen(s): " + |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
187 |
QString::number(screen->width()) + "x" + QString::number(screen->height()) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
188 |
QString number_of_screens = "Number of screens: " + QString::number(screen->screenCount()) + "\n"; |
8721 | 189 |
QString processor_name = "Processor: "; |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
190 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
191 |
// platform specific code |
9163
67334acaaac7
port all Q_WS_* to Q_OS_* so that we are forward compatible with Qt5
koda
parents:
9080
diff
changeset
|
192 |
#ifdef Q_OS_MACX |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
193 |
number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
194 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
195 |
uint64_t memsize; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
196 |
size_t len = sizeof(memsize); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
197 |
static int mib_s[2] = { CTL_HW, HW_MEMSIZE }; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
198 |
if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
199 |
total_ram += QString::number(memsize/1024/1024) + " MB\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
200 |
else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
201 |
total_ram += "Error getting total RAM information\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
202 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
203 |
int mib[] = {CTL_KERN, KERN_OSRELEASE}; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
204 |
sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
205 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
206 |
char *kernelVersion = (char *)malloc(sizeof(char)*len); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
207 |
sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
208 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
209 |
QString kernelVersionStr = QString(kernelVersion); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
210 |
free(kernelVersion); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
211 |
int major_version = kernelVersionStr.split(".").first().toUInt() - 4; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
212 |
int minor_version = kernelVersionStr.split(".").at(1).toUInt(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
213 |
os_version += QString("Mac OS X 10.%1.%2").arg(major_version).arg(minor_version) + " "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
214 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
215 |
switch(major_version) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
216 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
217 |
case 4: os_version += "\"Tiger\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
218 |
case 5: os_version += "\"Leopard\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
219 |
case 6: os_version += "\"Snow Leopard\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
220 |
case 7: os_version += "\"Lion\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
221 |
case 8: os_version += "\"Mountain Lion\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
222 |
default: os_version += "\"Unknown version\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
223 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
224 |
#endif |
9163
67334acaaac7
port all Q_WS_* to Q_OS_* so that we are forward compatible with Qt5
koda
parents:
9080
diff
changeset
|
225 |
#ifdef Q_OS_WIN |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
226 |
SYSTEM_INFO sysinfo; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
227 |
GetSystemInfo(&sysinfo); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
228 |
number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
229 |
MEMORYSTATUSEX status; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
230 |
status.dwLength = sizeof(status); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
231 |
GlobalMemoryStatusEx(&status); |
8871 | 232 |
total_ram += QString::number(status.ullTotalPhys/1024/1024) + " MB\n"; |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
233 |
|
8874
8121ce2b0a88
fix displaying the right version of windows in system info
koda
parents:
8871
diff
changeset
|
234 |
switch(QSysInfo::windowsVersion()) |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
235 |
{ |
8874
8121ce2b0a88
fix displaying the right version of windows in system info
koda
parents:
8871
diff
changeset
|
236 |
case QSysInfo::WV_NT: os_version += "Windows NT\n"; break; |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
237 |
case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
238 |
case QSysInfo::WV_XP: os_version += "Windows XP\n"; break; |
8874
8121ce2b0a88
fix displaying the right version of windows in system info
koda
parents:
8871
diff
changeset
|
239 |
case QSysInfo::WV_2003: os_version += "Windows Server 2003\n"; break; |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
240 |
case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
241 |
case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break; |
9323 | 242 |
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
243 |
case QSysInfo::WV_WINDOWS8: os_version += "Windows 8\n"; break; |
|
244 |
#endif |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
245 |
default: os_version += "Windows (Unknown version)\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
246 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
247 |
kernel_line += "Windows kernel\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
248 |
#endif |
9323 | 249 |
#ifdef Q_OS_LINUX |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
250 |
number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n"; |
9335 | 251 |
quint32 pages = sysconf(_SC_PHYS_PAGES); |
9325 | 252 |
quint32 page_size = sysconf(_SC_PAGE_SIZE); |
10804
f5dc72575c92
feedback/linux: fix wrong mem size being reported if mem > 4GB. thanks to tomreyn for reporting this issue
sheepluva
parents:
10108
diff
changeset
|
253 |
quint64 total = (quint64)pages * page_size / 1024 / 1024; |
9323 | 254 |
total_ram += QString::number(total) + " MB\n"; |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
255 |
os_version += "GNU/Linux or BSD\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
256 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
257 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
258 |
// uname -a |
9323 | 259 |
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC) |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
260 |
QProcess *process = new QProcess(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
261 |
QStringList arguments = QStringList("-a"); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
262 |
process->start("uname", arguments); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
263 |
if (process->waitForFinished()) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
264 |
kernel_line += QString(process->readAll()); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
265 |
delete process; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
266 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
267 |
|
9652 | 268 |
#if (defined(Q_OS_WIN) && defined(__i386__)) || defined(__x86_64__) |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
269 |
// cpu info |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
270 |
quint32 registers[4]; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
271 |
quint32 i; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
272 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
273 |
i = 0x80000002; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
274 |
asm volatile |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
275 |
("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3]) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
276 |
: "a" (i), "c" (0)); |
8721 | 277 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[0]), 4); |
278 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[1]), 4); |
|
279 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[2]), 4); |
|
280 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[3]), 4); |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
281 |
i = 0x80000003; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
282 |
asm volatile |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
283 |
("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3]) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
284 |
: "a" (i), "c" (0)); |
8721 | 285 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[0]), 4); |
286 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[1]), 4); |
|
287 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[2]), 4); |
|
288 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[3]), 4); |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
289 |
i = 0x80000004; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
290 |
asm volatile |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
291 |
("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3]) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
292 |
: "a" (i), "c" (0)); |
8721 | 293 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[0]), 4); |
294 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[1]), 4); |
|
295 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[2]), 4); |
|
296 |
processor_name += QByteArray(reinterpret_cast<char*>(®isters[3]), 4); |
|
297 |
processor_name += "\n"; |
|
8595 | 298 |
#else |
299 |
processor_name += "Unknown"; |
|
300 |
#endif |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
301 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
302 |
// compiler |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
303 |
#ifdef __GNUC__ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
304 |
compiler_version += "GCC " + QString(__VERSION__) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
305 |
#else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
306 |
compiler_version += "Unknown\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
307 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
308 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
309 |
if(sizeof(void*) == 4) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
310 |
compiler_bits += "i386\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
311 |
else if(sizeof(void*) == 8) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
312 |
compiler_bits += "x86_64\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
313 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
314 |
// concat system info |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
315 |
specs = qt_version |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
316 |
+ os_version |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
317 |
+ total_ram |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
318 |
+ screen_size |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
319 |
+ number_of_screens |
8721 | 320 |
+ processor_name |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
321 |
+ number_of_cores |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
322 |
+ compiler_version |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
323 |
+ compiler_bits |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
324 |
+ kernel_line; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
325 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
326 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
327 |
void FeedbackDialog::ShowErrorMessage(const QString & msg) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
328 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
329 |
QMessageBox msgMsg(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
330 |
msgMsg.setIcon(QMessageBox::Warning); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
331 |
msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
332 |
msgMsg.setText(msg); |
14841
b9437746bffb
Frontend: Force plain text mode for many message windows
Wuzzy <Wuzzy2@mail.ru>
parents:
13405
diff
changeset
|
333 |
msgMsg.setTextFormat(Qt::PlainText); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
334 |
msgMsg.setWindowModality(Qt::WindowModal); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
335 |
msgMsg.exec(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
336 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
337 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
338 |
void FeedbackDialog::ShowSpecs() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
339 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
340 |
QMessageBox msgMsg(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
341 |
msgMsg.setIcon(QMessageBox::Information); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
342 |
msgMsg.setWindowTitle(QMessageBox::tr("System Information Preview")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
343 |
msgMsg.setText(specs); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
344 |
msgMsg.setTextFormat(Qt::PlainText); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
345 |
msgMsg.setWindowModality(Qt::WindowModal); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
346 |
msgMsg.setStyleSheet("background: #0A0533;"); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
347 |
msgMsg.exec(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
348 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
349 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
350 |
void FeedbackDialog::NetReply(QNetworkReply *reply) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
351 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
352 |
if (reply == genCaptchaRequest) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
353 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
354 |
if (reply->error() != QNetworkReply::NoError) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
355 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
356 |
qDebug() << "Error generating captcha image: " << reply->errorString(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
357 |
ShowErrorMessage(QMessageBox::tr("Failed to generate captcha")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
358 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
359 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
360 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
361 |
bool okay; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
362 |
QByteArray body = reply->readAll(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
363 |
captchaID = QString(body).toInt(&okay); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
364 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
365 |
if (!okay) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
366 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
367 |
qDebug() << "Failed to get captcha ID: " << body; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
368 |
ShowErrorMessage(QMessageBox::tr("Failed to generate captcha")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
369 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
370 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
371 |
|
11630
9d3e32623567
change all URLs of feedback dialog to use https
sheepluva
parents:
11520
diff
changeset
|
372 |
QString url = "https://hedgewars.org/feedback/?captcha&id="; |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
373 |
url += QString::number(captchaID); |
8434 | 374 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
375 |
QNetworkAccessManager *netManager = GetNetManager(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
376 |
QUrl captchaURL(url); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
377 |
QNetworkRequest req(captchaURL); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
378 |
captchaImageRequest = netManager->get(req); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
379 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
380 |
else if (reply == captchaImageRequest) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
381 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
382 |
if (reply->error() != QNetworkReply::NoError) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
383 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
384 |
qDebug() << "Error loading captcha image: " << reply->errorString(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
385 |
ShowErrorMessage(QMessageBox::tr("Failed to download captcha")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
386 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
387 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
388 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
389 |
QByteArray imageData = reply->readAll(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
390 |
QPixmap pixmap; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
391 |
pixmap.loadFromData(imageData); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
392 |
label_captcha->setPixmap(pixmap); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
393 |
captcha_code->setText(""); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
394 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
395 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
396 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
397 |
QNetworkAccessManager * FeedbackDialog::GetNetManager() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
398 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
399 |
if (netManager) return netManager; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
400 |
netManager = new QNetworkAccessManager(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
401 |
connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*))); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
402 |
return netManager; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
403 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
404 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
405 |
void FeedbackDialog::LoadCaptchaImage() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
406 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
407 |
QNetworkAccessManager *netManager = GetNetManager(); |
11630
9d3e32623567
change all URLs of feedback dialog to use https
sheepluva
parents:
11520
diff
changeset
|
408 |
QUrl captchaURL("https://hedgewars.org/feedback/?gencaptcha"); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
409 |
QNetworkRequest req(captchaURL); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
410 |
genCaptchaRequest = netManager->get(req); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
411 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
412 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
413 |
void FeedbackDialog::finishedSlot(QNetworkReply* reply) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
414 |
{ |
9393 | 415 |
if (reply->error() == QNetworkReply::NoError) |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
416 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
417 |
QMessageBox infoMsg(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
418 |
infoMsg.setIcon(QMessageBox::Information); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
419 |
infoMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Success")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
420 |
infoMsg.setText(reply->readAll()); |
14841
b9437746bffb
Frontend: Force plain text mode for many message windows
Wuzzy <Wuzzy2@mail.ru>
parents:
13405
diff
changeset
|
421 |
infoMsg.setTextFormat(Qt::PlainText); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
422 |
infoMsg.setWindowModality(Qt::WindowModal); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
423 |
infoMsg.exec(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
424 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
425 |
accept(); |
8434 | 426 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
427 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
428 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
429 |
else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
430 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
431 |
ShowErrorMessage(QString("Error: ") + reply->readAll()); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
432 |
LoadCaptchaImage(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
433 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
434 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
435 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
436 |
void FeedbackDialog::SendFeedback() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
437 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
438 |
// Get form data |
8434 | 439 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
440 |
QString summary = this->summary->text(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
441 |
QString description = this->description->toPlainText(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
442 |
QString email = this->email->text(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
443 |
QString captchaCode = this->captcha_code->text(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
444 |
QString captchaID = QString::number(this->captchaID); |
8924 | 445 |
QString version = "HedgewarsFoundation-Hedgewars-v" + *cVersionString + "_r" + |
8613
82c649dfc7c3
split cVersionString into its three separate components (version, revision, hash) and apply the new values sensibly on the frontend (esp. title, info and feedback)
koda
parents:
8595
diff
changeset
|
446 |
*cRevisionString + "|" + *cHashString; |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
447 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
448 |
if (summary.isEmpty() || description.isEmpty()) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
449 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
450 |
ShowErrorMessage(QMessageBox::tr("Please fill out all fields. Email is optional.")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
451 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
452 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
453 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
454 |
// Submit issue to PHP script |
8434 | 455 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
456 |
QByteArray body; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
457 |
body.append("captcha="); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
458 |
body.append(captchaID); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
459 |
body.append("&code="); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
460 |
body.append(captchaCode); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
461 |
body.append("&version="); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
462 |
body.append(QUrl::toPercentEncoding(version)); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
463 |
body.append("&title="); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
464 |
body.append(QUrl::toPercentEncoding(summary)); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
465 |
body.append("&body="); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
466 |
body.append(QUrl::toPercentEncoding(description)); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
467 |
body.append("&email="); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
468 |
body.append(QUrl::toPercentEncoding(email)); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
469 |
if (CheckSendSpecs->isChecked()) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
470 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
471 |
body.append("&specs="); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
472 |
body.append(QUrl::toPercentEncoding(specs)); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
473 |
} |
8434 | 474 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
475 |
nam = new QNetworkAccessManager(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
476 |
connect(nam, SIGNAL(finished(QNetworkReply*)), |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
477 |
this, SLOT(finishedSlot(QNetworkReply*))); |
8434 | 478 |
|
11630
9d3e32623567
change all URLs of feedback dialog to use https
sheepluva
parents:
11520
diff
changeset
|
479 |
QNetworkRequest header(QUrl("https://hedgewars.org/feedback/?submit")); |
12902
fc47fc4af6bd
Finish porting. Seems to work, but no thorough testing has been performed
unc0rr
parents:
12041
diff
changeset
|
480 |
header.setRawHeader("Content-Length", QString::number(body.size()).toLatin1()); |
8389
6d65ed1f832c
Fixed feedback submission by correcting Content-Type.
dag10 <gottlieb.drew@gmail.com>
parents:
8386
diff
changeset
|
481 |
header.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); |
8434 | 482 |
|
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
483 |
nam->post(header, body); |
8386 | 484 |
} |