author | koda |
Fri, 18 Jan 2013 11:47:23 +0100 | |
changeset 8400 | 33ab77c0b486 |
parent 8389 | 6d65ed1f832c |
child 8434 | 4821897a0f10 |
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 |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
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 |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
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> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
23 |
#include <QHttp> |
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> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
33 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
34 |
#include <string> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
35 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
36 |
#ifdef Q_WS_WIN |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
37 |
#define WINVER 0x0500 |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
38 |
#include <windows.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
39 |
#else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
40 |
#include <unistd.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
41 |
#include <sys/types.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
42 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
43 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
44 |
#ifdef Q_WS_MAC |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
45 |
#include <sys/sysctl.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
46 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
47 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
48 |
#include <stdint.h> |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
49 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
50 |
#include "AbstractPage.h" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
51 |
#include "hwconsts.h" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
52 |
#include "feedbackdialog.h" |
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 |
FeedbackDialog::FeedbackDialog(QWidget * parent) : QDialog(parent) |
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 |
setModal(true); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
57 |
setWindowFlags(Qt::Sheet); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
58 |
setWindowModality(Qt::WindowModal); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
59 |
setMinimumSize(700, 460); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
60 |
resize(700, 460); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
61 |
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
62 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
63 |
netManager = NULL; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
64 |
GenerateSpecs(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
65 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
66 |
/* Top layout */ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
67 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
68 |
QVBoxLayout * pageLayout = new QVBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
69 |
QHBoxLayout * summaryLayout = new QHBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
70 |
QHBoxLayout * emailLayout = new QHBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
71 |
QHBoxLayout * descriptionLayout = new QHBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
72 |
QHBoxLayout * combinedTopLayout = new QHBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
73 |
QHBoxLayout * systemLayout = new QHBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
74 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
75 |
info = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
76 |
info->setText( |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
77 |
"<style type=\"text/css\">" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
78 |
"a { color: #fc0; }" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
79 |
"b { color: #0df; }" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
80 |
"</style>" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
81 |
"<div align=\"center\"><h1>Please give us feedback!</h1>" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
82 |
"<h3>We are always happy about suggestions, ideas, or bug reports.<h3>" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
83 |
"<h4>Your email address is optional, but we may want to contact you.<h4>" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
84 |
"</div>" |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
85 |
); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
86 |
pageLayout->addWidget(info); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
87 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
88 |
QVBoxLayout * summaryEmailLayout = new QVBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
89 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
90 |
const int labelWidth = 90; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
91 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
92 |
label_email = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
93 |
label_email->setText(QLabel::tr("Your Email")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
94 |
label_email->setFixedWidth(labelWidth); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
95 |
emailLayout->addWidget(label_email); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
96 |
email = new QLineEdit(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
97 |
emailLayout->addWidget(email); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
98 |
summaryEmailLayout->addLayout(emailLayout); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
99 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
100 |
label_summary = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
101 |
label_summary->setText(QLabel::tr("Summary")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
102 |
label_summary->setFixedWidth(labelWidth); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
103 |
summaryLayout->addWidget(label_summary); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
104 |
summary = new QLineEdit(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
105 |
summaryLayout->addWidget(summary); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
106 |
summaryEmailLayout->addLayout(summaryLayout); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
107 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
108 |
combinedTopLayout->addLayout(summaryEmailLayout); |
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")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
112 |
CheckSendSpecs->setChecked(true); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
113 |
systemLayout->addWidget(CheckSendSpecs); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
114 |
BtnViewInfo = new QPushButton(tr("View")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
115 |
systemLayout->addWidget(BtnViewInfo, 1); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
116 |
BtnViewInfo->setFixedSize(60, 30); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
117 |
connect(BtnViewInfo, SIGNAL(clicked()), this, SLOT(ShowSpecs())); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
118 |
combinedTopLayout->addLayout(systemLayout); |
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 |
combinedTopLayout->setStretch(0, 1); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
121 |
combinedTopLayout->insertSpacing(1, 20); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
122 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
123 |
pageLayout->addLayout(combinedTopLayout); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
124 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
125 |
label_description = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
126 |
label_description->setText(QLabel::tr("Description")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
127 |
label_description->setFixedWidth(labelWidth); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
128 |
descriptionLayout->addWidget(label_description, 0, Qt::AlignTop); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
129 |
description = new QTextBrowser(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
130 |
description->setReadOnly(false); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
131 |
descriptionLayout->addWidget(description); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
132 |
pageLayout->addLayout(descriptionLayout); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
133 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
134 |
/* Bottom layout */ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
135 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
136 |
QHBoxLayout * bottomLayout = new QHBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
137 |
QHBoxLayout * captchaLayout = new QHBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
138 |
QVBoxLayout * captchaInputLayout = new QVBoxLayout(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
139 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
140 |
QPushButton * BtnCancel = new QPushButton(tr("Cancel")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
141 |
bottomLayout->addWidget(BtnCancel, 0); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
142 |
BtnCancel->setFixedSize(100, 40); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
143 |
connect(BtnCancel, SIGNAL(clicked()), this, SLOT(reject())); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
144 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
145 |
bottomLayout->insertStretch(1); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
146 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
147 |
label_captcha = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
148 |
label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px"); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
149 |
label_captcha->setText("loading<br>captcha"); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
150 |
label_captcha->setFixedSize(200, 50); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
151 |
captchaLayout->addWidget(label_captcha); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
152 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
153 |
label_captcha_input = new QLabel(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
154 |
label_captcha_input->setText(QLabel::tr("Type the security code:")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
155 |
captchaInputLayout->addWidget(label_captcha_input); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
156 |
captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
157 |
captcha_code = new QLineEdit(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
158 |
captcha_code->setFixedSize(165, 30); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
159 |
captchaInputLayout->addWidget(captcha_code); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
160 |
captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
161 |
captchaLayout->addLayout(captchaInputLayout); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
162 |
captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
163 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
164 |
bottomLayout->addLayout(captchaLayout); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
165 |
bottomLayout->addSpacing(40); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
166 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
167 |
// TODO: Set green arrow icon for send button (:/res/Start.png) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
168 |
BtnSend = new QPushButton(tr("Send Feedback")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
169 |
bottomLayout->addWidget(BtnSend, 0); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
170 |
BtnSend->setFixedSize(120, 40); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
171 |
connect(BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback())); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
172 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
173 |
bottomLayout->setStretchFactor(captchaLayout, 0); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
174 |
bottomLayout->setStretchFactor(BtnSend, 1); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
175 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
176 |
QVBoxLayout * dialogLayout = new QVBoxLayout(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
177 |
dialogLayout->addLayout(pageLayout, 1); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
178 |
dialogLayout->addLayout(bottomLayout); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
179 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
180 |
LoadCaptchaImage(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
181 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
182 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
183 |
void FeedbackDialog::GenerateSpecs() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
184 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
185 |
// 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
|
186 |
QDesktopWidget* screen = QApplication::desktop(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
187 |
QString os_version = "Operating system: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
188 |
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
|
189 |
QString total_ram = "Total RAM: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
190 |
QString number_of_cores = "Number of cores: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
191 |
QString compiler_bits = "Compiler architecture: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
192 |
QString compiler_version = "Compiler version: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
193 |
QString kernel_line = "Kernel: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
194 |
QString screen_size = "Size of the screen(s): " + |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
195 |
QString::number(screen->width()) + "x" + QString::number(screen->height()) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
196 |
QString number_of_screens = "Number of screens: " + QString::number(screen->screenCount()) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
197 |
std::string processor_name = "Processor: "; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
198 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
199 |
// platform specific code |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
200 |
#ifdef Q_WS_MACX |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
201 |
number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\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 |
uint64_t memsize; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
204 |
size_t len = sizeof(memsize); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
205 |
static int mib_s[2] = { CTL_HW, HW_MEMSIZE }; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
206 |
if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
207 |
total_ram += QString::number(memsize/1024/1024) + " MB\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
208 |
else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
209 |
total_ram += "Error getting total RAM information\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
210 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
211 |
int mib[] = {CTL_KERN, KERN_OSRELEASE}; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
212 |
sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
213 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
214 |
char *kernelVersion = (char *)malloc(sizeof(char)*len); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
215 |
sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0); |
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 |
QString kernelVersionStr = QString(kernelVersion); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
218 |
free(kernelVersion); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
219 |
int major_version = kernelVersionStr.split(".").first().toUInt() - 4; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
220 |
int minor_version = kernelVersionStr.split(".").at(1).toUInt(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
221 |
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
|
222 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
223 |
switch(major_version) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
224 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
225 |
case 4: os_version += "\"Tiger\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
226 |
case 5: os_version += "\"Leopard\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
227 |
case 6: os_version += "\"Snow Leopard\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
228 |
case 7: os_version += "\"Lion\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
229 |
case 8: os_version += "\"Mountain Lion\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
230 |
default: os_version += "\"Unknown version\"\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
231 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
232 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
233 |
#ifdef Q_WS_WIN |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
234 |
SYSTEM_INFO sysinfo; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
235 |
GetSystemInfo(&sysinfo); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
236 |
number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
237 |
MEMORYSTATUSEX status; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
238 |
status.dwLength = sizeof(status); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
239 |
GlobalMemoryStatusEx(&status); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
240 |
total_ram += QString::number(status.ullTotalPhys); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
241 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
242 |
switch(QSysInfo::WinVersion()) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
243 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
244 |
case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
245 |
case QSysInfo::WV_XP: os_version += "Windows XP\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
246 |
case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
247 |
case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
248 |
default: os_version += "Windows (Unknown version)\n"; break; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
249 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
250 |
kernel_line += "Windows kernel\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
251 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
252 |
#ifdef Q_WS_X11 |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
253 |
number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
254 |
long pages = sysconf(_SC_PHYS_PAGES), |
8386 | 255 |
/* |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
256 |
#ifndef Q_OS_FREEBSD |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
257 |
available_pages = sysconf(_SC_AVPHYS_PAGES), |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
258 |
#else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
259 |
available_pages = 0, |
8386 | 260 |
#endif*/ |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
261 |
page_size = sysconf(_SC_PAGE_SIZE); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
262 |
total_ram += QString::number(pages * page_size) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
263 |
os_version += "GNU/Linux or BSD\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
264 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
265 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
266 |
// uname -a |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
267 |
#if defined(Q_WS_X11) || defined(Q_WS_MACX) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
268 |
QProcess *process = new QProcess(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
269 |
QStringList arguments = QStringList("-a"); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
270 |
process->start("uname", arguments); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
271 |
if (process->waitForFinished()) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
272 |
kernel_line += QString(process->readAll()); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
273 |
delete process; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
274 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
275 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
276 |
// cpu info |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
277 |
quint32 registers[4]; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
278 |
quint32 i; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
279 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
280 |
i = 0x80000002; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
281 |
asm volatile |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
282 |
("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
|
283 |
: "a" (i), "c" (0)); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
284 |
processor_name += std::string((const char *)®isters[0], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
285 |
processor_name += std::string((const char *)®isters[1], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
286 |
processor_name += std::string((const char *)®isters[2], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
287 |
processor_name += std::string((const char *)®isters[3], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
288 |
i = 0x80000003; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
289 |
asm volatile |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
290 |
("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
|
291 |
: "a" (i), "c" (0)); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
292 |
processor_name += std::string((const char *)®isters[0], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
293 |
processor_name += std::string((const char *)®isters[1], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
294 |
processor_name += std::string((const char *)®isters[2], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
295 |
processor_name += std::string((const char *)®isters[3], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
296 |
i = 0x80000004; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
297 |
asm volatile |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
298 |
("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
|
299 |
: "a" (i), "c" (0)); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
300 |
processor_name += std::string((const char *)®isters[0], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
301 |
processor_name += std::string((const char *)®isters[1], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
302 |
processor_name += std::string((const char *)®isters[2], 4); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
303 |
processor_name += std::string((const char *)®isters[3], 3); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
304 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
305 |
// compiler |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
306 |
#ifdef __GNUC__ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
307 |
compiler_version += "GCC " + QString(__VERSION__) + "\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
308 |
#else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
309 |
compiler_version += "Unknown\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
310 |
#endif |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
311 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
312 |
if(sizeof(void*) == 4) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
313 |
compiler_bits += "i386\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
314 |
else if(sizeof(void*) == 8) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
315 |
compiler_bits += "x86_64\n"; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
316 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
317 |
// concat system info |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
318 |
specs = qt_version |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
319 |
+ os_version |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
320 |
+ total_ram |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
321 |
+ screen_size |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
322 |
+ number_of_screens |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
323 |
+ QString::fromStdString(processor_name + "\n") |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
324 |
+ number_of_cores |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
325 |
+ compiler_version |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
326 |
+ compiler_bits |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
327 |
+ kernel_line; |
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 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
330 |
void FeedbackDialog::ShowErrorMessage(const QString & msg) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
331 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
332 |
QMessageBox msgMsg(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
333 |
msgMsg.setIcon(QMessageBox::Warning); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
334 |
msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
335 |
msgMsg.setText(msg); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
336 |
msgMsg.setWindowModality(Qt::WindowModal); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
337 |
msgMsg.exec(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
338 |
} |
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 |
void FeedbackDialog::ShowSpecs() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
341 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
342 |
QMessageBox msgMsg(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
343 |
msgMsg.setIcon(QMessageBox::Information); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
344 |
msgMsg.setWindowTitle(QMessageBox::tr("System Information Preview")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
345 |
msgMsg.setText(specs); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
346 |
msgMsg.setTextFormat(Qt::PlainText); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
347 |
msgMsg.setWindowModality(Qt::WindowModal); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
348 |
msgMsg.setStyleSheet("background: #0A0533;"); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
349 |
msgMsg.exec(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
350 |
} |
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 |
void FeedbackDialog::NetReply(QNetworkReply *reply) |
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 == genCaptchaRequest) |
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 |
if (reply->error() != QNetworkReply::NoError) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
357 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
358 |
qDebug() << "Error generating captcha image: " << reply->errorString(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
359 |
ShowErrorMessage(QMessageBox::tr("Failed to generate captcha")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
360 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
361 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
362 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
363 |
bool okay; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
364 |
QByteArray body = reply->readAll(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
365 |
captchaID = QString(body).toInt(&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 |
if (!okay) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
368 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
369 |
qDebug() << "Failed to get captcha ID: " << body; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
370 |
ShowErrorMessage(QMessageBox::tr("Failed to generate captcha")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
371 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
372 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
373 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
374 |
QString url = "http://hedgewars.org/feedback/?captcha&id="; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
375 |
url += QString::number(captchaID); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
376 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
377 |
QNetworkAccessManager *netManager = GetNetManager(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
378 |
QUrl captchaURL(url); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
379 |
QNetworkRequest req(captchaURL); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
380 |
captchaImageRequest = netManager->get(req); |
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 |
else if (reply == captchaImageRequest) |
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 |
if (reply->error() != QNetworkReply::NoError) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
385 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
386 |
qDebug() << "Error loading captcha image: " << reply->errorString(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
387 |
ShowErrorMessage(QMessageBox::tr("Failed to download captcha")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
388 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
389 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
390 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
391 |
QByteArray imageData = reply->readAll(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
392 |
QPixmap pixmap; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
393 |
pixmap.loadFromData(imageData); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
394 |
label_captcha->setPixmap(pixmap); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
395 |
captcha_code->setText(""); |
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 |
} |
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 |
QNetworkAccessManager * FeedbackDialog::GetNetManager() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
400 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
401 |
if (netManager) return netManager; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
402 |
netManager = new QNetworkAccessManager(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
403 |
connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*))); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
404 |
return netManager; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
405 |
} |
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 |
void FeedbackDialog::LoadCaptchaImage() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
408 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
409 |
QNetworkAccessManager *netManager = GetNetManager(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
410 |
QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha"); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
411 |
QNetworkRequest req(captchaURL); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
412 |
genCaptchaRequest = netManager->get(req); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
413 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
414 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
415 |
void FeedbackDialog::finishedSlot(QNetworkReply* reply) |
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 |
if (reply && reply->error() == QNetworkReply::NoError) |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
418 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
419 |
QMessageBox infoMsg(this); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
420 |
infoMsg.setIcon(QMessageBox::Information); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
421 |
infoMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Success")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
422 |
infoMsg.setText(reply->readAll()); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
423 |
infoMsg.setWindowModality(Qt::WindowModal); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
424 |
infoMsg.exec(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
425 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
426 |
accept(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
427 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
428 |
return; |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
429 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
430 |
else |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
431 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
432 |
ShowErrorMessage(QString("Error: ") + reply->readAll()); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
433 |
LoadCaptchaImage(); |
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 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
437 |
void FeedbackDialog::SendFeedback() |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
438 |
{ |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
439 |
// Get form data |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
440 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
441 |
QString summary = this->summary->text(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
442 |
QString description = this->description->toPlainText(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
443 |
QString email = this->email->text(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
444 |
QString captchaCode = this->captcha_code->text(); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
445 |
QString captchaID = QString::number(this->captchaID); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
446 |
QString version = "HedgewarsFoundation-Hedgewars-" + (cVersionString?(*cVersionString):QString("")); |
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 |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
455 |
|
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 |
} |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
474 |
|
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*))); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
478 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
479 |
QNetworkRequest header(QUrl("http://hedgewars.org/feedback/?submit")); |
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
480 |
header.setRawHeader("Content-Length", QString::number(body.size()).toAscii()); |
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"); |
8385
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
482 |
|
9e8924ff9813
Convert feedback page to dialog (+some fixes from unC0Rr)
dag10
parents:
diff
changeset
|
483 |
nam->post(header, body); |
8386 | 484 |
} |