QTfrontend/ui/page/pagefeedback.cpp
author koda
Sat, 08 Dec 2012 15:35:03 +0100
changeset 8270 16a52ad5a362
parent 8268 fe4e94311585
child 8274 7324298dbcc1
permissions -rw-r--r--
strip available ram entry, add notice for entering email
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),
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   179
         available_pages = sysconf(_SC_AVPHYS_PAGES),
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   180
         page_size = sysconf(_SC_PAGE_SIZE);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   181
    total_ram += QString::number(pages * page_size) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   182
    os_version += "GNU/Linux or BSD\n";
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   183
#endif
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   184
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   185
    // uname -a
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   186
#if defined(Q_WS_X11) || defined(Q_WS_MACX)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   187
    QProcess *process = new QProcess();
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   188
    QStringList arguments = QStringList("-a");
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   189
    process->start("uname", arguments);
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   190
    if (process->waitForFinished())
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   191
        kernel_line += QString(process->readAll());
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   192
    delete process;
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   193
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   194
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   195
    // cpu info
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   196
    uint32_t registers[4];
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   197
    uint32_t i;
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   198
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   199
    i = 0x80000002;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   200
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   201
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   202
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   203
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   204
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   205
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   206
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   207
    i = 0x80000003;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   208
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   209
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   210
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   211
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   212
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   213
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   214
    processor_name += std::string((const char *)&registers[3], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   215
    i = 0x80000004;
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   216
    asm volatile
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   217
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   218
       : "a" (i), "c" (0));
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   219
    processor_name += std::string((const char *)&registers[0], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   220
    processor_name += std::string((const char *)&registers[1], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   221
    processor_name += std::string((const char *)&registers[2], 4);
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   222
    processor_name += std::string((const char *)&registers[3], 3);
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   223
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   224
    // compiler
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   225
#ifdef __GNUC__
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   226
    compiler_version += "GCC " + QString(__VERSION__) + "\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   227
#else
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   228
    compiler_version += "Unknown\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   229
#endif
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   230
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   231
    if(sizeof(void*) == 4)
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   232
        compiler_bits += "i386\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   233
    else if(sizeof(void*) == 8)
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   234
        compiler_bits += "x86_64\n";
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   235
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   236
    // add everything to the field of text
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   237
    description->setText(
8270
16a52ad5a362 strip available ram entry, add notice for entering email
koda
parents: 8268
diff changeset
   238
        "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
   239
        "\n\n\n\n\n"
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   240
        "System information:\n"
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   241
        + qt_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   242
        + os_version
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   243
        + total_ram
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   244
        + screen_size
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   245
        + number_of_screens
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   246
        + QString::fromStdString(processor_name + "\n")
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   247
        + number_of_cores
8252
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   248
        + compiler_version
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   249
        + compiler_bits
db3bccd784c9 tinker around the info delivery...
koda
parents: 8250
diff changeset
   250
        + kernel_line
8250
ebaec8186e4a GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   251
    );
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   252
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   253
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   254
QNetworkAccessManager * PageFeedback::GetNetManager()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   255
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   256
    if (netManager) return netManager;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   257
    netManager = new QNetworkAccessManager(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   258
    connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*)));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   259
    return netManager;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   260
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   261
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   262
void PageFeedback::LoadCaptchaImage()
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   263
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   264
        QNetworkAccessManager *netManager = GetNetManager();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   265
        QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   266
        QNetworkRequest req(captchaURL);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   267
        genCaptchaRequest = netManager->get(req);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   268
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   269
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   270
void PageFeedback::NetReply(QNetworkReply *reply)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   271
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   272
    if (reply == genCaptchaRequest)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   273
    {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   274
        if (reply->error() != QNetworkReply::NoError)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   275
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   276
            qDebug() << "Error generating captcha image: " << reply->errorString();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   277
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   278
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   279
        }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   280
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   281
        bool okay;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   282
        QByteArray body = reply->readAll();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   283
        captchaID = QString(body).toInt(&okay);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   284
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   285
        if (!okay)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   286
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   287
            qDebug() << "Failed to get captcha ID: " << body;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   288
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   289
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   290
        }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   291
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   292
        QString url = "http://hedgewars.org/feedback/?captcha&id=";
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   293
        url += QString::number(captchaID);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   294
        
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   295
        QNetworkAccessManager *netManager = GetNetManager();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   296
        QUrl captchaURL(url);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   297
        QNetworkRequest req(captchaURL);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   298
        captchaImageRequest = netManager->get(req);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   299
    }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   300
    else if (reply == captchaImageRequest)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   301
    {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   302
        if (reply->error() != QNetworkReply::NoError)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   303
        {
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   304
            qDebug() << "Error loading captcha image: " << reply->errorString();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   305
            ShowErrorMessage(QMessageBox::tr("Failed to download captcha"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   306
            return;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   307
        }
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   308
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   309
        QByteArray imageData = reply->readAll();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   310
        QPixmap pixmap;
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   311
        pixmap.loadFromData(imageData);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   312
        label_captcha->setPixmap(pixmap);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   313
        captcha_code->setText("");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   314
    }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   315
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   316
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   317
QLayout * PageFeedback::footerLayoutDefinition()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   318
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   319
    QHBoxLayout * bottomLayout = new QHBoxLayout();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   320
    QHBoxLayout * captchaLayout = new QHBoxLayout();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   321
    QVBoxLayout * captchaInputLayout = new QVBoxLayout();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   322
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   323
    label_captcha = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   324
    label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   325
    label_captcha->setText("<div style='width: 200px; height: 100px;'>loading<br>captcha</div>");
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   326
    captchaLayout->addWidget(label_captcha);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   327
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   328
    label_captcha_input = new QLabel();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   329
    label_captcha_input->setText(QLabel::tr("Type the security code:"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   330
    captchaInputLayout->addWidget(label_captcha_input);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   331
    captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   332
    captcha_code = new QLineEdit();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   333
    captcha_code->setFixedSize(165, 30);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   334
    captchaInputLayout->addWidget(captcha_code);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   335
    captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   336
    captchaLayout->addLayout(captchaInputLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   337
    captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   338
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   339
    captchaLayout->insertSpacing(-1, 40);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   340
    bottomLayout->addLayout(captchaLayout);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   341
    
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   342
    //TODO: create logo for send button
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   343
    BtnSend = addButton("Send Feedback", bottomLayout, 0, false);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   344
    BtnSend->setFixedSize(120, 40);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   345
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   346
    bottomLayout->setStretchFactor(captchaLayout, 0);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   347
    bottomLayout->setStretchFactor(BtnSend, 1);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   348
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   349
    return bottomLayout;
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   350
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   351
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   352
void PageFeedback::connectSignals()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   353
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   354
    //TODO
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
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   357
void PageFeedback::ShowErrorMessage(const QString & msg)
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   358
{
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   359
    QMessageBox msgMsg(this);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   360
    msgMsg.setIcon(QMessageBox::Warning);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   361
    msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error"));
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   362
    msgMsg.setText(msg);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   363
    msgMsg.setWindowModality(Qt::WindowModal);
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   364
    msgMsg.exec();
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   365
}
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   366
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   367
PageFeedback::PageFeedback(QWidget* parent) : AbstractPage(parent)
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   368
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   369
    initPage();
8268
fe4e94311585 GCI2012: Google Issue Login
Drew Gottlieb
parents: 8258
diff changeset
   370
    netManager = NULL;
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   371
}