Style changes in utility.hpp

This commit is contained in:
WarmUpTill
2023-04-29 00:16:25 +02:00
committed by WarmUpTill
parent 20a934c9ab
commit 0138b412b4
100 changed files with 403 additions and 402 deletions

View File

@@ -353,13 +353,13 @@ void ConnectionSettingsDialog::SetStatus()
void ConnectionSettingsDialog::ShowPassword()
{
setButtonIcon(_showPassword, ":res/images/visible.svg");
SetButtonIcon(_showPassword, ":res/images/visible.svg");
_password->setEchoMode(QLineEdit::Normal);
}
void ConnectionSettingsDialog::HidePassword()
{
setButtonIcon(_showPassword, ":res/images/invisible.svg");
SetButtonIcon(_showPassword, ":res/images/invisible.svg");
_password->setEchoMode(QLineEdit::PasswordEchoOnEdit);
}

View File

@@ -57,7 +57,7 @@ ItemSelection::ItemSelection(std::deque<std::shared_ptr<Item>> &items,
_addStr(add)
{
_modify->setMaximumWidth(22);
setButtonIcon(_modify, ":/settings/images/settings/general.svg");
SetButtonIcon(_modify, ":/settings/images/settings/general.svg");
_modify->setFlat(true);
// Connect to slots
@@ -77,7 +77,7 @@ ItemSelection::ItemSelection(std::deque<std::shared_ptr<Item>> &items,
_selection->addItem(QString::fromStdString(i->_name));
}
_selection->model()->sort(0);
addSelectionEntry(_selection, obs_module_text(_selectStr.data()));
AddSelectionEntry(_selection, obs_module_text(_selectStr.data()));
_selection->insertSeparator(_selection->count());
_selection->addItem(obs_module_text(_addStr.data()));
}

View File

@@ -216,7 +216,7 @@ int MacroList::FindEntry(const std::string &macro)
void MacroList::SetMacroListSize()
{
setHeightToContentHeight(_list);
SetHeightToContentHeight(_list);
adjustSize();
}

View File

@@ -77,11 +77,11 @@ ProcessConfigEdit::ProcessConfigEdit(QWidget *parent)
{"{{workingDirectory}}", _workingDirectory},
{"{{advancedSettings}}", _showAdvancedSettings},
};
placeWidgets(obs_module_text("AdvSceneSwitcher.process.entry"),
PlaceWidgets(obs_module_text("AdvSceneSwitcher.process.entry"),
entryLayout, widgetPlaceholders, false);
auto workingDirectoryLayout = new QHBoxLayout;
placeWidgets(obs_module_text(
PlaceWidgets(obs_module_text(
"AdvSceneSwitcher.process.entry.workingDirectory"),
workingDirectoryLayout, widgetPlaceholders, false);
@@ -138,7 +138,7 @@ void ProcessConfigEdit::ArgsChanged(const StringList &args)
void ProcessConfigEdit::ShowAdvancedSettings(bool showAdvancedSettings)
{
setLayoutVisible(_advancedSettingsLayout, showAdvancedSettings);
SetLayoutVisible(_advancedSettingsLayout, showAdvancedSettings);
_showAdvancedSettings->setVisible(!showAdvancedSettings);
adjustSize();
updateGeometry();

View File

@@ -63,7 +63,7 @@ RegexConfigWidget::RegexConfigWidget(QWidget *parent)
obs_module_text("AdvSceneSwitcher.regex.enable")))
{
_openSettings->setMaximumWidth(22);
setButtonIcon(_openSettings, ":/settings/images/settings/general.svg");
SetButtonIcon(_openSettings, ":/settings/images/settings/general.svg");
_openSettings->setFlat(true);
QWidget::connect(_enable, SIGNAL(stateChanged(int)), this,

View File

@@ -223,7 +223,7 @@ void populateSceneItemSelection(QComboBox *list)
names.removeDuplicates();
names.sort();
list->addItems(names);
addSelectionEntry(list, obs_module_text("AdvSceneSwitcher.selectItem"));
AddSelectionEntry(list, obs_module_text("AdvSceneSwitcher.selectItem"));
list->setCurrentIndex(0);
}
@@ -265,16 +265,16 @@ void SceneItemSelectionWidget::Reset()
void SceneItemSelectionWidget::PopulateItemSelection()
{
_sceneItems->clear();
addSelectionEntry(_sceneItems,
AddSelectionEntry(_sceneItems,
obs_module_text("AdvSceneSwitcher.selectItem"));
_sceneItems->insertSeparator(_sceneItems->count());
const QStringList variables = GetVariablesNameList();
addSelectionGroup(_sceneItems, variables);
AddSelectionGroup(_sceneItems, variables);
_variablesEndIdx = _sceneItems->count();
const QStringList sceneItmes = GetSceneItemsList(_scene);
addSelectionGroup(_sceneItems, sceneItmes, false);
AddSelectionGroup(_sceneItems, sceneItmes, false);
_itemsEndIdx = _sceneItems->count();
_sceneItems->setCurrentIndex(0);
}
@@ -325,7 +325,7 @@ void SceneItemSelectionWidget::SetSceneItem(const SceneItemSelection &item)
idx += 1;
}
_idx->setCurrentIndex(idx);
itemIdx = findIdxInRagne(_sceneItems, _variablesEndIdx,
itemIdx = FindIdxInRagne(_sceneItems, _variablesEndIdx,
_itemsEndIdx,
GetWeakSourceName(item._sceneItem));
_sceneItems->setCurrentIndex(itemIdx);
@@ -337,7 +337,7 @@ void SceneItemSelectionWidget::SetSceneItem(const SceneItemSelection &item)
if (!var) {
break;
}
itemIdx = findIdxInRagne(_sceneItems, _selectIdx,
itemIdx = FindIdxInRagne(_sceneItems, _selectIdx,
_variablesEndIdx, var->Name());
_sceneItems->setCurrentIndex(itemIdx);
break;

View File

@@ -251,31 +251,31 @@ void SceneSelectionWidget::Reset()
void SceneSelectionWidget::PopulateSelection()
{
clear();
addSelectionEntry(this,
AddSelectionEntry(this,
obs_module_text("AdvSceneSwitcher.selectScene"));
insertSeparator(count());
if (_current || _previous) {
const QStringList order =
getOrderList(_current, _previous, _preview);
addSelectionGroup(this, order);
AddSelectionGroup(this, order);
}
_placeholderEndIdx = count();
if (_variables) {
const QStringList variables = GetVariablesNameList();
addSelectionGroup(this, variables);
AddSelectionGroup(this, variables);
}
_variablesEndIdx = count();
if (_sceneGroups) {
const QStringList sceneGroups = getSceneGroupsList();
addSelectionGroup(this, sceneGroups);
AddSelectionGroup(this, sceneGroups);
}
_groupsEndIdx = count();
const QStringList scenes = getScenesList();
addSelectionGroup(this, scenes);
AddSelectionGroup(this, scenes);
_scenesEndIdx = count();
// Remove last separator
@@ -330,7 +330,7 @@ void SceneSelectionWidget::SetScene(const SceneSelection &s)
idx = 0;
break;
}
idx = findIdxInRagne(this, _groupsEndIdx, _scenesEndIdx,
idx = FindIdxInRagne(this, _groupsEndIdx, _scenesEndIdx,
s.ToString());
break;
}
@@ -339,7 +339,7 @@ void SceneSelectionWidget::SetScene(const SceneSelection &s)
idx = 0;
break;
}
idx = findIdxInRagne(this, _variablesEndIdx, _groupsEndIdx,
idx = FindIdxInRagne(this, _variablesEndIdx, _groupsEndIdx,
s.ToString());
break;
}
@@ -349,7 +349,7 @@ void SceneSelectionWidget::SetScene(const SceneSelection &s)
break;
}
idx = findIdxInRagne(
idx = FindIdxInRagne(
this, _selectIdx, _placeholderEndIdx,
obs_module_text(
"AdvSceneSwitcher.selectPreviousScene"));
@@ -361,7 +361,7 @@ void SceneSelectionWidget::SetScene(const SceneSelection &s)
break;
}
idx = findIdxInRagne(
idx = FindIdxInRagne(
this, _selectIdx, _placeholderEndIdx,
obs_module_text("AdvSceneSwitcher.selectCurrentScene"));
break;
@@ -372,7 +372,7 @@ void SceneSelectionWidget::SetScene(const SceneSelection &s)
break;
}
idx = findIdxInRagne(
idx = FindIdxInRagne(
this, _selectIdx, _placeholderEndIdx,
obs_module_text("AdvSceneSwitcher.selectPreviewScene"));
break;
@@ -382,7 +382,7 @@ void SceneSelectionWidget::SetScene(const SceneSelection &s)
idx = 0;
break;
}
idx = findIdxInRagne(this, _placeholderEndIdx, _variablesEndIdx,
idx = FindIdxInRagne(this, _placeholderEndIdx, _variablesEndIdx,
s.ToString());
break;
default:

View File

@@ -166,7 +166,7 @@ void Section::CleanUpPreviousContent()
if (_contentArea) {
auto oldLayout = _contentArea->layout();
if (oldLayout) {
clearLayout(oldLayout);
ClearLayout(oldLayout);
delete oldLayout;
}
}

View File

@@ -131,17 +131,17 @@ void SourceSelectionWidget::Reset()
void SourceSelectionWidget::PopulateSelection()
{
clear();
addSelectionEntry(this,
AddSelectionEntry(this,
obs_module_text("AdvSceneSwitcher.selectSource"));
insertSeparator(count());
if (_addVariables) {
const QStringList variables = GetVariablesNameList();
addSelectionGroup(this, variables);
AddSelectionGroup(this, variables);
}
_variablesEndIdx = count();
addSelectionGroup(this, _sourceNames);
AddSelectionGroup(this, _sourceNames);
_sourcesEndIdx = count();
// Remove last separator
@@ -183,7 +183,7 @@ void SourceSelectionWidget::SetSource(const SourceSelection &s)
idx = 0;
break;
}
idx = findIdxInRagne(this, _variablesEndIdx, _sourcesEndIdx,
idx = FindIdxInRagne(this, _variablesEndIdx, _sourcesEndIdx,
s.ToString());
break;
}
@@ -192,7 +192,7 @@ void SourceSelectionWidget::SetSource(const SourceSelection &s)
idx = 0;
break;
}
idx = findIdxInRagne(this, _selectIdx, _variablesEndIdx,
idx = FindIdxInRagne(this, _selectIdx, _variablesEndIdx,
s.ToString());
break;
default:

View File

@@ -193,7 +193,7 @@ void StringListEdit::Clicked(QListWidgetItem *item)
void StringListEdit::SetListSize()
{
setHeightToContentHeight(_list);
SetHeightToContentHeight(_list);
adjustSize();
updateGeometry();
}

View File

@@ -70,7 +70,7 @@ TransitionSelectionWidget::TransitionSelectionWidget(QWidget *parent,
: QComboBox(parent)
{
setDuplicatesEnabled(true);
populateTransitionSelection(this, current, any);
PopulateTransitionSelection(this, current, any);
QWidget::connect(this, SIGNAL(currentTextChanged(const QString &)),
this, SLOT(SelectionChanged(const QString &)));
@@ -114,7 +114,7 @@ void TransitionSelectionWidget::Repopulate(bool current, bool any)
{
const QSignalBlocker blocker(this);
clear();
populateTransitionSelection(this, current, any);
PopulateTransitionSelection(this, current, any);
setCurrentIndex(0);
}
TransitionSelection t;

View File

@@ -157,7 +157,7 @@ std::pair<double, double> getSceneItemSize(obs_scene_item *item)
return size;
}
std::string getSceneItemTransform(obs_scene_item *item)
std::string GetSceneItemTransform(obs_scene_item *item)
{
struct obs_transform_info info;
struct obs_sceneitem_crop crop;
@@ -166,7 +166,7 @@ std::string getSceneItemTransform(obs_scene_item *item)
auto size = getSceneItemSize(item);
auto data = obs_data_create();
saveTransformState(data, info, crop);
SaveTransformState(data, info, crop);
obs_data_t *obj = obs_data_create();
obs_data_set_double(obj, "width", size.first * info.scale.x);
obs_data_set_double(obj, "height", size.second * info.scale.y);
@@ -177,7 +177,7 @@ std::string getSceneItemTransform(obs_scene_item *item)
return json;
}
void placeWidgets(std::string text, QBoxLayout *layout,
void PlaceWidgets(std::string text, QBoxLayout *layout,
std::unordered_map<std::string, QWidget *> placeholders,
bool addStretch)
{
@@ -211,7 +211,7 @@ void placeWidgets(std::string text, QBoxLayout *layout,
}
}
void deleteLayoutItemWidget(QLayoutItem *item)
void DeleteLayoutItemWidget(QLayoutItem *item)
{
if (item) {
auto widget = item->widget();
@@ -223,19 +223,19 @@ void deleteLayoutItemWidget(QLayoutItem *item)
}
}
void clearLayout(QLayout *layout, int afterIdx)
void ClearLayout(QLayout *layout, int afterIdx)
{
QLayoutItem *item;
while ((item = layout->takeAt(afterIdx))) {
if (item->layout()) {
clearLayout(item->layout());
ClearLayout(item->layout());
delete item->layout();
}
deleteLayoutItemWidget(item);
DeleteLayoutItemWidget(item);
}
}
void setLayoutVisible(QLayout *layout, bool visible)
void SetLayoutVisible(QLayout *layout, bool visible)
{
if (!layout) {
return;
@@ -247,7 +247,7 @@ void setLayoutVisible(QLayout *layout, bool visible)
widget->setVisible(visible);
}
if (nestedLayout) {
setLayoutVisible(nestedLayout, visible);
SetLayoutVisible(nestedLayout, visible);
}
}
}
@@ -282,7 +282,7 @@ void MinimizeSizeOfColumn(QGridLayout *layout, int idx)
layout->setColumnMinimumWidth(idx, columnWidth);
}
bool compareIgnoringLineEnding(QString &s1, QString &s2)
bool CompareIgnoringLineEnding(QString &s1, QString &s2)
{
// Let QT deal with different types of lineendings
QTextStream s1stream(&s1);
@@ -303,7 +303,7 @@ bool compareIgnoringLineEnding(QString &s1, QString &s2)
return true;
}
std::string getSourceSettings(OBSWeakSource ws)
std::string GetSourceSettings(OBSWeakSource ws)
{
if (!ws) {
return "";
@@ -322,7 +322,7 @@ std::string getSourceSettings(OBSWeakSource ws)
return settings;
}
void setSourceSettings(obs_source_t *s, const std::string &settings)
void SetSourceSettings(obs_source_t *s, const std::string &settings)
{
if (settings.empty()) {
return;
@@ -339,11 +339,11 @@ void setSourceSettings(obs_source_t *s, const std::string &settings)
}
// Match json1 with pattern json2
bool matchJson(const std::string &json1, const std::string &json2,
bool MatchJson(const std::string &json1, const std::string &json2,
const RegexConfig &regex)
{
auto j1 = formatJsonString(json1).toStdString();
auto j2 = formatJsonString(json2).toStdString();
auto j1 = FormatJsonString(json1).toStdString();
auto j2 = FormatJsonString(json2).toStdString();
if (j1.empty()) {
j1 = json1;
@@ -363,15 +363,15 @@ bool matchJson(const std::string &json1, const std::string &json2,
return j1 == j2;
}
bool compareSourceSettings(const OBSWeakSource &source,
bool CompareSourceSettings(const OBSWeakSource &source,
const std::string &settings,
const RegexConfig &regex)
{
std::string currentSettings = getSourceSettings(source);
return matchJson(currentSettings, settings, regex);
std::string currentSettings = GetSourceSettings(source);
return MatchJson(currentSettings, settings, regex);
}
std::string getDataFilePath(const std::string &file)
std::string GetDataFilePath(const std::string &file)
{
std::string root_path = obs_get_module_data_path(obs_current_module());
if (!root_path.empty()) {
@@ -380,18 +380,18 @@ std::string getDataFilePath(const std::string &file)
return "";
}
QString formatJsonString(std::string s)
QString FormatJsonString(std::string s)
{
return formatJsonString(QString::fromStdString(s));
return FormatJsonString(QString::fromStdString(s));
}
QString formatJsonString(QString json)
QString FormatJsonString(QString json)
{
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8());
return QString::fromUtf8(doc.toJson(QJsonDocument::Indented));
}
QString escapeForRegex(QString &s)
QString EscapeForRegex(QString &s)
{
std::regex specialChars{R"([-[\]{}()*+?.,\^$|#\s])"};
std::string input = s.toStdString();
@@ -399,7 +399,7 @@ QString escapeForRegex(QString &s)
std::regex_replace(input, specialChars, R"(\$&)"));
}
void loadTransformState(obs_data_t *obj, struct obs_transform_info &info,
void LoadTransformState(obs_data_t *obj, struct obs_transform_info &info,
struct obs_sceneitem_crop &crop)
{
obs_data_get_vec2(obj, "pos", &info.pos);
@@ -417,7 +417,7 @@ void loadTransformState(obs_data_t *obj, struct obs_transform_info &info,
crop.right = (int)obs_data_get_int(obj, "right");
}
bool saveTransformState(obs_data_t *obj, const struct obs_transform_info &info,
bool SaveTransformState(obs_data_t *obj, const struct obs_transform_info &info,
const struct obs_sceneitem_crop &crop)
{
struct vec2 pos = info.pos;
@@ -476,7 +476,7 @@ void DisplayTrayMessage(const QString &title, const QString &msg)
tray->showMessage(title, msg);
}
void addSelectionEntry(QComboBox *sel, const char *description, bool selectable,
void AddSelectionEntry(QComboBox *sel, const char *description, bool selectable,
const char *tooltip)
{
sel->insertItem(0, description);
@@ -510,21 +510,21 @@ QStringList GetSourceNames()
return list;
}
void populateSourceSelection(QComboBox *list, bool addSelect)
void PopulateSourceSelection(QComboBox *list, bool addSelect)
{
auto sources = GetSourceNames();
sources.sort();
list->addItems(sources);
if (addSelect) {
addSelectionEntry(
AddSelectionEntry(
list, obs_module_text("AdvSceneSwitcher.selectSource"),
false);
}
list->setCurrentIndex(0);
}
void populateTransitionSelection(QComboBox *sel, bool addCurrent, bool addAny)
void PopulateTransitionSelection(QComboBox *sel, bool addCurrent, bool addAny)
{
obs_frontend_source_list *transitions = new obs_frontend_source_list();
@@ -540,7 +540,7 @@ void populateTransitionSelection(QComboBox *sel, bool addCurrent, bool addAny)
sel->model()->sort(0);
addSelectionEntry(sel,
AddSelectionEntry(sel,
obs_module_text("AdvSceneSwitcher.selectTransition"));
sel->setCurrentIndex(0);
@@ -555,7 +555,7 @@ void populateTransitionSelection(QComboBox *sel, bool addCurrent, bool addAny)
}
}
void populateWindowSelection(QComboBox *sel, bool addSelect)
void PopulateWindowSelection(QComboBox *sel, bool addSelect)
{
std::vector<std::string> windows;
@@ -567,7 +567,7 @@ void populateWindowSelection(QComboBox *sel, bool addSelect)
sel->model()->sort(0);
if (addSelect) {
addSelectionEntry(
AddSelectionEntry(
sel, obs_module_text("AdvSceneSwitcher.selectWindow"));
}
sel->setCurrentIndex(0);
@@ -595,14 +595,14 @@ QStringList GetAudioSourceNames()
return list;
}
void populateAudioSelection(QComboBox *sel, bool addSelect)
void PopulateAudioSelection(QComboBox *sel, bool addSelect)
{
auto sources = GetAudioSourceNames();
sources.sort();
sel->addItems(sources);
if (addSelect) {
addSelectionEntry(
AddSelectionEntry(
sel,
obs_module_text("AdvSceneSwitcher.selectAudioSource"),
false,
@@ -649,7 +649,7 @@ void populateVideoSelection(QComboBox *sel, bool addMainOutput, bool addScenes,
0, obs_module_text("AdvSceneSwitcher.OBSVideoOutput"));
}
if (addSelect) {
addSelectionEntry(
AddSelectionEntry(
sel,
obs_module_text("AdvSceneSwitcher.selectVideoSource"),
false,
@@ -678,14 +678,14 @@ QStringList GetMediaSourceNames()
return list;
}
void populateMediaSelection(QComboBox *sel, bool addSelect)
void PopulateMediaSelection(QComboBox *sel, bool addSelect)
{
auto sources = GetMediaSourceNames();
sources.sort();
sel->addItems(sources);
if (addSelect) {
addSelectionEntry(
AddSelectionEntry(
sel,
obs_module_text("AdvSceneSwitcher.selectMediaSource"),
false,
@@ -695,7 +695,7 @@ void populateMediaSelection(QComboBox *sel, bool addSelect)
sel->setCurrentIndex(0);
}
void populateProcessSelection(QComboBox *sel, bool addSelect)
void PopulateProcessSelection(QComboBox *sel, bool addSelect)
{
QStringList processes;
GetProcessList(processes);
@@ -706,7 +706,7 @@ void populateProcessSelection(QComboBox *sel, bool addSelect)
sel->model()->sort(0);
if (addSelect) {
addSelectionEntry(
AddSelectionEntry(
sel, obs_module_text("AdvSceneSwitcher.selectProcess"));
}
sel->setCurrentIndex(0);
@@ -726,7 +726,7 @@ QStringList GetSceneNames()
return list;
}
void populateSceneSelection(QComboBox *sel, bool addPrevious, bool addCurrent,
void PopulateSceneSelection(QComboBox *sel, bool addPrevious, bool addCurrent,
bool addAny, bool addSceneGroup,
std::deque<SceneGroup> *sceneGroups, bool addSelect,
std::string selectText, bool selectable)
@@ -743,14 +743,14 @@ void populateSceneSelection(QComboBox *sel, bool addPrevious, bool addCurrent,
sel->model()->sort(0);
if (addSelect) {
if (selectText.empty()) {
addSelectionEntry(
AddSelectionEntry(
sel,
obs_module_text("AdvSceneSwitcher.selectScene"),
selectable,
obs_module_text(
"AdvSceneSwitcher.invaildEntriesWillNotBeSaved"));
} else {
addSelectionEntry(sel, selectText.c_str(), selectable);
AddSelectionEntry(sel, selectText.c_str(), selectable);
}
}
sel->setCurrentIndex(0);
@@ -802,17 +802,17 @@ QStringList GetSourcesWithFilterNames()
return list;
}
void populateSourcesWithFilterSelection(QComboBox *list)
void PopulateSourcesWithFilterSelection(QComboBox *list)
{
auto sources = GetSourcesWithFilterNames();
sources.sort();
list->addItems(sources);
addSelectionEntry(list,
AddSelectionEntry(list,
obs_module_text("AdvSceneSwitcher.selectSource"));
list->setCurrentIndex(0);
}
void populateFilterSelection(QComboBox *list, OBSWeakSource weakSource)
void PopulateFilterSelection(QComboBox *list, OBSWeakSource weakSource)
{
auto enumFilters = [](obs_source_t *, obs_source_t *filter, void *ptr) {
QComboBox *list = reinterpret_cast<QComboBox *>(ptr);
@@ -823,7 +823,7 @@ void populateFilterSelection(QComboBox *list, OBSWeakSource weakSource)
auto s = obs_weak_source_get_source(weakSource);
obs_source_enum_filters(s, enumFilters, list);
list->model()->sort(0);
addSelectionEntry(list,
AddSelectionEntry(list,
obs_module_text("AdvSceneSwitcher.selectFilter"));
obs_source_release(s);
list->setCurrentIndex(0);
@@ -849,7 +849,7 @@ void populateTypeList(std::set<QString> &list,
}
}
void populateSourceGroupSelection(QComboBox *list)
void PopulateSourceGroupSelection(QComboBox *list)
{
std::set<QString> sourceTypes;
populateTypeList(sourceTypes, obs_enum_source_types);
@@ -869,11 +869,11 @@ void populateSourceGroupSelection(QComboBox *list)
}
list->model()->sort(0);
addSelectionEntry(list, obs_module_text("AdvSceneSwitcher.selectItem"));
AddSelectionEntry(list, obs_module_text("AdvSceneSwitcher.selectItem"));
list->setCurrentIndex(0);
}
void populateProfileSelection(QComboBox *box)
void PopulateProfileSelection(QComboBox *box)
{
auto profiles = obs_frontend_get_profiles();
char **temp = profiles;
@@ -884,12 +884,12 @@ void populateProfileSelection(QComboBox *box)
}
bfree(profiles);
box->model()->sort(0);
addSelectionEntry(
AddSelectionEntry(
box, obs_module_text("AdvSceneSwitcher.selectProfile"), false);
box->setCurrentIndex(0);
}
void populateMonitorTypeSelection(QComboBox *list)
void PopulateMonitorTypeSelection(QComboBox *list)
{
list->addItem(obs_module_text("AdvSceneSwitcher.audio.monitor.none"));
list->addItem(
@@ -897,7 +897,7 @@ void populateMonitorTypeSelection(QComboBox *list)
list->addItem(obs_module_text("AdvSceneSwitcher.audio.monitor.both"));
}
bool windowPosValid(QPoint pos)
bool WindowPosValid(QPoint pos)
{
return !!QGuiApplication::screenAt(pos);
}
@@ -1017,7 +1017,7 @@ bool listMoveDown(QListWidget *list)
return true;
}
void setHeightToContentHeight(QListWidget *list)
void SetHeightToContentHeight(QListWidget *list)
{
auto nrItems = list->count();
if (nrItems == 0) {
@@ -1028,12 +1028,12 @@ void setHeightToContentHeight(QListWidget *list)
}
}
bool doubleEquals(double left, double right, double epsilon)
bool DoubleEquals(double left, double right, double epsilon)
{
return (fabs(left - right) < epsilon);
}
void setButtonIcon(QPushButton *button, const char *path)
void SetButtonIcon(QPushButton *button, const char *path)
{
QIcon icon;
icon.addFile(QString::fromUtf8(path), QSize(), QIcon::Normal,
@@ -1041,7 +1041,7 @@ void setButtonIcon(QPushButton *button, const char *path)
button->setIcon(icon);
}
void addSelectionGroup(QComboBox *selection, const QStringList &group,
void AddSelectionGroup(QComboBox *selection, const QStringList &group,
bool addSeparator)
{
selection->addItems(group);
@@ -1050,7 +1050,7 @@ void addSelectionGroup(QComboBox *selection, const QStringList &group,
}
}
int findIdxInRagne(QComboBox *list, int start, int stop,
int FindIdxInRagne(QComboBox *list, int start, int stop,
const std::string &value)
{
if (value.empty()) {
@@ -1071,13 +1071,13 @@ int findIdxInRagne(QComboBox *list, int start, int stop,
return foundIdx;
}
std::pair<int, int> getCursorPos()
std::pair<int, int> GetCursorPos()
{
auto cursorPos = QCursor::pos();
return {cursorPos.x(), cursorPos.y()};
}
void replaceAll(std::string &str, const std::string &from,
void ReplaceAll(std::string &str, const std::string &from,
const std::string &to)
{
if (from.empty()) {

View File

@@ -28,21 +28,19 @@ OBSWeakSource GetWeakTransitionByName(const char *transitionName);
OBSWeakSource GetWeakTransitionByQString(const QString &name);
OBSWeakSource GetWeakFilterByName(OBSWeakSource source, const char *name);
OBSWeakSource GetWeakFilterByQString(OBSWeakSource source, const QString &name);
std::string getSourceSettings(OBSWeakSource ws);
void setSourceSettings(obs_source_t *s, const std::string &settings);
bool compareSourceSettings(const OBSWeakSource &source,
std::string GetSourceSettings(OBSWeakSource ws);
void SetSourceSettings(obs_source_t *s, const std::string &settings);
bool CompareSourceSettings(const OBSWeakSource &source,
const std::string &settings,
const RegexConfig &regex);
void loadTransformState(obs_data_t *obj, struct obs_transform_info &info,
void LoadTransformState(obs_data_t *obj, struct obs_transform_info &info,
struct obs_sceneitem_crop &crop);
bool saveTransformState(obs_data_t *obj, const struct obs_transform_info &info,
bool SaveTransformState(obs_data_t *obj, const struct obs_transform_info &info,
const struct obs_sceneitem_crop &crop);
/* Scene item helpers */
std::string getSceneItemTransform(obs_scene_item *item);
std::vector<obs_scene_item *> getSceneItemsWithName(obs_scene_t *scene,
std::string &name);
std::string GetSceneItemTransform(obs_scene_item *item);
/* Selection helpers */
@@ -55,74 +53,77 @@ QStringList GetSourceNames();
/* Populate list helpers */
void addSelectionEntry(QComboBox *sel, const char *description,
void AddSelectionEntry(QComboBox *sel, const char *description,
bool selectable = false, const char *tooltip = "");
void addSelectionGroup(QComboBox *selection, const QStringList &group,
void AddSelectionGroup(QComboBox *selection, const QStringList &group,
bool addSeparator = true);
void populateTransitionSelection(QComboBox *sel, bool addCurrent = true,
void PopulateTransitionSelection(QComboBox *sel, bool addCurrent = true,
bool addAny = false);
void populateWindowSelection(QComboBox *sel, bool addSelect = true);
void populateAudioSelection(QComboBox *sel, bool addSelect = true);
void PopulateWindowSelection(QComboBox *sel, bool addSelect = true);
void PopulateAudioSelection(QComboBox *sel, bool addSelect = true);
void populateVideoSelection(QComboBox *sel, bool addMainOutput = false,
bool addScenes = false, bool addSelect = true);
void populateMediaSelection(QComboBox *sel, bool addSelect = true);
void populateProcessSelection(QComboBox *sel, bool addSelect = true);
void populateSourceSelection(QComboBox *list, bool addSelect = true);
void populateSceneSelection(QComboBox *sel, bool addPrevious = false,
void PopulateMediaSelection(QComboBox *sel, bool addSelect = true);
void PopulateProcessSelection(QComboBox *sel, bool addSelect = true);
void PopulateSourceSelection(QComboBox *list, bool addSelect = true);
void PopulateSceneSelection(QComboBox *sel, bool addPrevious = false,
bool addCurrent = false, bool addAny = false,
bool addSceneGroup = false,
std::deque<SceneGroup> *sceneGroups = nullptr,
bool addSelect = true, std::string selectText = "",
bool selectable = false);
void populateSourcesWithFilterSelection(QComboBox *list);
void populateFilterSelection(QComboBox *list,
void PopulateSourcesWithFilterSelection(QComboBox *list);
void PopulateFilterSelection(QComboBox *list,
OBSWeakSource weakSource = nullptr);
void populateSourceGroupSelection(QComboBox *list);
void populateProfileSelection(QComboBox *list);
void populateMonitorTypeSelection(QComboBox *list);
void PopulateSourceGroupSelection(QComboBox *list);
void PopulateProfileSelection(QComboBox *list);
void PopulateMonitorTypeSelection(QComboBox *list);
/* Widget helpers */
void placeWidgets(std::string text, QBoxLayout *layout,
void PlaceWidgets(std::string text, QBoxLayout *layout,
std::unordered_map<std::string, QWidget *> placeholders,
bool addStretch = true);
void deleteLayoutItemWidget(QLayoutItem *item);
void clearLayout(QLayout *layout, int afterIdx = 0);
void setLayoutVisible(QLayout *layout, bool visible);
void DeleteLayoutItemWidget(QLayoutItem *item);
void ClearLayout(QLayout *layout, int afterIdx = 0);
void SetLayoutVisible(QLayout *layout, bool visible);
void MinimizeSizeOfColumn(QGridLayout *layout, int idx);
QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
QColor endColor = QColor(0, 0, 0, 0),
bool once = false);
void listAddClicked(QListWidget *list, QWidget *newWidget,
QPushButton *addButton = nullptr,
QMetaObject::Connection *addHighlight = nullptr);
bool listMoveUp(QListWidget *list);
bool listMoveDown(QListWidget *list);
void setHeightToContentHeight(QListWidget *list);
void setButtonIcon(QPushButton *button, const char *path);
int findIdxInRagne(QComboBox *list, int start, int stop,
void SetHeightToContentHeight(QListWidget *list);
void SetButtonIcon(QPushButton *button, const char *path);
int FindIdxInRagne(QComboBox *list, int start, int stop,
const std::string &value);
/* UI helpers */
bool DisplayMessage(const QString &msg, bool question = false);
void DisplayTrayMessage(const QString &title, const QString &msg);
bool windowPosValid(QPoint pos);
bool WindowPosValid(QPoint pos);
std::string GetThemeTypeName();
/* Generic helpers */
bool compareIgnoringLineEnding(QString &s1, QString &s2);
std::string getDataFilePath(const std::string &file);
bool matchJson(const std::string &json1, const std::string &json2,
bool CompareIgnoringLineEnding(QString &s1, QString &s2);
std::string GetDataFilePath(const std::string &file);
bool MatchJson(const std::string &json1, const std::string &json2,
const RegexConfig &regex);
QString formatJsonString(std::string);
QString formatJsonString(QString);
QString escapeForRegex(QString &s);
bool doubleEquals(double left, double right, double epsilon);
std::pair<int, int> getCursorPos();
void replaceAll(std::string &str, const std::string &from,
QString FormatJsonString(std::string);
QString FormatJsonString(QString);
QString EscapeForRegex(QString &s);
bool DoubleEquals(double left, double right, double epsilon);
std::pair<int, int> GetCursorPos();
void ReplaceAll(std::string &str, const std::string &from,
const std::string &to);
QString GetDefaultSettingsSaveLocation();
/* Legacy helpers */
void listAddClicked(QListWidget *list, QWidget *newWidget,
QPushButton *addButton = nullptr,
QMetaObject::Connection *addHighlight = nullptr);
bool listMoveUp(QListWidget *list);
bool listMoveDown(QListWidget *list);
} // namespace advss

View File

@@ -17,7 +17,7 @@ GenericVaraiableSpinbox::GenericVaraiableSpinbox(QWidget *parent,
{
_toggleType->setCheckable(true);
_toggleType->setMaximumWidth(11);
setButtonIcon(_toggleType, ":/res/images/dots-vert.svg");
SetButtonIcon(_toggleType, ":/res/images/dots-vert.svg");
QWidget::connect(_fixedValueInt, SIGNAL(valueChanged(int)), this,
SLOT(SetFixedValue(int)));

View File

@@ -69,7 +69,7 @@ std::string SubstitueVariables(std::string str)
for (const auto &v : switcher->variables) {
const auto &variable = std::dynamic_pointer_cast<Variable>(v);
const std::string pattern = "${" + variable->Name() + "}";
replaceAll(str, pattern, variable->Value());
ReplaceAll(str, pattern, variable->Value());
}
return str;
}