mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-29 04:36:21 -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);
|
||||
ui->sceneGroups->setCurrentItem(item);
|
||||
|
||||
addPulse->deleteLater();
|
||||
addPulse = nullptr;
|
||||
if (addPulse) {
|
||||
addPulse->deleteLater();
|
||||
addPulse = nullptr;
|
||||
}
|
||||
ui->sceneGroupHelp->setVisible(false);
|
||||
|
||||
emit SceneGroupAdded(QString::fromStdString(name));
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
|
||||
} // namespace
|
||||
|
||||
static std::mutex mutex;
|
||||
static std::recursive_mutex mutex;
|
||||
|
||||
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)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
if (auto it = GetMap().find(id); it == GetMap().end()) {
|
||||
GetMap()[id] = info;
|
||||
return true;
|
||||
@@ -41,7 +41,7 @@ bool MacroActionFactory::Register(const std::string &id, MacroActionInfo info)
|
||||
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ static std::shared_ptr<MacroAction> createUnknownAction(Macro *m)
|
||||
std::shared_ptr<MacroAction> MacroActionFactory::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()) {
|
||||
return it->second._create(m);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ QWidget *MacroActionFactory::CreateWidget(const std::string &id,
|
||||
QWidget *parent,
|
||||
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()) {
|
||||
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::lock_guard<std::mutex> lock(mutex);
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||
return it->second._name;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ std::string MacroActionFactory::GetActionName(const std::string &id)
|
||||
|
||||
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()) {
|
||||
if (name == obs_module_text(it.second._name.c_str())) {
|
||||
return it.first;
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
} // namespace
|
||||
|
||||
static std::mutex mutex;
|
||||
static std::recursive_mutex mutex;
|
||||
|
||||
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,
|
||||
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()) {
|
||||
GetMap()[id] = info;
|
||||
return true;
|
||||
@@ -38,7 +38,7 @@ bool MacroConditionFactory::Register(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) {
|
||||
return false;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ static std::shared_ptr<MacroCondition> createUnknownCondition(Macro *m)
|
||||
std::shared_ptr<MacroCondition>
|
||||
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()) {
|
||||
return it->second._create(m);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ QWidget *
|
||||
MacroConditionFactory::CreateWidget(const std::string &id, QWidget *parent,
|
||||
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()) {
|
||||
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::lock_guard<std::mutex> lock(mutex);
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
if (auto it = GetMap().find(id); it != GetMap().end()) {
|
||||
return it->second._name;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ std::string MacroConditionFactory::GetConditionName(const std::string &id)
|
||||
|
||||
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()) {
|
||||
if (name == obs_module_text(it.second._name.c_str())) {
|
||||
return it.first;
|
||||
@@ -100,7 +100,7 @@ std::string MacroConditionFactory::GetIdByName(const QString &name)
|
||||
|
||||
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()) {
|
||||
return it->second._useDurationModifier;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ void MacroSegmentSelection::MacroSegmentOrderChanged()
|
||||
SetupDescription();
|
||||
}
|
||||
|
||||
QString GetMacroSegmentDescription(Macro *macro, int idx, bool isCondition)
|
||||
static QString GetMacroSegmentDescription(Macro *macro, int idx,
|
||||
bool isCondition)
|
||||
{
|
||||
if (!macro) {
|
||||
return "";
|
||||
|
||||
@@ -68,7 +68,7 @@ void MacroSelection::HideSelectedMacro()
|
||||
void MacroSelection::ShowAllMacros()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,8 +100,10 @@ void AdvSceneSwitcher::on_macroAdd_clicked()
|
||||
}
|
||||
|
||||
ui->macros->Add(newMacro);
|
||||
addPulse->deleteLater();
|
||||
addPulse = nullptr;
|
||||
if (addPulse) {
|
||||
addPulse->deleteLater();
|
||||
addPulse = nullptr;
|
||||
}
|
||||
emit MacroAdded(QString::fromStdString(name));
|
||||
}
|
||||
|
||||
@@ -1218,8 +1220,10 @@ void AdvSceneSwitcher::CopyMacro()
|
||||
Macro::PrepareMoveToGroup(macro->Parent(), newMacro);
|
||||
|
||||
ui->macros->Add(newMacro, macro);
|
||||
addPulse->deleteLater();
|
||||
addPulse = nullptr;
|
||||
if (addPulse) {
|
||||
addPulse->deleteLater();
|
||||
addPulse = nullptr;
|
||||
}
|
||||
emit MacroAdded(QString::fromStdString(name));
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ void MacroTreeItem::Update(bool force)
|
||||
_spacer = nullptr;
|
||||
}
|
||||
|
||||
if (_type == Type::Group) {
|
||||
if (_type == Type::Group && _expand) {
|
||||
_boxLayout->removeWidget(_expand);
|
||||
_expand->deleteLater();
|
||||
_expand = nullptr;
|
||||
|
||||
@@ -84,8 +84,7 @@ void FilterComboBox::focusOutEvent(QFocusEvent *event)
|
||||
// Reset on invalid selection
|
||||
if (findText(currentText()) == -1) {
|
||||
setCurrentIndex(-1);
|
||||
emit currentIndexChanged(-1);
|
||||
emit currentTextChanged("");
|
||||
Emit(-1, "");
|
||||
}
|
||||
|
||||
QComboBox::focusOutEvent(event);
|
||||
@@ -121,8 +120,7 @@ void FilterComboBox::CompleterHighlightChanged(const QModelIndex &index)
|
||||
if (idx == -1) {
|
||||
return;
|
||||
}
|
||||
emit currentIndexChanged(idx);
|
||||
emit currentTextChanged(text);
|
||||
Emit(idx, text);
|
||||
}
|
||||
|
||||
void FilterComboBox::TextChanged(const QString &text)
|
||||
@@ -134,8 +132,18 @@ void FilterComboBox::TextChanged(const QString &text)
|
||||
if (idx == -1) {
|
||||
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
|
||||
|
||||
@@ -25,6 +25,11 @@ private slots:
|
||||
void TextChanged(const QString &);
|
||||
|
||||
private:
|
||||
void Emit(int index, const QString &text);
|
||||
|
||||
int _lastEmittedIndex = -1;
|
||||
QString _lastEmittedText;
|
||||
|
||||
int _lastCompleterHighlightRow = -1;
|
||||
static bool _filteringEnabled;
|
||||
};
|
||||
|
||||
@@ -154,6 +154,7 @@ void StatusControl::SetStarted()
|
||||
_status->setText(obs_module_text("AdvSceneSwitcher.status.active"));
|
||||
if (_pulse) {
|
||||
_pulse->deleteLater();
|
||||
_pulse = nullptr;
|
||||
}
|
||||
SetStatusStyleSheet(false);
|
||||
_setToStopped = false;
|
||||
|
||||
Reference in New Issue
Block a user