OBSApp类有以下功能:

1.负责配置文件管理

2.版本信息管理

3.主界面OBSBasic对象管理

4.obs模块初始化

class OBSApp : public QApplication {
Q_OBJECT

private:
std::string locale;
std::string theme;
ConfigFile globalConfig;
TextLookup textLookup;
OBSContext obsContext;
QPointer<OBSMainWindow> mainWindow;
profiler_name_store_t *profilerNameStore = nullptr;

os_inhibit_t *sleepInhibitor = nullptr;
int sleepInhibitRefs = 0;

std::deque<obs_frontend_translate_ui_cb> translatorHooks;

bool InitGlobalConfig();
bool InitGlobalConfigDefaults();
bool InitLocale();
bool InitTheme();

public:
OBSApp(int &argc, char **argv, profiler_name_store_t *store);
~OBSApp();

void AppInit();
bool OBSInit();

inline QMainWindow *GetMainWindow() const {return mainWindow.data();}

inline config_t *GlobalConfig() const {return globalConfig;}

inline const char *GetLocale() const
{
return locale.c_str();
}

inline const char *GetTheme() const {return theme.c_str();}
bool SetTheme(std::string name, std::string path = "");

inline lookup_t *GetTextLookup() const {return textLookup;}

inline const char *GetString(const char *lookupVal) const
{
return textLookup.GetString(lookupVal);
}

bool TranslateString(const char *lookupVal, const char **out) const;

profiler_name_store_t *GetProfilerNameStore() const
{
return profilerNameStore;
}

const char *GetLastLog() const;
const char *GetCurrentLog() const;

std::string GetVersionString() const;

const char *InputAudioSource() const;
const char *OutputAudioSource() const;

const char *GetRenderModule() const;

inline void IncrementSleepInhibition()
{
if (!sleepInhibitor) return;
if (sleepInhibitRefs++ == 0)
os_inhibit_sleep_set_active(sleepInhibitor, true);
}

inline void DecrementSleepInhibition()
{
if (!sleepInhibitor) return;
if (sleepInhibitRefs == 0) return;
if (--sleepInhibitRefs == 0)
os_inhibit_sleep_set_active(sleepInhibitor, false);
}

inline void PushUITranslation(obs_frontend_translate_ui_cb cb)
{
translatorHooks.emplace_front(cb);
}

inline void PopUITranslation()
{
translatorHooks.pop_front();
}
};

04-03 19:40