diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-11-14 17:23:00 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-11-23 11:18:08 +0000 |
commit | 56a9594649872f4076b6891f917138d2b1e8d028 (patch) | |
tree | 2d14083e97fae7de29162e6002d6a7f2da08ffd3 /vcl | |
parent | 91cbbb7797f048834b51690e9fab60aa778b1e44 (diff) |
Update-check, expand to allow reporting of H/W and OS versions.
Off by default.
Expand config options to show the user agent used.
Re-use this to show more useful info in Help->About too.
Change-Id: I1044116ef9beeb341a537c0f4451dca54e198f67
Reviewed-on: https://gerrit.libreoffice.org/20098
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/app/geninst.cxx | 33 | ||||
-rw-r--r-- | vcl/inc/generic/geninst.h | 2 | ||||
-rw-r--r-- | vcl/inc/salinst.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/win/salinst.h | 2 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 32 | ||||
-rw-r--r-- | vcl/win/source/app/salinst.cxx | 40 |
6 files changed, 110 insertions, 2 deletions
diff --git a/vcl/generic/app/geninst.cxx b/vcl/generic/app/geninst.cxx index f481eb880b27..27923a1b56c0 100644 --- a/vcl/generic/app/geninst.cxx +++ b/vcl/generic/app/geninst.cxx @@ -20,6 +20,10 @@ #include <string.h> #include <stdlib.h> +#if defined(LINUX) +# include <stdio.h> +#endif + #include <osl/module.hxx> #include <comphelper/solarmutex.hxx> #include <vcl/opengl/OpenGLContext.hxx> @@ -128,4 +132,33 @@ SalGenericInstance::~SalGenericInstance() delete mpSalYieldMutex; } +OUString SalGenericInstance::getOSVersion() +{ + OUString aKernelVer = "unknown"; + +// not so generic, but at least shared between all unix backend +#if defined(LINUX) + FILE* pVersion = fopen( "/proc/version", "r" ); + if ( pVersion ) + { + char aVerBuffer[512]; + if ( fgets ( aVerBuffer, 511, pVersion ) ) + { + aKernelVer = OUString::createFromAscii( aVerBuffer ); + sal_Int32 nIndex = 0; + // "Linux version 3.16.7-29-desktop ..." + OUString aVers = aKernelVer.getToken( 2, ' ', nIndex ); + // "3.16.7-29-desktop ..." + sal_Int32 nTooDetailed = aVers.indexOf( '.', 2); + if (nTooDetailed < 1 || nTooDetailed > 8) + aKernelVer = "misparse"; + else // "3.16.7-29-desktop ..." + aKernelVer = aVers.copy(0, nTooDetailed); + } + fclose( pVersion ); + } +#endif + return aKernelVer; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/generic/geninst.h b/vcl/inc/generic/geninst.h index 0ebfd67f3957..5e7e61e0a50a 100644 --- a/vcl/inc/generic/geninst.h +++ b/vcl/inc/generic/geninst.h @@ -105,6 +105,8 @@ public: bool isPrinterInit() const { return mbPrinterInit; } virtual GenPspGraphics *CreatePrintGraphics() = 0; + virtual OUString getOSVersion() override; + // prolly belongs somewhere else ... just a font help static void RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection ); static int FetchFontSubstitutionFlags(); diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 8f1a4a595886..a5f8806a27de 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -172,6 +172,9 @@ public: virtual void updatePrinterUpdate() {} virtual void jobStartedPrinterUpdate() {} virtual void jobEndedPrinterUpdate() {} + + /// get information about underlying versions + virtual OUString getOSVersion() { return OUString("-"); } }; // called from SVMain diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h index 601159a26fb0..4c1bc7f7f055 100644 --- a/vcl/inc/win/salinst.h +++ b/vcl/inc/win/salinst.h @@ -82,6 +82,8 @@ public: virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) override; virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; + virtual OUString getOSVersion() override; + static int WorkaroundExceptionHandlingInUSER32Lib(int nExcept, LPEXCEPTION_POINTERS pExceptionInfo); }; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 7f490b603c87..e8cb62f865b5 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -51,6 +51,7 @@ #include "vcl/scheduler.hxx" #include "vcl/unohelp.hxx" #include "vcl/lazydelete.hxx" +#include "vcl/opengl/OpenGLWrapper.hxx" #include "salinst.hxx" #include "salframe.hxx" @@ -74,6 +75,7 @@ #include <cassert> #include <utility> +#include <thread> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -1162,6 +1164,36 @@ OUString Application::GetAppName() return OUString(); } +OUString Application::GetHWOSConfInfo() +{ + ImplSVData* pSVData = ImplGetSVData(); + OUStringBuffer aDetails; + + aDetails.append( "Threads " ); + aDetails.append( (sal_Int32) + std::thread::hardware_concurrency() ); + aDetails.append( "; " ); + + OUString aVersion; + if ( pSVData && pSVData->mpDefInst ) + aVersion = pSVData->mpDefInst->getOSVersion(); + else + aVersion = "-"; + + aDetails.append( "Ver: " ); + aDetails.append( aVersion ); + aDetails.append( "; " ); + + aDetails.append( "Render: " ); + if ( OpenGLWrapper::isVCLOpenGLEnabled() ) + aDetails.append( "GL" ); + else + aDetails.append( "default" ); + aDetails.append( "; " ); + + return aDetails.makeStringAndClear(); +} + void Application::SetDisplayName( const OUString& rName ) { ImplSVData* pSVData = ImplGetSVData(); diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 4ddf3a9e616c..fcb5a1581405 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -115,7 +115,7 @@ class SalYieldMutex : public comphelper::SolarMutex public: // for ImplSalYield() WinSalInstance* mpInstData; - sal_uLong mnCount; + sal_uLong mnCount; DWORD mnThreadId; public: @@ -125,7 +125,7 @@ public: virtual void release(); virtual bool tryToAcquire(); - sal_uLong GetAcquireCount( sal_uLong nThreadId ); + sal_uLong GetAcquireCount( sal_uLong nThreadId ); }; SalYieldMutex::SalYieldMutex( WinSalInstance* pInstData ) @@ -1114,4 +1114,40 @@ int WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POIN } #endif +OUString WinSalInstance::getOSVersion() +{ + SalData* pSalData = GetSalData(); + if ( !pSalData ) + return OUString("unknown"); + + WORD nMajor = 0, nMinor = 0; +#ifdef _WIN32_WINNT_WINBLUE + // Trying to hide the real version info behind an + // uber-lame non-forward-compatible, 'compatibility' API + // seems unlikely to help OS designers, or API users. + nMajor = 30; + while( !IsWindowsVersionOrGreater( nMajor, 0, 0 ) && nMajor > 0) + nMajor--; + nMinor = 30; + while( !IsWindowsVersionOrGreater( nMajor, nMinor, 0 ) && nMinor > 0) + nMinor--; +#else + OSVERSIONINFO aVersionInfo; + memset( &aVersionInfo, 0, sizeof( aVersionInfo ) ); + aVersionInfo.dwOSVersionInfoSize = sizeof( aVersionInfo ); + if ( GetVersionEx( &aVersionInfo ) ) + { + nMajor = aVersionInfo.dwMajorVersion; + nMinor = aVersionInfo.dwMinorVersion; + } +#endif + OUStringBuffer aVer; + aVer.append( "Windows " ); + aVer.append( (sal_Int32)nMajor ); + aVer.append( "." ); + aVer.append( (sal_Int32)nMinor ); + + return aVer.makeStringAndClear(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |