QTfrontend/ui/page/pagefeedback.cpp
changeset 8270 16a52ad5a362
parent 8268 fe4e94311585
child 8274 7324298dbcc1
equal deleted inserted replaced
8268:fe4e94311585 8270:16a52ad5a362
    84     
    84     
    85     //  Email -- although implemented -- doesn't seem to work as intended.
    85     //  Email -- although implemented -- doesn't seem to work as intended.
    86     //  It's sent in the XML as a <issues:cc> , the <entry>, but it doesn't seem
    86     //  It's sent in the XML as a <issues:cc> , the <entry>, but it doesn't seem
    87     //  to actually do anything. If you figure out how to fix that, uncomment these lines
    87     //  to actually do anything. If you figure out how to fix that, uncomment these lines
    88     //  and the line above in the 'info' QLabel to re-enable this feature.
    88     //  and the line above in the 'info' QLabel to re-enable this feature.
    89     //combinedTopLayout->addLayout(emailLayout);
    89     combinedTopLayout->addLayout(emailLayout);
    90     //combinedTopLayout->insertSpacing(1, 50);
    90     combinedTopLayout->insertSpacing(1, 50);
    91 
    91 
    92     pageLayout->addLayout(combinedTopLayout);
    92     pageLayout->addLayout(combinedTopLayout);
    93 
    93 
    94     label_description = new QLabel();
    94     label_description = new QLabel();
    95     label_description->setText(QLabel::tr("Description"));
    95     label_description->setText(QLabel::tr("Description"));
   109     // Gather some information about the system and embed it into the report
   109     // Gather some information about the system and embed it into the report
   110     QDesktopWidget* screen = QApplication::desktop();
   110     QDesktopWidget* screen = QApplication::desktop();
   111     QString os_version = "Operating system: ";
   111     QString os_version = "Operating system: ";
   112     QString qt_version = QString("Qt version: ") + QT_VERSION_STR + QString("\n");
   112     QString qt_version = QString("Qt version: ") + QT_VERSION_STR + QString("\n");
   113     QString total_ram = "Total RAM: ";
   113     QString total_ram = "Total RAM: ";
   114     QString available_ram = "Available RAM: ";
       
   115     QString number_of_cores = "Number of cores: ";
   114     QString number_of_cores = "Number of cores: ";
   116     QString compiler_bits = "Compiler architecture: ";
   115     QString compiler_bits = "Compiler architecture: ";
   117     QString compiler_version = "Compiler version: ";
   116     QString compiler_version = "Compiler version: ";
   118     QString kernel_line = "Kernel: ";
   117     QString kernel_line = "Kernel: ";
   119     QString screen_size = "Size of the screen(s): " +
   118     QString screen_size = "Size of the screen(s): " +
   123 
   122 
   124     // platform specific code
   123     // platform specific code
   125 #ifdef Q_WS_MACX
   124 #ifdef Q_WS_MACX
   126     number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
   125     number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
   127 
   126 
   128     uint64_t memsize, memavail;
   127     uint64_t memsize;
   129     size_t len = sizeof(memsize);
   128     size_t len = sizeof(memsize);
   130     static int mib_s[2] = { CTL_HW, HW_MEMSIZE };
   129     static int mib_s[2] = { CTL_HW, HW_MEMSIZE };
   131     static int mib_a[2] = { CTL_HW, HW_USERMEM };
       
   132     if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0)
   130     if (sysctl (mib_s, 2, &memsize, &len, NULL, 0) == 0)
   133         total_ram += QString::number(memsize/1024/1024) + " MB\n";
   131         total_ram += QString::number(memsize/1024/1024) + " MB\n";
   134     else
   132     else
   135         total_ram += "Error getting total RAM information\n";
   133         total_ram += "Error getting total RAM information\n";
   136     if (sysctl (mib_a, 2, &memavail, &len, NULL, 0) == 0)
   134 
   137         available_ram += QString::number(memavail/1024/1024) + " MB\n";
   135     int mib[] = {CTL_KERN, KERN_OSRELEASE};
   138     else
       
   139         available_ram += "Error getting available RAM information\n";
       
   140 
       
   141         int mib[] = {CTL_KERN, KERN_OSRELEASE};
       
   142     sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0);
   136     sysctl(mib, sizeof mib / sizeof(int), NULL, &len, NULL, 0);
   143 
   137 
   144     char *kernelVersion = (char *)malloc(sizeof(char)*len);
   138     char *kernelVersion = (char *)malloc(sizeof(char)*len);
   145     sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0);
   139     sysctl(mib, sizeof mib / sizeof(int), kernelVersion, &len, NULL, 0);
   146 
   140 
   165     GetSystemInfo(&sysinfo);
   159     GetSystemInfo(&sysinfo);
   166     number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n";
   160     number_of_cores += QString::number(sysinfo.dwNumberOfProcessors) + "\n";
   167     MEMORYSTATUSEX status;
   161     MEMORYSTATUSEX status;
   168     status.dwLength = sizeof(status);
   162     status.dwLength = sizeof(status);
   169     GlobalMemoryStatusEx(&status);
   163     GlobalMemoryStatusEx(&status);
   170     total_ram = QString::number(status.ullTotalPhys);
   164     total_ram += QString::number(status.ullTotalPhys);
   171 
   165 
   172     switch(QSysInfo::WinVersion())
   166     switch(QSysInfo::WinVersion())
   173     {
   167     {
   174         case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break;
   168         case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break;
   175         case QSysInfo::WV_XP: os_version += "Windows XP\n"; break;
   169         case QSysInfo::WV_XP: os_version += "Windows XP\n"; break;
   183     number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
   177     number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
   184     long pages = sysconf(_SC_PHYS_PAGES),
   178     long pages = sysconf(_SC_PHYS_PAGES),
   185          available_pages = sysconf(_SC_AVPHYS_PAGES),
   179          available_pages = sysconf(_SC_AVPHYS_PAGES),
   186          page_size = sysconf(_SC_PAGE_SIZE);
   180          page_size = sysconf(_SC_PAGE_SIZE);
   187     total_ram += QString::number(pages * page_size) + "\n";
   181     total_ram += QString::number(pages * page_size) + "\n";
   188     available_ram += QString::number(available_pages * page_size) + "\n";
       
   189     os_version += "GNU/Linux or BSD\n";
   182     os_version += "GNU/Linux or BSD\n";
   190 #endif
   183 #endif
   191 
   184 
   192     // uname -a
   185     // uname -a
   193 #if defined(Q_WS_X11) || defined(Q_WS_MACX)
   186 #if defined(Q_WS_X11) || defined(Q_WS_MACX)
   240     else if(sizeof(void*) == 8)
   233     else if(sizeof(void*) == 8)
   241         compiler_bits += "x86_64\n";
   234         compiler_bits += "x86_64\n";
   242 
   235 
   243     // add everything to the field of text
   236     // add everything to the field of text
   244     description->setText(
   237     description->setText(
       
   238         "Don't forget to mention your email or you won't be able to receive updates on this topic!"
   245         "\n\n\n\n\n"
   239         "\n\n\n\n\n"
   246         "System information:\n"
   240         "System information:\n"
   247         + qt_version
   241         + qt_version
   248         + os_version
   242         + os_version
   249         + total_ram
   243         + total_ram
   250         + available_ram
       
   251         + screen_size
   244         + screen_size
   252         + number_of_screens
   245         + number_of_screens
   253         + QString::fromStdString(processor_name + "\n")
   246         + QString::fromStdString(processor_name + "\n")
   254         + number_of_cores
   247         + number_of_cores
   255         + compiler_version
   248         + compiler_version