mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Split utility headers
This commit is contained in:
parent
8b9f3064ba
commit
cf5f338902
|
|
@ -159,6 +159,8 @@ target_sources(
|
|||
lib/utils/filter-combo-box.hpp
|
||||
lib/utils/item-selection-helpers.cpp
|
||||
lib/utils/item-selection-helpers.hpp
|
||||
lib/utils/layout-helpers.cpp
|
||||
lib/utils/layout-helpers.hpp
|
||||
lib/utils/log-helper.cpp
|
||||
lib/utils/log-helper.hpp
|
||||
lib/utils/math-helpers.cpp
|
||||
|
|
@ -188,10 +190,16 @@ target_sources(
|
|||
lib/utils/screenshot-helper.hpp
|
||||
lib/utils/section.cpp
|
||||
lib/utils/section.hpp
|
||||
lib/utils/selection-helpers.cpp
|
||||
lib/utils/selection-helpers.hpp
|
||||
lib/utils/slider-spinbox.cpp
|
||||
lib/utils/slider-spinbox.hpp
|
||||
lib/utils/source-helpers.cpp
|
||||
lib/utils/source-helpers.hpp
|
||||
lib/utils/source-selection.cpp
|
||||
lib/utils/source-selection.hpp
|
||||
lib/utils/splitter-helpers.cpp
|
||||
lib/utils/splitter-helpers.hpp
|
||||
lib/utils/status-control.cpp
|
||||
lib/utils/status-control.hpp
|
||||
lib/utils/switch-button.cpp
|
||||
|
|
@ -200,6 +208,8 @@ target_sources(
|
|||
lib/utils/sync-helpers.hpp
|
||||
lib/utils/temp-variable.cpp
|
||||
lib/utils/temp-variable.hpp
|
||||
lib/utils/ui-helpers.cpp
|
||||
lib/utils/ui-helpers.hpp
|
||||
lib/utils/utility.cpp
|
||||
lib/utils/utility.hpp
|
||||
lib/utils/variable-line-edit.cpp
|
||||
|
|
|
|||
|
|
@ -1,22 +1,25 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "curl-helper.hpp"
|
||||
#include "log-helper.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "status-control.hpp"
|
||||
#include "scene-switch-helpers.hpp"
|
||||
#include "curl-helper.hpp"
|
||||
#include "platform-funcs.hpp"
|
||||
#include "scene-switch-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "status-control.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "version.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QDirIterator>
|
||||
#include <regex>
|
||||
#include <filesystem>
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QAction>
|
||||
#include <QDirIterator>
|
||||
#include <QFileDialog>
|
||||
#include <QMainWindow>
|
||||
#include <QTextStream>
|
||||
#include <regex>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "file-selection.hpp"
|
||||
#include "filter-combo-box.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "splitter-helpers.hpp"
|
||||
#include "status-control.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "variable.hpp"
|
||||
#include "version.h"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QFileDialog>
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <random>
|
||||
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "name-dialog.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <random>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <thread>
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "volume-control.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "volume-control.hpp"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "platform-funcs.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "curl-helper.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QtGlobal>
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
constexpr auto previous_scene_name = "Previous Scene";
|
||||
constexpr auto current_transition_name = "Current Transition";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "platform-funcs.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
|
||||
#include <regex>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -2,15 +2,16 @@
|
|||
Most of this code is based on https://github.com/Palakis/obs-websocket
|
||||
*/
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QTime>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "scene-switch-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QMessageBox>
|
||||
#include <QTime>
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <regex>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <random>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QTimer>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "obs-frontend-api.h"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <thread>
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
|
@ -404,7 +408,7 @@ VideoSwitchWidget::VideoSwitchWidget(QWidget *parent, VideoSwitch *s)
|
|||
QWidget::connect(ignoreInactiveSource, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(IgnoreInactiveChanged(int)));
|
||||
|
||||
populateVideoSelection(videoSources);
|
||||
PopulateVideoSelection(videoSources);
|
||||
populateConditionSelection(condition);
|
||||
|
||||
if (s) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#include "advanced-scene-switcher.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "platform-funcs.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <regex>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#include "macro-action-edit.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "macro-properties.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "macro-properties.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "section.hpp"
|
||||
#include "switch-button.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QGraphicsOpacityEffect>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "macro-action-macro.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "macro-action-queue.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
#include "macro-action-variable.hpp"
|
||||
#include "macro-condition-edit.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "math-helpers.hpp"
|
||||
#include "macro-condition-edit.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "non-modal-dialog.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#include "macro-condition-edit.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "macro-properties.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "macro-properties.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "section.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "macro-condition-macro.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro-action-edit.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "macro.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "macro-condition-queue.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "macro-condition-tempvar.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "math-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "macro-condition-variable.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "macro-dock.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -129,4 +129,21 @@ void ResetMacroRunCount(Macro *macro)
|
|||
macro->ResetRunCount();
|
||||
}
|
||||
|
||||
bool IsValidMacroSegmentIndex(Macro *m, const int idx, bool isCondition)
|
||||
{
|
||||
if (!m || idx < 0) {
|
||||
return false;
|
||||
}
|
||||
if (isCondition) {
|
||||
if (idx >= (int)m->Conditions().size()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (idx >= (int)m->Actions().size()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
|
|
@ -61,4 +61,6 @@ EXPORT void InvalidateMacroTempVarValues();
|
|||
EXPORT void ResetMacroConditionTimers(Macro *);
|
||||
EXPORT void ResetMacroRunCount(Macro *);
|
||||
|
||||
bool IsValidMacroSegmentIndex(Macro *m, const int idx, bool isCondition);
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "macro-helpers.hpp"
|
||||
#include "macro-selection.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#include "macro-properties.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "macro.hpp"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QScrollArea>
|
||||
#include <QScrollBar>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#include "macro-run-button.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "macro-tree.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
#include "macro-segment-list.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QDrag>
|
||||
#include <QGridLayout>
|
||||
#include <QMimeData>
|
||||
#include <QMouseEvent>
|
||||
#include <QScrollBar>
|
||||
#include <QSpacerItem>
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
#include "macro-segment-selection.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "macro-action-factory.hpp"
|
||||
#include "macro-condition-factory.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "macro-segment.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
@ -64,6 +70,41 @@ void MacroSegmentSelection::MacroSegmentOrderChanged()
|
|||
SetupDescription();
|
||||
}
|
||||
|
||||
QString GetMacroSegmentDescription(Macro *macro, int idx, bool isCondition)
|
||||
{
|
||||
if (!macro) {
|
||||
return "";
|
||||
}
|
||||
if (!IsValidMacroSegmentIndex(macro, idx, isCondition)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
MacroSegment *segment;
|
||||
if (isCondition) {
|
||||
segment = GetMacroConditions(macro)->at(idx).get();
|
||||
} else {
|
||||
segment = GetMacroActions(macro)->at(idx).get();
|
||||
}
|
||||
|
||||
QString description = QString::fromStdString(segment->GetShortDesc());
|
||||
QString type;
|
||||
if (isCondition) {
|
||||
type = obs_module_text(MacroConditionFactory::GetConditionName(
|
||||
segment->GetId())
|
||||
.c_str());
|
||||
} else {
|
||||
type = obs_module_text(
|
||||
MacroActionFactory::GetActionName(segment->GetId())
|
||||
.c_str());
|
||||
}
|
||||
|
||||
QString result = type;
|
||||
if (!description.isEmpty()) {
|
||||
result += ": " + description;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void MacroSegmentSelection::SetupDescription() const
|
||||
{
|
||||
if (!_macro) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
#include "macro-segment.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "section.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "mouse-wheel-guard.hpp"
|
||||
#include "section.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <obs.hpp>
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QLabel>
|
||||
#include <QScrollBar>
|
||||
#include <QApplication>
|
||||
#include <QEvent>
|
||||
#include <QLabel>
|
||||
#include <QMouseEvent>
|
||||
#include <QScrollBar>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#include "macro-selection.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro.hpp"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
#include "macro.hpp"
|
||||
#include "macro-tree.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "macro-action-edit.hpp"
|
||||
#include "macro-condition-edit.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "name-dialog.hpp"
|
||||
#include "macro-properties.hpp"
|
||||
#include "macro-export-import-dialog.hpp"
|
||||
#include "macro-properties.hpp"
|
||||
#include "macro-tree.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "name-dialog.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "version.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QMenu>
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#include <QMenu>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "macro-tree.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "sync-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <obs.h>
|
||||
|
|
|
|||
|
|
@ -4,15 +4,16 @@
|
|||
#include "macro-dock.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "splitter-helpers.hpp"
|
||||
#include "sync-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
#undef max
|
||||
#include <chrono>
|
||||
#include <unordered_map>
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QAction>
|
||||
#include <QMainWindow>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "switcher-data.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "duration-control.hpp"
|
||||
#include "mouse-wheel-guard.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "duration.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "filter-combo-box.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QCompleter>
|
||||
#include <QLineEdit>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "item-selection-helpers.hpp"
|
||||
#include "name-dialog.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <QAction>
|
||||
|
|
|
|||
185
lib/utils/layout-helpers.cpp
Normal file
185
lib/utils/layout-helpers.cpp
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
namespace advss {
|
||||
|
||||
static std::string
|
||||
getNextDelim(const std::string &text,
|
||||
const std::unordered_map<std::string, QWidget *> &placeholders)
|
||||
{
|
||||
size_t pos = std::string::npos;
|
||||
std::string res = "";
|
||||
|
||||
for (const auto &ph : placeholders) {
|
||||
size_t newPos = text.find(ph.first);
|
||||
if (newPos <= pos) {
|
||||
pos = newPos;
|
||||
res = ph.first;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos == std::string::npos) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void PlaceWidgets(std::string text, QBoxLayout *layout,
|
||||
const std::unordered_map<std::string, QWidget *> &placeholders,
|
||||
bool addStretch)
|
||||
{
|
||||
std::vector<std::pair<std::string, QWidget *>> labelsWidgetsPairs;
|
||||
|
||||
std::string delim = getNextDelim(text, placeholders);
|
||||
while (delim != "") {
|
||||
size_t pos = text.find(delim);
|
||||
if (pos != std::string::npos) {
|
||||
labelsWidgetsPairs.emplace_back(text.substr(0, pos),
|
||||
placeholders.at(delim));
|
||||
text.erase(0, pos + delim.length());
|
||||
}
|
||||
delim = getNextDelim(text, placeholders);
|
||||
}
|
||||
|
||||
if (text != "") {
|
||||
labelsWidgetsPairs.emplace_back(text, nullptr);
|
||||
}
|
||||
|
||||
for (auto &lw : labelsWidgetsPairs) {
|
||||
if (lw.first != "") {
|
||||
layout->addWidget(new QLabel(lw.first.c_str()));
|
||||
}
|
||||
if (lw.second) {
|
||||
layout->addWidget(lw.second);
|
||||
}
|
||||
}
|
||||
if (addStretch) {
|
||||
layout->addStretch();
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteLayoutItemWidget(QLayoutItem *item)
|
||||
{
|
||||
if (item) {
|
||||
auto widget = item->widget();
|
||||
if (widget) {
|
||||
widget->setVisible(false);
|
||||
widget->deleteLater();
|
||||
}
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
void ClearLayout(QLayout *layout, int afterIdx)
|
||||
{
|
||||
QLayoutItem *item;
|
||||
while ((item = layout->takeAt(afterIdx))) {
|
||||
if (item->layout()) {
|
||||
ClearLayout(item->layout());
|
||||
delete item->layout();
|
||||
}
|
||||
DeleteLayoutItemWidget(item);
|
||||
}
|
||||
}
|
||||
|
||||
void SetLayoutVisible(QLayout *layout, bool visible)
|
||||
{
|
||||
if (!layout) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < layout->count(); ++i) {
|
||||
QWidget *widget = layout->itemAt(i)->widget();
|
||||
QLayout *nestedLayout = layout->itemAt(i)->layout();
|
||||
if (widget) {
|
||||
widget->setVisible(visible);
|
||||
}
|
||||
if (nestedLayout) {
|
||||
SetLayoutVisible(nestedLayout, visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetGridLayoutRowVisible(QGridLayout *layout, int row, bool visible)
|
||||
{
|
||||
for (int col = 0; col < layout->columnCount(); col++) {
|
||||
auto item = layout->itemAtPosition(row, col);
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto rowLayout = item->layout();
|
||||
if (rowLayout) {
|
||||
SetLayoutVisible(rowLayout, visible);
|
||||
}
|
||||
|
||||
auto widget = item->widget();
|
||||
if (widget) {
|
||||
widget->setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
if (!visible) {
|
||||
layout->setRowMinimumHeight(row, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void AddStretchIfNecessary(QBoxLayout *layout)
|
||||
{
|
||||
int itemCount = layout->count();
|
||||
if (itemCount > 0) {
|
||||
auto lastItem = layout->itemAt(itemCount - 1);
|
||||
auto lastSpacer = dynamic_cast<QSpacerItem *>(lastItem);
|
||||
if (!lastSpacer) {
|
||||
layout->addStretch();
|
||||
}
|
||||
} else {
|
||||
layout->addStretch();
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveStretchIfPresent(QBoxLayout *layout)
|
||||
{
|
||||
int itemCount = layout->count();
|
||||
if (itemCount > 0) {
|
||||
auto lastItem = layout->itemAt(itemCount - 1);
|
||||
auto lastSpacer = dynamic_cast<QSpacerItem *>(lastItem);
|
||||
if (lastSpacer) {
|
||||
layout->removeItem(lastItem);
|
||||
delete lastItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MinimizeSizeOfColumn(QGridLayout *layout, int idx)
|
||||
{
|
||||
if (idx >= layout->columnCount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < layout->columnCount(); i++) {
|
||||
if (i == idx) {
|
||||
layout->setColumnStretch(i, 0);
|
||||
} else {
|
||||
layout->setColumnStretch(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
int columnWidth = 0;
|
||||
for (int row = 0; row < layout->rowCount(); row++) {
|
||||
auto item = layout->itemAtPosition(row, idx);
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
auto widget = item->widget();
|
||||
if (!widget) {
|
||||
continue;
|
||||
}
|
||||
columnWidth = std::max(columnWidth,
|
||||
widget->minimumSizeHint().width());
|
||||
}
|
||||
layout->setColumnMinimumWidth(idx, columnWidth);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
23
lib/utils/layout-helpers.hpp
Normal file
23
lib/utils/layout-helpers.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <QLayout>
|
||||
#include <QWidget>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace advss {
|
||||
|
||||
EXPORT void
|
||||
PlaceWidgets(std::string text, QBoxLayout *layout,
|
||||
const std::unordered_map<std::string, QWidget *> &placeholders,
|
||||
bool addStretch = true);
|
||||
void DeleteLayoutItemWidget(QLayoutItem *item);
|
||||
EXPORT void ClearLayout(QLayout *layout, int afterIdx = 0);
|
||||
EXPORT void SetLayoutVisible(QLayout *layout, bool visible);
|
||||
EXPORT void SetGridLayoutRowVisible(QGridLayout *layout, int row, bool visible);
|
||||
EXPORT void AddStretchIfNecessary(QBoxLayout *layout);
|
||||
EXPORT void RemoveStretchIfPresent(QBoxLayout *layout);
|
||||
EXPORT void MinimizeSizeOfColumn(QGridLayout *layout, int idx);
|
||||
|
||||
} // namespace advss
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#include "regex-config.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QLayout>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#include "resizing-text-edit.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <obs-module-helper.hpp>
|
||||
#include <QScrollBar>
|
||||
#include <utility.hpp>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,13 @@
|
|||
#include "obs-module-helper.hpp"
|
||||
#include "scene-group.hpp"
|
||||
#include "scene-switch-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "variable.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
#pragma once
|
||||
#include "scene-group.hpp"
|
||||
#include "variable.hpp"
|
||||
#include "filter-combo-box.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <obs.hpp>
|
||||
|
||||
namespace advss {
|
||||
|
||||
struct SceneGroup;
|
||||
class Variable;
|
||||
|
||||
class SceneSelection {
|
||||
public:
|
||||
EXPORT void Save(obs_data_t *obj) const;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#include "scene-switch-helpers.hpp"
|
||||
#include "log-helper.hpp"
|
||||
#include "obs-frontend-api.h"
|
||||
#include "source-helpers.hpp"
|
||||
#include "switcher-data.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "section.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <QPropertyAnimation>
|
||||
#include <QEvent>
|
||||
|
|
|
|||
334
lib/utils/selection-helpers.cpp
Normal file
334
lib/utils/selection-helpers.cpp
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
#include "selection-helpers.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "platform-funcs.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "scene-group.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
namespace advss {
|
||||
|
||||
QStringList GetAudioSourceNames()
|
||||
{
|
||||
auto sourceEnum = [](void *param, obs_source_t *source) -> bool /* -- */
|
||||
{
|
||||
QStringList *list = reinterpret_cast<QStringList *>(param);
|
||||
uint32_t flags = obs_source_get_output_flags(source);
|
||||
|
||||
if ((flags & OBS_SOURCE_AUDIO) != 0) {
|
||||
*list << obs_source_get_name(source);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
QStringList list;
|
||||
obs_enum_sources(sourceEnum, &list);
|
||||
return list;
|
||||
}
|
||||
|
||||
static void hasFilterEnum(obs_source_t *, obs_source_t *filter, void *ptr)
|
||||
{
|
||||
if (!filter) {
|
||||
return;
|
||||
}
|
||||
bool *hasFilter = reinterpret_cast<bool *>(ptr);
|
||||
*hasFilter = true;
|
||||
}
|
||||
|
||||
QStringList GetSourcesWithFilterNames()
|
||||
{
|
||||
auto enumSourcesWithFilters = [](void *param, obs_source_t *source) {
|
||||
if (!source) {
|
||||
return true;
|
||||
}
|
||||
QStringList *list = reinterpret_cast<QStringList *>(param);
|
||||
bool hasFilter = false;
|
||||
obs_source_enum_filters(source, hasFilterEnum, &hasFilter);
|
||||
if (hasFilter) {
|
||||
*list << obs_source_get_name(source);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
QStringList list;
|
||||
obs_enum_sources(enumSourcesWithFilters, &list);
|
||||
obs_enum_scenes(enumSourcesWithFilters, &list);
|
||||
return list;
|
||||
}
|
||||
|
||||
QStringList GetMediaSourceNames()
|
||||
{
|
||||
auto sourceEnum = [](void *param, obs_source_t *source) -> bool /* -- */
|
||||
{
|
||||
QStringList *list = reinterpret_cast<QStringList *>(param);
|
||||
if (IsMediaSource(source)) {
|
||||
*list << obs_source_get_name(source);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
QStringList list;
|
||||
obs_enum_sources(sourceEnum, &list);
|
||||
return list;
|
||||
}
|
||||
|
||||
QStringList GetVideoSourceNames()
|
||||
{
|
||||
auto sourceEnum = [](void *param, obs_source_t *source) -> bool /* -- */
|
||||
{
|
||||
QStringList *list = reinterpret_cast<QStringList *>(param);
|
||||
uint32_t flags = obs_source_get_output_flags(source);
|
||||
std::string test = obs_source_get_name(source);
|
||||
if ((flags & (OBS_SOURCE_VIDEO | OBS_SOURCE_ASYNC)) != 0) {
|
||||
*list << obs_source_get_name(source);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
QStringList list;
|
||||
obs_enum_sources(sourceEnum, &list);
|
||||
return list;
|
||||
}
|
||||
|
||||
QStringList GetSceneNames()
|
||||
{
|
||||
QStringList list;
|
||||
char **scenes = obs_frontend_get_scene_names();
|
||||
char **temp = scenes;
|
||||
while (*temp) {
|
||||
const char *name = *temp;
|
||||
list << name;
|
||||
temp++;
|
||||
}
|
||||
bfree(scenes);
|
||||
return list;
|
||||
}
|
||||
|
||||
QStringList GetSourceNames()
|
||||
{
|
||||
auto sourceEnum = [](void *param, obs_source_t *source) -> bool /* -- */
|
||||
{
|
||||
QStringList *list = reinterpret_cast<QStringList *>(param);
|
||||
*list << obs_source_get_name(source);
|
||||
return true;
|
||||
};
|
||||
|
||||
QStringList list;
|
||||
obs_enum_sources(sourceEnum, &list);
|
||||
return list;
|
||||
}
|
||||
|
||||
void PopulateTransitionSelection(QComboBox *sel, bool addCurrent, bool addAny,
|
||||
bool addSelect)
|
||||
{
|
||||
|
||||
obs_frontend_source_list *transitions = new obs_frontend_source_list();
|
||||
obs_frontend_get_transitions(transitions);
|
||||
|
||||
for (size_t i = 0; i < transitions->sources.num; i++) {
|
||||
const char *name =
|
||||
obs_source_get_name(transitions->sources.array[i]);
|
||||
sel->addItem(name);
|
||||
}
|
||||
|
||||
obs_frontend_source_list_free(transitions);
|
||||
|
||||
sel->model()->sort(0);
|
||||
|
||||
if (addSelect) {
|
||||
AddSelectionEntry(
|
||||
sel,
|
||||
obs_module_text("AdvSceneSwitcher.selectTransition"));
|
||||
}
|
||||
sel->setCurrentIndex(0);
|
||||
|
||||
if (addCurrent) {
|
||||
sel->insertItem(
|
||||
addSelect ? 1 : 0,
|
||||
obs_module_text("AdvSceneSwitcher.currentTransition"));
|
||||
}
|
||||
if (addAny) {
|
||||
sel->insertItem(
|
||||
addSelect ? 1 : 0,
|
||||
obs_module_text("AdvSceneSwitcher.anyTransition"));
|
||||
}
|
||||
}
|
||||
|
||||
void PopulateWindowSelection(QComboBox *sel, bool addSelect)
|
||||
{
|
||||
|
||||
std::vector<std::string> windows;
|
||||
GetWindowList(windows);
|
||||
|
||||
for (std::string &window : windows) {
|
||||
sel->addItem(window.c_str());
|
||||
}
|
||||
|
||||
sel->model()->sort(0);
|
||||
if (addSelect) {
|
||||
AddSelectionEntry(
|
||||
sel, obs_module_text("AdvSceneSwitcher.selectWindow"));
|
||||
}
|
||||
sel->setCurrentIndex(0);
|
||||
#ifdef WIN32
|
||||
sel->setItemData(0, obs_module_text("AdvSceneSwitcher.selectWindowTip"),
|
||||
Qt::ToolTipRole);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PopulateAudioSelection(QComboBox *sel, bool addSelect)
|
||||
{
|
||||
auto sources = GetAudioSourceNames();
|
||||
sources.sort();
|
||||
sel->addItems(sources);
|
||||
|
||||
if (addSelect) {
|
||||
AddSelectionEntry(
|
||||
sel,
|
||||
obs_module_text("AdvSceneSwitcher.selectAudioSource"),
|
||||
false,
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.invaildEntriesWillNotBeSaved"));
|
||||
}
|
||||
sel->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void PopulateVideoSelection(QComboBox *sel, bool addMainOutput, bool addScenes,
|
||||
bool addSelect)
|
||||
{
|
||||
|
||||
auto sources = GetVideoSourceNames();
|
||||
sources.sort();
|
||||
sel->addItems(sources);
|
||||
if (addScenes) {
|
||||
auto scenes = GetSceneNames();
|
||||
scenes.sort();
|
||||
sel->addItems(scenes);
|
||||
}
|
||||
|
||||
sel->model()->sort(0);
|
||||
if (addMainOutput) {
|
||||
sel->insertItem(
|
||||
0, obs_module_text("AdvSceneSwitcher.OBSVideoOutput"));
|
||||
}
|
||||
if (addSelect) {
|
||||
AddSelectionEntry(
|
||||
sel,
|
||||
obs_module_text("AdvSceneSwitcher.selectVideoSource"),
|
||||
false,
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.invaildEntriesWillNotBeSaved"));
|
||||
}
|
||||
sel->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void PopulateMediaSelection(QComboBox *sel, bool addSelect)
|
||||
{
|
||||
auto sources = GetMediaSourceNames();
|
||||
sources.sort();
|
||||
sel->addItems(sources);
|
||||
|
||||
if (addSelect) {
|
||||
AddSelectionEntry(
|
||||
sel,
|
||||
obs_module_text("AdvSceneSwitcher.selectMediaSource"),
|
||||
false,
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.invaildEntriesWillNotBeSaved"));
|
||||
}
|
||||
sel->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void PopulateProcessSelection(QComboBox *sel, bool addSelect)
|
||||
{
|
||||
QStringList processes;
|
||||
GetProcessList(processes);
|
||||
processes.sort();
|
||||
for (QString &process : processes) {
|
||||
sel->addItem(process);
|
||||
}
|
||||
|
||||
sel->model()->sort(0);
|
||||
if (addSelect) {
|
||||
AddSelectionEntry(
|
||||
sel, obs_module_text("AdvSceneSwitcher.selectProcess"));
|
||||
}
|
||||
sel->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void PopulateSceneSelection(QComboBox *sel, bool addPrevious, bool addCurrent,
|
||||
bool addAny, bool addSceneGroup,
|
||||
std::deque<SceneGroup> *sceneGroups, bool addSelect,
|
||||
std::string selectText, bool selectable)
|
||||
{
|
||||
auto sceneNames = GetSceneNames();
|
||||
sel->addItems(sceneNames);
|
||||
|
||||
if (addSceneGroup && sceneGroups) {
|
||||
for (auto &sg : *sceneGroups) {
|
||||
sel->addItem(QString::fromStdString(sg.name));
|
||||
}
|
||||
}
|
||||
|
||||
sel->model()->sort(0);
|
||||
if (addSelect) {
|
||||
if (selectText.empty()) {
|
||||
AddSelectionEntry(
|
||||
sel,
|
||||
obs_module_text("AdvSceneSwitcher.selectScene"),
|
||||
selectable,
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.invaildEntriesWillNotBeSaved"));
|
||||
} else {
|
||||
AddSelectionEntry(sel, selectText.c_str(), selectable);
|
||||
}
|
||||
}
|
||||
sel->setCurrentIndex(0);
|
||||
|
||||
if (addPrevious) {
|
||||
sel->insertItem(
|
||||
1, obs_module_text(
|
||||
"AdvSceneSwitcher.selectPreviousScene"));
|
||||
}
|
||||
if (addCurrent) {
|
||||
sel->insertItem(
|
||||
1,
|
||||
obs_module_text("AdvSceneSwitcher.selectCurrentScene"));
|
||||
}
|
||||
if (addAny) {
|
||||
sel->insertItem(
|
||||
1, obs_module_text("AdvSceneSwitcher.selectAnyScene"));
|
||||
}
|
||||
}
|
||||
|
||||
void AddSelectionEntry(QComboBox *sel, const char *description, bool selectable,
|
||||
const char *tooltip)
|
||||
{
|
||||
sel->insertItem(0, description);
|
||||
|
||||
if (strcmp(tooltip, "") != 0) {
|
||||
sel->setItemData(0, tooltip, Qt::ToolTipRole);
|
||||
}
|
||||
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(sel->model());
|
||||
QModelIndex firstIndex =
|
||||
model->index(0, sel->modelColumn(), sel->rootModelIndex());
|
||||
QStandardItem *firstItem = model->itemFromIndex(firstIndex);
|
||||
if (!selectable) {
|
||||
firstItem->setSelectable(false);
|
||||
firstItem->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AddSelectionGroup(QComboBox *selection, const QStringList &group,
|
||||
bool addSeparator)
|
||||
{
|
||||
selection->addItems(group);
|
||||
if (addSeparator) {
|
||||
selection->insertSeparator(selection->count());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
42
lib/utils/selection-helpers.hpp
Normal file
42
lib/utils/selection-helpers.hpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <deque>
|
||||
#include <obs.hpp>
|
||||
#include <QComboBox>
|
||||
#include <QStringList>
|
||||
#include <string>
|
||||
|
||||
namespace advss {
|
||||
|
||||
struct SceneGroup;
|
||||
|
||||
EXPORT QStringList GetAudioSourceNames();
|
||||
EXPORT QStringList GetSourcesWithFilterNames();
|
||||
EXPORT QStringList GetMediaSourceNames();
|
||||
EXPORT QStringList GetVideoSourceNames();
|
||||
EXPORT QStringList GetSceneNames();
|
||||
EXPORT QStringList GetSourceNames();
|
||||
|
||||
EXPORT void PopulateTransitionSelection(QComboBox *sel, bool addCurrent = true,
|
||||
bool addAny = false,
|
||||
bool addSelect = true);
|
||||
EXPORT 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);
|
||||
EXPORT void PopulateProcessSelection(QComboBox *sel, bool addSelect = true);
|
||||
EXPORT 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);
|
||||
|
||||
EXPORT void AddSelectionEntry(QComboBox *sel, const char *description,
|
||||
bool selectable = false,
|
||||
const char *tooltip = "");
|
||||
EXPORT void AddSelectionGroup(QComboBox *selection, const QStringList &group,
|
||||
bool addSeparator = true);
|
||||
|
||||
} // namespace advss
|
||||
136
lib/utils/source-helpers.cpp
Normal file
136
lib/utils/source-helpers.cpp
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
#include "source-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
bool WeakSourceValid(obs_weak_source_t *ws)
|
||||
{
|
||||
obs_source_t *source = obs_weak_source_get_source(ws);
|
||||
if (source) {
|
||||
obs_source_release(source);
|
||||
}
|
||||
return !!source;
|
||||
}
|
||||
|
||||
std::string GetWeakSourceName(obs_weak_source_t *weak_source)
|
||||
{
|
||||
std::string name;
|
||||
|
||||
obs_source_t *source = obs_weak_source_get_source(weak_source);
|
||||
if (source) {
|
||||
name = obs_source_get_name(source);
|
||||
obs_source_release(source);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
OBSWeakSource GetWeakSourceByName(const char *name)
|
||||
{
|
||||
OBSWeakSource weak;
|
||||
obs_source_t *source = obs_get_source_by_name(name);
|
||||
if (source) {
|
||||
weak = obs_source_get_weak_source(source);
|
||||
obs_weak_source_release(weak);
|
||||
obs_source_release(source);
|
||||
}
|
||||
|
||||
return weak;
|
||||
}
|
||||
|
||||
OBSWeakSource GetWeakSourceByQString(const QString &name)
|
||||
{
|
||||
return GetWeakSourceByName(name.toUtf8().constData());
|
||||
}
|
||||
|
||||
OBSWeakSource GetWeakTransitionByName(const char *transitionName)
|
||||
{
|
||||
OBSWeakSource weak;
|
||||
obs_source_t *source = nullptr;
|
||||
|
||||
if (strcmp(transitionName, "Default") == 0) {
|
||||
source = obs_frontend_get_current_transition();
|
||||
weak = obs_source_get_weak_source(source);
|
||||
obs_source_release(source);
|
||||
obs_weak_source_release(weak);
|
||||
return weak;
|
||||
}
|
||||
|
||||
obs_frontend_source_list *transitions = new obs_frontend_source_list();
|
||||
obs_frontend_get_transitions(transitions);
|
||||
bool match = false;
|
||||
|
||||
for (size_t i = 0; i < transitions->sources.num; i++) {
|
||||
const char *name =
|
||||
obs_source_get_name(transitions->sources.array[i]);
|
||||
if (strcmp(transitionName, name) == 0) {
|
||||
match = true;
|
||||
source = transitions->sources.array[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (match) {
|
||||
weak = obs_source_get_weak_source(source);
|
||||
obs_weak_source_release(weak);
|
||||
}
|
||||
obs_frontend_source_list_free(transitions);
|
||||
|
||||
return weak;
|
||||
}
|
||||
|
||||
OBSWeakSource GetWeakTransitionByQString(const QString &name)
|
||||
{
|
||||
return GetWeakTransitionByName(name.toUtf8().constData());
|
||||
}
|
||||
|
||||
OBSWeakSource GetWeakFilterByName(OBSWeakSource source, const char *name)
|
||||
{
|
||||
OBSWeakSource weak;
|
||||
auto s = obs_weak_source_get_source(source);
|
||||
if (s) {
|
||||
auto filterSource = obs_source_get_filter_by_name(s, name);
|
||||
weak = obs_source_get_weak_source(filterSource);
|
||||
obs_weak_source_release(weak);
|
||||
obs_source_release(filterSource);
|
||||
obs_source_release(s);
|
||||
}
|
||||
return weak;
|
||||
}
|
||||
|
||||
OBSWeakSource GetWeakFilterByQString(OBSWeakSource source, const QString &name)
|
||||
{
|
||||
return GetWeakFilterByName(source, name.toUtf8().constData());
|
||||
}
|
||||
|
||||
static bool getTotalSceneItemCountHelper(obs_scene_t *, obs_sceneitem_t *item,
|
||||
void *ptr)
|
||||
{
|
||||
auto count = reinterpret_cast<int *>(ptr);
|
||||
|
||||
if (obs_sceneitem_is_group(item)) {
|
||||
obs_scene_t *scene = obs_sceneitem_group_get_scene(item);
|
||||
obs_scene_enum_items(scene, getTotalSceneItemCountHelper, ptr);
|
||||
}
|
||||
*count = *count + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
int GetSceneItemCount(const OBSWeakSource &sceneWeakSource)
|
||||
{
|
||||
auto s = obs_weak_source_get_source(sceneWeakSource);
|
||||
auto scene = obs_scene_from_source(s);
|
||||
int count = 0;
|
||||
obs_scene_enum_items(scene, getTotalSceneItemCountHelper, &count);
|
||||
obs_source_release(s);
|
||||
return count;
|
||||
}
|
||||
|
||||
bool IsMediaSource(obs_source_t *source)
|
||||
{
|
||||
uint32_t flags = obs_source_get_output_flags(source);
|
||||
return (flags & OBS_SOURCE_CONTROLLABLE_MEDIA) != 0;
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
23
lib/utils/source-helpers.hpp
Normal file
23
lib/utils/source-helpers.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <obs.hpp>
|
||||
#include <QString>
|
||||
#include <string>
|
||||
|
||||
namespace advss {
|
||||
|
||||
EXPORT bool WeakSourceValid(obs_weak_source_t *ws);
|
||||
EXPORT std::string GetWeakSourceName(obs_weak_source_t *weak_source);
|
||||
EXPORT OBSWeakSource GetWeakSourceByName(const char *name);
|
||||
EXPORT OBSWeakSource GetWeakSourceByQString(const QString &name);
|
||||
EXPORT OBSWeakSource GetWeakTransitionByName(const char *transitionName);
|
||||
EXPORT OBSWeakSource GetWeakTransitionByQString(const QString &name);
|
||||
EXPORT OBSWeakSource GetWeakFilterByName(OBSWeakSource source,
|
||||
const char *name);
|
||||
EXPORT OBSWeakSource GetWeakFilterByQString(OBSWeakSource source,
|
||||
const QString &name);
|
||||
EXPORT int GetSceneItemCount(const OBSWeakSource &);
|
||||
EXPORT bool IsMediaSource(obs_source_t *source);
|
||||
|
||||
} // namespace advss
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
#include "source-selection.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "variable.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
33
lib/utils/splitter-helpers.cpp
Normal file
33
lib/utils/splitter-helpers.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "splitter-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
void SaveSplitterPos(const QList<int> &sizes, obs_data_t *obj,
|
||||
const std::string &name)
|
||||
{
|
||||
auto array = obs_data_array_create();
|
||||
for (int i = 0; i < sizes.count(); ++i) {
|
||||
obs_data_t *array_obj = obs_data_create();
|
||||
obs_data_set_int(array_obj, "pos", sizes[i]);
|
||||
obs_data_array_push_back(array, array_obj);
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
obs_data_set_array(obj, name.c_str(), array);
|
||||
obs_data_array_release(array);
|
||||
}
|
||||
|
||||
void LoadSplitterPos(QList<int> &sizes, obs_data_t *obj,
|
||||
const std::string &name)
|
||||
{
|
||||
sizes.clear();
|
||||
obs_data_array_t *array = obs_data_get_array(obj, name.c_str());
|
||||
size_t count = obs_data_array_count(array);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
obs_data_t *item = obs_data_array_item(array, i);
|
||||
sizes << obs_data_get_int(item, "pos");
|
||||
obs_data_release(item);
|
||||
}
|
||||
obs_data_array_release(array);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
15
lib/utils/splitter-helpers.hpp
Normal file
15
lib/utils/splitter-helpers.hpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <obs-data.h>
|
||||
#include <QList>
|
||||
#include <string>
|
||||
|
||||
namespace advss {
|
||||
|
||||
void SaveSplitterPos(const QList<int> &sizes, obs_data_t *obj,
|
||||
const std::string &name);
|
||||
void LoadSplitterPos(QList<int> &sizes, obs_data_t *obj,
|
||||
const std::string &name);
|
||||
|
||||
} // namespace advss
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
#include "status-control.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QAction>
|
||||
#include <QMainWindow>
|
||||
#include <QToolBar>
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "macro.hpp"
|
||||
#include "macro-segment.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QVariant>
|
||||
|
|
|
|||
170
lib/utils/ui-helpers.cpp
Normal file
170
lib/utils/ui-helpers.cpp
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
#include "ui-helpers.hpp"
|
||||
#include "non-modal-dialog.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <obs.hpp>
|
||||
#include <QGraphicsColorizeEffect>
|
||||
#include <QMainWindow>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QScrollBar>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
namespace advss {
|
||||
|
||||
QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
|
||||
QColor endColor, bool once)
|
||||
{
|
||||
QGraphicsColorizeEffect *effect = new QGraphicsColorizeEffect(widget);
|
||||
widget->setGraphicsEffect(effect);
|
||||
QPropertyAnimation *animation =
|
||||
new QPropertyAnimation(effect, "color", widget);
|
||||
animation->setStartValue(startColor);
|
||||
animation->setEndValue(endColor);
|
||||
animation->setDuration(1000);
|
||||
|
||||
QMetaObject::Connection con;
|
||||
if (once) {
|
||||
auto widgetPtr = widget;
|
||||
con = QWidget::connect(
|
||||
animation, &QPropertyAnimation::finished,
|
||||
[widgetPtr]() {
|
||||
if (widgetPtr) {
|
||||
widgetPtr->setGraphicsEffect(nullptr);
|
||||
}
|
||||
});
|
||||
animation->start(QPropertyAnimation::DeleteWhenStopped);
|
||||
} else {
|
||||
auto widgetPtr = widget;
|
||||
con = QWidget::connect(
|
||||
animation, &QPropertyAnimation::finished,
|
||||
[animation, widgetPtr]() {
|
||||
QTimer *timer = new QTimer(widgetPtr);
|
||||
QWidget::connect(timer, &QTimer::timeout,
|
||||
[animation] {
|
||||
animation->start();
|
||||
});
|
||||
timer->setSingleShot(true);
|
||||
timer->start(1000);
|
||||
});
|
||||
animation->start();
|
||||
}
|
||||
return con;
|
||||
}
|
||||
|
||||
static int getHorizontalScrollBarHeight(QListWidget *list)
|
||||
{
|
||||
if (!list) {
|
||||
return 0;
|
||||
}
|
||||
auto horizontalScrollBar = list->horizontalScrollBar();
|
||||
if (!horizontalScrollBar || !horizontalScrollBar->isVisible()) {
|
||||
return 0;
|
||||
}
|
||||
return horizontalScrollBar->height();
|
||||
}
|
||||
|
||||
void SetHeightToContentHeight(QListWidget *list)
|
||||
{
|
||||
auto nrItems = list->count();
|
||||
if (nrItems == 0) {
|
||||
list->setMaximumHeight(0);
|
||||
list->setMinimumHeight(0);
|
||||
return;
|
||||
}
|
||||
|
||||
int scrollBarHeight = getHorizontalScrollBarHeight(list);
|
||||
int height = (list->sizeHintForRow(0) + list->spacing()) * nrItems +
|
||||
2 * list->frameWidth() + scrollBarHeight;
|
||||
list->setMinimumHeight(height);
|
||||
list->setMaximumHeight(height);
|
||||
}
|
||||
|
||||
void SetButtonIcon(QPushButton *button, const char *path)
|
||||
{
|
||||
QIcon icon;
|
||||
icon.addFile(QString::fromUtf8(path), QSize(), QIcon::Normal,
|
||||
QIcon::Off);
|
||||
button->setIcon(icon);
|
||||
}
|
||||
|
||||
int FindIdxInRagne(QComboBox *list, int start, int stop,
|
||||
const std::string &value, Qt::MatchFlags flags)
|
||||
{
|
||||
if (value.empty()) {
|
||||
return -1;
|
||||
}
|
||||
auto model = list->model();
|
||||
auto startIdx = model->index(start, 0);
|
||||
auto match = model->match(startIdx, Qt::DisplayRole,
|
||||
QString::fromStdString(value), 1, flags);
|
||||
if (match.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
int foundIdx = match.first().row();
|
||||
if (foundIdx > stop) {
|
||||
return -1;
|
||||
}
|
||||
return foundIdx;
|
||||
}
|
||||
|
||||
QWidget *GetSettingsWindow();
|
||||
|
||||
bool DisplayMessage(const QString &msg, bool question, bool modal)
|
||||
{
|
||||
if (!modal) {
|
||||
auto dialog = new NonModalMessageDialog(msg, question);
|
||||
QMessageBox::StandardButton answer = dialog->ShowMessage();
|
||||
return (answer == QMessageBox::Yes);
|
||||
} else if (question && modal) {
|
||||
auto answer = QMessageBox::question(
|
||||
GetSettingsWindow()
|
||||
? GetSettingsWindow()
|
||||
: static_cast<QMainWindow *>(
|
||||
obs_frontend_get_main_window()),
|
||||
obs_module_text("AdvSceneSwitcher.windowTitle"), msg,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
return answer == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setWindowTitle(obs_module_text("AdvSceneSwitcher.windowTitle"));
|
||||
Msgbox.setText(msg);
|
||||
Msgbox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
void DisplayTrayMessage(const QString &title, const QString &msg,
|
||||
const QIcon &icon)
|
||||
{
|
||||
auto tray = reinterpret_cast<QSystemTrayIcon *>(
|
||||
obs_frontend_get_system_tray());
|
||||
if (!tray) {
|
||||
return;
|
||||
}
|
||||
if (icon.isNull()) {
|
||||
tray->showMessage(title, msg);
|
||||
} else {
|
||||
tray->showMessage(title, msg, icon);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetThemeTypeName()
|
||||
{
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(29, 0, 0)
|
||||
return obs_frontend_is_theme_dark() ? "Dark" : "Light";
|
||||
#else
|
||||
auto mainWindow =
|
||||
static_cast<QMainWindow *>(obs_frontend_get_main_window());
|
||||
if (!mainWindow) {
|
||||
return "Dark";
|
||||
}
|
||||
QColor color = mainWindow->palette().text().color();
|
||||
const bool themeDarkMode = !(color.redF() < 0.5);
|
||||
return themeDarkMode ? "Dark" : "Light";
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
32
lib/utils/ui-helpers.hpp
Normal file
32
lib/utils/ui-helpers.hpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <QColor>
|
||||
#include <QComboBox>
|
||||
#include <QIcon>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <string>
|
||||
|
||||
namespace advss {
|
||||
|
||||
EXPORT QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
|
||||
QColor endColor = QColor(0, 0, 0, 0),
|
||||
bool once = false);
|
||||
|
||||
EXPORT void SetHeightToContentHeight(QListWidget *list);
|
||||
EXPORT void SetButtonIcon(QPushButton *button, const char *path);
|
||||
EXPORT int
|
||||
FindIdxInRagne(QComboBox *list, int start, int stop, const std::string &value,
|
||||
Qt::MatchFlags = Qt::MatchExactly | Qt::MatchCaseSensitive);
|
||||
|
||||
EXPORT bool DisplayMessage(const QString &msg, bool question = false,
|
||||
bool modal = true);
|
||||
EXPORT void DisplayTrayMessage(const QString &title, const QString &msg,
|
||||
const QIcon &icon = QIcon());
|
||||
|
||||
EXPORT std::string GetThemeTypeName();
|
||||
|
||||
} // namespace advss
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,124 +1,29 @@
|
|||
#pragma once
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QLayout>
|
||||
#include <QComboBox>
|
||||
#include <QMetaObject>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QColor>
|
||||
#include <obs.hpp>
|
||||
#include <obs-frontend-api.h>
|
||||
#include <deque>
|
||||
#include <unordered_map>
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <optional>
|
||||
#include <QListWidget>
|
||||
#include <QMetaObject>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QTextStream>
|
||||
#include <QWidget>
|
||||
#include <string>
|
||||
|
||||
namespace advss {
|
||||
|
||||
class SceneSelection;
|
||||
class RegexConfig;
|
||||
struct SceneGroup;
|
||||
class Macro;
|
||||
|
||||
/* Source helpers */
|
||||
|
||||
EXPORT bool WeakSourceValid(obs_weak_source_t *ws);
|
||||
EXPORT std::string GetWeakSourceName(obs_weak_source_t *weak_source);
|
||||
EXPORT OBSWeakSource GetWeakSourceByName(const char *name);
|
||||
EXPORT OBSWeakSource GetWeakSourceByQString(const QString &name);
|
||||
EXPORT OBSWeakSource GetWeakTransitionByName(const char *transitionName);
|
||||
EXPORT OBSWeakSource GetWeakTransitionByQString(const QString &name);
|
||||
EXPORT OBSWeakSource GetWeakFilterByName(OBSWeakSource source,
|
||||
const char *name);
|
||||
EXPORT OBSWeakSource GetWeakFilterByQString(OBSWeakSource source,
|
||||
const QString &name);
|
||||
EXPORT int GetSceneItemCount(const OBSWeakSource &);
|
||||
|
||||
/* Selection helpers */
|
||||
|
||||
EXPORT bool IsMediaSource(obs_source_t *source);
|
||||
|
||||
EXPORT QStringList GetAudioSourceNames();
|
||||
EXPORT QStringList GetSourcesWithFilterNames();
|
||||
EXPORT QStringList GetMediaSourceNames();
|
||||
EXPORT QStringList GetVideoSourceNames();
|
||||
EXPORT QStringList GetSceneNames();
|
||||
EXPORT QStringList GetSourceNames();
|
||||
EXPORT QStringList GetFilterNames(OBSWeakSource weakSource);
|
||||
|
||||
/* Populate list helpers */
|
||||
|
||||
EXPORT void AddSelectionEntry(QComboBox *sel, const char *description,
|
||||
bool selectable = false,
|
||||
const char *tooltip = "");
|
||||
EXPORT void AddSelectionGroup(QComboBox *selection, const QStringList &group,
|
||||
bool addSeparator = true);
|
||||
EXPORT void PopulateTransitionSelection(QComboBox *sel, bool addCurrent = true,
|
||||
bool addAny = false,
|
||||
bool addSelect = true);
|
||||
EXPORT 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);
|
||||
EXPORT void PopulateProcessSelection(QComboBox *sel, bool addSelect = true);
|
||||
void PopulateSourceSelection(QComboBox *list, bool addSelect = true);
|
||||
EXPORT 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,
|
||||
OBSWeakSource weakSource = nullptr);
|
||||
|
||||
/* Widget helpers */
|
||||
|
||||
EXPORT void
|
||||
PlaceWidgets(std::string text, QBoxLayout *layout,
|
||||
std::unordered_map<std::string, QWidget *> placeholders,
|
||||
bool addStretch = true);
|
||||
void DeleteLayoutItemWidget(QLayoutItem *item);
|
||||
EXPORT void ClearLayout(QLayout *layout, int afterIdx = 0);
|
||||
EXPORT void SetLayoutVisible(QLayout *layout, bool visible);
|
||||
EXPORT void SetGridLayoutRowVisible(QGridLayout *layout, int row, bool visible);
|
||||
EXPORT void AddStretchIfNecessary(QBoxLayout *layout);
|
||||
EXPORT void RemoveStretchIfPresent(QBoxLayout *layout);
|
||||
EXPORT void MinimizeSizeOfColumn(QGridLayout *layout, int idx);
|
||||
EXPORT QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
|
||||
QColor endColor = QColor(0, 0, 0, 0),
|
||||
bool once = false);
|
||||
EXPORT void SetHeightToContentHeight(QListWidget *list);
|
||||
EXPORT void SetButtonIcon(QPushButton *button, const char *path);
|
||||
EXPORT int
|
||||
FindIdxInRagne(QComboBox *list, int start, int stop, const std::string &value,
|
||||
Qt::MatchFlags = Qt::MatchExactly | Qt::MatchCaseSensitive);
|
||||
|
||||
/* UI helpers */
|
||||
|
||||
EXPORT bool DisplayMessage(const QString &msg, bool question = false,
|
||||
bool modal = true);
|
||||
EXPORT void DisplayTrayMessage(const QString &title, const QString &msg,
|
||||
const QIcon &icon = QIcon());
|
||||
EXPORT std::string GetThemeTypeName();
|
||||
|
||||
/* Generic helpers */
|
||||
|
||||
EXPORT bool CompareIgnoringLineEnding(QString &s1, QString &s2);
|
||||
EXPORT std::string GetDataFilePath(const std::string &file);
|
||||
EXPORT bool DoubleEquals(double left, double right, double epsilon);
|
||||
EXPORT std::pair<int, int> GetCursorPos();
|
||||
|
||||
EXPORT bool DoubleEquals(double left, double right, double epsilon);
|
||||
|
||||
void ReplaceAll(std::string &str, const std::string &from,
|
||||
const std::string &to);
|
||||
QString GetDefaultSettingsSaveLocation();
|
||||
bool IsValidMacroSegmentIndex(Macro *m, const int idx, bool isCondition);
|
||||
QString GetMacroSegmentDescription(Macro *, int idx, bool isCondition);
|
||||
void SaveSplitterPos(const QList<int> &sizes, obs_data_t *obj,
|
||||
const std::string name);
|
||||
void LoadSplitterPos(QList<int> &sizes, obs_data_t *obj,
|
||||
const std::string name);
|
||||
EXPORT std::optional<std::string> GetJsonField(const std::string &json,
|
||||
const std::string &id);
|
||||
EXPORT bool CompareIgnoringLineEnding(QString &s1, QString &s2);
|
||||
|
||||
EXPORT std::string GetDataFilePath(const std::string &file);
|
||||
QString GetDefaultSettingsSaveLocation();
|
||||
|
||||
/* Legacy helpers */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "variable-line-edit.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
|
||||
#include <utility.hpp>
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "variable-spinbox.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#include "variable.hpp"
|
||||
#include "math-helpers.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <QGridLayout>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#include "macro-action-audio.hpp"
|
||||
#include "audio-helpers.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#include "macro-action-file.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QFileDialog>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#include "macro-action-filter.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "json-helpers.hpp"
|
||||
#include "source-settings-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "macro-action-hotkey.hpp"
|
||||
#include "platform-funcs.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
|
||||
#include <thread>
|
||||
#include <obs-interaction.h>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "macro-action-http.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "curl-helper.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "macro-action-media.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#include "macro-action-osc.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <system_error>
|
||||
#include <QGroupBox>
|
||||
#include <system_error>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
#include "macro-action-plugin-state.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include <obs-frontend-api.h>
|
||||
#include <QMainWindow>
|
||||
#include <thread>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#include "macro-action-profile.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "profile-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
#include "macro-action-projector.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "monitor-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "macro-action-random.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "macro-action-recording.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <util/config-file.h>
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "macro-action-replay-buffer.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
@ -10,7 +12,7 @@ bool MacroActionReplayBuffer::_registered = MacroActionFactory::Register(
|
|||
{MacroActionReplayBuffer::Create, MacroActionReplayBufferEdit::Create,
|
||||
"AdvSceneSwitcher.action.replay"});
|
||||
|
||||
const static std::map<ReplayBufferAction, std::string> actionTypes = {
|
||||
static const std::map<ReplayBufferAction, std::string> actionTypes = {
|
||||
{ReplayBufferAction::STOP, "AdvSceneSwitcher.action.replay.type.stop"},
|
||||
{ReplayBufferAction::START,
|
||||
"AdvSceneSwitcher.action.replay.type.start"},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "macro-action-run.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QDesktopServices>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#include "macro-action-scene-collection.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "macro-action-scene-lock.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "macro-action-scene-order.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
#include "macro-action-scene-switch.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "plugin-state-helpers.hpp"
|
||||
#include "scene-switch-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "macro-action-scene-transform.hpp"
|
||||
#include "json-helpers.hpp"
|
||||
#include "scene-item-transform-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <graphics/matrix4.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "macro-action-scene-visibility.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#include "macro-action-screenshot.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "macro-action-sequence.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
#include "macro-action-source.hpp"
|
||||
#include "source-settings-helpers.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "json-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-settings-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
Q_DECLARE_METATYPE(advss::SourceSettingButton);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#include "macro-action-streaming.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "profile-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
#include <util/config-file.h>
|
||||
|
||||
namespace advss {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "macro-action-studio-mode.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "macro-action-systray.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "macro-action-timer.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "macro-condition-timer.hpp"
|
||||
#include "macro-helpers.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
#include <random>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "macro-action-transition.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "macro-action-virtual-cam.hpp"
|
||||
#include "utility.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
|
||||
#include <obs-frontend-api.h>
|
||||
|
||||
namespace advss {
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user