Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49
50
51
52
53 //=============================================================================
54 //
55 // CLASS Core - IMPLEMENTATION
56 //
57 //=============================================================================
58
59
60 //== INCLUDES =================================================================
61
62 #include <common/glew_wrappers.hh>
63 #include "CoreWidget.hh"
64 #include <OpenFlipper/common/FileTypes.hh>
65
66 #include <QGLFormat>
67
68 #ifndef WIN32
69 #ifndef ARCH_DARWIN
70 #include <malloc.h>
71 #include <unistd.h>
72 #endif
73 #endif
74
75 #ifdef ARCH_DARWIN
76 #include <sys/types.h>
77 #include <sys/sysctl.h>
78 #endif
79
80 //== Defines =================================================================
81
82 #define GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
83 #define GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
84
85 //== IMPLEMENTATION ==========================================================
86
87 void CoreWidget::addAboutInfo(QString _text, QString _tabName ) {
88 additionalAboutTabs_[_tabName] = _text;
89 }
90
91 void CoreWidget::showAboutWidget( ) {
92
93 if ( OpenFlipper::Options::nogui() )
94 return;
95
96 if ( aboutWidget_ == 0 ) {
97 aboutWidget_ = new AboutWidget( this );
98
99
100 // Add all additional tabs
101 QMap<QString, QString>::const_iterator it = additionalAboutTabs_.constBegin();
102 while (it != additionalAboutTabs_.constEnd()) {
103 QTextEdit* tmp = new QTextEdit();
104 tmp->insertHtml( it.value() );
105
106 aboutWidget_->About->addTab( tmp, it.key() );
107 ++it;
108 }
109
110 } else {
111 aboutWidget_->OpenFlipperAbout->clear();
112 }
113
114 QFont standardFont = aboutWidget_->OpenFlipperAbout->currentFont();
115 QFont boldFont = standardFont;
116 boldFont.setBold(true);
117
118 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
119 aboutWidget_->OpenFlipperAbout->append(tr("%1 Core Version: %2", "PRODUCT_NAME Core Version:").arg(TOSTRING(PRODUCT_NAME)).arg(OpenFlipper::Options::coreVersion()) ) ;
120 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
121
122 // =====================================================================================
123 // Directory info
124 // =====================================================================================
125 aboutWidget_->OpenFlipperAbout->append("\n");
126 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
127 aboutWidget_->OpenFlipperAbout->append(tr("%1 Directories:").arg(TOSTRING(PRODUCT_NAME)));
128 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
129
130 // Get the dataDir
131 QDir tempDir = QDir(OpenFlipper::Options::applicationDir());
132 #ifdef OPENFLIPPER_DATADIR
133 tempDir.cd(OPENFLIPPER_DATADIR);
134 #endif
135 aboutWidget_->OpenFlipperAbout->append("Data:\t " + tempDir.absolutePath() );
136 aboutWidget_->OpenFlipperAbout->append("Shaders:\t " + OpenFlipper::Options::shaderDirStr() );
137 aboutWidget_->OpenFlipperAbout->append("Textures:\t " + OpenFlipper::Options::textureDirStr() );
138 aboutWidget_->OpenFlipperAbout->append("Scripts:\t " + OpenFlipper::Options::scriptDirStr() );
139 aboutWidget_->OpenFlipperAbout->append("Icons:\t " + OpenFlipper::Options::iconDirStr() );
140 aboutWidget_->OpenFlipperAbout->append("Fonts:\t" + OpenFlipper::Options::fontsDirStr() );
141 aboutWidget_->OpenFlipperAbout->append("Help:\t" + OpenFlipper::Options::helpDirStr() );
142 aboutWidget_->OpenFlipperAbout->append("\n");
143
144 // =====================================================================================
145 // Config files
146 // =====================================================================================
147 aboutWidget_->OpenFlipperAbout->append("\n");
148 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
149 aboutWidget_->OpenFlipperAbout->append(tr("%1 configuration files:").arg(TOSTRING(PRODUCT_NAME)));
150 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
151
152 aboutWidget_->OpenFlipperAbout->append(tr("ConfigDir:\t\t\t") + OpenFlipper::Options::configDirStr() );
153 aboutWidget_->OpenFlipperAbout->append(tr("Window states:\t\t") + OpenFlipper::Options::configDirStr() + OpenFlipper::Options::dirSeparator() + "WindowStates.dat");
154
155 aboutWidget_->OpenFlipperAbout->append(tr("Main option file:\t\t") + OpenFlipperSettings().fileName());
156 aboutWidget_->OpenFlipperAbout->append(tr("Additional option files:"));
157 for ( int i = 0 ; i < OpenFlipper::Options::optionFiles().size() ; ++i)
158 aboutWidget_->OpenFlipperAbout->append(OpenFlipper::Options::optionFiles()[i]);
159
160
161
162
163 // =====================================================================================
164 // Memory infos
165 // =====================================================================================
166 aboutWidget_->OpenFlipperAbout->append("\n");
167 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
168 aboutWidget_->OpenFlipperAbout->append(tr("Memory Information:"));
169 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
170
171
172 #ifdef WIN32
173
174 // Define memory structure
175 MEMORYSTATUSEX ms;
176 // Set the size ( required according to spec ... why???? )
177 ms.dwLength = sizeof (ms);
178
179 // Get the info
180 GlobalMemoryStatusEx(&ms);
181
182 // Output to widget
183 aboutWidget_->OpenFlipperAbout->append(tr("Physical Memory:\t")+ QString::number(ms.ullAvailPhys/1024/1024) + "MB/"+
184 QString::number(ms.ullTotalPhys/1024/1024) + "MB free ("+
185 QString::number(ms.dwMemoryLoad) + "%)");
186 aboutWidget_->OpenFlipperAbout->append(tr("Pagefile Memory:\t")+ QString::number(ms.ullAvailPageFile/1024/1024) + "MB/"
187 + QString::number(ms.ullTotalPageFile/1024/1024) + "MB free");
188
189
190 #elif defined ARCH_DARWIN
191
192 aboutWidget_->OpenFlipperAbout->append(tr("Not available for this platform (MacOS)"));
193
194
195 #else
196 unsigned long memory = 0;
197
198 struct mallinfo info;
199 info = mallinfo();
200
201 // add mmap-allocated memory
202 memory += info.hblkhd;
203
204 // add sbrk-allocated memory
205 memory += info.uordblks;
206
207 double mmapAllocated = double(info.hblkhd ) / 1024 / 1024;
208 double sbrkAllocated = double(info.uordblks) / 1024 / 1024;
209 double totalAllocated = double(memory) / 1024 / 1024;
210
211 double pageSize = double(getpagesize()) /1024 ;
212 double availablePages = double( sysconf (_SC_AVPHYS_PAGES) );
213 double freeMem = availablePages * pageSize / 1024;
214
215 aboutWidget_->OpenFlipperAbout->append(tr("Total Memory allocated:\t ") + QString::number(totalAllocated,'f' ,2 ) + tr("MB ")
216 + tr("( mmap: ") + QString::number(mmapAllocated ,'f' ,2 ) + tr("MB")
217 + tr(", sbrk: ") + QString::number(sbrkAllocated ,'f' ,2 ) + tr("MB )") );
218
219 aboutWidget_->OpenFlipperAbout->append(tr("Free Memory:\t\t ") + QString::number(freeMem,'f' ,2 ) + tr("MB ")
220 + tr("(") + QString::number(availablePages,'f' ,0 ) + tr(" pages of ")
221 + QString::number(pageSize,'f' ,2 ) + tr("KB size)"));
222
223 #endif
224
225 // =====================================================================================
226 // Memory infos
227 // =====================================================================================
228 aboutWidget_->OpenFlipperAbout->append("\n");
229 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
230 aboutWidget_->OpenFlipperAbout->append(tr("CPU Information:"));
231 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
232
233 #ifdef WIN32
234
235 QSettings registryCPU("HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor", QSettings::NativeFormat);
236
237 QStringList cpus = registryCPU.childGroups();
238 if ( cpus.size() != 0 ) {
239
240 aboutWidget_->OpenFlipperAbout->append(tr("CPU vendor:\t\t ") +
241 registryCPU.value( cpus[0]+"/VendorIdentifier", "Unknown" ).toString() );
242 aboutWidget_->OpenFlipperAbout->append(tr("CPU model:\t\t ") +
243 registryCPU.value( cpus[0]+"/ProcessorNameString", "Unknown" ).toString() );
244 aboutWidget_->OpenFlipperAbout->append(tr("CPU identifier:\t\t ") +
245 registryCPU.value( cpus[0]+"/Identifier", "Unknown" ).toString() );
246 aboutWidget_->OpenFlipperAbout->append(tr("CPU Speed:\t\t ") +
247 registryCPU.value( cpus[0]+"/~MHz", "Unknown" ).toString()+ " MHz" );
248
249 aboutWidget_->OpenFlipperAbout->append("CPU Cores:\t\t " + QString::number(cpus.size()));
250
251 } else {
252 aboutWidget_->OpenFlipperAbout->append(tr("Unable to retrieve CPU information"));
253 }
254
255 #elif defined ARCH_DARWIN
256
257
258 size_t lenCPU;
259 char *pCPU;
260
261 // First call to get required size
262 sysctlbyname("machdep.cpu.brand_string", NULL, &lenCPU, NULL, 0);
263
264 // allocate
265 pCPU = (char * )malloc(lenCPU);
266
267 // Second call to get data
268 sysctlbyname("machdep.cpu.brand_string", pCPU, &lenCPU, NULL, 0);
269
270 // Output
271 aboutWidget_->OpenFlipperAbout->append(tr("CPU Brand:\t\t ") + QString(pCPU) );
272
273 // free memory
274 free(pCPU);
275
276 int physicalCPUS = 0;
277
278 // Get data
279 lenCPU = sizeof(int);
280 sysctlbyname("hw.physicalcpu", &physicalCPUS, &lenCPU , NULL, 0);
281
282 // Output
283 aboutWidget_->OpenFlipperAbout->append(tr("Physical Cores:\t\t ") + QString::number(physicalCPUS) );
284
285 int logicalCPUS = 0;
286
287 // Get data
288 lenCPU = sizeof(int);
289 sysctlbyname("hw.logicalcpu", &logicalCPUS, &lenCPU, NULL, 0);
290
291 // Output
292 aboutWidget_->OpenFlipperAbout->append(tr("LogicalCores:\t\t ") + QString::number(logicalCPUS) );
293
294 #else
295 QFile cpuinfo("/proc/cpuinfo");
296 if (! cpuinfo.exists() )
297 aboutWidget_->OpenFlipperAbout->append(tr("Unable to retrieve CPU information"));
298 else {
299
300 cpuinfo.open(QFile::ReadOnly);
301 QTextStream stream(&cpuinfo);
302 QStringList splitted = stream.readAll().split("\n",QString::SkipEmptyParts);
303
304 int position = splitted.indexOf ( QRegExp("^vendor_id.*") );
305 if ( position != -1 ){
306 QString cpuVendor = splitted[position].section(':', -1).simplified();
307 aboutWidget_->OpenFlipperAbout->append(tr("CPU vendor:\t\t ") + cpuVendor );
308 } else {
309 aboutWidget_->OpenFlipperAbout->append(tr("CPU vendor:\t\t vendor specification not found"));
310 }
311
312 position = splitted.indexOf ( QRegExp("^model name.*") );
313 if ( position != -1 ){
314 QString cpuModel = splitted[position].section(':', -1).simplified();
315 aboutWidget_->OpenFlipperAbout->append(tr("CPU model:\t\t ") + cpuModel );
316 } else {
317 aboutWidget_->OpenFlipperAbout->append(tr("CPU model:\t\t Model specification not found"));
318 }
319
320 position = splitted.indexOf ( QRegExp("^cpu cores.*") );
321 if ( position != -1 ){
322 QString cpuCoresPhysical = splitted[position].section(':', -1).simplified();
323 aboutWidget_->OpenFlipperAbout->append(tr("Physical CPU cores:\t\t ") + cpuCoresPhysical );
324 } else {
325 aboutWidget_->OpenFlipperAbout->append(tr("Physical CPU cores:\t\t CPU Core specification not found"));
326 }
327
328 position = splitted.indexOf ( QRegExp("^siblings.*") );
329 if ( position != -1 ){
330 QString cpuCoresLogical = splitted[position].section(':', -1).simplified();
331 aboutWidget_->OpenFlipperAbout->append(tr("Logical CPU cores:\t\t ") + cpuCoresLogical );
332 } else {
333 aboutWidget_->OpenFlipperAbout->append(tr("Logical CPU cores:\t\t CPU Core specification not found"));
334 }
335
336 position = splitted.indexOf ( QRegExp("^flags.*") );
337 if ( position != -1 ){
338 QString cpuFlags = splitted[position].section(':', -1).simplified();
339 aboutWidget_->OpenFlipperAbout->append( tr("CPU capabilities:") );
340 aboutWidget_->OpenFlipperAbout->append( cpuFlags );
341 } else {
342 aboutWidget_->OpenFlipperAbout->append(tr("CPU capabilities:\t\t CPU flag specification not found"));
343 }
344
345 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
346 aboutWidget_->OpenFlipperAbout->append(tr("System is Big Endian"));
347 #endif
348
349 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
350 aboutWidget_->OpenFlipperAbout->append(tr("System is Little Endian"));
351 #endif
352
353 }
354
355 #endif
356
357 // =====================================================================================
358 // OS info
359 // =====================================================================================
360 aboutWidget_->OpenFlipperAbout->append("\n");
361 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
362 aboutWidget_->OpenFlipperAbout->append(tr("Operating System Info:"));
363 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
364
365 #ifdef WIN32
366 QSettings registryOS("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
367 aboutWidget_->OpenFlipperAbout->append(tr("Product Name:\t\t ") +
368 registryOS.value( "ProductName", "Unknown" ).toString() );
369 aboutWidget_->OpenFlipperAbout->append(tr("Current Version:\t\t ") +
370 registryOS.value( "CurrentVersion", "Unknown" ).toString() );
371 #elif defined ARCH_DARWIN
372
373 int mib[2];
374 size_t len;
375 char *p;
376
377 mib[0] = CTL_KERN;
378 mib[1] = KERN_VERSION;
379
380 sysctl(mib, 2, NULL, &len, NULL, 0);
381 p = (char * )malloc(len);
382 sysctl(mib, 2, p, &len, NULL, 0);
383
384 aboutWidget_->OpenFlipperAbout->append(tr("OS Version:\t\t ") + QString(p) );
385
386 free(p);
387
388 #else
389 QFile versionInfo("/proc/version");
390 if (! versionInfo.exists() )
391 aboutWidget_->OpenFlipperAbout->append(tr("Unable to retrieve Kernel information"));
392 else {
393 versionInfo.open(QFile::ReadOnly);
394 QTextStream versionStream(&versionInfo);
395 aboutWidget_->OpenFlipperAbout->append(tr("Kernel Version:\t\t ") + versionStream.readAll().simplified());
396
397 QString program = "/usr/bin/lsb_release";
398
399 QFile lsb(program);
400 if ( lsb.exists() ) {
401 QStringList arguments;
402 arguments << "-a";
403
404 QProcess myProcess;
405 myProcess.start(program, arguments);
406
407 if ( myProcess.waitForFinished ( 4000 ) ) {
408 QStringList outputLSB = QString(myProcess.readAllStandardOutput()).split('\n');
409
410
411 int position = outputLSB.indexOf ( QRegExp("^Distributor ID.*") );
412 if ( position != -1 ){
413 QString distributorID = outputLSB[position].section(':', -1).simplified();
414 aboutWidget_->OpenFlipperAbout->append(tr("Distributor ID:\t\t ") + distributorID );
415 } else {
416 aboutWidget_->OpenFlipperAbout->append(tr("Distributor ID:\t\t Unknown"));
417 }
418
419 position = outputLSB.indexOf ( QRegExp("^Description.*") );
420 if ( position != -1 ){
421 QString description = outputLSB[position].section(':', -1).simplified();
422 aboutWidget_->OpenFlipperAbout->append(tr("Description:\t\t ") + description );
423 } else {
424 aboutWidget_->OpenFlipperAbout->append(tr("Description:\t\t Unknown"));
425 }
426
427 position = outputLSB.indexOf ( QRegExp("^Release.*") );
428 if ( position != -1 ){
429 QString release = outputLSB[position].section(':', -1).simplified();
430 aboutWidget_->OpenFlipperAbout->append(tr("Release number:\t\t ") + release );
431 } else {
432 aboutWidget_->OpenFlipperAbout->append(tr("Release number:\t\t Unknown"));
433 }
434
435 position = outputLSB.indexOf ( QRegExp("^Codename.*") );
436 if ( position != -1 ){
437 QString codename = outputLSB[position].section(':', -1).simplified();
438 aboutWidget_->OpenFlipperAbout->append(tr("Codename:\t\t ") + codename );
439 } else {
440 aboutWidget_->OpenFlipperAbout->append(tr("Codename:\t\t Unknown"));
441 }
442
443 } else {
444 aboutWidget_->OpenFlipperAbout->append(tr("Unable to get LSB info"));
445 }
446
447 } else {
448 aboutWidget_->OpenFlipperAbout->append(tr("No additional information. Unable to get info via LSB."));
449 }
450
451 }
452 #endif
453
454 QString systemPathVariable = getenv("PATH");
455 aboutWidget_->OpenFlipperAbout->append(tr("System Path:\n ") + systemPathVariable);
456
457 #ifndef WIN32
458 QString systemLibraryPathVariable = getenv("LD_LIBRARY_PATH");
459 aboutWidget_->OpenFlipperAbout->append(tr("LD_LIBRARY_PATH:\n ") + systemLibraryPathVariable);
460 #endif
461
462
463
464 // =====================================================================================
465 // OpenGL Renderer/Vendor and version info
466 // =====================================================================================
467 aboutWidget_->OpenFlipperAbout->append("\n");
468 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
469 aboutWidget_->OpenFlipperAbout->append(tr("OpenGL Specific Info:"));
470 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
471
472 QString vendor = QString((const char*)glGetString(GL_VENDOR));
473 aboutWidget_->OpenFlipperAbout->append(tr("Qt reports Vendor:\t\t") + vendor);
474 QString renderer = QString((const char*)glGetString(GL_RENDERER));
475 aboutWidget_->OpenFlipperAbout->append(tr("Qt reports Renderer:\t\t") + renderer);
476
477 QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
478
479 QString openGLQtVersion = tr("Qt reports Version:\t\t");
480
481 if ( flags.testFlag(QGLFormat::OpenGL_Version_4_0) )
482 openGLQtVersion += tr("4.0 or higher") ;
483 else if (flags.testFlag(QGLFormat::OpenGL_Version_3_3))
484 openGLQtVersion += tr("3.3") ;
485 else if (flags.testFlag(QGLFormat::OpenGL_Version_3_2))
486 openGLQtVersion += tr("3.2") ;
487 else if (flags.testFlag(QGLFormat::OpenGL_Version_3_1))
488 openGLQtVersion += tr("3.1") ;
489 else if (flags.testFlag(QGLFormat::OpenGL_Version_3_0))
490 openGLQtVersion += tr("3.0") ;
491 else if (flags.testFlag(QGLFormat::OpenGL_Version_2_1))
492 openGLQtVersion += tr("2.1" );
493 else if (flags.testFlag(QGLFormat::OpenGL_Version_2_0))
494 openGLQtVersion += tr("2.0" );
495 else if (flags.testFlag(QGLFormat::OpenGL_Version_1_5))
496 openGLQtVersion += tr("1.5" );
497 else if (flags.testFlag(QGLFormat::OpenGL_Version_1_4))
498 openGLQtVersion += tr("1.4" );
499 else if (flags.testFlag(QGLFormat::OpenGL_Version_1_3))
500 openGLQtVersion += tr("1.3" );
501 else if (flags.testFlag(QGLFormat::OpenGL_Version_1_2))
502 openGLQtVersion += tr("1.2" );
503 else if (flags.testFlag(QGLFormat::OpenGL_Version_1_1))
504 openGLQtVersion += tr("1.1" );
505 else
506 openGLQtVersion += tr("Version:\tUNKNOWN!" );
507
508 aboutWidget_->OpenFlipperAbout->append(openGLQtVersion);
509
510 aboutWidget_->OpenFlipperAbout->append("\n");
511
512 const QGLContext* context = QGLContext::currentContext();
513 if (context) {
514 QString openGLprofile = tr("Qt reports the OpenGL profile:\t");
515 QGLFormat::OpenGLContextProfile profile = context->format().profile();
516 if (profile == QGLFormat::NoProfile)
517 openGLprofile += tr("no profile");
518 else if (profile == QGLFormat::CoreProfile)
519 openGLprofile += tr("Core profile");
520 else if (profile == QGLFormat::CompatibilityProfile)
521 openGLprofile += tr("Compatibility profile");
522 else
523 openGLprofile += tr("unknown profile");
524
525 aboutWidget_->OpenFlipperAbout->append(openGLprofile);
526 aboutWidget_->OpenFlipperAbout->append("\n");
527 }
528
529
530 QString openGLVendor = tr("GL reports Vendor:\t\t");
531 openGLVendor += QString((const char*)glGetString(GL_VENDOR));
532 aboutWidget_->OpenFlipperAbout->append(openGLVendor);
533
534 QString openGLRenderer = tr("GL reports Renderer:\t\t");
535 openGLRenderer += QString((const char*)glGetString(GL_RENDERER));
536 aboutWidget_->OpenFlipperAbout->append(openGLRenderer);
537
538 QString openGLGLVersion = tr("GL reports Version:\t\t");
539 openGLGLVersion += QString((const char*)glGetString(GL_VERSION));
540 aboutWidget_->OpenFlipperAbout->append(openGLGLVersion);
541
542 QString openGLShadingLanguageVersion = tr("GL reports Shading Language Version:\t");
543 openGLShadingLanguageVersion += QString((const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
544 aboutWidget_->OpenFlipperAbout->append(openGLShadingLanguageVersion);
545
546
547 // =====================================================================================
548 // OpenGL Extensions
549 // =====================================================================================
550 aboutWidget_->OpenFlipperAbout->append("\n");
551 aboutWidget_->OpenFlipperAbout->append(tr("Supported Extensions:"));
552 QString glExtensions = QString((const char*)glGetString(GL_EXTENSIONS));
553 aboutWidget_->OpenFlipperAbout->append(glExtensions);
554
555
556 // =====================================================================================
557 // OpenGL Properties
558 // =====================================================================================
559 aboutWidget_->OpenFlipperAbout->append("\n");
560 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
561 aboutWidget_->OpenFlipperAbout->append(tr("OpenGL Values:"));
562 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
563 GLint getBuffer[2];
564 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &getBuffer[0] );
565 aboutWidget_->OpenFlipperAbout->append(tr("Maximal Viewport size(GL_MAX_VIEWPORT_DIMS):\t\t\t\t ") + QString::number(getBuffer[0]) + "x" + QString::number(getBuffer[1]) );
566
567 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &getBuffer[0] );
568 aboutWidget_->OpenFlipperAbout->append(tr("Maximum supported texture image units(GL_MAX_TEXTURE_IMAGE_UNITS):\t") + QString::number(getBuffer[0]) );
569
570 // Check extension for NVIDIA memory information
571 if ( glExtensions.contains("GL_NVX_gpu_memory_info") ) {
572 // get total memory on gpu
573 GLint total_mem_kb = 0;
574 glGetIntegerv(GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &total_mem_kb);
575
576 aboutWidget_->OpenFlipperAbout->append(tr("GPU Memory (Total available):\t\t") + QString::number(total_mem_kb /1024) + " MB" );
577
578 // get currently available memory on gpu
579 GLint cur_avail_mem_kb = 0;
580 glGetIntegerv(GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &cur_avail_mem_kb);
581
582 aboutWidget_->OpenFlipperAbout->append(tr("GPU Memory (Currently available):\t") + QString::number(cur_avail_mem_kb / 1024) + " MB" );
583 }
584
585
586
587 aboutWidget_->OpenFlipperAbout->moveCursor(QTextCursor::Start);
588
589 // =====================================================================================
590 // glew Information
591 // =====================================================================================
592 #ifndef __APPLE__
593 aboutWidget_->OpenFlipperAbout->append("\n");
594 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
595 aboutWidget_->OpenFlipperAbout->append(tr("GLEW Specific Info:"));
596 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
597
598 QString glewVersion = QString(getGlewVersion());
599 aboutWidget_->OpenFlipperAbout->append(tr("GLEW Version:\t") + glewVersion);
600 #endif
601
602 // =====================================================================================
603 // Qt information
604 // =====================================================================================
605
606 aboutWidget_->OpenFlipperAbout->append("\n");
607 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
608 aboutWidget_->OpenFlipperAbout->append(tr("Qt Version Info:"));
609 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
610 aboutWidget_->OpenFlipperAbout->append(tr("Currently used Version:\t") + qVersion() );
611 aboutWidget_->OpenFlipperAbout->append(tr("Link time Version:\t\t") + QT_VERSION_STR );
612
613 QList<QByteArray> imageFormats = QImageReader::supportedImageFormats();
614 QString formatsString = "";
615 for ( int i = 0 ; i < imageFormats.size() ; ++i) {
616 formatsString += imageFormats[i] + " ";
617
618 if ( (i != 0) && (i % 15) == 0 )
619 formatsString+= "\n";
620 }
621
622 aboutWidget_->OpenFlipperAbout->append(tr("Supported image read formats:") );
623 aboutWidget_->OpenFlipperAbout->append(formatsString);
624
625 aboutWidget_->OpenFlipperAbout->append("\n");
626
627 aboutWidget_->OpenFlipperAbout->append(tr("Currently used Library paths:") );
628 QStringList libPaths = QCoreApplication::libraryPaths();
629 for(int i = 0 ; i < libPaths.size() ; ++i)
630 aboutWidget_->OpenFlipperAbout->append(" " + libPaths[i]);
631
632
633 // =========================================================
634 // Qt Documentation files
635 // =========================================================
636 /*
637 aboutWidget_->OpenFlipperAbout->append("\n");
638 aboutWidget_->OpenFlipperAbout->append(tr("Currently Loaded documentations:") );
639
640 QStringList registeredDocumentations = helpEngine_->registeredDocumentations ();
641
642 for ( int i = 0 ; i < registeredDocumentations.size(); ++i) {
643 QString documentationInfo = registeredDocumentations[i];
644 documentationInfo += " ";
645 documentationInfo += helpEngine_->documentationFileName(registeredDocumentations[i]);
646 aboutWidget_->OpenFlipperAbout->append(documentationInfo);
647 }
648 */
649 // =====================================================================================
650 // Compiler information
651 // =====================================================================================
652 aboutWidget_->OpenFlipperAbout->append("\n");
653 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
654 aboutWidget_->OpenFlipperAbout->append(tr("Compiler Info:"));
655 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
656 aboutWidget_->OpenFlipperAbout->append( OpenFlipper::Options::compilerInfo() );
657
658 QString definitions;
659
660 // Trying to check some defines:
661 #ifdef WIN32
662 definitions += "WIN32 ";
663 #endif
664
665 #ifdef WIN64
666 definitions += "WIN64 ";
667 #endif
668
669 #ifdef DLL
670 definitions += "DLL ";
671 #endif
672
673
674 #ifdef APPLE
675 definitions += "APPLE ";
676 #endif
677
678 #ifdef ARCH_DARWIN
679 definitions += "ARCH_DARWIN ";
680 #endif
681
682 #ifdef INCLUDE_TEMPLATES
683 definitions += "INCLUDE_TEMPLATES ";
684 #endif
685
686 #ifdef DEBUG
687 definitions += "DEBUG ";
688 #endif
689
690 #ifdef NDEBUG
691 definitions += "NDEBUG ";
692 #endif
693
694 #ifdef QT_NO_OPENGL
695 definitions += "QT_NO_OPENGL ";
696 #endif
697
698 #ifdef OPENMP
699 definitions += "OPENMP ";
700 #endif
701
702 #ifdef USE_OPENMP
703 definitions += "USE_OPENMP ";
704 #endif
705
706 aboutWidget_->OpenFlipperAbout->append( tr("Definitions (incomplete):\n") + definitions );
707
708 // =====================================================================================
709 // List the currently registered data types
710 // =====================================================================================
711 aboutWidget_->OpenFlipperAbout->append("\n");
712 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
713 aboutWidget_->OpenFlipperAbout->append(tr("Registered data types:"));
714 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
715
716 QString types;
717
718 // Iterate over all Types known to the core
719 // Start at 1:
720 // 0 type is defined as DATA_UNKNOWN
721 DataType currentType = 1;
722 for ( uint i = 0 ; i < typeCount() - 2 ; ++i) {
723 types += typeName( currentType ) + "\t\t typeId: " + QString::number(currentType.value()) + "\n";
724
725 // Advance to next type ( Indices are bits so multiply by to to get next bit)
726 ++currentType;
727 }
728
729 aboutWidget_->OpenFlipperAbout->append( types );
730
731 // =====================================================================================
732 // List The File Plugins with their filters
733 // =====================================================================================
734 aboutWidget_->OpenFlipperAbout->append("\n");
735 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
736 aboutWidget_->OpenFlipperAbout->append(tr("Registered File Plugins:"));
737 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
738
739 for ( uint i = 0 ; i < supportedTypes().size() ; ++i ) {
740 aboutWidget_->OpenFlipperAbout->setCurrentFont(boldFont);
741 aboutWidget_->OpenFlipperAbout->append( "\t" + supportedTypes()[i].name );
742 aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
743 aboutWidget_->OpenFlipperAbout->append( "\t\t Load: " + supportedTypes()[i].loadFilters );
744 aboutWidget_->OpenFlipperAbout->append( "\t\t Save: " + supportedTypes()[i].saveFilters );
745 }
746
747
748 aboutWidget_->show();
749
750 }
751 //=============================================================================
OpenFlipperSettings
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
Definition: GlobalOptions.cc:938
CoreWidget::additionalAboutTabs_
QMap< QString, QString > additionalAboutTabs_
Additional tab information, that could be provided by plugins.
Definition: CoreWidget.hh:1194
typeCount
DLLEXPORT size_t typeCount()
Get the number of registered types.
Definition: Types.cc:186
CoreWidget::aboutWidget_
AboutWidget * aboutWidget_
Pointer to the about widget.
Definition: CoreWidget.hh:1191
CoreWidget::addAboutInfo
void addAboutInfo(QString _text, QString _tabName)
Adds an entry to the about dialog.
Definition: About.cc:87
typeName
DLLEXPORT QString typeName(DataType _id)
Get the name of a type with given id.
Definition: Types.cc:165
AboutWidget
Definition: aboutWidget.hh:60
TOSTRING
#define TOSTRING(x)
QSettings object containing all program settings of OpenFlipper.
Definition: GlobalOptions.hh:168
CoreWidget::showAboutWidget
void showAboutWidget()
Display the about widget.
Definition: About.cc:91
FileTypes.hh
DataType::value
unsigned int value() const
Definition: Types.cc:423
DataType
Predefined datatypes.
Definition: DataTypes.hh:96
CoreWidget.hh