The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
7.2KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #include "jucedemo_headers.h"
  18. #include "MainDemoWindow.h"
  19. //==============================================================================
  20. class JUCEDemoApplication : public JUCEApplication
  21. {
  22. public:
  23. //==============================================================================
  24. JUCEDemoApplication()
  25. {
  26. }
  27. ~JUCEDemoApplication()
  28. {
  29. }
  30. //==============================================================================
  31. void initialise (const String& /*commandLine*/)
  32. {
  33. #if JUCE_IOS || JUCE_ANDROID
  34. theMainWindow.setVisible (true);
  35. theMainWindow.setFullScreen (true);
  36. #else
  37. theMainWindow.centreWithSize (700, 600);
  38. theMainWindow.setVisible (true);
  39. #endif
  40. // this little function just demonstrates a few system info calls
  41. Logger::outputDebugString (collectSomeSystemInfo());
  42. /* on return from this method, the app will go into its the main event
  43. dispatch loop, and this will run until something calls
  44. JUCEAppliction::quit().
  45. In this case, JUCEAppliction::quit() will be called by the
  46. demo window when the user clicks on its close button.
  47. */
  48. }
  49. void shutdown()
  50. {
  51. // This method is where your app should do any cleaning-up that's needed
  52. // before being shut down.
  53. }
  54. //==============================================================================
  55. const String getApplicationName()
  56. {
  57. // When you use the Jucer to auto-generate a project, it puts the project's name and version in
  58. // this constant, so we can use that here as our return value. Alternatively you can return
  59. // your own string here, of course.
  60. return ProjectInfo::projectName;
  61. }
  62. const String getApplicationVersion()
  63. {
  64. // When you use the Jucer to auto-generate a project, it puts the project's name and version in
  65. // this constant, so we can use that here as our return value. Alternatively you can return
  66. // your own string here, of course.
  67. return ProjectInfo::versionString;
  68. }
  69. bool moreThanOneInstanceAllowed()
  70. {
  71. return true;
  72. }
  73. void anotherInstanceStarted (const String& /*commandLine*/)
  74. {
  75. // This will get called if the user launches another copy of the app, but
  76. // there's nothing that the demo app needs to do here.
  77. }
  78. private:
  79. // This is the main demo window component.
  80. MainDemoWindow theMainWindow;
  81. //==============================================================================
  82. // this little function just demonstrates a few system info calls
  83. static String collectSomeSystemInfo()
  84. {
  85. String systemInfo;
  86. systemInfo
  87. << "Time and date: " << Time::getCurrentTime().toString (true, true) << newLine
  88. << "User logon name: " << SystemStats::getLogonName() << newLine
  89. << "Full user name: " << SystemStats::getFullUserName() << newLine
  90. << "Host name: " << SystemStats::getComputerName() << newLine
  91. << "Operating system: " << SystemStats::getOperatingSystemName() << newLine
  92. << "Locale: " << SystemStats::getUserLanguage() << "-" << SystemStats::getUserRegion() << newLine
  93. << "Memory size: " << SystemStats::getMemorySizeInMegabytes() << "MB" << newLine
  94. << "Number of CPUs: " << SystemStats::getNumCpus() << newLine
  95. << "CPU vendor: " << SystemStats::getCpuVendor() << newLine
  96. << "CPU speed: " << SystemStats::getCpuSpeedInMegaherz() << "MHz" << newLine
  97. << "CPU has MMX: " << (SystemStats::hasMMX() ? "yes" : "no") << newLine
  98. << "CPU has SSE: " << (SystemStats::hasSSE() ? "yes" : "no") << newLine
  99. << "CPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no") << newLine
  100. << "CPU has SSE3: " << (SystemStats::hasSSE3() ? "yes" : "no") << newLine
  101. << "CPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no") << newLine
  102. << "Found network card MAC addresses: " << getMacAddressList() << newLine
  103. << "Found IP addresses: " << getIPAddressList() << newLine
  104. << "Current working directory: " << File::getCurrentWorkingDirectory().getFullPathName() << newLine
  105. << "Current executable file: " << File::getSpecialLocation (File::currentExecutableFile).getFullPathName() << newLine
  106. << "Current application file: " << File::getSpecialLocation (File::currentApplicationFile).getFullPathName() << newLine
  107. << "User home directory: " << File::getSpecialLocation (File::userHomeDirectory).getFullPathName() << newLine
  108. << "User documents directory: " << File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName() << newLine
  109. << "User application data directory: " << File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName() << newLine
  110. << "Common application data directory: " << File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName() << newLine
  111. << "Temp directory: " << File::getSpecialLocation (File::tempDirectory).getFullPathName() << newLine
  112. << newLine;
  113. return systemInfo;
  114. }
  115. static String getMacAddressList()
  116. {
  117. Array <MACAddress> macAddresses;
  118. MACAddress::findAllAddresses (macAddresses);
  119. StringArray addressStrings;
  120. for (int i = 0; i < macAddresses.size(); ++i)
  121. addressStrings.add (macAddresses[i].toString());
  122. return addressStrings.joinIntoString (", ");
  123. }
  124. static String getIPAddressList()
  125. {
  126. Array <IPAddress> addresses;
  127. IPAddress::findAllAddresses (addresses);
  128. StringArray addressStrings;
  129. for (int i = 0; i < addresses.size(); ++i)
  130. addressStrings.add (addresses[i].toString());
  131. return addressStrings.joinIntoString (", ");
  132. }
  133. };
  134. //==============================================================================
  135. /*
  136. This macro creates the application's main() function..
  137. */
  138. START_JUCE_APPLICATION (JUCEDemoApplication)