QTfrontend/ui/page/pagefeedback.cpp
author unc0rr
Sat, 08 Dec 2012 20:23:13 +0400
changeset 8274 7324298dbcc1
parent 8270 16a52ad5a362
child 8277 cd2bae15a9a3
permissions -rw-r--r--
Unbreak build
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.
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
    89
    combinedTopLayout->addLayout(emailLayout);
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
    90
    combinedTopLayout->insertSpacing(1, 50);
8268
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 number_of_cores = "Number of cores: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   115
    QString compiler_bits = "Compiler architecture: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   116
    QString compiler_version = "Compiler version: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   117
    QString kernel_line = "Kernel: ";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   118
    QString screen_size = "Size of the screen(s): " +
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   119
        QString::number(screen->width()) + "x" + QString::number(screen->height()) + "\n";
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   120
    QString number_of_screens = "Number of screens: " + QString::number(screen->screenCount()) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   121
    std::string processor_name = "Processor: ";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   122
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   123
    // platform specific code
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   124
#ifdef Q_WS_MACX
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   125
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   126
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   127
    uint64_t memsize;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   128
    size_t len = sizeof(memsize);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   129
    static int mib_s[2] = { CTL_HW, HW_MEMSIZE };
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   130
    if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   131
        total_ram += QString::number(memsize/1024/1024) + " MB\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   132
    else
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   133
        total_ram += "Error getting total RAM information\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   134
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   135
    int mib[] = {CTL_KERN, KERN_OSRELEASE};
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   136
    sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   137
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   138
    char *kernelVersion = (char *)malloc(sizeof(char)*len);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   139
    sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   140
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   141
    QString kernelVersionStr = QString(kernelVersion);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   142
    free(kernelVersion);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   143
    int major_version = kernelVersionStr.split(".").first().toUInt() - 4;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   144
    int minor_version = kernelVersionStr.split(".").at(1).toUInt();
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   145
    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
   146
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   147
    switch(major_version)
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   148
    {
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   149
        case 4:  os_version += "\"Tiger\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   150
        case 5:  os_version += "\"Leopard\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   151
        case 6:  os_version += "\"Snow Leopard\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   152
        case 7:  os_version += "\"Lion\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   153
        case 8:  os_version += "\"Mountain Lion\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   154
        default: os_version += "\"Unknown version\"\n"; break;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   155
    }
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   156
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   157
#ifdef Q_WS_WIN
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   158
    SYSTEM_INFO sysinfo;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   159
    GetSystemInfo(&sysinfo);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   160
    number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   161
    MEMORYSTATUSEX status;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   162
    status.dwLength = sizeof(status);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   163
    GlobalMemoryStatusEx(&status);
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   164
    total_ram += QString::number(status.ullTotalPhys);
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   165
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   166
    switch(QSysInfo::WinVersion())
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   167
    {
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   168
        case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   169
        case QSysInfo::WV_XP: os_version += "Windows XP\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   170
        case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   171
        case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   172
        default: os_version += "Windows (Unknown version)\n"; break;
8250
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
    kernel_line += "Windows kernel\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   175
#endif
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   176
#ifdef Q_WS_X11
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   177
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   178
    long pages = sysconf(_SC_PHYS_PAGES),
8274
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   179
#ifndef Q_OS_FREEBSD
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   180
         available_pages = sysconf(_SC_AVPHYS_PAGES),
8274
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   181
#else
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   182
         available_pages = 0,
7324298dbcc1 Unbreak build
unc0rr
parents: 8270
diff changeset
   183
#endif
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   184
         page_size = sysconf(_SC_PAGE_SIZE);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   185
    total_ram += QString::number(pages * page_size) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   186
    os_version += "GNU/Linux or BSD\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   187
#endif
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   188
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   189
    // uname -a
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   190
#if defined(Q_WS_X11) || defined(Q_WS_MACX)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   191
    QProcess *process = new QProcess();
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   192
    QStringList arguments = QStringList("-a");
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   193
    process->start("uname", arguments);
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   194
    if (process->waitForFinished())
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   195
        kernel_line += QString(process->readAll());
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   196
    delete process;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   197
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   198
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   199
    // cpu info
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   200
    uint32_t registers[4];
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   201
    uint32_t i;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   202
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   203
    i = 0x80000002;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   204
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   205
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   206
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   207
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   208
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   209
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   210
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   211
    i = 0x80000003;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   212
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   213
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   214
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   215
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   216
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   217
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   218
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   219
    i = 0x80000004;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   220
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   221
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   222
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   223
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   224
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   225
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   226
    processor_name += std::string((const char *)&registers[3], 3);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   227
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   228
    // compiler
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   229
#ifdef __GNUC__
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   230
    compiler_version += "GCC " + QString(__VERSION__) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   231
#else
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   232
    compiler_version += "Unknown\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   233
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   234
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   235
    if(sizeof(void*) == 4)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   236
        compiler_bits += "i386\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   237
    else if(sizeof(void*) == 8)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   238
        compiler_bits += "x86_64\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   239
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   240
    // add everything to the field of text
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   241
    description->setText(
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   242
        "Don't forget to mention your email or you won't be able to receive updates on this topic!"
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   243
        "\n\n\n\n\n"
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   244
        "System information:\n"
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   245
        + qt_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   246
        + os_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   247
        + total_ram
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   248
        + screen_size
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   249
        + number_of_screens
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   250
        + QString::fromStdString(processor_name + "\n")
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   251
        + number_of_cores
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   252
        + compiler_version
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   253
        + compiler_bits
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   254
        + kernel_line
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   255
    );
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   256
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   257
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   258
QNetworkAccessManager * PageFeedback::GetNetManager()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   259
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   260
    if (netManager) return netManager;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   261
    netManager = new QNetworkAccessManager(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   262
    connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*)));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   263
    return netManager;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   264
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   265
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   266
void PageFeedback::LoadCaptchaImage()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   267
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   268
        QNetworkAccessManager *netManager = GetNetManager();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   269
        QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   270
        QNetworkRequest req(captchaURL);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   271
        genCaptchaRequest = netManager->get(req);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   272
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   273
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   274
void PageFeedback::NetReply(QNetworkReply *reply)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   275
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   276
    if (reply == genCaptchaRequest)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   277
    {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   278
        if (reply->error() != QNetworkReply::NoError)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   279
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   280
            qDebug() << "Error generating captcha image: " << reply->errorString();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   281
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   282
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   283
        }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   284
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   285
        bool okay;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   286
        QByteArray body = reply->readAll();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   287
        captchaID = QString(body).toInt(&okay);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   288
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   289
        if (!okay)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   290
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   291
            qDebug() << "Failed to get captcha ID: " << body;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   292
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   293
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   294
        }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   295
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   296
        QString url = "http://hedgewars.org/feedback/?captcha&id=";
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   297
        url += QString::number(captchaID);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   298
        
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   299
        QNetworkAccessManager *netManager = GetNetManager();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   300
        QUrl captchaURL(url);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   301
        QNetworkRequest req(captchaURL);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   302
        captchaImageRequest = netManager->get(req);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   303
    }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   304
    else if (reply == captchaImageRequest)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   305
    {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   306
        if (reply->error() != QNetworkReply::NoError)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   307
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   308
            qDebug() << "Error loading captcha image: " << reply->errorString();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   309
            ShowErrorMessage(QMessageBox::tr("Failed to download captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   310
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   311
        }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   312
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   313
        QByteArray imageData = reply->readAll();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   314
        QPixmap pixmap;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   315
        pixmap.loadFromData(imageData);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   316
        label_captcha->setPixmap(pixmap);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   317
        captcha_code->setText("");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   318
    }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   319
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   320
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   321
QLayout * PageFeedback::footerLayoutDefinition()
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
    QHBoxLayout * bottomLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   324
    QHBoxLayout * captchaLayout = new QHBoxLayout();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   325
    QVBoxLayout * captchaInputLayout = new QVBoxLayout();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   326
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   327
    label_captcha = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   328
    label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   329
    label_captcha->setText("<div style='width: 200px; height: 100px;'>loading<br>captcha</div>");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   330
    captchaLayout->addWidget(label_captcha);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   331
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   332
    label_captcha_input = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   333
    label_captcha_input->setText(QLabel::tr("Type the security code:"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   334
    captchaInputLayout->addWidget(label_captcha_input);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   335
    captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   336
    captcha_code = new QLineEdit();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   337
    captcha_code->setFixedSize(165, 30);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   338
    captchaInputLayout->addWidget(captcha_code);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   339
    captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   340
    captchaLayout->addLayout(captchaInputLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   341
    captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   342
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   343
    captchaLayout->insertSpacing(-1, 40);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   344
    bottomLayout->addLayout(captchaLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   345
    
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   346
    //TODO: create logo for send button
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   347
    BtnSend = addButton("Send Feedback", bottomLayout, 0, false);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   348
    BtnSend->setFixedSize(120, 40);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   349
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   350
    bottomLayout->setStretchFactor(captchaLayout, 0);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   351
    bottomLayout->setStretchFactor(BtnSend, 1);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   352
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   353
    return bottomLayout;
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   354
}
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
void PageFeedback::connectSignals()
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
    //TODO
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
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   361
void PageFeedback::ShowErrorMessage(const QString & msg)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   362
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   363
    QMessageBox msgMsg(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   364
    msgMsg.setIcon(QMessageBox::Warning);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   365
    msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   366
    msgMsg.setText(msg);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   367
    msgMsg.setWindowModality(Qt::WindowModal);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   368
    msgMsg.exec();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   369
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   370
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   371
PageFeedback::PageFeedback(QWidget* parent) : AbstractPage(parent)
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   372
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   373
    initPage();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   374
    netManager = NULL;
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   375
}