From 76ce63da64be5360fa25401789b14a6cceacb0e8 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Sun, 30 Dec 2018 20:24:00 -0800 Subject: [PATCH] Can read graphics card type. --- interface/src/Application.cpp | 4 ++++ interface/src/Application.h | 3 ++- interface/src/scripting/PlatformInfoScriptingInterface.cpp | 7 ++++++- interface/src/scripting/PlatformInfoScriptingInterface.h | 7 +++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 56130160c4..503e974f24 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -8931,6 +8931,10 @@ void Application::copyToClipboard(const QString& text) { QApplication::clipboard()->setText(text); } +QString Application::getGraphicsCardType() { + return GPUIdent::getInstance()->getName(); +} + #if defined(Q_OS_ANDROID) void Application::beforeEnterBackground() { auto nodeList = DependencyManager::get(); diff --git a/interface/src/Application.h b/interface/src/Application.h index fd45a594b5..66667518fc 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -459,6 +459,8 @@ public slots: void changeViewAsNeeded(float boomLength); + QString Application::getGraphicsCardType(); + private slots: void onDesktopRootItemCreated(QQuickItem* qmlContext); void onDesktopRootContextCreated(QQmlContext* qmlContext); @@ -787,6 +789,5 @@ private: bool _showTrackedObjects { false }; bool _prevShowTrackedObjects { false }; - }; #endif // hifi_Application_h diff --git a/interface/src/scripting/PlatformInfoScriptingInterface.cpp b/interface/src/scripting/PlatformInfoScriptingInterface.cpp index 3ffb00e4b8..7f5ee3e08a 100644 --- a/interface/src/scripting/PlatformInfoScriptingInterface.cpp +++ b/interface/src/scripting/PlatformInfoScriptingInterface.cpp @@ -6,8 +6,9 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include "PlatformInfoScriptingInterface.h" +#include "Application.h" -# include +#include #ifdef Q_OS_WIN #include @@ -69,4 +70,8 @@ int PlatformInfoScriptingInterface::getTotalSystemMemoryMB() { #else return -1; #endif +} + +QString PlatformInfoScriptingInterface::getGraphicsCardType() { + return qApp->getGraphicsCardType(); } \ No newline at end of file diff --git a/interface/src/scripting/PlatformInfoScriptingInterface.h b/interface/src/scripting/PlatformInfoScriptingInterface.h index f0b8122fa5..903658cc20 100644 --- a/interface/src/scripting/PlatformInfoScriptingInterface.h +++ b/interface/src/scripting/PlatformInfoScriptingInterface.h @@ -46,6 +46,13 @@ public slots: * @returns {int} size of memory in megabytes */ int getTotalSystemMemoryMB(); + + /**jsdoc + * Returns the graphics card type + * @function Test.getGraphicsCardType + * @returns {string} graphics card type + */ + QString getGraphicsCardType(); }; #endif // hifi_PlatformInfoScriptingInterface_h