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