The Obsapp class has the following features:
1. Responsible for profile management
2. Version information management
3. Main interface Obsbasic Object management
4.obs Module Initialization
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::d eque<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 ();
}
};
OBS Source Code Analysis (3) Obsapp class Introduction