obs-app.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /******************************************************************************
  2. Copyright (C) 2013 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include <wx/app.h>
  16. #include <wx/window.h>
  17. #include <util/util.hpp>
  18. #include <string>
  19. class OBSAppBase : public wxApp {
  20. public:
  21. virtual ~OBSAppBase();
  22. };
  23. class OBSApp : public OBSAppBase {
  24. std::string locale;
  25. ConfigFile globalConfig;
  26. TextLookup textLookup;
  27. wxWindow *mainWindow;
  28. bool InitGlobalConfig();
  29. bool InitGlobalConfigDefaults();
  30. bool InitConfigDefaults();
  31. bool InitLocale();
  32. bool InitOBSBasic();
  33. void GetFPSCommon(uint32_t &num, uint32_t &den) const;
  34. void GetFPSInteger(uint32_t &num, uint32_t &den) const;
  35. void GetFPSFraction(uint32_t &num, uint32_t &den) const;
  36. void GetFPSNanoseconds(uint32_t &num, uint32_t &den) const;
  37. public:
  38. virtual bool OnInit();
  39. virtual int OnExit();
  40. inline wxWindow *GetMainWindow() const {return mainWindow;}
  41. inline config_t GlobalConfig() const {return globalConfig;}
  42. inline const char *GetLocale() const
  43. {
  44. return locale.c_str();
  45. }
  46. inline const char *GetString(const char *lookupVal) const
  47. {
  48. return textLookup.GetString(lookupVal);
  49. }
  50. void GetConfigFPS(uint32_t &num, uint32_t &den) const;
  51. const char *GetRenderModule() const;
  52. };
  53. wxDECLARE_APP(OBSApp);
  54. inline config_t GetGlobalConfig() {return wxGetApp().GlobalConfig();}
  55. #define Str(lookupVal) wxGetApp().GetString(lookupVal)
  56. #define WXStr(lookupVal) wxString(Str(lookupVal), wxConvUTF8)