QTfrontend/ui/page/pagefeedback.cpp
author koda
Fri, 28 Dec 2012 23:54:42 +0100
changeset 8344 3d18f7f71d65
parent 8328 03684c667664
child 8330 aaefa587e277
child 8383 b557c73a7593
permissions -rw-r--r--
ok, enable the splashscreen for win only
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     1
/*
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6700
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     4
 *
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     8
 *
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    12
 * GNU General Public License for more details.
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    13
 *
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    15
 * along with this program; if not, write to the Free Software
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    17
 */
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    18
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    19
#include <QHBoxLayout>
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    20
#include <QLineEdit>
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    21
#include <QTextBrowser>
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    22
#include <QLabel>
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    23
#include <QHttp>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    24
#include <QSysInfo>
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    25
#include <QDebug>
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    26
#include <QBuffer>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    27
#include <QApplication>
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    28
#include <QDesktopWidget>
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    29
#include <QNetworkReply>
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    30
#include <QProcess>
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    31
#include <QMessageBox>
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    32
#include <QCheckBox>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    33
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    34
#include <string>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    35
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    36
#ifdef Q_WS_WIN
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    37
#define WINVER 0x0500
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    38
#include <windows.h>
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    39
#else
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    40
#include <unistd.h>
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    41
#include <sys/types.h>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    42
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    43
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    44
#ifdef Q_WS_MAC
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    45
#include <sys/sysctl.h>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    46
#endif
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    47
8258
c14b27abe452 fix build on linux for me ( the uint32_t releated breakage )
sheepluva
parents: 8252
diff changeset
    48
#include <stdint.h>
c14b27abe452 fix build on linux for me ( the uint32_t releated breakage )
sheepluva
parents: 8252
diff changeset
    49
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    50
#include "pagefeedback.h"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    51
#include "hwconsts.h"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    52
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    53
QLayout * PageFeedback::bodyLayoutDefinition()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    54
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    55
    QVBoxLayout * pageLayout = new QVBoxLayout();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    56
    QHBoxLayout * summaryLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    57
    QHBoxLayout * emailLayout = new QHBoxLayout();
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    58
    QHBoxLayout * descriptionLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    59
    QHBoxLayout * combinedTopLayout = new QHBoxLayout();
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    60
    QHBoxLayout * systemLayout = new QHBoxLayout();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    61
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    62
    info = new QLabel();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    63
    info->setText(
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    64
        "<style type=\"text/css\">"
8277
cd2bae15a9a3 hides the 'email' prompt on the feedback page (as that doesn't work, so it's a misleading/useless feature), makes the "please add your email" text a little nicer and more noticeable, and makes the "feedback" and "downloadable content" buttons on the main menu a little bit larger, and more clickable.
Drew Gottlieb
parents: 8274
diff changeset
    65
        "a { color: #fc0; }"
cd2bae15a9a3 hides the 'email' prompt on the feedback page (as that doesn't work, so it's a misleading/useless feature), makes the "please add your email" text a little nicer and more noticeable, and makes the "feedback" and "downloadable content" buttons on the main menu a little bit larger, and more clickable.
Drew Gottlieb
parents: 8274
diff changeset
    66
        "b { color: #0df; }"
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    67
        "</style>"
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    68
        "<div align=\"center\"><h1>Please give us feedback!</h1>"
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    69
        "<h3>We are always happy about suggestions, ideas, or bug reports.<h3>"
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    70
        "<h4>Your email address is optional, but we may want to contact you.<h4>"
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    71
        "</div>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    72
    );
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    73
    pageLayout->addWidget(info);
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    74
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    75
    QVBoxLayout * summaryEmailLayout = new QVBoxLayout();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    76
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    77
    const int labelWidth = 90;
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    78
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    79
    label_email = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    80
    label_email->setText(QLabel::tr("Your Email"));
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    81
    label_email->setFixedWidth(labelWidth);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    82
    emailLayout->addWidget(label_email);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    83
    email = new QLineEdit();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    84
    emailLayout->addWidget(email);
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    85
    summaryEmailLayout->addLayout(emailLayout);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    86
    
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    87
    label_summary = new QLabel();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    88
    label_summary->setText(QLabel::tr("Summary"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    89
    label_summary->setFixedWidth(labelWidth);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    90
    summaryLayout->addWidget(label_summary);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    91
    summary = new QLineEdit();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    92
    summaryLayout->addWidget(summary);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    93
    summaryEmailLayout->addLayout(summaryLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    94
    
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    95
    combinedTopLayout->addLayout(summaryEmailLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    96
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    97
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    98
    CheckSendSpecs = new QCheckBox();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    99
    CheckSendSpecs->setText(QLabel::tr("Send system information"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   100
    CheckSendSpecs->setChecked(true);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   101
    systemLayout->addWidget(CheckSendSpecs);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   102
    BtnViewInfo = addButton("View", systemLayout, 1, false);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   103
    BtnViewInfo->setFixedSize(60, 30);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   104
    connect(BtnViewInfo, SIGNAL(clicked()), this, SLOT(ShowSpecs()));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   105
    combinedTopLayout->addLayout(systemLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   106
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   107
    combinedTopLayout->setStretch(0, 1);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   108
    combinedTopLayout->insertSpacing(1, 20);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   109
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   110
    pageLayout->addLayout(combinedTopLayout);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   111
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   112
    label_description = new QLabel();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   113
    label_description->setText(QLabel::tr("Description"));
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   114
    label_description->setFixedWidth(labelWidth);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   115
    descriptionLayout->addWidget(label_description, 0, Qt::AlignTop);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   116
    description = new QTextBrowser();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   117
    description->setReadOnly(false);
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   118
    descriptionLayout->addWidget(description);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   119
    pageLayout->addLayout(descriptionLayout);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   120
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   121
    return pageLayout;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   122
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   123
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   124
QNetworkAccessManager * PageFeedback::GetNetManager()
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   125
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   126
    if (netManager) return netManager;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   127
    netManager = new QNetworkAccessManager(this);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   128
    connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*)));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   129
    return netManager;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   130
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   131
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   132
void PageFeedback::LoadCaptchaImage()
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   133
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   134
        QNetworkAccessManager *netManager = GetNetManager();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   135
        QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   136
        QNetworkRequest req(captchaURL);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   137
        genCaptchaRequest = netManager->get(req);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   138
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   139
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   140
void PageFeedback::NetReply(QNetworkReply *reply)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   141
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   142
    if (reply == genCaptchaRequest)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   143
    {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   144
        if (reply->error() != QNetworkReply::NoError)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   145
        {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   146
            qDebug() << "Error generating captcha image: " << reply->errorString();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   147
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   148
            return;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   149
        }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   150
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   151
        bool okay;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   152
        QByteArray body = reply->readAll();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   153
        captchaID = QString(body).toInt(&okay);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   154
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   155
        if (!okay)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   156
        {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   157
            qDebug() << "Failed to get captcha ID: " << body;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   158
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   159
            return;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   160
        }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   161
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   162
        QString url = "http://hedgewars.org/feedback/?captcha&id=";
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   163
        url += QString::number(captchaID);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   164
        
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   165
        QNetworkAccessManager *netManager = GetNetManager();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   166
        QUrl captchaURL(url);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   167
        QNetworkRequest req(captchaURL);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   168
        captchaImageRequest = netManager->get(req);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   169
    }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   170
    else if (reply == captchaImageRequest)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   171
    {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   172
        if (reply->error() != QNetworkReply::NoError)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   173
        {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   174
            qDebug() << "Error loading captcha image: " << reply->errorString();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   175
            ShowErrorMessage(QMessageBox::tr("Failed to download captcha"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   176
            return;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   177
        }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   178
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   179
        QByteArray imageData = reply->readAll();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   180
        QPixmap pixmap;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   181
        pixmap.loadFromData(imageData);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   182
        label_captcha->setPixmap(pixmap);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   183
        captcha_code->setText("");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   184
    }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   185
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   186
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   187
QLayout * PageFeedback::footerLayoutDefinition()
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   188
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   189
    QHBoxLayout * bottomLayout = new QHBoxLayout();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   190
    QHBoxLayout * captchaLayout = new QHBoxLayout();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   191
    QVBoxLayout * captchaInputLayout = new QVBoxLayout();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   192
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   193
    label_captcha = new QLabel();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   194
    label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   195
    label_captcha->setText("<div style='width: 200px; height: 100px;'>loading<br>captcha</div>");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   196
    captchaLayout->addWidget(label_captcha);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   197
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   198
    label_captcha_input = new QLabel();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   199
    label_captcha_input->setText(QLabel::tr("Type the security code:"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   200
    captchaInputLayout->addWidget(label_captcha_input);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   201
    captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   202
    captcha_code = new QLineEdit();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   203
    captcha_code->setFixedSize(165, 30);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   204
    captchaInputLayout->addWidget(captcha_code);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   205
    captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   206
    captchaLayout->addLayout(captchaInputLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   207
    captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   208
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   209
    captchaLayout->insertSpacing(-1, 40);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   210
    bottomLayout->addLayout(captchaLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   211
    
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   212
    //TODO: create logo for send button
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   213
    BtnSend = addButton("Send Feedback", bottomLayout, 0, false);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   214
    BtnSend->setFixedSize(120, 40);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   215
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   216
    bottomLayout->setStretchFactor(captchaLayout, 0);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   217
    bottomLayout->setStretchFactor(BtnSend, 1);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   218
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   219
    return bottomLayout;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   220
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   221
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   222
void PageFeedback::GenerateSpecs()
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   223
{
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   224
    // Gather some information about the system and embed it into the report
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   225
    QDesktopWidget* screen = QApplication::desktop();
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   226
    QString os_version = "Operating system: ";
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   227
    QString qt_version = QString("Qt version: ") + QT_VERSION_STR + QString("\n");
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   228
    QString total_ram = "Total RAM: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   229
    QString number_of_cores = "Number of cores: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   230
    QString compiler_bits = "Compiler architecture: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   231
    QString compiler_version = "Compiler version: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   232
    QString kernel_line = "Kernel: ";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   233
    QString screen_size = "Size of the screen(s): " +
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   234
        QString::number(screen->width()) + "x" + QString::number(screen->height()) + "\n";
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   235
    QString number_of_screens = "Number of screens: " + QString::number(screen->screenCount()) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   236
    std::string processor_name = "Processor: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   237
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   238
    // platform specific code
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   239
#ifdef Q_WS_MACX
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   240
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   241
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   242
    uint64_t memsize;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   243
    size_t len = sizeof(memsize);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   244
    static int mib_s[2] = { CTL_HW, HW_MEMSIZE };
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   245
    if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   246
        total_ram += QString::number(memsize/1024/1024) + " MB\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   247
    else
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   248
        total_ram += "Error getting total RAM information\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   249
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   250
    int mib[] = {CTL_KERN, KERN_OSRELEASE};
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   251
    sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   252
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   253
    char *kernelVersion = (char *)malloc(sizeof(char)*len);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   254
    sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   255
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   256
    QString kernelVersionStr = QString(kernelVersion);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   257
    free(kernelVersion);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   258
    int major_version = kernelVersionStr.split(".").first().toUInt() - 4;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   259
    int minor_version = kernelVersionStr.split(".").at(1).toUInt();
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   260
    os_version += QString("Mac OS X 10.%1.%2").arg(major_version).arg(minor_version) + " ";
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   261
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   262
    switch(major_version)
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   263
    {
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   264
        case 4:  os_version += "\"Tiger\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   265
        case 5:  os_version += "\"Leopard\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   266
        case 6:  os_version += "\"Snow Leopard\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   267
        case 7:  os_version += "\"Lion\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   268
        case 8:  os_version += "\"Mountain Lion\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   269
        default: os_version += "\"Unknown version\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   270
    }
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   271
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   272
#ifdef Q_WS_WIN
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   273
    SYSTEM_INFO sysinfo;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   274
    GetSystemInfo(&sysinfo);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   275
    number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   276
    MEMORYSTATUSEX status;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   277
    status.dwLength = sizeof(status);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   278
    GlobalMemoryStatusEx(&status);
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   279
    total_ram += QString::number(status.ullTotalPhys);
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   280
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   281
    switch(QSysInfo::WinVersion())
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   282
    {
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   283
        case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   284
        case QSysInfo::WV_XP: os_version += "Windows XP\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   285
        case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   286
        case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   287
        default: os_version += "Windows (Unknown version)\n"; break;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   288
    }
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   289
    kernel_line += "Windows kernel\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   290
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   291
#ifdef Q_WS_X11
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   292
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   293
    long pages = sysconf(_SC_PHYS_PAGES),
8274
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   294
#ifndef Q_OS_FREEBSD
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   295
         available_pages = sysconf(_SC_AVPHYS_PAGES),
8274
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   296
#else
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   297
         available_pages = 0,
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   298
#endif
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   299
         page_size = sysconf(_SC_PAGE_SIZE);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   300
    total_ram += QString::number(pages * page_size) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   301
    os_version += "GNU/Linux or BSD\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   302
#endif
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   303
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   304
    // uname -a
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   305
#if defined(Q_WS_X11) || defined(Q_WS_MACX)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   306
    QProcess *process = new QProcess();
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   307
    QStringList arguments = QStringList("-a");
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   308
    process->start("uname", arguments);
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   309
    if (process->waitForFinished())
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   310
        kernel_line += QString(process->readAll());
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   311
    delete process;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   312
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   313
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   314
    // cpu info
8289
302a2521fe7a uint32_t -> quint32
nemo
parents: 8277
diff changeset
   315
    quint32 registers[4];
302a2521fe7a uint32_t -> quint32
nemo
parents: 8277
diff changeset
   316
    quint32 i;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   317
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   318
    i = 0x80000002;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   319
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   320
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   321
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   322
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   323
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   324
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   325
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   326
    i = 0x80000003;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   327
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   328
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   329
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   330
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   331
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   332
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   333
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   334
    i = 0x80000004;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   335
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   336
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   337
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   338
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   339
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   340
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   341
    processor_name += std::string((const char *)&registers[3], 3);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   342
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   343
    // compiler
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   344
#ifdef __GNUC__
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   345
    compiler_version += "GCC " + QString(__VERSION__) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   346
#else
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   347
    compiler_version += "Unknown\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   348
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   349
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   350
    if(sizeof(void*) == 4)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   351
        compiler_bits += "i386\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   352
    else if(sizeof(void*) == 8)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   353
        compiler_bits += "x86_64\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   354
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   355
    // concat system info
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   356
    specs = qt_version
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   357
        + os_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   358
        + total_ram
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   359
        + screen_size
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   360
        + number_of_screens
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   361
        + QString::fromStdString(processor_name + "\n")
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   362
        + number_of_cores
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   363
        + compiler_version
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   364
        + compiler_bits
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   365
        + kernel_line;
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   366
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   367
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   368
void PageFeedback::connectSignals()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   369
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   370
    //TODO
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   371
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   372
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   373
void PageFeedback::ShowErrorMessage(const QString & msg)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   374
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   375
    QMessageBox msgMsg(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   376
    msgMsg.setIcon(QMessageBox::Warning);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   377
    msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   378
    msgMsg.setText(msg);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   379
    msgMsg.setWindowModality(Qt::WindowModal);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   380
    msgMsg.exec();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   381
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   382
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   383
void PageFeedback::ShowSpecs()
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   384
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   385
    QMessageBox msgMsg(this);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   386
    msgMsg.setIcon(QMessageBox::Information);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   387
    msgMsg.setWindowTitle(QMessageBox::tr("System Information Preview"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   388
    msgMsg.setText(specs);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   389
    msgMsg.setTextFormat(Qt::PlainText);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   390
    msgMsg.setWindowModality(Qt::WindowModal);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   391
    msgMsg.setStyleSheet("background: #0A0533;");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   392
    msgMsg.exec();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   393
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   394
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   395
PageFeedback::PageFeedback(QWidget* parent) : AbstractPage(parent)
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   396
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   397
    initPage();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   398
    netManager = NULL;
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   399
    GenerateSpecs();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   400
}