zoukankan      html  css  js  c++  java
  • 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();
    }
    };

    本博客所有内容均为原创,转载请说明出处。欢迎音视频多媒体领域的朋友来人来函交流心得。
  • 相关阅读:
    JS-OO-数据属性,访问器属性
    下载php扩展笔记
    php字符串笔记
    include、require、include_once和require_once理解
    http协议笔记
    Git中三种文件状态及其转换
    git add 命令
    / 直接用就可以了 想用,需要用\来转义
    $_POST 变量以及$GLOBALS['HTTP_RAW_POST_DATA']
    Python multiprocessing
  • 原文地址:https://www.cnblogs.com/liuxt/p/6070709.html
Copyright © 2011-2022 走看看