AvCaster.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*\
  2. |*| Copyright 2015 bill-auger <https://github.com/bill-auger/av-caster/issues>
  3. |*|
  4. |*| This file is part of the AvCaster program.
  5. |*|
  6. |*| AvCaster is free software: you can redistribute it and/or modify
  7. |*| it under the terms of the GNU Lesser General Public License version 3
  8. |*| as published by the Free Software Foundation.
  9. |*|
  10. |*| AvCaster is distributed in the hope that it will be useful,
  11. |*| but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. |*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. |*| GNU Lesser General Public License for more details.
  14. |*|
  15. |*| You should have received a copy of the GNU Lesser General Public License
  16. |*| along with AvCaster. If not, see <http://www.gnu.org/licenses/>.
  17. \*/
  18. #ifndef _AVCASTER_H_
  19. #define _AVCASTER_H_
  20. #include "Constants.h"
  21. #include "AvCasterStore.h"
  22. #include "MainContent.h"
  23. #include "IrcClient.h"
  24. /**
  25. Alert is a helper class for the AvCaster application.
  26. It queues and presents GUI message boxes to the user.
  27. */
  28. class Alert
  29. {
  30. public:
  31. Alert(GUI::AlertType message_type , String message_text)
  32. {
  33. this->messageType = message_type ;
  34. this->messageText = message_text ;
  35. }
  36. GUI::AlertType messageType ;
  37. String messageText ;
  38. } ;
  39. /**
  40. AvCaster is the controller class for the AvCaster application.
  41. It instantiates, initializes, and configures the runtime components
  42. and mediates communication amongst other parts of the application.
  43. */
  44. class AvCaster
  45. {
  46. friend class AvCasterApplication ;
  47. friend class AvCasterStore ;
  48. public:
  49. // GUI dispatchers
  50. static void Warning (String message_text) ;
  51. static void Error (String message_text) ;
  52. static void AddChatLine(String prefix , String nick , String message) ;
  53. static void SendChat (String chat_message) ;
  54. // callbacks and event handlers
  55. static ModalComponentManager::Callback* GetModalCb() ;
  56. static void OnModalDismissed(int result , int unused) ;
  57. // getters/setters
  58. static bool GetIsInitialized () ;
  59. static bool GetIsMediaEnabled () ;
  60. static bool GetIsScreenEnabled () ;
  61. static bool GetIsCameraEnabled () ;
  62. static bool GetIsTextEnabled () ;
  63. static bool GetIsImageEnabled () ;
  64. static bool GetIsCompositorEnabled() ;
  65. static bool GetIsPreviewEnabled () ;
  66. static bool GetIsAudioEnabled () ;
  67. static bool GetIsChatEnabled () ;
  68. static Rectangle<int> GetPreviewBounds () ;
  69. static void SetConfig (const Identifier& a_key , var a_value) ;
  70. static ValueTree GetConfigStore () ;
  71. static void DeactivateControl (const Identifier& a_key) ;
  72. static void StorePreset (String preset_name) ;
  73. static void RenamePreset (String preset_name) ;
  74. static void DeletePreset () ;
  75. static void ResetPreset () ;
  76. static bool SetPreset (String preset_name , int option_n) ;
  77. static bool RejectPresetChange () ;
  78. static bool IsStaticPreset () ;
  79. static int GetPresetIdx () ;
  80. static String GetPresetName () ;
  81. static bool GetIsPreviewActive () ;
  82. static bool GetIsConfigPending () ;
  83. static StringArray GetPresetsNames () ;
  84. static StringArray GetCameraNames () ;
  85. static StringArray GetAudioNames () ;
  86. static StringArray GetCameraResolutions () ;
  87. static String GetCameraResolution () ;
  88. static String GetCameraPath () ;
  89. static int GetCameraRate () ;
  90. static String GetVersionString () ;
  91. static void UpdateIrcHost (StringArray alias_uris , String actual_host) ;
  92. #ifdef PREFIX_CHAT_NICKS
  93. static void UpdateChatNicks (String host , String channel , StringArray nicks) ;
  94. #else // PREFIX_CHAT_NICKS
  95. static void UpdateChatNicks (String host , StringArray nicks) ;
  96. #endif // PREFIX_CHAT_NICKS
  97. static StringArray GetChatNicks (ValueTree chatters_store) ;
  98. private:
  99. // setup
  100. static bool Initialize(MainContent* main_content) ;
  101. static void Shutdown () ;
  102. // callbacks and event handlers
  103. static void HandleTimer (int timer_id) ;
  104. static void UpdateStatusGUI () ;
  105. static void HandleConfigChanged(const Identifier& a_key) ;
  106. static void RefreshGui () ;
  107. static void RefreshStatus () ;
  108. // helpers
  109. static bool HandleCliParamsTerminating() ;
  110. static bool ProcessCliParams () ;
  111. static bool ValidateEnvironment () ;
  112. static void DisplayAlert () ;
  113. static MainContent* Gui ;
  114. #ifndef DISABLE_CHAT
  115. static ScopedPointer<IrcClient> Irc ;
  116. #endif // DISABLE_CHAT
  117. static StringArray CliParams ;
  118. static Array<Alert*> Alerts ;
  119. static bool IsAlertModal ;
  120. // persistence
  121. static ScopedPointer<AvCasterStore> Store ;
  122. // runtime features
  123. static bool IsInitialized ;
  124. static bool IsMediaEnabled ;
  125. static bool IsScreenEnabled ;
  126. static bool IsCameraEnabled ;
  127. static bool IsTextEnabled ;
  128. static bool IsImageEnabled ;
  129. static bool IsCompositorEnabled ;
  130. static bool IsPreviewEnabled ;
  131. static bool IsAudioEnabled ;
  132. static bool IsChatEnabled ;
  133. } ;
  134. #endif // _AVCASTER_H_