mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 17:16:00 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
510f83246e | ||
|
|
c969b21f93 | ||
|
|
6ec40ef8e9 | ||
|
|
27859e83b3 | ||
|
|
263565700a |
@@ -170,8 +170,10 @@ void AdvSceneSwitcher::on_sceneGroupAdd_clicked()
|
|||||||
item->setData(Qt::UserRole, text);
|
item->setData(Qt::UserRole, text);
|
||||||
ui->sceneGroups->setCurrentItem(item);
|
ui->sceneGroups->setCurrentItem(item);
|
||||||
|
|
||||||
addPulse->deleteLater();
|
if (addPulse) {
|
||||||
addPulse = nullptr;
|
addPulse->deleteLater();
|
||||||
|
addPulse = nullptr;
|
||||||
|
}
|
||||||
ui->sceneGroupHelp->setVisible(false);
|
ui->sceneGroupHelp->setVisible(false);
|
||||||
|
|
||||||
emit SceneGroupAdded(QString::fromStdString(name));
|
emit SceneGroupAdded(QString::fromStdString(name));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
static std::mutex mutex;
|
static std::recursive_mutex mutex;
|
||||||
|
|
||||||
std::map<std::string, MacroActionInfo> &MacroActionFactory::GetMap()
|
std::map<std::string, MacroActionInfo> &MacroActionFactory::GetMap()
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@ std::map<std::string, MacroActionInfo> &MacroActionFactory::GetMap()
|
|||||||
|
|
||||||
bool MacroActionFactory::Register(const std::string &id, MacroActionInfo info)
|
bool MacroActionFactory::Register(const std::string &id, MacroActionInfo info)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it == GetMap().end()) {
|
if (auto it = GetMap().find(id); it == GetMap().end()) {
|
||||||
GetMap()[id] = info;
|
GetMap()[id] = info;
|
||||||
return true;
|
return true;
|
||||||
@@ -41,7 +41,7 @@ bool MacroActionFactory::Register(const std::string &id, MacroActionInfo info)
|
|||||||
|
|
||||||
bool MacroActionFactory::Deregister(const std::string &id)
|
bool MacroActionFactory::Deregister(const std::string &id)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (GetMap().count(id) == 0) {
|
if (GetMap().count(id) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ static std::shared_ptr<MacroAction> createUnknownAction(Macro *m)
|
|||||||
std::shared_ptr<MacroAction> MacroActionFactory::Create(const std::string &id,
|
std::shared_ptr<MacroAction> MacroActionFactory::Create(const std::string &id,
|
||||||
Macro *m)
|
Macro *m)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||||
return it->second._create(m);
|
return it->second._create(m);
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ QWidget *MacroActionFactory::CreateWidget(const std::string &id,
|
|||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
std::shared_ptr<MacroAction> action)
|
std::shared_ptr<MacroAction> action)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||||
return it->second._createWidget(parent, action);
|
return it->second._createWidget(parent, action);
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ QWidget *MacroActionFactory::CreateWidget(const std::string &id,
|
|||||||
|
|
||||||
std::string MacroActionFactory::GetActionName(const std::string &id)
|
std::string MacroActionFactory::GetActionName(const std::string &id)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||||
return it->second._name;
|
return it->second._name;
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ std::string MacroActionFactory::GetActionName(const std::string &id)
|
|||||||
|
|
||||||
std::string MacroActionFactory::GetIdByName(const QString &name)
|
std::string MacroActionFactory::GetIdByName(const QString &name)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
for (auto it : GetMap()) {
|
for (auto it : GetMap()) {
|
||||||
if (name == obs_module_text(it.second._name.c_str())) {
|
if (name == obs_module_text(it.second._name.c_str())) {
|
||||||
return it.first;
|
return it.first;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
static std::mutex mutex;
|
static std::recursive_mutex mutex;
|
||||||
|
|
||||||
std::map<std::string, MacroConditionInfo> &MacroConditionFactory::GetMap()
|
std::map<std::string, MacroConditionInfo> &MacroConditionFactory::GetMap()
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ std::map<std::string, MacroConditionInfo> &MacroConditionFactory::GetMap()
|
|||||||
bool MacroConditionFactory::Register(const std::string &id,
|
bool MacroConditionFactory::Register(const std::string &id,
|
||||||
MacroConditionInfo info)
|
MacroConditionInfo info)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it == GetMap().end()) {
|
if (auto it = GetMap().find(id); it == GetMap().end()) {
|
||||||
GetMap()[id] = info;
|
GetMap()[id] = info;
|
||||||
return true;
|
return true;
|
||||||
@@ -38,7 +38,7 @@ bool MacroConditionFactory::Register(const std::string &id,
|
|||||||
|
|
||||||
bool MacroConditionFactory::Deregister(const std::string &id)
|
bool MacroConditionFactory::Deregister(const std::string &id)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (GetMap().count(id) == 0) {
|
if (GetMap().count(id) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ static std::shared_ptr<MacroCondition> createUnknownCondition(Macro *m)
|
|||||||
std::shared_ptr<MacroCondition>
|
std::shared_ptr<MacroCondition>
|
||||||
MacroConditionFactory::Create(const std::string &id, Macro *m)
|
MacroConditionFactory::Create(const std::string &id, Macro *m)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||||
return it->second._create(m);
|
return it->second._create(m);
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ QWidget *
|
|||||||
MacroConditionFactory::CreateWidget(const std::string &id, QWidget *parent,
|
MacroConditionFactory::CreateWidget(const std::string &id, QWidget *parent,
|
||||||
std::shared_ptr<MacroCondition> cond)
|
std::shared_ptr<MacroCondition> cond)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||||
return it->second._createWidget(parent, cond);
|
return it->second._createWidget(parent, cond);
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ MacroConditionFactory::CreateWidget(const std::string &id, QWidget *parent,
|
|||||||
|
|
||||||
std::string MacroConditionFactory::GetConditionName(const std::string &id)
|
std::string MacroConditionFactory::GetConditionName(const std::string &id)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||||
return it->second._name;
|
return it->second._name;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ std::string MacroConditionFactory::GetConditionName(const std::string &id)
|
|||||||
|
|
||||||
std::string MacroConditionFactory::GetIdByName(const QString &name)
|
std::string MacroConditionFactory::GetIdByName(const QString &name)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
for (auto it : GetMap()) {
|
for (auto it : GetMap()) {
|
||||||
if (name == obs_module_text(it.second._name.c_str())) {
|
if (name == obs_module_text(it.second._name.c_str())) {
|
||||||
return it.first;
|
return it.first;
|
||||||
@@ -100,7 +100,7 @@ std::string MacroConditionFactory::GetIdByName(const QString &name)
|
|||||||
|
|
||||||
bool MacroConditionFactory::UsesDurationModifier(const std::string &id)
|
bool MacroConditionFactory::UsesDurationModifier(const std::string &id)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||||
return it->second._useDurationModifier;
|
return it->second._useDurationModifier;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ void MacroSegmentSelection::MacroSegmentOrderChanged()
|
|||||||
SetupDescription();
|
SetupDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GetMacroSegmentDescription(Macro *macro, int idx, bool isCondition)
|
static QString GetMacroSegmentDescription(Macro *macro, int idx,
|
||||||
|
bool isCondition)
|
||||||
{
|
{
|
||||||
if (!macro) {
|
if (!macro) {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void MacroSelection::HideSelectedMacro()
|
|||||||
void MacroSelection::ShowAllMacros()
|
void MacroSelection::ShowAllMacros()
|
||||||
{
|
{
|
||||||
auto v = qobject_cast<QListView *>(view());
|
auto v = qobject_cast<QListView *>(view());
|
||||||
for (int i = count(); i > 0; i--) {
|
for (int i = count() - 1; i >= 0; i--) {
|
||||||
v->setRowHidden(i, false);
|
v->setRowHidden(i, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,8 +100,10 @@ void AdvSceneSwitcher::on_macroAdd_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->macros->Add(newMacro);
|
ui->macros->Add(newMacro);
|
||||||
addPulse->deleteLater();
|
if (addPulse) {
|
||||||
addPulse = nullptr;
|
addPulse->deleteLater();
|
||||||
|
addPulse = nullptr;
|
||||||
|
}
|
||||||
emit MacroAdded(QString::fromStdString(name));
|
emit MacroAdded(QString::fromStdString(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1218,8 +1220,10 @@ void AdvSceneSwitcher::CopyMacro()
|
|||||||
Macro::PrepareMoveToGroup(macro->Parent(), newMacro);
|
Macro::PrepareMoveToGroup(macro->Parent(), newMacro);
|
||||||
|
|
||||||
ui->macros->Add(newMacro, macro);
|
ui->macros->Add(newMacro, macro);
|
||||||
addPulse->deleteLater();
|
if (addPulse) {
|
||||||
addPulse = nullptr;
|
addPulse->deleteLater();
|
||||||
|
addPulse = nullptr;
|
||||||
|
}
|
||||||
emit MacroAdded(QString::fromStdString(name));
|
emit MacroAdded(QString::fromStdString(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ void MacroTreeItem::Update(bool force)
|
|||||||
_spacer = nullptr;
|
_spacer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_type == Type::Group) {
|
if (_type == Type::Group && _expand) {
|
||||||
_boxLayout->removeWidget(_expand);
|
_boxLayout->removeWidget(_expand);
|
||||||
_expand->deleteLater();
|
_expand->deleteLater();
|
||||||
_expand = nullptr;
|
_expand = nullptr;
|
||||||
|
|||||||
@@ -84,8 +84,7 @@ void FilterComboBox::focusOutEvent(QFocusEvent *event)
|
|||||||
// Reset on invalid selection
|
// Reset on invalid selection
|
||||||
if (findText(currentText()) == -1) {
|
if (findText(currentText()) == -1) {
|
||||||
setCurrentIndex(-1);
|
setCurrentIndex(-1);
|
||||||
emit currentIndexChanged(-1);
|
Emit(-1, "");
|
||||||
emit currentTextChanged("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QComboBox::focusOutEvent(event);
|
QComboBox::focusOutEvent(event);
|
||||||
@@ -121,8 +120,7 @@ void FilterComboBox::CompleterHighlightChanged(const QModelIndex &index)
|
|||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit currentIndexChanged(idx);
|
Emit(idx, text);
|
||||||
emit currentTextChanged(text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterComboBox::TextChanged(const QString &text)
|
void FilterComboBox::TextChanged(const QString &text)
|
||||||
@@ -134,8 +132,18 @@ void FilterComboBox::TextChanged(const QString &text)
|
|||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit currentIndexChanged(idx);
|
}
|
||||||
emit currentTextChanged(text);
|
|
||||||
|
void FilterComboBox::Emit(int index, const QString &text)
|
||||||
|
{
|
||||||
|
if (_lastEmittedIndex != index) {
|
||||||
|
_lastEmittedIndex = index;
|
||||||
|
emit currentIndexChanged(index);
|
||||||
|
}
|
||||||
|
if (_lastEmittedText != text) {
|
||||||
|
_lastEmittedText = text;
|
||||||
|
emit currentTextChanged(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace advss
|
} // namespace advss
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ private slots:
|
|||||||
void TextChanged(const QString &);
|
void TextChanged(const QString &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Emit(int index, const QString &text);
|
||||||
|
|
||||||
|
int _lastEmittedIndex = -1;
|
||||||
|
QString _lastEmittedText;
|
||||||
|
|
||||||
int _lastCompleterHighlightRow = -1;
|
int _lastCompleterHighlightRow = -1;
|
||||||
static bool _filteringEnabled;
|
static bool _filteringEnabled;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ void StatusControl::SetStarted()
|
|||||||
_status->setText(obs_module_text("AdvSceneSwitcher.status.active"));
|
_status->setText(obs_module_text("AdvSceneSwitcher.status.active"));
|
||||||
if (_pulse) {
|
if (_pulse) {
|
||||||
_pulse->deleteLater();
|
_pulse->deleteLater();
|
||||||
|
_pulse = nullptr;
|
||||||
}
|
}
|
||||||
SetStatusStyleSheet(false);
|
SetStatusStyleSheet(false);
|
||||||
_setToStopped = false;
|
_setToStopped = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user