| @@ -119,16 +119,18 @@ private: | |||||
| String systemInfo; | String systemInfo; | ||||
| systemInfo | systemInfo | ||||
| << T("Time and date: ") << Time::getCurrentTime().toString (true, true) | |||||
| << T("\nOperating system: ") << SystemStats::getOperatingSystemName() | |||||
| << T("\nCPU vendor: ") << SystemStats::getCpuVendor() | |||||
| << T("\nCPU speed: ") << SystemStats::getCpuSpeedInMegaherz() << T("MHz\n") | |||||
| << T("\nNumber of CPUs: ") << SystemStats::getNumCpus() | |||||
| << T("\nCPU has MMX: ") << (SystemStats::hasMMX() ? T("yes") : T("no")) | |||||
| << T("\nCPU has SSE: ") << (SystemStats::hasSSE() ? T("yes") : T("no")) | |||||
| << T("\nCPU has SSE2: ") << (SystemStats::hasSSE2() ? T("yes") : T("no")) | |||||
| << T("\nCPU has 3DNOW: ") << (SystemStats::has3DNow() ? T("yes") : T("no")) | |||||
| << T("\nMemory size: ") << SystemStats::getMemorySizeInMegabytes() << T("MB\n"); | |||||
| << "Time and date: " << Time::getCurrentTime().toString (true, true) | |||||
| << "\nUser logon name: " << SystemStats::getLogonName() | |||||
| << "\nFull user name: " << SystemStats::getFullUserName() | |||||
| << "\nOperating system: " << SystemStats::getOperatingSystemName() | |||||
| << "\nCPU vendor: " << SystemStats::getCpuVendor() | |||||
| << "\nCPU speed: " << SystemStats::getCpuSpeedInMegaherz() << "MHz\n" | |||||
| << "\nNumber of CPUs: " << SystemStats::getNumCpus() | |||||
| << "\nCPU has MMX: " << (SystemStats::hasMMX() ? "yes" : "no") | |||||
| << "\nCPU has SSE: " << (SystemStats::hasSSE() ? "yes" : "no") | |||||
| << "\nCPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no") | |||||
| << "\nCPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no") | |||||
| << "\nMemory size: " << SystemStats::getMemorySizeInMegabytes() << "MB\n"; | |||||
| int64 macAddresses[8]; | int64 macAddresses[8]; | ||||
| const int numAddresses = SystemStats::getMACAddresses (macAddresses, 8, false); | const int numAddresses = SystemStats::getMACAddresses (macAddresses, 8, false); | ||||
| @@ -136,7 +138,7 @@ private: | |||||
| for (int i = 0; i < numAddresses; ++i) | for (int i = 0; i < numAddresses; ++i) | ||||
| { | { | ||||
| systemInfo | systemInfo | ||||
| << T("Found network card MAC address: ") | |||||
| << "Found network card MAC address: " | |||||
| << String::formatted (T("%02x-%02x-%02x-%02x-%02x-%02x\n"), | << String::formatted (T("%02x-%02x-%02x-%02x-%02x-%02x\n"), | ||||
| 0xff & (int) (macAddresses [i] >> 40), | 0xff & (int) (macAddresses [i] >> 40), | ||||
| 0xff & (int) (macAddresses [i] >> 32), | 0xff & (int) (macAddresses [i] >> 32), | ||||
| @@ -147,21 +149,21 @@ private: | |||||
| } | } | ||||
| systemInfo | systemInfo | ||||
| << T("Current executable file: ") | |||||
| << "Current executable file: " | |||||
| << File::getSpecialLocation (File::currentExecutableFile).getFullPathName() | << File::getSpecialLocation (File::currentExecutableFile).getFullPathName() | ||||
| << T("\nCurrent application file: ") | |||||
| << "\nCurrent application file: " | |||||
| << File::getSpecialLocation (File::currentApplicationFile).getFullPathName() | << File::getSpecialLocation (File::currentApplicationFile).getFullPathName() | ||||
| << T("\nUser home directory: ") | |||||
| << "\nUser home directory: " | |||||
| << File::getSpecialLocation (File::userHomeDirectory).getFullPathName() | << File::getSpecialLocation (File::userHomeDirectory).getFullPathName() | ||||
| << T("\nUser documents directory: ") | |||||
| << "\nUser documents directory: " | |||||
| << File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName() | << File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName() | ||||
| << T("\nUser application data directory: ") | |||||
| << "\nUser application data directory: " | |||||
| << File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName() | << File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName() | ||||
| << T("\nCommon application data directory: ") | |||||
| << "\nCommon application data directory: " | |||||
| << File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName() | << File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName() | ||||
| << T("\nTemp directory: ") | |||||
| << "\nTemp directory: " | |||||
| << File::getSpecialLocation (File::tempDirectory).getFullPathName() | << File::getSpecialLocation (File::tempDirectory).getFullPathName() | ||||
| << T("\n\n"); | |||||
| << "\n\n"; | |||||
| return systemInfo; | return systemInfo; | ||||
| } | } | ||||
| @@ -212409,6 +212409,20 @@ int SystemStats::getPageSize() throw() | |||||
| return systemInfo.dwPageSize; | return systemInfo.dwPageSize; | ||||
| } | } | ||||
| const String SystemStats::getLogonName() | |||||
| { | |||||
| TCHAR text [256]; | |||||
| DWORD len = numElementsInArray (text) - 2; | |||||
| zerostruct (text); | |||||
| GetUserName (text, &len); | |||||
| return String (text, len); | |||||
| } | |||||
| const String SystemStats::getFullUserName() | |||||
| { | |||||
| return getLogonName(); | |||||
| } | |||||
| #endif | #endif | ||||
| /********* End of inlined file: juce_win32_SystemStats.cpp *********/ | /********* End of inlined file: juce_win32_SystemStats.cpp *********/ | ||||
| @@ -230238,6 +230252,25 @@ int SystemStats::getNumCpus() throw() | |||||
| return lastCpu + 1; | return lastCpu + 1; | ||||
| } | } | ||||
| const String SystemStats::getLogonName() | |||||
| { | |||||
| const char* user = getenv ("USER"); | |||||
| if (user == 0) | |||||
| { | |||||
| struct passwd* const pw = getpwuid (getuid()); | |||||
| if (pw != 0) | |||||
| user = pw->pw_name; | |||||
| } | |||||
| return String::fromUTF8 ((const uint8*) user); | |||||
| } | |||||
| const String SystemStats::getFullUserName() | |||||
| { | |||||
| return getLogonName(); | |||||
| } | |||||
| void SystemStats::initialiseStats() throw() | void SystemStats::initialiseStats() throw() | ||||
| { | { | ||||
| // Process starts off as root when running suid | // Process starts off as root when running suid | ||||
| @@ -237564,6 +237597,16 @@ int SystemStats::getNumCpus() throw() | |||||
| #endif | #endif | ||||
| } | } | ||||
| const String SystemStats::getLogonName() | |||||
| { | |||||
| return nsStringToJuce (NSUserName()); | |||||
| } | |||||
| const String SystemStats::getFullUserName() | |||||
| { | |||||
| return nsStringToJuce (NSFullUserName()); | |||||
| } | |||||
| uint32 juce_millisecondsSinceStartup() throw() | uint32 juce_millisecondsSinceStartup() throw() | ||||
| { | { | ||||
| return (uint32) (mach_absolute_time() * highResTimerToMillisecRatio); | return (uint32) (mach_absolute_time() * highResTimerToMillisecRatio); | ||||
| @@ -7088,6 +7088,10 @@ public: | |||||
| static bool isOperatingSystem64Bit() throw(); | static bool isOperatingSystem64Bit() throw(); | ||||
| static const String getLogonName(); | |||||
| static const String getFullUserName(); | |||||
| // CPU and memory information.. | // CPU and memory information.. | ||||
| static int getCpuSpeedInMegaherz() throw(); | static int getCpuSpeedInMegaherz() throw(); | ||||
| @@ -86,6 +86,18 @@ public: | |||||
| */ | */ | ||||
| static bool isOperatingSystem64Bit() throw(); | static bool isOperatingSystem64Bit() throw(); | ||||
| //============================================================================== | |||||
| /** Returns the current user's name, if available. | |||||
| @see getFullUserName() | |||||
| */ | |||||
| static const String getLogonName(); | |||||
| /** Returns the current user's full name, if available. | |||||
| On some OSes, this may just return the same value as getLogonName(). | |||||
| @see getLogonName() | |||||
| */ | |||||
| static const String getFullUserName(); | |||||
| //============================================================================== | //============================================================================== | ||||
| // CPU and memory information.. | // CPU and memory information.. | ||||
| @@ -116,26 +116,26 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| CodeDocument::Iterator::Iterator (CodeDocument* const document_) | CodeDocument::Iterator::Iterator (CodeDocument* const document_) | ||||
| : document (document_), | : document (document_), | ||||
| currentLine (document_->lines[0]), | |||||
| line (0), | line (0), | ||||
| position (0), | |||||
| currentLine (document_->lines[0]) | |||||
| position (0) | |||||
| { | { | ||||
| } | } | ||||
| CodeDocument::Iterator::Iterator (const CodeDocument::Iterator& other) | CodeDocument::Iterator::Iterator (const CodeDocument::Iterator& other) | ||||
| : document (other.document), | : document (other.document), | ||||
| currentLine (other.currentLine), | |||||
| line (other.line), | line (other.line), | ||||
| position (other.position), | |||||
| currentLine (other.currentLine) | |||||
| position (other.position) | |||||
| { | { | ||||
| } | } | ||||
| const CodeDocument::Iterator& CodeDocument::Iterator::operator= (const CodeDocument::Iterator& other) throw() | const CodeDocument::Iterator& CodeDocument::Iterator::operator= (const CodeDocument::Iterator& other) throw() | ||||
| { | { | ||||
| document = other.document; | document = other.document; | ||||
| currentLine = other.currentLine; | |||||
| line = other.line; | line = other.line; | ||||
| position = other.position; | position = other.position; | ||||
| currentLine = other.currentLine; | |||||
| return *this; | return *this; | ||||
| } | } | ||||
| @@ -214,6 +214,25 @@ int SystemStats::getNumCpus() throw() | |||||
| return lastCpu + 1; | return lastCpu + 1; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const String SystemStats::getLogonName() | |||||
| { | |||||
| const char* user = getenv ("USER"); | |||||
| if (user == 0) | |||||
| { | |||||
| struct passwd* const pw = getpwuid (getuid()); | |||||
| if (pw != 0) | |||||
| user = pw->pw_name; | |||||
| } | |||||
| return String::fromUTF8 ((const uint8*) user); | |||||
| } | |||||
| const String SystemStats::getFullUserName() | |||||
| { | |||||
| return getLogonName(); | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| void SystemStats::initialiseStats() throw() | void SystemStats::initialiseStats() throw() | ||||
| @@ -218,6 +218,17 @@ int SystemStats::getNumCpus() throw() | |||||
| #endif | #endif | ||||
| } | } | ||||
| //============================================================================== | |||||
| const String SystemStats::getLogonName() | |||||
| { | |||||
| return nsStringToJuce (NSUserName()); | |||||
| } | |||||
| const String SystemStats::getFullUserName() | |||||
| { | |||||
| return nsStringToJuce (NSFullUserName()); | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| uint32 juce_millisecondsSinceStartup() throw() | uint32 juce_millisecondsSinceStartup() throw() | ||||
| { | { | ||||
| @@ -390,4 +390,20 @@ int SystemStats::getPageSize() throw() | |||||
| return systemInfo.dwPageSize; | return systemInfo.dwPageSize; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const String SystemStats::getLogonName() | |||||
| { | |||||
| TCHAR text [256]; | |||||
| DWORD len = numElementsInArray (text) - 2; | |||||
| zerostruct (text); | |||||
| GetUserName (text, &len); | |||||
| return String (text, len); | |||||
| } | |||||
| const String SystemStats::getFullUserName() | |||||
| { | |||||
| return getLogonName(); | |||||
| } | |||||
| #endif | #endif | ||||