OBS源码解析(3)OBSApp类介绍

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();
}
};

上一篇:随select动,将value值显示在后面的input里


下一篇:oracle连接数据的oci和thin的区别