mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Add MonitorSelectionWidget
Refreshes list of monitors when widget becomes visible to support widget caching
This commit is contained in:
parent
c281c6db83
commit
5ce4171773
|
|
@ -1,6 +1,5 @@
|
|||
#include "macro-action-projector.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "monitor-helpers.hpp"
|
||||
#include "selection-helpers.hpp"
|
||||
#include "source-helpers.hpp"
|
||||
|
||||
|
|
@ -246,7 +245,7 @@ MacroActionProjectorEdit::MacroActionProjectorEdit(
|
|||
_scenes(new SceneSelectionWidget(window(), true, false, true, true,
|
||||
true)),
|
||||
_sources(new SourceSelectionWidget(window(), getSourcesList, true)),
|
||||
_monitors(new QComboBox()),
|
||||
_monitors(new MonitorSelectionWidget(this)),
|
||||
_projectorWindowName(new VariableLineEdit(this)),
|
||||
_regex(new RegexConfigWidget(this)),
|
||||
_layout(new QHBoxLayout(this))
|
||||
|
|
@ -258,6 +257,7 @@ MacroActionProjectorEdit::MacroActionProjectorEdit(
|
|||
_monitors->addItems(GetMonitorNames());
|
||||
_monitors->setPlaceholderText(
|
||||
obs_module_text("AdvSceneSwitcher.selectDisplay"));
|
||||
_monitors->SetAllowUnmatchedSelection(false);
|
||||
|
||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(ActionChanged(int)));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "macro-action-edit.hpp"
|
||||
#include "monitor-helpers.hpp"
|
||||
#include "regex-config.hpp"
|
||||
#include "scene-selection.hpp"
|
||||
#include "source-selection.hpp"
|
||||
|
|
@ -88,7 +89,7 @@ private:
|
|||
QComboBox *_windowTypes;
|
||||
SceneSelectionWidget *_scenes;
|
||||
SourceSelectionWidget *_sources;
|
||||
QComboBox *_monitors;
|
||||
MonitorSelectionWidget *_monitors;
|
||||
VariableLineEdit *_projectorWindowName;
|
||||
RegexConfigWidget *_regex;
|
||||
QHBoxLayout *_layout;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "macro-condition-display.hpp"
|
||||
#include "layout-helpers.hpp"
|
||||
#include "monitor-helpers.hpp"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
|
|
@ -254,7 +253,7 @@ MacroConditionDisplayEdit::MacroConditionDisplayEdit(
|
|||
: QWidget(parent),
|
||||
_conditions(new QComboBox()),
|
||||
_compareModes(new QComboBox()),
|
||||
_displays(new QComboBox()),
|
||||
_displays(new MonitorSelectionWidget(this)),
|
||||
_regex(new RegexConfigWidget()),
|
||||
_displayCount(new VariableSpinBox(this)),
|
||||
_displayWidth(new VariableSpinBox(this)),
|
||||
|
|
@ -264,8 +263,6 @@ MacroConditionDisplayEdit::MacroConditionDisplayEdit(
|
|||
{
|
||||
populateConditionSelection(_conditions);
|
||||
populateCompareModeselection(_compareModes);
|
||||
_displays->addItems(GetMonitorNames());
|
||||
_displays->setEditable(true);
|
||||
_displayWidth->setMaximum(99999);
|
||||
_displayHeight->setMaximum(99999);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include "macro-condition-edit.hpp"
|
||||
#include "monitor-helpers.hpp"
|
||||
#include "variable-line-edit.hpp"
|
||||
#include "variable-spinbox.hpp"
|
||||
#include "regex-config.hpp"
|
||||
|
|
@ -80,7 +81,7 @@ private:
|
|||
|
||||
QComboBox *_conditions;
|
||||
QComboBox *_compareModes;
|
||||
QComboBox *_displays;
|
||||
MonitorSelectionWidget *_displays;
|
||||
RegexConfigWidget *_regex;
|
||||
VariableSpinBox *_displayCount;
|
||||
VariableSpinBox *_displayWidth;
|
||||
|
|
|
|||
|
|
@ -47,4 +47,23 @@ QStringList GetMonitorNames()
|
|||
return monitorNames;
|
||||
}
|
||||
|
||||
MonitorSelectionWidget::MonitorSelectionWidget(QWidget *parent)
|
||||
: FilterComboBox(parent)
|
||||
{
|
||||
setEditable(true);
|
||||
SetAllowUnmatchedSelection(true);
|
||||
setMaxVisibleItems(20);
|
||||
addItems(GetMonitorNames());
|
||||
}
|
||||
|
||||
void MonitorSelectionWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
FilterComboBox::showEvent(event);
|
||||
const QSignalBlocker b(this);
|
||||
const auto text = currentText();
|
||||
clear();
|
||||
addItems(GetMonitorNames());
|
||||
setCurrentText(text);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
#pragma once
|
||||
#include <QStringList>
|
||||
#include "filter-combo-box.hpp"
|
||||
|
||||
namespace advss {
|
||||
|
||||
QStringList GetMonitorNames();
|
||||
|
||||
class MonitorSelectionWidget : public FilterComboBox {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MonitorSelectionWidget(QWidget *parent);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event) override;
|
||||
};
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user