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.

161 lines
6.8KB

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