QTfrontend/ui/page/pagefeedback.cpp
author Drew Gottlieb
Sat, 08 Dec 2012 20:49:43 -0500
changeset 8277 cd2bae15a9a3
parent 8274 7324298dbcc1
child 8289 302a2521fe7a
permissions -rw-r--r--
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.
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>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    32
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    33
#include <string>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    34
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    35
#ifdef Q_WS_WIN
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    36
#define WINVER 0x0500
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    37
#include <windows.h>
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    38
#else
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    39
#include <unistd.h>
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    40
#include <sys/types.h>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    41
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    42
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    43
#ifdef Q_WS_MAC
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    44
#include <sys/sysctl.h>
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    45
#endif
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    46
8258
c14b27abe452 fix build on linux for me ( the uint32_t releated breakage )
sheepluva
parents: 8252
diff changeset
    47
#include <stdint.h>
c14b27abe452 fix build on linux for me ( the uint32_t releated breakage )
sheepluva
parents: 8252
diff changeset
    48
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    49
#include "pagefeedback.h"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    50
#include "hwconsts.h"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    51
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    52
QLayout * PageFeedback::bodyLayoutDefinition()
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
    QVBoxLayout * pageLayout = new QVBoxLayout();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    55
    QHBoxLayout * summaryLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    56
    QHBoxLayout * emailLayout = new QHBoxLayout();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    57
    QHBoxLayout * combinedTopLayout = new QHBoxLayout();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    58
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    59
    info = new QLabel();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    60
    info->setText(
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    61
        "<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
    62
        "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
    63
        "b { color: #0df; }"
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    64
        "</style>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    65
        "<div align=\"center\"><h1>Please give us a feedback!</h1>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    66
        "<h3>We are always happy about suggestions, ideas or bug reports.<h3>"
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
    67
        "<h4>The feedback will be posted as a new issue on our Google Code page.<br />"
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
    68
        "<b>Don't forget to mention your email or you won't be able to receive updates on this topic!</b><br /></h4>"
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    69
        //"<h4>Your email is optional, but if given, you will be notified of responses.<h4>"
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    70
        "</div>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    71
    );
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    72
    pageLayout->addWidget(info);
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
    label_summary = new QLabel();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    75
    label_summary->setText(QLabel::tr("Summary"));
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    76
    summaryLayout->addWidget(label_summary);
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    77
    summary = new QLineEdit();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    78
    summaryLayout->addWidget(summary);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    79
    combinedTopLayout->addLayout(summaryLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    80
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    81
    label_email = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    82
    label_email->setText(QLabel::tr("Your Email"));
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);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    86
    
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    87
    //  Email -- although implemented -- doesn't seem to work as intended.
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    88
    //  It's sent in the XML as a <issues:cc> , the <entry>, but it doesn't seem
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    89
    //  to actually do anything. If you figure out how to fix that, uncomment these lines
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    90
    //  and the line above in the 'info' QLabel to re-enable this feature.
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
    91
    //  UPDATE: I found out that CC only works if that email is a member of the
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
    92
    //  Google Code project. So this feature is pretty much useless atm.
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
    93
    /*
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
    94
    combinedTopLayout->addLayout(emailLayout);
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
    95
    combinedTopLayout->insertSpacing(1, 50);
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
    96
    */
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    97
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    98
    pageLayout->addLayout(combinedTopLayout);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    99
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   100
    label_description = new QLabel();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   101
    label_description->setText(QLabel::tr("Description"));
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   102
    pageLayout->addWidget(label_description, 0, Qt::AlignHCenter);
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   103
    description = new QTextBrowser();
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   104
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   105
    EmbedSystemInfo();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   106
    
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   107
    description->setReadOnly(false);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   108
    pageLayout->addWidget(description);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   109
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   110
    return pageLayout;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   111
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   112
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   113
void PageFeedback::EmbedSystemInfo()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   114
{
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   115
    // Gather some information about the system and embed it into the report
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   116
    QDesktopWidget* screen = QApplication::desktop();
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   117
    QString os_version = "Operating system: ";
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   118
    QString qt_version = QString("Qt version: ") + QT_VERSION_STR + QString("\n");
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   119
    QString total_ram = "Total RAM: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   120
    QString number_of_cores = "Number of cores: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   121
    QString compiler_bits = "Compiler architecture: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   122
    QString compiler_version = "Compiler version: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   123
    QString kernel_line = "Kernel: ";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   124
    QString screen_size = "Size of the screen(s): " +
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   125
        QString::number(screen->width()) + "x" + QString::number(screen->height()) + "\n";
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   126
    QString number_of_screens = "Number of screens: " + QString::number(screen->screenCount()) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   127
    std::string processor_name = "Processor: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   128
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   129
    // platform specific code
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   130
#ifdef Q_WS_MACX
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   131
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   132
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   133
    uint64_t memsize;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   134
    size_t len = sizeof(memsize);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   135
    static int mib_s[2] = { CTL_HW, HW_MEMSIZE };
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   136
    if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   137
        total_ram += QString::number(memsize/1024/1024) + " MB\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   138
    else
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   139
        total_ram += "Error getting total RAM information\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   140
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   141
    int mib[] = {CTL_KERN, KERN_OSRELEASE};
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   142
    sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   143
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   144
    char *kernelVersion = (char *)malloc(sizeof(char)*len);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   145
    sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   146
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   147
    QString kernelVersionStr = QString(kernelVersion);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   148
    free(kernelVersion);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   149
    int major_version = kernelVersionStr.split(".").first().toUInt() - 4;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   150
    int minor_version = kernelVersionStr.split(".").at(1).toUInt();
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   151
    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
   152
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   153
    switch(major_version)
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   154
    {
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   155
        case 4:  os_version += "\"Tiger\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   156
        case 5:  os_version += "\"Leopard\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   157
        case 6:  os_version += "\"Snow Leopard\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   158
        case 7:  os_version += "\"Lion\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   159
        case 8:  os_version += "\"Mountain Lion\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   160
        default: os_version += "\"Unknown version\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   161
    }
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   162
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   163
#ifdef Q_WS_WIN
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   164
    SYSTEM_INFO sysinfo;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   165
    GetSystemInfo(&sysinfo);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   166
    number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   167
    MEMORYSTATUSEX status;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   168
    status.dwLength = sizeof(status);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   169
    GlobalMemoryStatusEx(&status);
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   170
    total_ram += QString::number(status.ullTotalPhys);
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   171
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   172
    switch(QSysInfo::WinVersion())
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   173
    {
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   174
        case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   175
        case QSysInfo::WV_XP: os_version += "Windows XP\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   176
        case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   177
        case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   178
        default: os_version += "Windows (Unknown version)\n"; break;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   179
    }
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   180
    kernel_line += "Windows kernel\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   181
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   182
#ifdef Q_WS_X11
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   183
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   184
    long pages = sysconf(_SC_PHYS_PAGES),
8274
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   185
#ifndef Q_OS_FREEBSD
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   186
         available_pages = sysconf(_SC_AVPHYS_PAGES),
8274
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   187
#else
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   188
         available_pages = 0,
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   189
#endif
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   190
         page_size = sysconf(_SC_PAGE_SIZE);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   191
    total_ram += QString::number(pages * page_size) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   192
    os_version += "GNU/Linux or BSD\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   193
#endif
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   194
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   195
    // uname -a
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   196
#if defined(Q_WS_X11) || defined(Q_WS_MACX)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   197
    QProcess *process = new QProcess();
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   198
    QStringList arguments = QStringList("-a");
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   199
    process->start("uname", arguments);
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   200
    if (process->waitForFinished())
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   201
        kernel_line += QString(process->readAll());
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   202
    delete process;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   203
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   204
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   205
    // cpu info
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   206
    uint32_t registers[4];
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   207
    uint32_t i;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   208
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   209
    i = 0x80000002;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   210
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   211
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   212
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   213
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   214
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   215
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   216
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   217
    i = 0x80000003;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   218
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   219
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   220
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   221
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   222
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   223
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   224
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   225
    i = 0x80000004;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   226
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   227
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   228
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   229
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   230
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   231
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   232
    processor_name += std::string((const char *)&registers[3], 3);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   233
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   234
    // compiler
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   235
#ifdef __GNUC__
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   236
    compiler_version += "GCC " + QString(__VERSION__) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   237
#else
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   238
    compiler_version += "Unknown\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   239
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   240
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   241
    if(sizeof(void*) == 4)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   242
        compiler_bits += "i386\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   243
    else if(sizeof(void*) == 8)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   244
        compiler_bits += "x86_64\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   245
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   246
    // add everything to the field of text
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   247
    description->setText(
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   248
        "\n\n\n\n\n"
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   249
        "System information:\n"
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   250
        + qt_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   251
        + os_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   252
        + total_ram
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   253
        + screen_size
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   254
        + number_of_screens
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   255
        + QString::fromStdString(processor_name + "\n")
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   256
        + number_of_cores
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   257
        + compiler_version
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   258
        + compiler_bits
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   259
        + kernel_line
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   260
    );
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   261
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   262
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   263
QNetworkAccessManager * PageFeedback::GetNetManager()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   264
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   265
    if (netManager) return netManager;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   266
    netManager = new QNetworkAccessManager(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   267
    connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*)));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   268
    return netManager;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   269
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   270
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   271
void PageFeedback::LoadCaptchaImage()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   272
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   273
        QNetworkAccessManager *netManager = GetNetManager();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   274
        QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   275
        QNetworkRequest req(captchaURL);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   276
        genCaptchaRequest = netManager->get(req);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   277
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   278
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   279
void PageFeedback::NetReply(QNetworkReply *reply)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   280
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   281
    if (reply == genCaptchaRequest)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   282
    {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   283
        if (reply->error() != QNetworkReply::NoError)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   284
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   285
            qDebug() << "Error generating captcha image: " << reply->errorString();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   286
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   287
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   288
        }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   289
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   290
        bool okay;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   291
        QByteArray body = reply->readAll();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   292
        captchaID = QString(body).toInt(&okay);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   293
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   294
        if (!okay)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   295
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   296
            qDebug() << "Failed to get captcha ID: " << body;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   297
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   298
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   299
        }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   300
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   301
        QString url = "http://hedgewars.org/feedback/?captcha&id=";
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   302
        url += QString::number(captchaID);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   303
        
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   304
        QNetworkAccessManager *netManager = GetNetManager();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   305
        QUrl captchaURL(url);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   306
        QNetworkRequest req(captchaURL);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   307
        captchaImageRequest = netManager->get(req);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   308
    }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   309
    else if (reply == captchaImageRequest)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   310
    {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   311
        if (reply->error() != QNetworkReply::NoError)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   312
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   313
            qDebug() << "Error loading captcha image: " << reply->errorString();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   314
            ShowErrorMessage(QMessageBox::tr("Failed to download captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   315
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   316
        }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   317
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   318
        QByteArray imageData = reply->readAll();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   319
        QPixmap pixmap;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   320
        pixmap.loadFromData(imageData);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   321
        label_captcha->setPixmap(pixmap);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   322
        captcha_code->setText("");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   323
    }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   324
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   325
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   326
QLayout * PageFeedback::footerLayoutDefinition()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   327
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   328
    QHBoxLayout * bottomLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   329
    QHBoxLayout * captchaLayout = new QHBoxLayout();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   330
    QVBoxLayout * captchaInputLayout = new QVBoxLayout();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   331
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   332
    label_captcha = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   333
    label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   334
    label_captcha->setText("<div style='width: 200px; height: 100px;'>loading<br>captcha</div>");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   335
    captchaLayout->addWidget(label_captcha);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   336
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   337
    label_captcha_input = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   338
    label_captcha_input->setText(QLabel::tr("Type the security code:"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   339
    captchaInputLayout->addWidget(label_captcha_input);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   340
    captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   341
    captcha_code = new QLineEdit();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   342
    captcha_code->setFixedSize(165, 30);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   343
    captchaInputLayout->addWidget(captcha_code);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   344
    captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   345
    captchaLayout->addLayout(captchaInputLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   346
    captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   347
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   348
    captchaLayout->insertSpacing(-1, 40);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   349
    bottomLayout->addLayout(captchaLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   350
    
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   351
    //TODO: create logo for send button
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   352
    BtnSend = addButton("Send Feedback", bottomLayout, 0, false);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   353
    BtnSend->setFixedSize(120, 40);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   354
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   355
    bottomLayout->setStretchFactor(captchaLayout, 0);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   356
    bottomLayout->setStretchFactor(BtnSend, 1);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   357
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   358
    return bottomLayout;
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   359
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   360
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   361
void PageFeedback::connectSignals()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   362
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   363
    //TODO
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   364
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   365
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   366
void PageFeedback::ShowErrorMessage(const QString & msg)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   367
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   368
    QMessageBox msgMsg(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   369
    msgMsg.setIcon(QMessageBox::Warning);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   370
    msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   371
    msgMsg.setText(msg);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   372
    msgMsg.setWindowModality(Qt::WindowModal);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   373
    msgMsg.exec();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   374
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   375
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   376
PageFeedback::PageFeedback(QWidget* parent) : AbstractPage(parent)
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   377
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   378
    initPage();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   379
    netManager = NULL;
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   380
}