mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 00:56:00 -05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
438c54599e | ||
|
|
da42183177 | ||
|
|
295fa3f122 | ||
|
|
cb87f1cc36 |
@@ -159,7 +159,7 @@ bool MacroConditionFile::CheckCondition()
|
|||||||
SetVariableValue(ret ? "true" : "false");
|
SetVariableValue(ret ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroConditionFile::Save(obs_data_t *obj) const
|
bool MacroConditionFile::Save(obs_data_t *obj) const
|
||||||
|
|||||||
@@ -501,10 +501,13 @@ Qt::ItemFlags MacroTreeModel::flags(const QModelIndex &index) const
|
|||||||
return QAbstractListModel::flags(index) | Qt::ItemIsDropEnabled;
|
return QAbstractListModel::flags(index) | Qt::ItemIsDropEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Macro> item =
|
std::shared_ptr<Macro> item;
|
||||||
_macros[ModelIndexToMacroIndex(index.row(), _macros)];
|
try {
|
||||||
|
item = _macros.at(ModelIndexToMacroIndex(index.row(), _macros));
|
||||||
|
} catch (const std::out_of_range &) {
|
||||||
|
return QAbstractListModel::flags(index) | Qt::ItemIsDropEnabled;
|
||||||
|
}
|
||||||
bool isGroup = item->IsGroup();
|
bool isGroup = item->IsGroup();
|
||||||
|
|
||||||
return QAbstractListModel::flags(index) | Qt::ItemIsEditable |
|
return QAbstractListModel::flags(index) | Qt::ItemIsEditable |
|
||||||
Qt::ItemIsDragEnabled |
|
Qt::ItemIsDragEnabled |
|
||||||
(isGroup ? Qt::ItemIsDropEnabled : Qt::NoItemFlags);
|
(isGroup ? Qt::ItemIsDropEnabled : Qt::NoItemFlags);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
#include <screenshot-helper.hpp>
|
#include <screenshot-helper.hpp>
|
||||||
#include <condition_variable>
|
|
||||||
|
|
||||||
PreviewDialog::PreviewDialog(QWidget *parent, int delay)
|
PreviewDialog::PreviewDialog(QWidget *parent, int delay)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
@@ -119,6 +118,7 @@ void PreviewDialog::SelectArea()
|
|||||||
void PreviewDialog::Stop()
|
void PreviewDialog::Stop()
|
||||||
{
|
{
|
||||||
_stop = true;
|
_stop = true;
|
||||||
|
_cv.notify_all();
|
||||||
if (_thread.joinable()) {
|
if (_thread.joinable()) {
|
||||||
_thread.join();
|
_thread.join();
|
||||||
}
|
}
|
||||||
@@ -189,13 +189,12 @@ void PreviewDialog::Start()
|
|||||||
|
|
||||||
void PreviewDialog::CheckForMatchLoop()
|
void PreviewDialog::CheckForMatchLoop()
|
||||||
{
|
{
|
||||||
std::condition_variable cv;
|
|
||||||
while (!_stop) {
|
while (!_stop) {
|
||||||
std::unique_lock<std::mutex> lock(_mtx);
|
std::unique_lock<std::mutex> lock(_mtx);
|
||||||
auto source = obs_weak_source_get_source(_video.GetVideo());
|
auto source = obs_weak_source_get_source(_video.GetVideo());
|
||||||
ScreenshotHelper screenshot(source);
|
ScreenshotHelper screenshot(source);
|
||||||
obs_source_release(source);
|
obs_source_release(source);
|
||||||
cv.wait_for(lock, std::chrono::milliseconds(_delay));
|
_cv.wait_for(lock, std::chrono::milliseconds(_delay));
|
||||||
if (_stop || isHidden()) {
|
if (_stop || isHidden()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <condition_variable>
|
||||||
|
|
||||||
class PreviewDialog : public QDialog {
|
class PreviewDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -62,6 +63,7 @@ private:
|
|||||||
std::atomic_bool _selectingArea = {false};
|
std::atomic_bool _selectingArea = {false};
|
||||||
|
|
||||||
std::mutex _mtx;
|
std::mutex _mtx;
|
||||||
|
std::condition_variable _cv;
|
||||||
std::thread _thread;
|
std::thread _thread;
|
||||||
std::atomic_bool _stop = {true};
|
std::atomic_bool _stop = {true};
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,10 @@ QStringList GetVariablesNameList()
|
|||||||
|
|
||||||
void VariableResolvingString::Resolve()
|
void VariableResolvingString::Resolve()
|
||||||
{
|
{
|
||||||
|
if (switcher->variables.empty()) {
|
||||||
|
_resolvedValue = _value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_lastResolve == lastVariableChange) {
|
if (_lastResolve == lastVariableChange) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -131,6 +135,7 @@ void VariableResolvingString::operator=(const char *value)
|
|||||||
void VariableResolvingString::Load(obs_data_t *obj, const char *name)
|
void VariableResolvingString::Load(obs_data_t *obj, const char *name)
|
||||||
{
|
{
|
||||||
_value = obs_data_get_string(obj, name);
|
_value = obs_data_get_string(obj, name);
|
||||||
|
Resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariableResolvingString::Save(obs_data_t *obj, const char *name) const
|
void VariableResolvingString::Save(obs_data_t *obj, const char *name) const
|
||||||
|
|||||||
Reference in New Issue
Block a user