QTfrontend/ui/page/pagefeedback.cpp
author Drew Gottlieb
Sat, 08 Dec 2012 15:06:30 +0100
changeset 8268 fe4e94311585
parent 8258 c14b27abe452
child 8270 16a52ad5a362
permissions -rw-r--r--
GCI2012: Google Issue Login
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\">"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    62
        "a { color: #ffcc00; }"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    63
        "</style>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    64
        "<div align=\"center\"><h1>Please give us a feedback!</h1>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    65
        "<h3>We are always happy about suggestions, ideas or bug reports.<h3>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    66
        "<h4>The feedback will be posted as a new issue on our Google Code page.<h4>"
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    67
        //"<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
    68
        "</div>"
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    69
    );
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    70
    pageLayout->addWidget(info);
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
    label_summary = new QLabel();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    73
    label_summary->setText(QLabel::tr("Summary"));
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    74
    summaryLayout->addWidget(label_summary);
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    75
    summary = new QLineEdit();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    76
    summaryLayout->addWidget(summary);
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    77
    combinedTopLayout->addLayout(summaryLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    78
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    79
    label_email = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    80
    label_email->setText(QLabel::tr("Your Email"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    81
    emailLayout->addWidget(label_email);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    82
    email = new QLineEdit();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    83
    emailLayout->addWidget(email);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    84
    
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    85
    //  Email -- although implemented -- doesn't seem to work as intended.
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    86
    //  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
    87
    //  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
    88
    //  and the line above in the 'info' QLabel to re-enable this feature.
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    89
    //combinedTopLayout->addLayout(emailLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    90
    //combinedTopLayout->insertSpacing(1, 50);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    91
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    92
    pageLayout->addLayout(combinedTopLayout);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    93
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    94
    label_description = new QLabel();
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    95
    label_description->setText(QLabel::tr("Description"));
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    96
    pageLayout->addWidget(label_description, 0, Qt::AlignHCenter);
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    97
    description = new QTextBrowser();
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
    98
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
    99
    EmbedSystemInfo();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   100
    
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   101
    description->setReadOnly(false);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   102
    pageLayout->addWidget(description);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   103
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   104
    return pageLayout;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   105
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   106
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   107
void PageFeedback::EmbedSystemInfo()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   108
{
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   109
    // Gather some information about the system and embed it into the report
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   110
    QDesktopWidget* screen = QApplication::desktop();
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   111
    QString os_version = "Operating system: ";
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   112
    QString qt_version = QString("Qt version: ") + QT_VERSION_STR + QString("\n");
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   113
    QString total_ram = "Total RAM: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   114
    QString available_ram = "Available RAM: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   115
    QString number_of_cores = "Number of cores: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   116
    QString compiler_bits = "Compiler architecture: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   117
    QString compiler_version = "Compiler version: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   118
    QString kernel_line = "Kernel: ";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   119
    QString screen_size = "Size of the screen(s): " +
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   120
        QString::number(screen->width()) + "x" + QString::number(screen->height()) + "\n";
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   121
    QString number_of_screens = "Number of screens: " + QString::number(screen->screenCount()) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   122
    std::string processor_name = "Processor: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   123
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   124
    // platform specific code
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   125
#ifdef Q_WS_MACX
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   126
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   127
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   128
    uint64_t memsize, memavail;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   129
    size_t len = sizeof(memsize);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   130
    static int mib_s[2] = { CTL_HW, HW_MEMSIZE };
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   131
    static int mib_a[2] = { CTL_HW, HW_USERMEM };
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   132
    if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   133
        total_ram += QString::number(memsize/1024/1024) + " MB\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   134
    else
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   135
        total_ram += "Error getting total RAM information\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   136
    if (sysctl (mib_a, 2, &memavail, &len, NULL, 0) == 0)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   137
        available_ram += QString::number(memavail/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
        available_ram += "Error getting available RAM information\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   140
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   141
        int mib[] = {CTL_KERN, KERN_OSRELEASE};
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);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   170
    total_ram = QString::number(status.ullTotalPhys);
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),
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   185
         available_pages = sysconf(_SC_AVPHYS_PAGES),
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   186
         page_size = sysconf(_SC_PAGE_SIZE);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   187
    total_ram += QString::number(pages * page_size) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   188
    available_ram += QString::number(available_pages * page_size) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   189
    os_version += "GNU/Linux or BSD\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   190
#endif
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   191
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   192
    // uname -a
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   193
#if defined(Q_WS_X11) || defined(Q_WS_MACX)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   194
    QProcess *process = new QProcess();
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   195
    QStringList arguments = QStringList("-a");
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   196
    process->start("uname", arguments);
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   197
    if (process->waitForFinished())
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   198
        kernel_line += QString(process->readAll());
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   199
    delete process;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   200
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   201
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   202
    // cpu info
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   203
    uint32_t registers[4];
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   204
    uint32_t i;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   205
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   206
    i = 0x80000002;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   207
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   208
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   209
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   210
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   211
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   212
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   213
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   214
    i = 0x80000003;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   215
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   216
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   217
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   218
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   219
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   220
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   221
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   222
    i = 0x80000004;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   223
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   224
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   225
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   226
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   227
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   228
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   229
    processor_name += std::string((const char *)&registers[3], 3);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   230
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   231
    // compiler
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   232
#ifdef __GNUC__
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   233
    compiler_version += "GCC " + QString(__VERSION__) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   234
#else
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   235
    compiler_version += "Unknown\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   236
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   237
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   238
    if(sizeof(void*) == 4)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   239
        compiler_bits += "i386\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   240
    else if(sizeof(void*) == 8)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   241
        compiler_bits += "x86_64\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   242
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   243
    // add everything to the field of text
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   244
    description->setText(
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   245
        "\n\n\n\n\n"
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   246
        "System information:\n"
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   247
        + qt_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   248
        + os_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   249
        + total_ram
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   250
        + available_ram
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   251
        + screen_size
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   252
        + number_of_screens
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   253
        + QString::fromStdString(processor_name + "\n")
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   254
        + number_of_cores
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   255
        + compiler_version
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   256
        + compiler_bits
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   257
        + kernel_line
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   258
    );
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   259
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   260
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   261
QNetworkAccessManager * PageFeedback::GetNetManager()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   262
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   263
    if (netManager) return netManager;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   264
    netManager = new QNetworkAccessManager(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   265
    connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*)));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   266
    return netManager;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   267
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   269
void PageFeedback::LoadCaptchaImage()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   270
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   271
        QNetworkAccessManager *netManager = GetNetManager();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   272
        QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   273
        QNetworkRequest req(captchaURL);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   274
        genCaptchaRequest = netManager->get(req);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   275
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   276
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   277
void PageFeedback::NetReply(QNetworkReply *reply)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   278
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   279
    if (reply == genCaptchaRequest)
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->error() != QNetworkReply::NoError)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   282
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   283
            qDebug() << "Error generating captcha image: " << reply->errorString();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   284
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   285
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   286
        }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   287
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   288
        bool okay;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   289
        QByteArray body = reply->readAll();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   290
        captchaID = QString(body).toInt(&okay);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   291
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   292
        if (!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
            qDebug() << "Failed to get captcha ID: " << body;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   295
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   296
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   297
        }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   298
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   299
        QString url = "http://hedgewars.org/feedback/?captcha&id=";
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   300
        url += QString::number(captchaID);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   301
        
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   302
        QNetworkAccessManager *netManager = GetNetManager();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   303
        QUrl captchaURL(url);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   304
        QNetworkRequest req(captchaURL);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   305
        captchaImageRequest = netManager->get(req);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   306
    }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   307
    else if (reply == captchaImageRequest)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   308
    {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   309
        if (reply->error() != QNetworkReply::NoError)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   310
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   311
            qDebug() << "Error loading captcha image: " << reply->errorString();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   312
            ShowErrorMessage(QMessageBox::tr("Failed to download captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   313
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   314
        }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   315
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   316
        QByteArray imageData = reply->readAll();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   317
        QPixmap pixmap;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   318
        pixmap.loadFromData(imageData);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   319
        label_captcha->setPixmap(pixmap);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   320
        captcha_code->setText("");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   321
    }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   322
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   323
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   324
QLayout * PageFeedback::footerLayoutDefinition()
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
    QHBoxLayout * bottomLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   327
    QHBoxLayout * captchaLayout = new QHBoxLayout();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   328
    QVBoxLayout * captchaInputLayout = new QVBoxLayout();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   329
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   330
    label_captcha = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   331
    label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   332
    label_captcha->setText("<div style='width: 200px; height: 100px;'>loading<br>captcha</div>");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   333
    captchaLayout->addWidget(label_captcha);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   334
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   335
    label_captcha_input = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   336
    label_captcha_input->setText(QLabel::tr("Type the security code:"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   337
    captchaInputLayout->addWidget(label_captcha_input);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   338
    captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   339
    captcha_code = new QLineEdit();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   340
    captcha_code->setFixedSize(165, 30);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   341
    captchaInputLayout->addWidget(captcha_code);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   342
    captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   343
    captchaLayout->addLayout(captchaInputLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   344
    captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   345
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   346
    captchaLayout->insertSpacing(-1, 40);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   347
    bottomLayout->addLayout(captchaLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   348
    
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   349
    //TODO: create logo for send button
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   350
    BtnSend = addButton("Send Feedback", bottomLayout, 0, false);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   351
    BtnSend->setFixedSize(120, 40);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   352
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   353
    bottomLayout->setStretchFactor(captchaLayout, 0);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   354
    bottomLayout->setStretchFactor(BtnSend, 1);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   355
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   356
    return bottomLayout;
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
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   359
void PageFeedback::connectSignals()
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
    //TODO
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
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   364
void PageFeedback::ShowErrorMessage(const QString & msg)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   365
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   366
    QMessageBox msgMsg(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   367
    msgMsg.setIcon(QMessageBox::Warning);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   368
    msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   369
    msgMsg.setText(msg);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   370
    msgMsg.setWindowModality(Qt::WindowModal);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   371
    msgMsg.exec();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   372
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   373
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   374
PageFeedback::PageFeedback(QWidget* parent) : AbstractPage(parent)
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   375
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   376
    initPage();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   377
    netManager = NULL;
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   378
}