QTfrontend/ui/page/pagefeedback.cpp
author dag10
Mon, 14 Jan 2013 13:28:03 +0100
changeset 8384 a6e7a95f3b2e
parent 8383 b557c73a7593
permissions -rw-r--r--
GCI2012: Abstract Page Load
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"
8383
b557c73a7593 GCI2012: Abstract Hedgewars Dialogs
dag10
parents: 8328
diff changeset
    51
#include "MessageDialog.h"
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    52
#include "hwconsts.h"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    53
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    54
QLayout * PageFeedback::bodyLayoutDefinition()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    55
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    56
    QVBoxLayout * pageLayout = new QVBoxLayout();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    57
    QHBoxLayout * summaryLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    58
    QHBoxLayout * emailLayout = new QHBoxLayout();
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    59
    QHBoxLayout * descriptionLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    60
    QHBoxLayout * combinedTopLayout = new QHBoxLayout();
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    61
    QHBoxLayout * systemLayout = new QHBoxLayout();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    62
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    63
    info = new QLabel();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    64
    info->setText(
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    65
        "<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
    66
        "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
    67
        "b { color: #0df; }"
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    68
        "</style>"
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    69
        "<div align=\"center\"><h1>Please give us feedback!</h1>"
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    70
        "<h3>We are always happy about suggestions, ideas, or bug reports.<h3>"
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    71
        "<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
    72
        "</div>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    73
    );
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    74
    pageLayout->addWidget(info);
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    75
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    76
    QVBoxLayout * summaryEmailLayout = new QVBoxLayout();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    77
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    78
    const int labelWidth = 90;
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    79
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    80
    label_email = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    81
    label_email->setText(QLabel::tr("Your Email"));
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    82
    label_email->setFixedWidth(labelWidth);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    83
    emailLayout->addWidget(label_email);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    84
    email = new QLineEdit();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    85
    emailLayout->addWidget(email);
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    86
    summaryEmailLayout->addLayout(emailLayout);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    87
    
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    88
    label_summary = new QLabel();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    89
    label_summary->setText(QLabel::tr("Summary"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    90
    label_summary->setFixedWidth(labelWidth);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    91
    summaryLayout->addWidget(label_summary);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    92
    summary = new QLineEdit();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    93
    summaryLayout->addWidget(summary);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    94
    summaryEmailLayout->addLayout(summaryLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    95
    
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    96
    combinedTopLayout->addLayout(summaryEmailLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    97
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    98
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
    99
    CheckSendSpecs = new QCheckBox();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   100
    CheckSendSpecs->setText(QLabel::tr("Send system information"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   101
    CheckSendSpecs->setChecked(true);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   102
    systemLayout->addWidget(CheckSendSpecs);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   103
    BtnViewInfo = addButton("View", systemLayout, 1, false);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   104
    BtnViewInfo->setFixedSize(60, 30);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   105
    connect(BtnViewInfo, SIGNAL(clicked()), this, SLOT(ShowSpecs()));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   106
    combinedTopLayout->addLayout(systemLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   107
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   108
    combinedTopLayout->setStretch(0, 1);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   109
    combinedTopLayout->insertSpacing(1, 20);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   110
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   111
    pageLayout->addLayout(combinedTopLayout);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   112
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   113
    label_description = new QLabel();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   114
    label_description->setText(QLabel::tr("Description"));
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   115
    label_description->setFixedWidth(labelWidth);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   116
    descriptionLayout->addWidget(label_description, 0, Qt::AlignTop);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   117
    description = new QTextBrowser();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   118
    description->setReadOnly(false);
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   119
    descriptionLayout->addWidget(description);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   120
    pageLayout->addLayout(descriptionLayout);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   121
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   122
    return pageLayout;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   123
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   124
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   125
QNetworkAccessManager * PageFeedback::GetNetManager()
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   126
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   127
    if (netManager) return netManager;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   128
    netManager = new QNetworkAccessManager(this);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   129
    connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*)));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   130
    return netManager;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   131
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   132
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   133
void PageFeedback::LoadCaptchaImage()
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   134
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   135
        QNetworkAccessManager *netManager = GetNetManager();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   136
        QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   137
        QNetworkRequest req(captchaURL);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   138
        genCaptchaRequest = netManager->get(req);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   139
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   140
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   141
void PageFeedback::NetReply(QNetworkReply *reply)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   142
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   143
    if (reply == genCaptchaRequest)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   144
    {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   145
        if (reply->error() != QNetworkReply::NoError)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   146
        {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   147
            qDebug() << "Error generating captcha image: " << reply->errorString();
8383
b557c73a7593 GCI2012: Abstract Hedgewars Dialogs
dag10
parents: 8328
diff changeset
   148
            MessageDialog::ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"), this);
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   149
            return;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   150
        }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   151
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   152
        bool okay;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   153
        QByteArray body = reply->readAll();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   154
        captchaID = QString(body).toInt(&okay);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   155
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   156
        if (!okay)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   157
        {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   158
            qDebug() << "Failed to get captcha ID: " << body;
8383
b557c73a7593 GCI2012: Abstract Hedgewars Dialogs
dag10
parents: 8328
diff changeset
   159
            MessageDialog::ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"), this);
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   160
            return;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   161
        }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   162
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   163
        QString url = "http://hedgewars.org/feedback/?captcha&id=";
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   164
        url += QString::number(captchaID);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   165
        
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   166
        QNetworkAccessManager *netManager = GetNetManager();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   167
        QUrl captchaURL(url);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   168
        QNetworkRequest req(captchaURL);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   169
        captchaImageRequest = netManager->get(req);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   170
    }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   171
    else if (reply == captchaImageRequest)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   172
    {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   173
        if (reply->error() != QNetworkReply::NoError)
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   174
        {
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   175
            qDebug() << "Error loading captcha image: " << reply->errorString();
8383
b557c73a7593 GCI2012: Abstract Hedgewars Dialogs
dag10
parents: 8328
diff changeset
   176
            MessageDialog::ShowErrorMessage(QMessageBox::tr("Failed to download captcha"), this);
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   177
            return;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   178
        }
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   179
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   180
        QByteArray imageData = reply->readAll();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   181
        QPixmap pixmap;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   182
        pixmap.loadFromData(imageData);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   183
        label_captcha->setPixmap(pixmap);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   184
        captcha_code->setText("");
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
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   188
QLayout * PageFeedback::footerLayoutDefinition()
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   189
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   190
    QHBoxLayout * bottomLayout = new QHBoxLayout();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   191
    QHBoxLayout * captchaLayout = new QHBoxLayout();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   192
    QVBoxLayout * captchaInputLayout = new QVBoxLayout();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   193
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   194
    label_captcha = new QLabel();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   195
    label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   196
    label_captcha->setText("<div style='width: 200px; height: 100px;'>loading<br>captcha</div>");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   197
    captchaLayout->addWidget(label_captcha);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   198
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   199
    label_captcha_input = new QLabel();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   200
    label_captcha_input->setText(QLabel::tr("Type the security code:"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   201
    captchaInputLayout->addWidget(label_captcha_input);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   202
    captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   203
    captcha_code = new QLineEdit();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   204
    captcha_code->setFixedSize(165, 30);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   205
    captchaInputLayout->addWidget(captcha_code);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   206
    captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   207
    captchaLayout->addLayout(captchaInputLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   208
    captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   209
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   210
    captchaLayout->insertSpacing(-1, 40);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   211
    bottomLayout->addLayout(captchaLayout);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   212
    
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   213
    //TODO: create logo for send button
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   214
    BtnSend = addButton("Send Feedback", bottomLayout, 0, false);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   215
    BtnSend->setFixedSize(120, 40);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   216
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   217
    bottomLayout->setStretchFactor(captchaLayout, 0);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   218
    bottomLayout->setStretchFactor(BtnSend, 1);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   219
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   220
    return bottomLayout;
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   221
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   222
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   223
void PageFeedback::GenerateSpecs()
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   224
{
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   225
    // Gather some information about the system and embed it into the report
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   226
    QDesktopWidget* screen = QApplication::desktop();
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   227
    QString os_version = "Operating system: ";
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   228
    QString qt_version = QString("Qt version: ") + QT_VERSION_STR + QString("\n");
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   229
    QString total_ram = "Total RAM: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   230
    QString number_of_cores = "Number of cores: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   231
    QString compiler_bits = "Compiler architecture: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   232
    QString compiler_version = "Compiler version: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   233
    QString kernel_line = "Kernel: ";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   234
    QString screen_size = "Size of the screen(s): " +
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   235
        QString::number(screen->width()) + "x" + QString::number(screen->height()) + "\n";
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   236
    QString number_of_screens = "Number of screens: " + QString::number(screen->screenCount()) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   237
    std::string processor_name = "Processor: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   238
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   239
    // platform specific code
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   240
#ifdef Q_WS_MACX
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   241
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   242
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   243
    uint64_t memsize;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   244
    size_t len = sizeof(memsize);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   245
    static int mib_s[2] = { CTL_HW, HW_MEMSIZE };
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   246
    if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   247
        total_ram += QString::number(memsize/1024/1024) + " MB\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   248
    else
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   249
        total_ram += "Error getting total RAM information\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   250
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   251
    int mib[] = {CTL_KERN, KERN_OSRELEASE};
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   252
    sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   253
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   254
    char *kernelVersion = (char *)malloc(sizeof(char)*len);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   255
    sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   256
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   257
    QString kernelVersionStr = QString(kernelVersion);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   258
    free(kernelVersion);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   259
    int major_version = kernelVersionStr.split(".").first().toUInt() - 4;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   260
    int minor_version = kernelVersionStr.split(".").at(1).toUInt();
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   261
    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
   262
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   263
    switch(major_version)
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   264
    {
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   265
        case 4:  os_version += "\"Tiger\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   266
        case 5:  os_version += "\"Leopard\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   267
        case 6:  os_version += "\"Snow Leopard\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   268
        case 7:  os_version += "\"Lion\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   269
        case 8:  os_version += "\"Mountain Lion\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   270
        default: os_version += "\"Unknown version\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   271
    }
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   272
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   273
#ifdef Q_WS_WIN
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   274
    SYSTEM_INFO sysinfo;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   275
    GetSystemInfo(&sysinfo);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   276
    number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   277
    MEMORYSTATUSEX status;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   278
    status.dwLength = sizeof(status);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   279
    GlobalMemoryStatusEx(&status);
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   280
    total_ram += QString::number(status.ullTotalPhys);
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   281
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   282
    switch(QSysInfo::WinVersion())
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   283
    {
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   284
        case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   285
        case QSysInfo::WV_XP: os_version += "Windows XP\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   286
        case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   287
        case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   288
        default: os_version += "Windows (Unknown version)\n"; break;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   289
    }
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   290
    kernel_line += "Windows kernel\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   291
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   292
#ifdef Q_WS_X11
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   293
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   294
    long pages = sysconf(_SC_PHYS_PAGES),
8274
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   295
#ifndef Q_OS_FREEBSD
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   296
         available_pages = sysconf(_SC_AVPHYS_PAGES),
8274
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   297
#else
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   298
         available_pages = 0,
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   299
#endif
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   300
         page_size = sysconf(_SC_PAGE_SIZE);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   301
    total_ram += QString::number(pages * page_size) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   302
    os_version += "GNU/Linux or BSD\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   303
#endif
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   304
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   305
    // uname -a
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   306
#if defined(Q_WS_X11) || defined(Q_WS_MACX)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   307
    QProcess *process = new QProcess();
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   308
    QStringList arguments = QStringList("-a");
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   309
    process->start("uname", arguments);
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   310
    if (process->waitForFinished())
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   311
        kernel_line += QString(process->readAll());
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   312
    delete process;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   313
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   314
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   315
    // cpu info
8289
302a2521fe7a uint32_t -> quint32
nemo
parents: 8277
diff changeset
   316
    quint32 registers[4];
302a2521fe7a uint32_t -> quint32
nemo
parents: 8277
diff changeset
   317
    quint32 i;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   318
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   319
    i = 0x80000002;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   320
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   321
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   322
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   323
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   324
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   325
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   326
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   327
    i = 0x80000003;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   328
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   329
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   330
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   331
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   332
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   333
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   334
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   335
    i = 0x80000004;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   336
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   337
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   338
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   339
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   340
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   341
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   342
    processor_name += std::string((const char *)&registers[3], 3);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   343
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   344
    // compiler
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   345
#ifdef __GNUC__
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   346
    compiler_version += "GCC " + QString(__VERSION__) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   347
#else
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   348
    compiler_version += "Unknown\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   349
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   350
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   351
    if(sizeof(void*) == 4)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   352
        compiler_bits += "i386\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   353
    else if(sizeof(void*) == 8)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   354
        compiler_bits += "x86_64\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   355
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   356
    // concat system info
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   357
    specs = qt_version
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   358
        + os_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   359
        + total_ram
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   360
        + screen_size
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   361
        + number_of_screens
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   362
        + QString::fromStdString(processor_name + "\n")
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   363
        + number_of_cores
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   364
        + compiler_version
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   365
        + compiler_bits
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   366
        + kernel_line;
6700
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
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   369
void PageFeedback::connectSignals()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   370
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   371
    //TODO
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   372
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   373
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   374
void PageFeedback::ShowSpecs()
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   375
{
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   376
    QMessageBox msgMsg(this);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   377
    msgMsg.setIcon(QMessageBox::Information);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   378
    msgMsg.setWindowTitle(QMessageBox::tr("System Information Preview"));
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   379
    msgMsg.setText(specs);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   380
    msgMsg.setTextFormat(Qt::PlainText);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   381
    msgMsg.setWindowModality(Qt::WindowModal);
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   382
    msgMsg.setStyleSheet("background: #0A0533;");
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   383
    msgMsg.exec();
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   384
}
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   385
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   386
PageFeedback::PageFeedback(QWidget* parent) : AbstractPage(parent)
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   387
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   388
    initPage();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   389
    netManager = NULL;
8328
03684c667664 GCI2012: Feedback Redo
dag10
parents: 8289
diff changeset
   390
    GenerateSpecs();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   391
}