| 58 | } |
| 59 | |
| 60 | unsigned int systemMemorySizeInMB() |
| 61 | { |
| 62 | static unsigned int memorySizeInMB; |
| 63 | if (!memorySizeInMB) |
| 64 | { |
| 65 | // Fetch size of main memory - assume 2 GB first. |
| 66 | // Unfortunately there is no Qt API for doing this so this is platform dependent. |
| 67 | memorySizeInMB = 2 << 10; |
| 68 | #ifdef Q_OS_MAC |
| 69 | int mib[2] = {CTL_HW, HW_MEMSIZE}; |
| 70 | u_int namelen = sizeof(mib) / sizeof(mib[0]); |
| 71 | uint64_t size; |
| 72 | size_t len = sizeof(size); |
| 73 | |
| 74 | if (sysctl(mib, namelen, &size, &len, NULL, 0) == 0) |
| 75 | memorySizeInMB = size >> 20; |
| 76 | #elif defined Q_OS_UNIX |
| 77 | long pages = sysconf(_SC_PHYS_PAGES); |
| 78 | long page_size = sysconf(_SC_PAGE_SIZE); |
| 79 | memorySizeInMB = (pages * page_size) >> 20; |
| 80 | #elif defined Q_OS_WIN32 |
| 81 | MEMORYSTATUSEX status; |
| 82 | status.dwLength = sizeof(status); |
| 83 | GlobalMemoryStatusEx(&status); |
| 84 | memorySizeInMB = status.ullTotalPhys >> 20; |
| 85 | #endif |
| 86 | } |
| 87 | return memorySizeInMB; |
| 88 | } |
| 89 | |
| 90 | QStringList getThemeNameList() |
| 91 | { |
no outgoing calls
no test coverage detected