@@ -235,6 +235,8 @@ AboutDialog::~AboutDialog()
235
235
delete ui;
236
236
}
237
237
238
+ class SystemInfo {
239
+ public:
238
240
static QString getOperatingSystem ()
239
241
{
240
242
#if defined (Q_OS_WIN32)
@@ -278,6 +280,79 @@ static QString getOperatingSystem()
278
280
#endif
279
281
}
280
282
283
+ #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
284
+ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
285
+ #endif
286
+ static int getWordSizeOfOS ()
287
+ {
288
+ #if defined(Q_OS_WIN64)
289
+ return 64 ; // 64-bit process running on 64-bit windows
290
+ #elif defined(Q_OS_WIN32)
291
+
292
+ // determine if 32-bit process running on 64-bit windows in WOW64 emulation
293
+ // or 32-bit process running on 32-bit windows
294
+ // default bIsWow64 to FALSE for 32-bit process on 32-bit windows
295
+
296
+ BOOL bIsWow64 = FALSE ; // must default to FALSE
297
+
298
+ LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (
299
+ GetModuleHandle (" kernel32" ), " IsWow64Process" );
300
+
301
+ if (NULL != fnIsWow64Process) {
302
+ if (!fnIsWow64Process (GetCurrentProcess (), &bIsWow64)) {
303
+ assert (false ); // something went majorly wrong
304
+ }
305
+ }
306
+ return bIsWow64 ? 64 : 32 ;
307
+
308
+ #elif defined (Q_OS_LINUX)
309
+ // http://stackoverflow.com/questions/246007/how-to-determine-whether-a-given-linux-is-32-bit-or-64-bit
310
+ QString exe (QLatin1String (" getconf" ));
311
+ QStringList args;
312
+ args << QLatin1String (" LONG_BIT" );
313
+ QProcess proc;
314
+ proc.setEnvironment (QProcess::systemEnvironment ());
315
+ proc.start (exe, args);
316
+ if (proc.waitForStarted () && proc.waitForFinished ()) {
317
+ QByteArray info = proc.readAll ();
318
+ return info.toInt ();
319
+ }
320
+
321
+ return 0 ; // failed
322
+
323
+ #elif defined (Q_OS_UNIX) || defined (Q_OS_MAC)
324
+ QString exe (QLatin1String (" uname" ));
325
+ QStringList args;
326
+ args << QLatin1String (" -m" );
327
+ QProcess proc;
328
+ proc.setEnvironment (QProcess::systemEnvironment ());
329
+ proc.start (exe, args);
330
+ if (proc.waitForStarted () && proc.waitForFinished ()) {
331
+ QByteArray info = proc.readAll ();
332
+ info.replace (' \n ' ," " );
333
+ if (info.indexOf (" x86_64" ) >= 0 )
334
+ return 64 ;
335
+ else if (info.indexOf (" amd64" ) >= 0 )
336
+ return 64 ;
337
+ else if (info.indexOf (" ia64" ) >= 0 )
338
+ return 64 ;
339
+ else if (info.indexOf (" ppc64" ) >= 0 )
340
+ return 64 ;
341
+ else if (info.indexOf (" i386" ) >= 0 )
342
+ return 32 ;
343
+ else if (info.indexOf (" i686" ) >= 0 )
344
+ return 32 ;
345
+ else if (info.indexOf (" x86" ) >= 0 )
346
+ return 32 ;
347
+ }
348
+
349
+ return 0 ; // failed
350
+ #else
351
+ return 0 ; // unknown
352
+ #endif
353
+ }
354
+ };
355
+
281
356
void AboutDialog::setupLabels ()
282
357
{
283
358
// fonts are rendered smaller on Mac so point size can't be the same for all platforms
@@ -320,7 +395,7 @@ void AboutDialog::setupLabels()
320
395
ui->labelBuildDate ->setText (date);
321
396
322
397
QString os = ui->labelBuildOS ->text ();
323
- os.replace (QString::fromAscii (" Unknown" ), getOperatingSystem ());
398
+ os.replace (QString::fromAscii (" Unknown" ), SystemInfo:: getOperatingSystem ());
324
399
ui->labelBuildOS ->setText (os);
325
400
326
401
QString platform = ui->labelBuildPlatform ->text ();
@@ -409,12 +484,17 @@ void AboutDialog::on_copyButton_clicked()
409
484
QTextStream str (&data);
410
485
std::map<std::string, std::string>& config = App::Application::Config ();
411
486
std::map<std::string,std::string>::iterator it;
487
+ QString exe = QString::fromAscii (App::GetApplication ().getExecutableName ());
412
488
413
489
QString major = QString::fromAscii (config[" BuildVersionMajor" ].c_str ());
414
490
QString minor = QString::fromAscii (config[" BuildVersionMinor" ].c_str ());
415
491
QString build = QString::fromAscii (config[" BuildRevision" ].c_str ());
416
- str << " OS: " << getOperatingSystem () << endl;
417
- str << " Word size: " << QSysInfo::WordSize << " -bit" << endl;
492
+ str << " OS: " << SystemInfo::getOperatingSystem () << endl;
493
+ int wordSize = SystemInfo::getWordSizeOfOS ();
494
+ if (wordSize > 0 ) {
495
+ str << " Word size of OS: " << wordSize << " -bit" << endl;
496
+ }
497
+ str << " Word size of " << exe << " : " << QSysInfo::WordSize << " -bit" << endl;
418
498
str << " Version: " << major << " ." << minor << " ." << build << endl;
419
499
it = config.find (" BuildRevisionBranch" );
420
500
if (it != config.end ())
0 commit comments