QTfrontend/ui/page/pagefeedback.cpp
author Drew Gottlieb
Sat, 08 Dec 2012 15:06:30 +0100
branchflibqtfrontend
changeset 8269 c71721d371dc
parent 8259 02e32be01232
child 8270 16a52ad5a362
permissions -rw-r--r--
GCI2012: Google Issue Login
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     1
/*
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6700
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     4
 *
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     8
 *
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    12
 * GNU General Public License for more details.
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    13
 *
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    15
 * along with this program; if not, write to the Free Software
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    17
 */
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    18
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    19
#include <QHBoxLayout>
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    20
#include <QLineEdit>
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    21
#include <QTextBrowser>
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
    22
#include <QLabel>
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    23
#include <QHttp>
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    24
#include <QSysInfo>
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    25
#include <QDebug>
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    26
#include <QBuffer>
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    27
#include <QApplication>
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    28
#include <QDesktopWidget>
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    29
#include <QNetworkReply>
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
    30
#include <QProcess>
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    31
#include <QMessageBox>
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    32
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
    33
#include <string>
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    34
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    35
#ifdef Q_WS_WIN
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    36
#define WINVER 0x0500
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    37
#include <windows.h>
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
    38
#else
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
    39
#include <unistd.h>
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
    40
#include <sys/types.h>
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    41
#endif
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    42
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
    43
#ifdef Q_WS_MAC
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
    44
#include <sys/sysctl.h>
8253
14c046a81e2b 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
8259
02e32be01232 fix build on linux for me ( the uint32_t releated breakage )
sheepluva
parents: 8255
diff changeset
    47
#include <stdint.h>
02e32be01232 fix build on linux for me ( the uint32_t releated breakage )
sheepluva
parents: 8255
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();
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    56
    QHBoxLayout * emailLayout = new QHBoxLayout();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
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>"
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
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();
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
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);
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    77
    combinedTopLayout->addLayout(summaryLayout);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    78
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    79
    label_email = new QLabel();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    80
    label_email->setText(QLabel::tr("Your Email"));
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    81
    emailLayout->addWidget(label_email);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    82
    email = new QLineEdit();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    83
    emailLayout->addWidget(email);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    84
    
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    85
    //  Email -- although implemented -- doesn't seem to work as intended.
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    86
    //  It's sent in the XML as a <issues:cc> , the <entry>, but it doesn't seem
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    87
    //  to actually do anything. If you figure out how to fix that, uncomment these lines
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    88
    //  and the line above in the 'info' QLabel to re-enable this feature.
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    89
    //combinedTopLayout->addLayout(emailLayout);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    90
    //combinedTopLayout->insertSpacing(1, 50);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    91
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
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();
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
    98
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
    99
    EmbedSystemInfo();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   100
    
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   101
    description->setReadOnly(false);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   102
    pageLayout->addWidget(description);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   103
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   104
    return pageLayout;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   105
}
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   106
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   107
void PageFeedback::EmbedSystemInfo()
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   108
{
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   109
    // Gather some information about the system and embed it into the report
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   110
    QDesktopWidget* screen = QApplication::desktop();
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   111
    QString os_version = "Operating system: ";
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   112
    QString qt_version = QString("Qt version: ") + QT_VERSION_STR + QString("\n");
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   113
    QString total_ram = "Total RAM: ";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   114
    QString available_ram = "Available RAM: ";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   115
    QString number_of_cores = "Number of cores: ";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   116
    QString compiler_bits = "Compiler architecture: ";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   117
    QString compiler_version = "Compiler version: ";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   118
    QString kernel_line = "Kernel: ";
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   119
    QString screen_size = "Size of the screen(s): " +
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   120
        QString::number(screen->width()) + "x" + QString::number(screen->height()) + "\n";
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   121
    QString number_of_screens = "Number of screens: " + QString::number(screen->screenCount()) + "\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   122
    std::string processor_name = "Processor: ";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   123
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   124
    // platform specific code
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   125
#ifdef Q_WS_MACX
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   126
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   127
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   128
    uint64_t memsize, memavail;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   129
    size_t len = sizeof(memsize);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   130
    static int mib_s[2] = { CTL_HW, HW_MEMSIZE };
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   131
    static int mib_a[2] = { CTL_HW, HW_USERMEM };
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   132
    if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0)
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   133
        total_ram += QString::number(memsize/1024/1024) + " MB\n";
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   134
    else
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   135
        total_ram += "Error getting total RAM information\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   136
    if (sysctl (mib_a, 2, &memavail, &len, NULL, 0) == 0)
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   137
        available_ram += QString::number(memavail/1024/1024) + " MB\n";
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   138
    else
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   139
        available_ram += "Error getting available RAM information\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   140
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   141
        int mib[] = {CTL_KERN, KERN_OSRELEASE};
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   142
    sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   143
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   144
    char *kernelVersion = (char *)malloc(sizeof(char)*len);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   145
    sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   146
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   147
    QString kernelVersionStr = QString(kernelVersion);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   148
    free(kernelVersion);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   149
    int major_version = kernelVersionStr.split(".").first().toUInt() - 4;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   150
    int minor_version = kernelVersionStr.split(".").at(1).toUInt();
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   151
    os_version += QString("Mac OS X 10.%1.%2").arg(major_version).arg(minor_version) + " ";
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   152
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   153
    switch(major_version)
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   154
    {
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   155
        case 4:  os_version += "\"Tiger\"\n"; break;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   156
        case 5:  os_version += "\"Leopard\"\n"; break;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   157
        case 6:  os_version += "\"Snow Leopard\"\n"; break;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   158
        case 7:  os_version += "\"Lion\"\n"; break;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   159
        case 8:  os_version += "\"Mountain Lion\"\n"; break;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   160
        default: os_version += "\"Unknown version\"\n"; break;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   161
    }
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   162
#endif
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   163
#ifdef Q_WS_WIN
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   164
    SYSTEM_INFO sysinfo;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   165
    GetSystemInfo(&sysinfo);
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   166
    number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n";
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   167
    MEMORYSTATUSEX status;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   168
    status.dwLength = sizeof(status);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   169
    GlobalMemoryStatusEx(&status);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   170
    total_ram = QString::number(status.ullTotalPhys);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   171
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   172
    switch(QSysInfo::WinVersion())
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   173
    {
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   174
        case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break;
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   175
        case QSysInfo::WV_XP: os_version += "Windows XP\n"; break;
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   176
        case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break;
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   177
        case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break;
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   178
        default: os_version += "Windows (Unknown version)\n"; break;
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   179
    }
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   180
    kernel_line += "Windows kernel\n";
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   181
#endif
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   182
#ifdef Q_WS_X11
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   183
    number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   184
    long pages = sysconf(_SC_PHYS_PAGES),
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   185
         available_pages = sysconf(_SC_AVPHYS_PAGES),
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   186
         page_size = sysconf(_SC_PAGE_SIZE);
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   187
    total_ram += QString::number(pages * page_size) + "\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   188
    available_ram += QString::number(available_pages * page_size) + "\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   189
    os_version += "GNU/Linux or BSD\n";
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   190
#endif
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   191
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   192
    // uname -a
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   193
#if defined(Q_WS_X11) || defined(Q_WS_MACX)
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   194
    QProcess *process = new QProcess();
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   195
    QStringList arguments = QStringList("-a");
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   196
    process->start("uname", arguments);
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   197
    if (process->waitForFinished())
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   198
        kernel_line += QString(process->readAll());
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   199
    delete process;
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   200
#endif
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   201
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   202
    // cpu info
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   203
    uint32_t registers[4];
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   204
    uint32_t i;
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   205
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   206
    i = 0x80000002;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   207
    asm volatile
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   208
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   209
       : "a" (i), "c" (0));
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   210
    processor_name += std::string((const char *)&registers[0], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   211
    processor_name += std::string((const char *)&registers[1], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   212
    processor_name += std::string((const char *)&registers[2], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   213
    processor_name += std::string((const char *)&registers[3], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   214
    i = 0x80000003;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   215
    asm volatile
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   216
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   217
       : "a" (i), "c" (0));
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   218
    processor_name += std::string((const char *)&registers[0], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   219
    processor_name += std::string((const char *)&registers[1], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   220
    processor_name += std::string((const char *)&registers[2], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   221
    processor_name += std::string((const char *)&registers[3], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   222
    i = 0x80000004;
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   223
    asm volatile
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   224
      ("cpuid" : "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3])
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   225
       : "a" (i), "c" (0));
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   226
    processor_name += std::string((const char *)&registers[0], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   227
    processor_name += std::string((const char *)&registers[1], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   228
    processor_name += std::string((const char *)&registers[2], 4);
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   229
    processor_name += std::string((const char *)&registers[3], 3);
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   230
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   231
    // compiler
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   232
#ifdef __GNUC__
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   233
    compiler_version += "GCC " + QString(__VERSION__) + "\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   234
#else
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   235
    compiler_version += "Unknown\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   236
#endif
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   237
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   238
    if(sizeof(void*) == 4)
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   239
        compiler_bits += "i386\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   240
    else if(sizeof(void*) == 8)
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   241
        compiler_bits += "x86_64\n";
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   242
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   243
    // add everything to the field of text
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   244
    description->setText(
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   245
        "\n\n\n\n\n"
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   246
        "System information:\n"
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   247
        + qt_version
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   248
        + os_version
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   249
        + total_ram
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   250
        + available_ram
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   251
        + screen_size
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   252
        + number_of_screens
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   253
        + QString::fromStdString(processor_name + "\n")
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   254
        + number_of_cores
8255
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   255
        + compiler_version
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   256
        + compiler_bits
c9c331d02794 tinker around the info delivery...
koda
parents: 8253
diff changeset
   257
        + kernel_line
8253
14c046a81e2b GCI2012: Embed System Info
Martin Bede
parents: 6952
diff changeset
   258
    );
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   259
}
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   260
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   261
QNetworkAccessManager * PageFeedback::GetNetManager()
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   262
{
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   263
    if (netManager) return netManager;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   264
    netManager = new QNetworkAccessManager(this);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   265
    connect(netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(NetReply(QNetworkReply*)));
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   266
    return netManager;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   267
}
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   268
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   269
void PageFeedback::LoadCaptchaImage()
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   270
{
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   271
        QNetworkAccessManager *netManager = GetNetManager();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   272
        QUrl captchaURL("http://hedgewars.org/feedback/?gencaptcha");
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   273
        QNetworkRequest req(captchaURL);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   274
        genCaptchaRequest = netManager->get(req);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   275
}
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   276
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   277
void PageFeedback::NetReply(QNetworkReply *reply)
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   278
{
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   279
    if (reply == genCaptchaRequest)
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   280
    {
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   281
        if (reply->error() != QNetworkReply::NoError)
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   282
        {
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   283
            qDebug() << "Error generating captcha image: " << reply->errorString();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   284
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   285
            return;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   286
        }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   287
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   288
        bool okay;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   289
        QByteArray body = reply->readAll();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   290
        captchaID = QString(body).toInt(&okay);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   291
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   292
        if (!okay)
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   293
        {
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   294
            qDebug() << "Failed to get captcha ID: " << body;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   295
            ShowErrorMessage(QMessageBox::tr("Failed to generate captcha"));
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   296
            return;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   297
        }
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   298
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   299
        QString url = "http://hedgewars.org/feedback/?captcha&id=";
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   300
        url += QString::number(captchaID);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   301
        
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   302
        QNetworkAccessManager *netManager = GetNetManager();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   303
        QUrl captchaURL(url);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   304
        QNetworkRequest req(captchaURL);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   305
        captchaImageRequest = netManager->get(req);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   306
    }
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   307
    else if (reply == captchaImageRequest)
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   308
    {
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   309
        if (reply->error() != QNetworkReply::NoError)
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   310
        {
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   311
            qDebug() << "Error loading captcha image: " << reply->errorString();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   312
            ShowErrorMessage(QMessageBox::tr("Failed to download captcha"));
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   313
            return;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   314
        }
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   315
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   316
        QByteArray imageData = reply->readAll();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   317
        QPixmap pixmap;
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   318
        pixmap.loadFromData(imageData);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   319
        label_captcha->setPixmap(pixmap);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   320
        captcha_code->setText("");
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   321
    }
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   322
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   323
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   324
QLayout * PageFeedback::footerLayoutDefinition()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   325
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   326
    QHBoxLayout * bottomLayout = new QHBoxLayout();
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   327
    QHBoxLayout * captchaLayout = new QHBoxLayout();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   328
    QVBoxLayout * captchaInputLayout = new QVBoxLayout();
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   329
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   330
    label_captcha = new QLabel();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   331
    label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   332
    label_captcha->setText("<div style='width: 200px; height: 100px;'>loading<br>captcha</div>");
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   333
    captchaLayout->addWidget(label_captcha);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   334
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   335
    label_captcha_input = new QLabel();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   336
    label_captcha_input->setText(QLabel::tr("Type the security code:"));
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   337
    captchaInputLayout->addWidget(label_captcha_input);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   338
    captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   339
    captcha_code = new QLineEdit();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   340
    captcha_code->setFixedSize(165, 30);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   341
    captchaInputLayout->addWidget(captcha_code);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   342
    captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   343
    captchaLayout->addLayout(captchaInputLayout);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   344
    captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   345
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   346
    captchaLayout->insertSpacing(-1, 40);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   347
    bottomLayout->addLayout(captchaLayout);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   348
    
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   349
    //TODO: create logo for send button
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   350
    BtnSend = addButton("Send Feedback", bottomLayout, 0, false);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   351
    BtnSend->setFixedSize(120, 40);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   352
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   353
    bottomLayout->setStretchFactor(captchaLayout, 0);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   354
    bottomLayout->setStretchFactor(BtnSend, 1);
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   355
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   356
    return bottomLayout;
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   357
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   358
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   359
void PageFeedback::connectSignals()
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   360
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   361
    //TODO
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   362
}
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   363
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   364
void PageFeedback::ShowErrorMessage(const QString & msg)
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   365
{
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   366
    QMessageBox msgMsg(this);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   367
    msgMsg.setIcon(QMessageBox::Warning);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   368
    msgMsg.setWindowTitle(QMessageBox::tr("Hedgewars - Error"));
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   369
    msgMsg.setText(msg);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   370
    msgMsg.setWindowModality(Qt::WindowModal);
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   371
    msgMsg.exec();
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   372
}
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   373
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   374
PageFeedback::PageFeedback(QWidget* parent) : AbstractPage(parent)
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   375
{
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   376
    initPage();
8269
c71721d371dc GCI2012: Google Issue Login
Drew Gottlieb
parents: 8259
diff changeset
   377
    netManager = NULL;
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
   378
}