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.

157 lines
6.5KB

  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 const String collectSomeSystemInfo()
  85. {
  86. String systemInfo;
  87. systemInfo
  88. << "Time and date: " << Time::getCurrentTime().toString (true, true)
  89. << "\nUser logon name: " << SystemStats::getLogonName()
  90. << "\nFull user name: " << SystemStats::getFullUserName()
  91. << "\nHost name: " << SystemStats::getComputerName()
  92. << "\nOperating system: " << SystemStats::getOperatingSystemName()
  93. << "\nCPU vendor: " << SystemStats::getCpuVendor()
  94. << "\nCPU speed: " << SystemStats::getCpuSpeedInMegaherz() << "MHz"
  95. << "\nNumber of CPUs: " << SystemStats::getNumCpus()
  96. << "\nCPU has MMX: " << (SystemStats::hasMMX() ? "yes" : "no")
  97. << "\nCPU has SSE: " << (SystemStats::hasSSE() ? "yes" : "no")
  98. << "\nCPU has SSE2: " << (SystemStats::hasSSE2() ? "yes" : "no")
  99. << "\nCPU has 3DNOW: " << (SystemStats::has3DNow() ? "yes" : "no")
  100. << "\nMemory size: " << SystemStats::getMemorySizeInMegabytes() << "MB"
  101. << "\nFound network card MAC addresses: " << getMacAddressList()
  102. << "\nCurrent executable file: " << File::getSpecialLocation (File::currentExecutableFile).getFullPathName()
  103. << "\nCurrent application file: " << File::getSpecialLocation (File::currentApplicationFile).getFullPathName()
  104. << "\nCurrent working directory: " << File::getCurrentWorkingDirectory().getFullPathName()
  105. << "\nUser home directory: " << File::getSpecialLocation (File::userHomeDirectory).getFullPathName()
  106. << "\nUser documents directory: " << File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName()
  107. << "\nUser application data directory: " << File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName()
  108. << "\nCommon application data directory: " << File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName()
  109. << "\nTemp directory: " << File::getSpecialLocation (File::tempDirectory).getFullPathName()
  110. << "\n\n";
  111. return systemInfo;
  112. }
  113. static const 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)