clang-format: Apply formatting
Code submissions have continually suffered from formatting inconsistencies that constantly have to be addressed. Using clang-format simplifies this by making code formatting more consistent, and allows automation of the code formatting so that maintainers can focus more on the code itself instead of code formatting.
This commit is contained in:
@@ -36,48 +36,50 @@
|
||||
|
||||
std::string CurrentTimeString();
|
||||
std::string CurrentDateTimeString();
|
||||
std::string GenerateTimeDateFilename(const char *extension, bool noSpace=false);
|
||||
std::string GenerateTimeDateFilename(const char *extension,
|
||||
bool noSpace = false);
|
||||
std::string GenerateSpecifiedFilename(const char *extension, bool noSpace,
|
||||
const char *format);
|
||||
const char *format);
|
||||
QObject *CreateShortcutFilter();
|
||||
|
||||
struct BaseLexer {
|
||||
lexer lex;
|
||||
|
||||
public:
|
||||
inline BaseLexer() {lexer_init(&lex);}
|
||||
inline ~BaseLexer() {lexer_free(&lex);}
|
||||
operator lexer*() {return &lex;}
|
||||
inline BaseLexer() { lexer_init(&lex); }
|
||||
inline ~BaseLexer() { lexer_free(&lex); }
|
||||
operator lexer *() { return &lex; }
|
||||
};
|
||||
|
||||
class OBSTranslator : public QTranslator {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
virtual bool isEmpty() const override {return false;}
|
||||
virtual bool isEmpty() const override { return false; }
|
||||
|
||||
virtual QString translate(const char *context, const char *sourceText,
|
||||
const char *disambiguation, int n) const override;
|
||||
const char *disambiguation,
|
||||
int n) const override;
|
||||
};
|
||||
|
||||
typedef std::function<void ()> VoidFunc;
|
||||
typedef std::function<void()> VoidFunc;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
bool enableHotkeysInFocus = true;
|
||||
os_inhibit_t *sleepInhibitor = nullptr;
|
||||
int sleepInhibitRefs = 0;
|
||||
|
||||
bool enableHotkeysInFocus = true;
|
||||
|
||||
std::deque<obs_frontend_translate_ui_cb> translatorHooks;
|
||||
|
||||
@@ -93,8 +95,8 @@ private:
|
||||
QPalette defaultPalette;
|
||||
|
||||
void ParseExtraThemeData(const char *path);
|
||||
void AddExtraThemeColor(QPalette &pal, int group,
|
||||
const char *name, uint32_t color);
|
||||
void AddExtraThemeColor(QPalette &pal, int group, const char *name,
|
||||
uint32_t color);
|
||||
|
||||
public:
|
||||
OBSApp(int &argc, char **argv, profiler_name_store_t *store);
|
||||
@@ -105,19 +107,16 @@ public:
|
||||
|
||||
void EnableInFocusHotkeys(bool enable);
|
||||
|
||||
inline QMainWindow *GetMainWindow() const {return mainWindow.data();}
|
||||
inline QMainWindow *GetMainWindow() const { return mainWindow.data(); }
|
||||
|
||||
inline config_t *GlobalConfig() const {return globalConfig;}
|
||||
inline config_t *GlobalConfig() const { return globalConfig; }
|
||||
|
||||
inline const char *GetLocale() const
|
||||
{
|
||||
return locale.c_str();
|
||||
}
|
||||
inline const char *GetLocale() const { return locale.c_str(); }
|
||||
|
||||
inline const char *GetTheme() const {return theme.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 lookup_t *GetTextLookup() const { return textLookup; }
|
||||
|
||||
inline const char *GetString(const char *lookupVal) const
|
||||
{
|
||||
@@ -146,15 +145,18 @@ public:
|
||||
|
||||
inline void IncrementSleepInhibition()
|
||||
{
|
||||
if (!sleepInhibitor) return;
|
||||
if (!sleepInhibitor)
|
||||
return;
|
||||
if (sleepInhibitRefs++ == 0)
|
||||
os_inhibit_sleep_set_active(sleepInhibitor, true);
|
||||
}
|
||||
|
||||
inline void DecrementSleepInhibition()
|
||||
{
|
||||
if (!sleepInhibitor) return;
|
||||
if (sleepInhibitRefs == 0) return;
|
||||
if (!sleepInhibitor)
|
||||
return;
|
||||
if (sleepInhibitRefs == 0)
|
||||
return;
|
||||
if (--sleepInhibitRefs == 0)
|
||||
os_inhibit_sleep_set_active(sleepInhibitor, false);
|
||||
}
|
||||
@@ -164,10 +166,7 @@ public:
|
||||
translatorHooks.emplace_front(cb);
|
||||
}
|
||||
|
||||
inline void PopUITranslation()
|
||||
{
|
||||
translatorHooks.pop_front();
|
||||
}
|
||||
inline void PopUITranslation() { translatorHooks.pop_front(); }
|
||||
|
||||
public slots:
|
||||
void Exec(VoidFunc func);
|
||||
@@ -182,12 +181,21 @@ char *GetConfigPathPtr(const char *name);
|
||||
int GetProgramDataPath(char *path, size_t size, const char *name);
|
||||
char *GetProgramDataPathPtr(const char *name);
|
||||
|
||||
inline OBSApp *App() {return static_cast<OBSApp*>(qApp);}
|
||||
inline OBSApp *App()
|
||||
{
|
||||
return static_cast<OBSApp *>(qApp);
|
||||
}
|
||||
|
||||
inline config_t *GetGlobalConfig() {return App()->GlobalConfig();}
|
||||
inline config_t *GetGlobalConfig()
|
||||
{
|
||||
return App()->GlobalConfig();
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> GetLocaleNames();
|
||||
inline const char *Str(const char *lookup) {return App()->GetString(lookup);}
|
||||
inline const char *Str(const char *lookup)
|
||||
{
|
||||
return App()->GetString(lookup);
|
||||
}
|
||||
#define QTStr(lookupVal) QString::fromUtf8(Str(lookupVal))
|
||||
|
||||
bool GetFileSafeName(const char *name, std::string &file);
|
||||
@@ -197,8 +205,8 @@ bool WindowPositionValid(QRect rect);
|
||||
|
||||
static inline int GetProfilePath(char *path, size_t size, const char *file)
|
||||
{
|
||||
OBSMainWindow *window = reinterpret_cast<OBSMainWindow*>(
|
||||
App()->GetMainWindow());
|
||||
OBSMainWindow *window =
|
||||
reinterpret_cast<OBSMainWindow *>(App()->GetMainWindow());
|
||||
return window->GetProfilePath(path, size, file);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user