mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
The "core" macro conditions and actions have been extracted out to the "base" plugin. The library now mostly contains functionality which is required across all plugins and (e.g. definitions for macro segments). The goal is to reduce the complexity and cross-dependencies and group the source files in a better way. This should relsove the "library limit of 65535 objects exceeded" build issue occuring in some Windows build environments.
88 lines
2.2 KiB
C++
88 lines
2.2 KiB
C++
/******************************************************************************
|
|
Note: Long-term goal is to remove this tab / file.
|
|
Most functionality shall be moved to the Macro tab instead.
|
|
|
|
So if you plan to make changes here, please consider applying them to the
|
|
corresponding macro tab functionality instead.
|
|
******************************************************************************/
|
|
#pragma once
|
|
#include <QSpinBox>
|
|
|
|
#include "switch-generic.hpp"
|
|
#include "obs-module-helper.hpp"
|
|
#include "screenshot-helper.hpp"
|
|
|
|
namespace advss {
|
|
|
|
constexpr auto video_func = 9;
|
|
|
|
enum class videoSwitchType {
|
|
MATCH,
|
|
DIFFER,
|
|
HAS_NOT_CHANGED,
|
|
HAS_CHANGED,
|
|
};
|
|
|
|
struct VideoSwitch : virtual SceneSwitcherEntry {
|
|
static bool pause;
|
|
|
|
videoSwitchType condition = videoSwitchType::MATCH;
|
|
OBSWeakSource videoSource = nullptr;
|
|
std::string file = obs_module_text("AdvSceneSwitcher.enterPath");
|
|
double duration = 0;
|
|
bool ignoreInactiveSource = false;
|
|
|
|
std::unique_ptr<ScreenshotHelper> screenshotData = nullptr;
|
|
std::chrono::high_resolution_clock::time_point previousTime{};
|
|
QImage matchImage;
|
|
|
|
std::chrono::milliseconds currentMatchDuration{};
|
|
|
|
const char *getType() { return "video"; }
|
|
bool initialized();
|
|
bool valid();
|
|
void save(obs_data_t *obj);
|
|
void load(obs_data_t *obj);
|
|
void getScreenshot();
|
|
bool loadImageFromFile();
|
|
bool checkMatch();
|
|
|
|
VideoSwitch(){};
|
|
friend void swap(VideoSwitch &first, VideoSwitch &second);
|
|
};
|
|
|
|
class VideoSwitchWidget : public SwitchWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
VideoSwitchWidget(QWidget *parent, VideoSwitch *s);
|
|
VideoSwitch *getSwitchData();
|
|
void setSwitchData(VideoSwitch *s);
|
|
|
|
static void swapSwitchData(VideoSwitchWidget *as1,
|
|
VideoSwitchWidget *as2);
|
|
|
|
void UpdatePreviewTooltip();
|
|
void SetFilePath(const QString &text);
|
|
|
|
private slots:
|
|
void SourceChanged(const QString &text);
|
|
void ConditionChanged(int cond);
|
|
void DurationChanged(double dur);
|
|
void FilePathChanged();
|
|
void BrowseButtonClicked();
|
|
void IgnoreInactiveChanged(int state);
|
|
|
|
private:
|
|
QComboBox *videoSources;
|
|
QComboBox *condition;
|
|
QDoubleSpinBox *duration;
|
|
QLineEdit *filePath;
|
|
QPushButton *browseButton;
|
|
QCheckBox *ignoreInactiveSource;
|
|
|
|
VideoSwitch *switchData;
|
|
};
|
|
|
|
} // namespace advss
|