From b73555b7f3dc79454a7f358ca9a41e16338b370b Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 15 Jul 2007 16:43:24 +0000 Subject: [PATCH] Windows functions to get the amount of total and free memory. Patch by Huhn Put, thanks! CCMAIL: nhuh.put@web.de svn path=/trunk/KDE/kdegraphics/okular/; revision=688271 --- core/document.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/document.cpp b/core/document.cpp index 17f027d69..babcc4a3e 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -58,6 +58,10 @@ #include +#ifdef Q_OS_WIN +#include +#endif + using namespace Okular; static int OkularDebug = 4650; @@ -331,6 +335,12 @@ qulonglong DocumentPrivate::getTotalMemory() if ( entry.startsWith( "MemTotal:" ) ) return (cachedValue = (1024 * entry.section( ' ', -2, -2 ).toInt())); } +#elif defined(Q_OS_WIN) + MEMORYSTATUSEX stat; + + GlobalMemoryStatusEx (&stat); + + return stat.ullTotalPhys; #endif return (cachedValue = 134217728); } @@ -371,6 +381,12 @@ qulonglong DocumentPrivate::getFreeMemory() lastUpdate = QTime::currentTime(); return ( cachedValue = (1024 * memoryFree) ); +#elif defined(Q_OS_WIN) + MEMORYSTATUS stat; + + GlobalMemoryStatus (&stat); + + return stat.ullAvailPhys; #else // tell the memory is full.. will act as in LOW profile return 0; -- GitLab