Commit b73555b7 authored by Pino Toscano's avatar Pino Toscano
Browse files

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
parent 905f6c09
...@@ -58,6 +58,10 @@ ...@@ -58,6 +58,10 @@
#include <config-okular.h> #include <config-okular.h>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
using namespace Okular; using namespace Okular;
static int OkularDebug = 4650; static int OkularDebug = 4650;
...@@ -331,6 +335,12 @@ qulonglong DocumentPrivate::getTotalMemory() ...@@ -331,6 +335,12 @@ qulonglong DocumentPrivate::getTotalMemory()
if ( entry.startsWith( "MemTotal:" ) ) if ( entry.startsWith( "MemTotal:" ) )
return (cachedValue = (1024 * entry.section( ' ', -2, -2 ).toInt())); return (cachedValue = (1024 * entry.section( ' ', -2, -2 ).toInt()));
} }
#elif defined(Q_OS_WIN)
MEMORYSTATUSEX stat;
GlobalMemoryStatusEx (&stat);
return stat.ullTotalPhys;
#endif #endif
return (cachedValue = 134217728); return (cachedValue = 134217728);
} }
...@@ -371,6 +381,12 @@ qulonglong DocumentPrivate::getFreeMemory() ...@@ -371,6 +381,12 @@ qulonglong DocumentPrivate::getFreeMemory()
lastUpdate = QTime::currentTime(); lastUpdate = QTime::currentTime();
return ( cachedValue = (1024 * memoryFree) ); return ( cachedValue = (1024 * memoryFree) );
#elif defined(Q_OS_WIN)
MEMORYSTATUS stat;
GlobalMemoryStatus (&stat);
return stat.ullAvailPhys;
#else #else
// tell the memory is full.. will act as in LOW profile // tell the memory is full.. will act as in LOW profile
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment