Просмотр исходного кода

UI: Remove SignalBlocker

Since QSignalBlocker does the same thing, remove SignalBlocker.
cg2121 2 лет назад
Родитель
Сommit
59766ee4ff
2 измененных файлов с 4 добавлено и 17 удалено
  1. 0 13
      UI/qt-wrappers.hpp
  2. 4 4
      UI/source-tree.cpp

+ 0 - 13
UI/qt-wrappers.hpp

@@ -86,19 +86,6 @@ void EnableThreadedMessageBoxes(bool enable);
 void ExecThreadedWithoutBlocking(std::function<void()> func,
 				 const QString &title, const QString &text);
 
-class SignalBlocker {
-	QWidget *widget;
-	bool blocked;
-
-public:
-	inline explicit SignalBlocker(QWidget *widget_) : widget(widget_)
-	{
-		blocked = widget->blockSignals(true);
-	}
-
-	inline ~SignalBlocker() { widget->blockSignals(blocked); }
-};
-
 void DeleteLayout(QLayout *layout);
 
 static inline Qt::ConnectionType WaitConnection()

+ 4 - 4
UI/source-tree.cpp

@@ -157,12 +157,12 @@ SourceTreeItem::SourceTreeItem(SourceTree *tree_, OBSSceneItem sceneitem_)
 			std::bind(undo_redo, std::placeholders::_1, id, val),
 			uuid, uuid);
 
-		SignalBlocker sourcesSignalBlocker(this);
+		QSignalBlocker sourcesSignalBlocker(this);
 		obs_sceneitem_set_visible(sceneitem, val);
 	};
 
 	auto setItemLocked = [this](bool checked) {
-		SignalBlocker sourcesSignalBlocker(this);
+		QSignalBlocker sourcesSignalBlocker(this);
 		obs_sceneitem_set_locked(sceneitem, checked);
 	};
 
@@ -447,7 +447,7 @@ void SourceTreeItem::ExitEditModeInternal(bool save)
 	/* ----------------------------------------- */
 	/* rename                                    */
 
-	SignalBlocker sourcesSignalBlocker(this);
+	QSignalBlocker sourcesSignalBlocker(this);
 	std::string prevName(obs_source_get_name(source));
 	std::string scene_uuid =
 		obs_source_get_uuid(main->GetCurrentSceneSource());
@@ -1485,7 +1485,7 @@ void SourceTree::selectionChanged(const QItemSelection &selected,
 				  const QItemSelection &deselected)
 {
 	{
-		SignalBlocker sourcesSignalBlocker(this);
+		QSignalBlocker sourcesSignalBlocker(this);
 		SourceTreeModel *stm = GetStm();
 
 		QModelIndexList selectedIdxs = selected.indexes();