Developer Documentation
About.cc
1/*===========================================================================*\
2* *
3* OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39* *
40\*===========================================================================*/
41
42
43
44
45
46
47//=============================================================================
48//
49// CLASS Core - IMPLEMENTATION
50//
51//=============================================================================
52
53
54//== INCLUDES =================================================================
55
56#include <common/glew_wrappers.hh>
57#include "CoreWidget.hh"
60
61
62#include <QSurfaceFormat>
63
64#ifndef WIN32
65 #ifndef ARCH_DARWIN
66 #include <malloc.h>
67 #include <unistd.h>
68 #endif
69#endif
70
71#ifdef ARCH_DARWIN
72 #include <sys/types.h>
73 #include <sys/sysctl.h>
74#endif
75
76//== Defines =================================================================
77
78#define GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
79#define GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
80
81//== IMPLEMENTATION ==========================================================
82
83void CoreWidget::addAboutInfo(const QString& _text, const QString& _tabName ) {
84 additionalAboutTabs_[_tabName] = _text;
85}
86
88
89 if ( OpenFlipper::Options::nogui() )
90 return;
91
92 if ( aboutWidget_ == 0 ) {
93 aboutWidget_ = new AboutWidget( this );
94
95
96 // Add all additional tabs
97 QMap<QString, QString>::const_iterator it = additionalAboutTabs_.constBegin();
98 while (it != additionalAboutTabs_.constEnd()) {
99 QTextEdit* tmp = new QTextEdit();
100 tmp->insertHtml( it.value() );
101 tmp->setReadOnly(true);
102 aboutWidget_->About->addTab( tmp, it.key() );
103 ++it;
104 }
105
106 } else {
107 aboutWidget_->OpenFlipperAbout->clear();
108 }
109
110 QFont standardFont = aboutWidget_->OpenFlipperAbout->currentFont();
111 QFont boldFont = standardFont;
112 boldFont.setBold(true);
113
114 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
115 aboutWidget_->OpenFlipperAbout->append(tr("%1 Core Version: %2", "PRODUCT_NAME Core Version:").arg(TOSTRING(PRODUCT_NAME)).arg(OpenFlipper::Options::coreVersion()) ) ;
116 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
117
118 // =====================================================================================
119 // Directory info
120 // =====================================================================================
121 aboutWidget_->OpenFlipperAbout->append("\n");
122 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
123 aboutWidget_->OpenFlipperAbout->append(tr("%1 Directories:").arg(TOSTRING(PRODUCT_NAME)));
124 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
125
126 // Get the dataDir
127 QDir tempDir = QDir(OpenFlipper::Options::applicationDir());
128 #ifdef OPENFLIPPER_DATADIR
129 tempDir.cd(OPENFLIPPER_DATADIR);
130 #endif
131 aboutWidget_->OpenFlipperAbout->append("Data:\t " + tempDir.absolutePath() );
132 aboutWidget_->OpenFlipperAbout->append("Shaders:\t " + OpenFlipper::Options::shaderDirStr() );
133 aboutWidget_->OpenFlipperAbout->append("Textures:\t " + OpenFlipper::Options::textureDirStr() );
134 aboutWidget_->OpenFlipperAbout->append("Scripts:\t " + OpenFlipper::Options::scriptDirStr() );
135 aboutWidget_->OpenFlipperAbout->append("Icons:\t " + OpenFlipper::Options::iconDirStr() );
136 aboutWidget_->OpenFlipperAbout->append("Fonts:\t" + OpenFlipper::Options::fontsDirStr() );
137 aboutWidget_->OpenFlipperAbout->append("Help:\t" + OpenFlipper::Options::helpDirStr() );
138 aboutWidget_->OpenFlipperAbout->append("\n");
139
140 // =====================================================================================
141 // Config files
142 // =====================================================================================
143 aboutWidget_->OpenFlipperAbout->append("\n");
144 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
145 aboutWidget_->OpenFlipperAbout->append(tr("%1 configuration files:").arg(TOSTRING(PRODUCT_NAME)));
146 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
147
148 aboutWidget_->OpenFlipperAbout->append(tr("ConfigDir:\t\t\t") + OpenFlipper::Options::configDirStr() );
149 aboutWidget_->OpenFlipperAbout->append(tr("Window states:\t\t") + OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "WindowStates.dat");
150
151 aboutWidget_->OpenFlipperAbout->append(tr("Main option file:\t\t") + OpenFlipperSettings().fileName());
152 aboutWidget_->OpenFlipperAbout->append(tr("Additional option files:"));
153 for ( int i = 0 ; i < OpenFlipper::Options::optionFiles().size() ; ++i)
154 aboutWidget_->OpenFlipperAbout->append(OpenFlipper::Options::optionFiles()[i]);
155
156
157
158
159 // =====================================================================================
160 // Memory infos
161 // =====================================================================================
162 aboutWidget_->OpenFlipperAbout->append("\n");
163 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
164 aboutWidget_->OpenFlipperAbout->append(tr("Memory Information:"));
165 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
166
167
168#ifdef WIN32
169
170 // Define memory structure
171 MEMORYSTATUSEX ms;
172 // Set the size ( required according to spec ... why???? )
173 ms.dwLength = sizeof (ms);
174
175 // Get the info
176 GlobalMemoryStatusEx(&ms);
177
178 // Output to widget
179 aboutWidget_->OpenFlipperAbout->append(tr("Physical Memory:\t")+ QString::number(ms.ullAvailPhys/1024/1024) + "MiB/"+
180 QString::number(ms.ullTotalPhys/1024/1024) + "MiB free ("+
181 QString::number(ms.dwMemoryLoad) + "%)");
182 aboutWidget_->OpenFlipperAbout->append(tr("Pagefile Memory:\t")+ QString::number(ms.ullAvailPageFile/1024/1024) + "MiB/"
183 + QString::number(ms.ullTotalPageFile/1024/1024) + "MiB free");
184
185
186#elif defined __GLIBC__
187
188# if __GLIBC__ >= 3 || (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 33)
189 // mallinfo2 appeared in glibc 2.33, according to manpage
190 struct mallinfo2 info = ::mallinfo2();
191# else
192 struct mallinfo info = ::mallinfo();
193# endif
194
195 size_t memory = 0;
196
197 // add mmap-allocated memory
198 memory += info.hblkhd;
199
200 // add sbrk-allocated memory
201 memory += info.uordblks;
202
203 double mmapAllocated = double(info.hblkhd ) / 1024 / 1024;
204 double sbrkAllocated = double(info.uordblks) / 1024 / 1024;
205 double totalAllocated = double(memory) / 1024 / 1024;
206
207 double pageSize = double(getpagesize()) /1024 ;
208 double availablePages = double( sysconf (_SC_AVPHYS_PAGES) );
209 double freeMem = availablePages * pageSize / 1024;
210
211 aboutWidget_->OpenFlipperAbout->append(tr("Total Memory allocated (mallinfo/mallinfo2, only main arena):\t ")
212 + QString::number(totalAllocated,'f' ,2 ) + tr("MiB ")
213 + tr("( mmap: ") + QString::number(mmapAllocated ,'f' ,2 ) + tr("MiB")
214 + tr(", sbrk: ") + QString::number(sbrkAllocated ,'f' ,2 ) + tr("MiB )") );
215
216 aboutWidget_->OpenFlipperAbout->append(tr("Free Memory:\t\t ") + QString::number(freeMem,'f' ,2 ) + tr("MiB ")
217 + tr("(") + QString::number(availablePages,'f' ,0 ) + tr(" pages of ")
218 + QString::number(pageSize,'f' ,2 ) + tr("KiB size)"));
219
220#elif defined ARCH_DARWIN
221 aboutWidget_->OpenFlipperAbout->append(tr("Not available for this platform (MacOS)"));
222#else
223 aboutWidget_->OpenFlipperAbout->append(tr("Not available for this platform"));
224#endif
225
226 // =====================================================================================
227 // CPU infos
228 // =====================================================================================
229 aboutWidget_->OpenFlipperAbout->append("\n");
230 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
231 aboutWidget_->OpenFlipperAbout->append(tr("CPU Information:"));
232 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
233
234 #ifdef WIN32
235
236 QSettings registryCPU("HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor", QSettings::NativeFormat);
237
238 QStringList cpus = registryCPU.childGroups();
239 if ( cpus.size() != 0 ) {
240
241 aboutWidget_->OpenFlipperAbout->append(tr("CPU vendor:\t\t ") +
242 registryCPU.value( cpus[0]+"/VendorIdentifier", "Unknown" ).toString() );
243 aboutWidget_->OpenFlipperAbout->append(tr("CPU model:\t\t ") +
244 registryCPU.value( cpus[0]+"/ProcessorNameString", "Unknown" ).toString() );
245 aboutWidget_->OpenFlipperAbout->append(tr("CPU identifier:\t\t ") +
246 registryCPU.value( cpus[0]+"/Identifier", "Unknown" ).toString() );
247 aboutWidget_->OpenFlipperAbout->append(tr("CPU Speed:\t\t ") +
248 registryCPU.value( cpus[0]+"/~MHz", "Unknown" ).toString()+ " MHz" );
249
250 aboutWidget_->OpenFlipperAbout->append("CPU Cores:\t\t " + QString::number(cpus.size()));
251
252 } else {
253 aboutWidget_->OpenFlipperAbout->append(tr("Unable to retrieve CPU information"));
254 }
255
256 #elif defined ARCH_DARWIN
257
258
259 size_t lenCPU;
260 char *pCPU;
261
262 // First call to get required size
263 sysctlbyname("machdep.cpu.brand_string", NULL, &lenCPU, NULL, 0);
264
265 // allocate
266 pCPU = (char * )malloc(lenCPU);
267
268 // Second call to get data
269 sysctlbyname("machdep.cpu.brand_string", pCPU, &lenCPU, NULL, 0);
270
271 // Output
272 aboutWidget_->OpenFlipperAbout->append(tr("CPU Brand:\t\t ") + QString(pCPU) );
273
274 // free memory
275 free(pCPU);
276
277 int physicalCPUS = 0;
278
279 // Get data
280 lenCPU = sizeof(int);
281 sysctlbyname("hw.physicalcpu", &physicalCPUS, &lenCPU , NULL, 0);
282
283 // Output
284 aboutWidget_->OpenFlipperAbout->append(tr("Physical Cores:\t\t ") + QString::number(physicalCPUS) );
285
286 int logicalCPUS = 0;
287
288 // Get data
289 lenCPU = sizeof(int);
290 sysctlbyname("hw.logicalcpu", &logicalCPUS, &lenCPU, NULL, 0);
291
292 // Output
293 aboutWidget_->OpenFlipperAbout->append(tr("LogicalCores:\t\t ") + QString::number(logicalCPUS) );
294
295 #else
296 QFile cpuinfo("/proc/cpuinfo");
297 if (! cpuinfo.exists() )
298 aboutWidget_->OpenFlipperAbout->append(tr("Unable to retrieve CPU information"));
299 else {
300
301 cpuinfo.open(QFile::ReadOnly);
302 QTextStream stream(&cpuinfo);
303
304 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
305 QStringList splitted = stream.readAll().split("\n",QString::SkipEmptyParts);
306 #else
307 QStringList splitted = stream.readAll().split("\n",Qt::SkipEmptyParts);
308 #endif
309
310
311 int position = splitted.indexOf ( QRegularExpression("^vendor_id.*") );
312 if ( position != -1 ){
313 QString cpuVendor = splitted[position].section(':', -1).simplified();
314 aboutWidget_->OpenFlipperAbout->append(tr("CPU vendor:\t\t ") + cpuVendor );
315 } else {
316 aboutWidget_->OpenFlipperAbout->append(tr("CPU vendor:\t\t vendor specification not found"));
317 }
318
319 position = splitted.indexOf ( QRegularExpression("^model name.*") );
320 if ( position != -1 ){
321 QString cpuModel = splitted[position].section(':', -1).simplified();
322 aboutWidget_->OpenFlipperAbout->append(tr("CPU model:\t\t ") + cpuModel );
323 } else {
324 aboutWidget_->OpenFlipperAbout->append(tr("CPU model:\t\t Model specification not found"));
325 }
326
327 position = splitted.indexOf ( QRegularExpression("^cpu cores.*") );
328 if ( position != -1 ){
329 QString cpuCoresPhysical = splitted[position].section(':', -1).simplified();
330 aboutWidget_->OpenFlipperAbout->append(tr("Physical CPU cores:\t\t ") + cpuCoresPhysical );
331 } else {
332 aboutWidget_->OpenFlipperAbout->append(tr("Physical CPU cores:\t\t CPU Core specification not found"));
333 }
334
335 position = splitted.indexOf ( QRegularExpression("^siblings.*") );
336 if ( position != -1 ){
337 QString cpuCoresLogical = splitted[position].section(':', -1).simplified();
338 aboutWidget_->OpenFlipperAbout->append(tr("Logical CPU cores:\t\t ") + cpuCoresLogical );
339 } else {
340 aboutWidget_->OpenFlipperAbout->append(tr("Logical CPU cores:\t\t CPU Core specification not found"));
341 }
342
343 position = splitted.indexOf ( QRegularExpression("^flags.*") );
344 if ( position != -1 ){
345 QString cpuFlags = splitted[position].section(':', -1).simplified();
346 aboutWidget_->OpenFlipperAbout->append( tr("CPU capabilities:") );
347 aboutWidget_->OpenFlipperAbout->append( cpuFlags );
348 } else {
349 aboutWidget_->OpenFlipperAbout->append(tr("CPU capabilities:\t\t CPU flag specification not found"));
350 }
351
352 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
353 aboutWidget_->OpenFlipperAbout->append(tr("System is Big Endian"));
354 #endif
355
356 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
357 aboutWidget_->OpenFlipperAbout->append(tr("System is Little Endian"));
358 #endif
359
360 }
361
362 #endif
363
364 // =====================================================================================
365 // OS info
366 // =====================================================================================
367 aboutWidget_->OpenFlipperAbout->append("\n");
368 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
369 aboutWidget_->OpenFlipperAbout->append(tr("Operating System Info:"));
370 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
371
372 #ifdef WIN32
373 QSettings registryOS("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
374 aboutWidget_->OpenFlipperAbout->append(tr("Product Name:\t\t ") +
375 registryOS.value( "ProductName", "Unknown" ).toString() );
376 aboutWidget_->OpenFlipperAbout->append(tr("Current Version:\t\t ") +
377 registryOS.value( "CurrentVersion", "Unknown" ).toString() );
378 #elif defined ARCH_DARWIN
379
380 int mib[2];
381 size_t len;
382 char *p;
383
384 mib[0] = CTL_KERN;
385 mib[1] = KERN_VERSION;
386
387 sysctl(mib, 2, NULL, &len, NULL, 0);
388 p = (char * )malloc(len);
389 sysctl(mib, 2, p, &len, NULL, 0);
390
391 aboutWidget_->OpenFlipperAbout->append(tr("OS Version:\t\t ") + QString(p) );
392
393 free(p);
394
395 #else
396 QFile versionInfo("/proc/version");
397 if (! versionInfo.exists() )
398 aboutWidget_->OpenFlipperAbout->append(tr("Unable to retrieve Kernel information"));
399 else {
400 versionInfo.open(QFile::ReadOnly);
401 QTextStream versionStream(&versionInfo);
402 aboutWidget_->OpenFlipperAbout->append(tr("Kernel Version:\t\t ") + versionStream.readAll().simplified());
403
404 QString program = "/usr/bin/lsb_release";
405
406 QFile lsb(program);
407 if ( lsb.exists() ) {
408 QStringList arguments;
409 arguments << "-a";
410
411 QProcess myProcess;
412 myProcess.start(program, arguments);
413
414 if ( myProcess.waitForFinished ( 4000 ) ) {
415 QStringList outputLSB = QString(myProcess.readAllStandardOutput()).split('\n');
416
417
418 int position = outputLSB.indexOf ( QRegularExpression("^Distributor ID.*") );
419 if ( position != -1 ){
420 QString distributorID = outputLSB[position].section(':', -1).simplified();
421 aboutWidget_->OpenFlipperAbout->append(tr("Distributor ID:\t\t ") + distributorID );
422 } else {
423 aboutWidget_->OpenFlipperAbout->append(tr("Distributor ID:\t\t Unknown"));
424 }
425
426 position = outputLSB.indexOf ( QRegularExpression("^Description.*") );
427 if ( position != -1 ){
428 QString description = outputLSB[position].section(':', -1).simplified();
429 aboutWidget_->OpenFlipperAbout->append(tr("Description:\t\t ") + description );
430 } else {
431 aboutWidget_->OpenFlipperAbout->append(tr("Description:\t\t Unknown"));
432 }
433
434 position = outputLSB.indexOf ( QRegularExpression("^Release.*") );
435 if ( position != -1 ){
436 QString release = outputLSB[position].section(':', -1).simplified();
437 aboutWidget_->OpenFlipperAbout->append(tr("Release number:\t\t ") + release );
438 } else {
439 aboutWidget_->OpenFlipperAbout->append(tr("Release number:\t\t Unknown"));
440 }
441
442 position = outputLSB.indexOf ( QRegularExpression("^Codename.*") );
443 if ( position != -1 ){
444 QString codename = outputLSB[position].section(':', -1).simplified();
445 aboutWidget_->OpenFlipperAbout->append(tr("Codename:\t\t ") + codename );
446 } else {
447 aboutWidget_->OpenFlipperAbout->append(tr("Codename:\t\t Unknown"));
448 }
449
450 } else {
451 aboutWidget_->OpenFlipperAbout->append(tr("Unable to get LSB info"));
452 }
453
454 } else {
455 aboutWidget_->OpenFlipperAbout->append(tr("No additional information. Unable to get info via LSB."));
456 }
457
458 }
459 #endif
460
461 QString systemPathVariable = getenv("PATH");
462 aboutWidget_->OpenFlipperAbout->append(tr("System Path:\n ") + systemPathVariable);
463
464#ifndef WIN32
465 QString systemLibraryPathVariable = getenv("LD_LIBRARY_PATH");
466 aboutWidget_->OpenFlipperAbout->append(tr("LD_LIBRARY_PATH:\n ") + systemLibraryPathVariable);
467#endif
468
469
470
471 // =====================================================================================
472 // OpenGL Renderer/Vendor and version info
473 // =====================================================================================
474 aboutWidget_->OpenFlipperAbout->append("\n");
475 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
476 aboutWidget_->OpenFlipperAbout->append(tr("OpenGL Specific Info:"));
477 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
478
479 QString vendor = QString((const char*)glGetString(GL_VENDOR));
480 aboutWidget_->OpenFlipperAbout->append(tr("Qt reports Vendor:\t\t") + vendor);
481 QString renderer = QString((const char*)glGetString(GL_RENDERER));
482 aboutWidget_->OpenFlipperAbout->append(tr("Qt reports Renderer:\t\t") + renderer);
483
484 QPair<int, int> version = QOpenGLContext::currentContext()->format().version();
485
486 QString openGLQtVersion = tr("Qt reports Version:\t\t");
487
488 openGLQtVersion += QString::number(version.first) + tr(",") + QString::number(version.second);
489
490 aboutWidget_->OpenFlipperAbout->append(openGLQtVersion);
491
492 aboutWidget_->OpenFlipperAbout->append("\n");
493
494 const QOpenGLContext* context = QOpenGLContext::currentContext();
495 if (context) {
496 QString openGLprofile = tr("Qt reports the OpenGL profile:\t");
497 QSurfaceFormat::OpenGLContextProfile profile = context->format().profile();
498 if (profile == QSurfaceFormat::NoProfile)
499 openGLprofile += tr("no profile");
500 else if (profile == QSurfaceFormat::CoreProfile)
501 openGLprofile += tr("Core profile");
502 else if (profile == QSurfaceFormat::CompatibilityProfile)
503 openGLprofile += tr("Compatibility profile");
504 else
505 openGLprofile += tr("unknown profile");
506
507 aboutWidget_->OpenFlipperAbout->append(openGLprofile);
508 aboutWidget_->OpenFlipperAbout->append("\n");
509 }
510
511
512 QString openGLVendor = tr("GL reports Vendor:\t\t");
513 openGLVendor += QString((const char*)glGetString(GL_VENDOR));
514 aboutWidget_->OpenFlipperAbout->append(openGLVendor);
515
516 QString openGLRenderer = tr("GL reports Renderer:\t\t");
517 openGLRenderer += QString((const char*)glGetString(GL_RENDERER));
518 aboutWidget_->OpenFlipperAbout->append(openGLRenderer);
519
520 QString openGLGLVersion = tr("GL reports Version:\t\t");
521 openGLGLVersion += QString((const char*)glGetString(GL_VERSION));
522 aboutWidget_->OpenFlipperAbout->append(openGLGLVersion);
523
524 QString openGLShadingLanguageVersion = tr("GL reports Shading Language Version:\t");
525 openGLShadingLanguageVersion += QString((const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
526 aboutWidget_->OpenFlipperAbout->append(openGLShadingLanguageVersion);
527
528
529 // =====================================================================================
530 // OpenGL Extensions
531 // =====================================================================================
532 aboutWidget_->OpenFlipperAbout->append("\n");
533 aboutWidget_->OpenFlipperAbout->append(tr("Supported Extensions:"));
534 QString glExtensions = QString(ACG::getExtensionString().c_str());
535 aboutWidget_->OpenFlipperAbout->append(glExtensions);
536
537
538 // =====================================================================================
539 // OpenGL Properties
540 // =====================================================================================
541 aboutWidget_->OpenFlipperAbout->append("\n");
542 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
543 aboutWidget_->OpenFlipperAbout->append(tr("OpenGL Values:"));
544 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
545 GLint getBuffer[2];
546 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &getBuffer[0] );
547 aboutWidget_->OpenFlipperAbout->append(tr("Maximal Viewport size(GL_MAX_VIEWPORT_DIMS):\t\t\t\t ") + QString::number(getBuffer[0]) + "x" + QString::number(getBuffer[1]) );
548
549 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &getBuffer[0] );
550 aboutWidget_->OpenFlipperAbout->append(tr("Maximum supported texture image units(GL_MAX_TEXTURE_IMAGE_UNITS):\t") + QString::number(getBuffer[0]) );
551
552 // Check extension for NVIDIA memory information
553 if ( glExtensions.contains("GL_NVX_gpu_memory_info") ) {
554 // get total memory on gpu
555 GLint total_mem_kb = 0;
556 glGetIntegerv(GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &total_mem_kb);
557
558 aboutWidget_->OpenFlipperAbout->append(tr("GPU Memory (Total available):\t\t") + QString::number(total_mem_kb /1024) + " MB" );
559
560 // get currently available memory on gpu
561 GLint cur_avail_mem_kb = 0;
562 glGetIntegerv(GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &cur_avail_mem_kb);
563
564 aboutWidget_->OpenFlipperAbout->append(tr("GPU Memory (Currently available):\t") + QString::number(cur_avail_mem_kb / 1024) + " MB" );
565 }
566
567
568
569 aboutWidget_->OpenFlipperAbout->moveCursor(QTextCursor::Start);
570
571 // =====================================================================================
572 // glew Information
573 // =====================================================================================
574 #ifndef __APPLE__
575 aboutWidget_->OpenFlipperAbout->append("\n");
576 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
577 aboutWidget_->OpenFlipperAbout->append(tr("GLEW Specific Info:"));
578 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
579
580 QString glewVersion = QString(getGlewVersion());
581 aboutWidget_->OpenFlipperAbout->append(tr("GLEW Version:\t") + glewVersion);
582 #endif
583
584 // =====================================================================================
585 // Qt information
586 // =====================================================================================
587
588 aboutWidget_->OpenFlipperAbout->append("\n");
589 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
590 aboutWidget_->OpenFlipperAbout->append(tr("Qt Version Info:"));
591 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
592 aboutWidget_->OpenFlipperAbout->append(tr("Currently used Version:\t") + qVersion() );
593 aboutWidget_->OpenFlipperAbout->append(tr("Link time Version:\t\t") + QT_VERSION_STR );
594
595 QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
596 QString formatsString = "";
597 for ( int i = 0 ; i < imageFormats.size() ; ++i) {
598 formatsString += imageFormats[i] + " ";
599
600 if ( (i != 0) && (i % 15) == 0 )
601 formatsString+= "\n";
602 }
603
604 aboutWidget_->OpenFlipperAbout->append(tr("Supported image read formats:") );
605 aboutWidget_->OpenFlipperAbout->append(formatsString);
606
607 aboutWidget_->OpenFlipperAbout->append("\n");
608
609 aboutWidget_->OpenFlipperAbout->append(tr("Currently used Library paths:") );
610 QStringList libPaths = QCoreApplication::libraryPaths();
611 for(int i = 0 ; i < libPaths.size() ; ++i)
612 aboutWidget_->OpenFlipperAbout->append(" " + libPaths[i]);
613
614
615 // =========================================================
616 // Qt Documentation files
617 // =========================================================
618/*
619 aboutWidget_->OpenFlipperAbout->append("\n");
620 aboutWidget_->OpenFlipperAbout->append(tr("Currently Loaded documentations:") );
621
622 QStringList registeredDocumentations = helpEngine_->registeredDocumentations ();
623
624 for ( int i = 0 ; i < registeredDocumentations.size(); ++i) {
625 QString documentationInfo = registeredDocumentations[i];
626 documentationInfo += " ";
627 documentationInfo += helpEngine_->documentationFileName(registeredDocumentations[i]);
628 aboutWidget_->OpenFlipperAbout->append(documentationInfo);
629 }
630*/
631 // =====================================================================================
632 // Compiler information
633 // =====================================================================================
634 aboutWidget_->OpenFlipperAbout->append("\n");
635 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
636 aboutWidget_->OpenFlipperAbout->append(tr("Compiler Info:"));
637 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
638 aboutWidget_->OpenFlipperAbout->append( OpenFlipper::Options::compilerInfo() );
639
640 QString definitions;
641
642 // Trying to check some defines:
643 #ifdef WIN32
644 definitions += "WIN32 ";
645 #endif
646
647 #ifdef WIN64
648 definitions += "WIN64 ";
649 #endif
650
651 #ifdef DLL
652 definitions += "DLL ";
653 #endif
654
655
656 #ifdef APPLE
657 definitions += "APPLE ";
658 #endif
659
660 #ifdef ARCH_DARWIN
661 definitions += "ARCH_DARWIN ";
662 #endif
663
664 #ifdef INCLUDE_TEMPLATES
665 definitions += "INCLUDE_TEMPLATES ";
666 #endif
667
668 #ifdef DEBUG
669 definitions += "DEBUG ";
670 #endif
671
672 #ifdef NDEBUG
673 definitions += "NDEBUG ";
674 #endif
675
676 #ifdef QT_NO_OPENGL
677 definitions += "QT_NO_OPENGL ";
678 #endif
679
680 #ifdef OPENMP
681 definitions += "OPENMP ";
682 #endif
683
684 #ifdef USE_OPENMP
685 definitions += "USE_OPENMP ";
686 #endif
687
688 aboutWidget_->OpenFlipperAbout->append( tr("Definitions (incomplete):\n") + definitions );
689
690 // =====================================================================================
691 // List the currently registered data types
692 // =====================================================================================
693 aboutWidget_->OpenFlipperAbout->append("\n");
694 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
695 aboutWidget_->OpenFlipperAbout->append(tr("Registered data types:"));
696 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
697
698 QString types;
699
700 // Iterate over all Types known to the core
701 // Start at 1:
702 // 0 type is defined as DATA_UNKNOWN
703 DataType currentType = 1;
704 for ( uint i = 0 ; i < typeCount() - 2 ; ++i) {
705 types += typeName( currentType ) + "\t\t typeId: " + QString::number(currentType.value()) + "\n";
706
707 // Advance to next type ( Indices are bits so multiply by to to get next bit)
708 ++currentType;
709 }
710
711 aboutWidget_->OpenFlipperAbout->append( types );
712
713 // =====================================================================================
714 // List The File Plugins with their filters
715 // =====================================================================================
716 aboutWidget_->OpenFlipperAbout->append("\n");
717 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
718 aboutWidget_->OpenFlipperAbout->append(tr("Registered File Plugins:"));
719 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
720
721 for ( uint i = 0 ; i < supportedTypes().size() ; ++i ) {
722 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
723 aboutWidget_->OpenFlipperAbout->append( "\t" + supportedTypes()[i].name );
724 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
725 aboutWidget_->OpenFlipperAbout->append( "\t\t Load: " + supportedTypes()[i].loadFilters );
726 aboutWidget_->OpenFlipperAbout->append( "\t\t Save: " + supportedTypes()[i].saveFilters );
727 }
728
729
730 // =====================================================================================
731 // List all Plugins
732 // =====================================================================================
733 aboutWidget_->OpenFlipperAbout->append("\n");
734 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
735 aboutWidget_->OpenFlipperAbout->append(tr("Loaded Plugins:"));
736 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
737
738 for ( uint i = 0 ; i < plugins().size() ; ++i ) {
739 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
740 aboutWidget_->OpenFlipperAbout->append( "\t" + plugins()[i].name );
741 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
742 aboutWidget_->OpenFlipperAbout->append( "\t\t Version: \t\t" + plugins()[i].version );
743 aboutWidget_->OpenFlipperAbout->append( "\t\t Description: \t" + plugins()[i].description );
744 aboutWidget_->OpenFlipperAbout->append( "\t\t Path \t\t" + plugins()[i].path );
745
746 if ( !plugins()[i].warnings.isEmpty() ) {
747 aboutWidget_->OpenFlipperAbout->setTextColor(Qt::darkYellow);
748 aboutWidget_->OpenFlipperAbout->append( "\t\t Warnings: \t\t" + plugins()[i].warnings );
749 aboutWidget_->OpenFlipperAbout->setTextColor(Qt::black);
750 }
751
752 if ( !plugins()[i].errors.isEmpty() ) {
753 aboutWidget_->OpenFlipperAbout->setTextColor(Qt::darkRed);
754 aboutWidget_->OpenFlipperAbout->append( "\t\t Errors: \t\t" + plugins()[i].errors );
755 aboutWidget_->OpenFlipperAbout->setTextColor(Qt::black);
756 }
757
758 }
759
760 // =====================================================================================
761 // List failed Plugins
762 // =====================================================================================
763 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
764 aboutWidget_->OpenFlipperAbout->append(tr("Failed Plugins:"));
765 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
766
767 for ( unsigned i = 0 ; i < PluginStorage::pluginsFailed().size() ; ++i ) {
768 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
769 aboutWidget_->OpenFlipperAbout->append( "\t" + PluginStorage::pluginsFailed()[i].name );
770 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
771 aboutWidget_->OpenFlipperAbout->append( "\t\t Version: \t\t" + PluginStorage::pluginsFailed()[i].version );
772 aboutWidget_->OpenFlipperAbout->append( "\t\t Description: \t" + PluginStorage::pluginsFailed()[i].description );
773 aboutWidget_->OpenFlipperAbout->append( "\t\t Path \t\t" + PluginStorage::pluginsFailed()[i].path );
774
775 if ( !PluginStorage::pluginsFailed()[i].warnings.isEmpty() ) {
776 aboutWidget_->OpenFlipperAbout->setTextColor(Qt::darkYellow);
777 aboutWidget_->OpenFlipperAbout->append( "\t\t Warnings: \t\t" + PluginStorage::pluginsFailed()[i].warnings );
778 aboutWidget_->OpenFlipperAbout->setTextColor(Qt::black);
779 }
780
781 if ( !PluginStorage::pluginsFailed()[i].errors.isEmpty() ) {
782 aboutWidget_->OpenFlipperAbout->setTextColor(Qt::darkRed);
783 aboutWidget_->OpenFlipperAbout->append( "\t\t Errors: \t\t" + PluginStorage::pluginsFailed()[i].errors );
784 aboutWidget_->OpenFlipperAbout->setTextColor(Qt::black);
785 }
786
787 }
788
789
790
791
792 // =====================================================================================
793 // List of build-in resources
794 // =====================================================================================
795
796 aboutWidget_->OpenFlipperAbout->append("\n");
797 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
798 aboutWidget_->OpenFlipperAbout->append(tr("Currently loaded Resources (e.g. by qrc files):"));
799 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
800
801 QDir toplevelResources(":/");
802 for ( auto str : toplevelResources.entryList() ) {
803 aboutWidget_->OpenFlipperAbout->append(str);
804
805 QDir firstLevel(":/" + str);
806 for ( auto firstLevelStr : firstLevel.entryList() ) {
807 aboutWidget_->OpenFlipperAbout->append(" \t" + firstLevelStr);
808
809 QDir secondLevel(":/" + str + "/" + firstLevelStr);
810
811 for ( auto secondLevelStr : secondLevel.entryList() ) {
812 aboutWidget_->OpenFlipperAbout->append(" \t\t" + secondLevelStr);
813 }
814
815 }
816
817 aboutWidget_->OpenFlipperAbout->append("\n");
818 }
819
820 aboutWidget_->show();
821
822}
823//=============================================================================
DLLEXPORT QString typeName(DataType _id)
Get the name of a type with given id.
Definition: Types.cc:154
DLLEXPORT size_t typeCount()
Get the number of registered types.
Definition: Types.cc:175
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
#define TOSTRING(x)
QSettings object containing all program settings of OpenFlipper.
QMap< QString, QString > additionalAboutTabs_
Additional tab information, that could be provided by plugins.
Definition: CoreWidget.hh:1212
void showAboutWidget()
Display the about widget.
Definition: About.cc:87
std::vector< PluginInfo > & plugins()
Convenient way to access plugin list.
Definition: CoreWidget.cc:679
void addAboutInfo(const QString &_text, const QString &_tabName)
Adds an entry to the about dialog.
Definition: About.cc:83
AboutWidget * aboutWidget_
Pointer to the about widget.
Definition: CoreWidget.hh:1209
Predefined datatypes.
Definition: DataTypes.hh:83
unsigned int value() const
Definition: Types.cc:407
std::string getExtensionString()
getExtensionString returns a string containing all supported OpenGL extensions this function uses the...
Definition: gl.cc:100