add airplay no-hold setting and UI option

This commit is contained in:
uncor3
2026-01-31 13:10:11 +00:00
parent c63686dc9e
commit 5b1503531f
6 changed files with 59 additions and 11 deletions
+15 -4
View File
@@ -56,11 +56,14 @@
#include <uxplay/uxplay.h>
#include "diagnosedialog.h"
#ifdef WIN32
#include "platform/windows/check_deps.h"
#endif
#include "toolboxwidget.h"
AirPlaySettings::AirPlaySettings()
: fps(SettingsManager::sharedInstance()->airplayFps())
: fps(SettingsManager::sharedInstance()->airplayFps()),
noHold(SettingsManager::sharedInstance()->airplayNoHold())
{
}
@@ -72,7 +75,8 @@ QStringList AirPlaySettings::toArgs() const
args << "-fps" << QString::number(fps);
// Allow new connections to take over
args << "-nohold";
if (noHold)
args << "-nohold";
return args;
}
@@ -110,8 +114,13 @@ void AirPlaySettingsDialog::setupUI()
fpsLayout->addWidget(fpsFootnote);
videoLayout->addRow("Max FPS:", fpsLayout);
mainLayout->addWidget(videoGroup);
m_noHoldCheckbox = new QCheckBox("Allow New Connections to Take Over");
m_noHoldCheckbox->setChecked(
SettingsManager::sharedInstance()->airplayNoHold());
videoLayout->addRow(m_noHoldCheckbox);
mainLayout->addWidget(videoGroup);
// Buttons
QDialogButtonBox *buttonBox =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
@@ -124,6 +133,7 @@ AirPlaySettings AirPlaySettingsDialog::getSettings() const
{
AirPlaySettings settings;
settings.fps = m_fpsComboBox->currentText().toInt();
settings.noHold = m_noHoldCheckbox->isChecked();
return settings;
}
@@ -305,7 +315,8 @@ void AirPlayWindow::showSettingsDialog()
// Save settings
SettingsManager::sharedInstance()->setAirplayFps(newSettings.fps);
SettingsManager::sharedInstance()->setAirplayNoHold(newSettings.noHold);
QMessageBox::information(this, "Settings Saved",
"AirPlay will be restarted to apply the new "
"settings.");
+2
View File
@@ -73,6 +73,7 @@ class AirPlaySettings
public:
explicit AirPlaySettings();
int fps;
bool noHold;
QStringList toArgs() const;
};
@@ -88,6 +89,7 @@ private:
void setupUI();
QComboBox *m_fpsComboBox;
QCheckBox *m_noHoldCheckbox;
AirPlaySettings m_settings;
};
+16
View File
@@ -235,6 +235,12 @@ void SettingsManager::resetToDefaults()
setConnectionTimeout(30);
setShowKeychainDialog(true);
setDefaultJailbrokenRootPassword("alpine");
setIconSizeBaseMultiplier(1.0);
setAirplayFps(60);
setAirplayNoHold(true);
#ifdef __linux__
setShowV4L2(false);
#endif
}
void SettingsManager::saveFavoritePlace(const QString &path,
@@ -403,6 +409,16 @@ void SettingsManager::setAirplayFps(int fps)
m_settings->sync();
}
bool SettingsManager::airplayNoHold() const
{
return m_settings->value("airplayNoHold", true).toBool();
}
void SettingsManager::setAirplayNoHold(bool noHold)
{
m_settings->setValue("airplayNoHold", noHold);
m_settings->sync();
}
#ifdef __linux__
bool SettingsManager::showV4L2() const
{
+4
View File
@@ -108,6 +108,10 @@ public:
int airplayFps() const;
void setAirplayFps(int fps);
bool airplayNoHold() const;
void setAirplayNoHold(bool noHold);
#ifdef __linux__
bool showV4L2() const;
void setShowV4L2(bool show);
+20 -6
View File
@@ -165,16 +165,20 @@ void SettingsWidget::setupUI()
auto *fpsLayout = new QHBoxLayout();
auto *fpsLabel = new QLabel("Fps:");
m_airplayFpsSpinBox = new QSpinBox();
m_airplayFpsSpinBox->setRange(1, 255);
m_airplayFpsSpinBox->setToolTip(
m_fpsComboBox = new QComboBox();
m_fpsComboBox->addItems({"24", "30", "60", "120"});
m_fpsComboBox->setToolTip(
"Set the fps for AirPlay. Go with 30 fps if have an older device.");
fpsLayout->addWidget(fpsLabel);
fpsLayout->addWidget(m_airplayFpsSpinBox);
fpsLayout->addWidget(m_fpsComboBox);
fpsLayout->addStretch();
airplayLayout->addLayout(fpsLayout);
m_noHoldCheckbox = new QCheckBox("Allow New Connections to Take Over");
airplayLayout->addWidget(m_noHoldCheckbox);
#ifdef __linux__
m_showV4L2CheckBox = new QCheckBox("Show V4L2 Button on AirPlay Widget");
airplayLayout->addWidget(m_showV4L2CheckBox);
@@ -279,7 +283,8 @@ void SettingsWidget::loadSettings()
m_applyButton->setEnabled(false);
m_iconSizeBaseMultiplier->setValue(sm->iconSizeBaseMultiplier());
m_airplayFpsSpinBox->setValue(sm->airplayFps());
m_fpsComboBox->setCurrentText(QString::number(sm->airplayFps()));
m_noHoldCheckbox->setChecked(sm->airplayNoHold());
#ifdef __linux__
m_showV4L2CheckBox->setChecked(sm->showV4L2());
#endif
@@ -334,6 +339,14 @@ void SettingsWidget::connectSignals()
connect(m_defaultJailbrokenRootPassword, &QLineEdit::textChanged, this,
&SettingsWidget::onSettingChanged);
connect(m_fpsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&SettingsWidget::onSettingChanged);
connect(m_noHoldCheckbox, &QCheckBox::toggled, this,
&SettingsWidget::onSettingChanged);
#ifdef __linux__
connect(m_showV4L2CheckBox, &QCheckBox::toggled, this,
&SettingsWidget::onSettingChanged);
#endif
}
void SettingsWidget::onBrowseButtonClicked()
@@ -420,7 +433,8 @@ void SettingsWidget::saveSettings()
sm->setIconSizeBaseMultiplier(m_iconSizeBaseMultiplier->value());
sm->setAirplayFps(m_airplayFpsSpinBox->value());
sm->setAirplayFps(m_fpsComboBox->currentText().toInt());
sm->setAirplayNoHold(m_noHoldCheckbox->isChecked());
#ifdef __linux__
sm->setShowV4L2(m_showV4L2CheckBox->isChecked());
#endif
+2 -1
View File
@@ -69,7 +69,8 @@ private:
QDoubleSpinBox *m_iconSizeBaseMultiplier;
// Airplay
QSpinBox *m_airplayFpsSpinBox;
QComboBox *m_fpsComboBox;
QCheckBox *m_noHoldCheckbox;
#ifdef __linux__
QCheckBox *m_showV4L2CheckBox;