feat(ui): check for Bonjour in AirPlay widget, make AirPlay widget resizeable

This commit is contained in:
uncor3
2026-01-28 16:04:19 +03:00
parent d48e478a86
commit 8ec38d3ee0
5 changed files with 36 additions and 24 deletions
+25 -7
View File
@@ -55,6 +55,8 @@
#include <uxplay/renderers/video_renderer.h>
#include <uxplay/uxplay.h>
#include "diagnosedialog.h"
#include "platform/windows/check_deps.h"
#include "toolboxwidget.h"
AirPlaySettings::AirPlaySettings()
@@ -69,9 +71,8 @@ QStringList AirPlaySettings::toArgs() const
// FPS
args << "-fps" << QString::number(fps);
// FIXME: causes seg fault on Windows ?
// Allow new connections to take over
// args << "-nohold";
args << "-nohold";
return args;
}
@@ -139,7 +140,27 @@ AirPlayWindow::AirPlayWindow(QWidget *parent)
m_serverThread(nullptr), m_serverRunning(false), m_clientConnected(false)
{
setupUI();
setMinimumSize(800, 600);
QTimer::singleShot(0, this, [this]() {
/* HACK: qt ignores resize() calls so let's workaround */
setMinimumSize(0, 0);
});
/* FIXME: this can be handled better, add linux support */
#ifdef WIN32
bool bonjour = IsBonjourServiceInstalled();
if (!bonjour) {
QMessageBox::warning(
this, "Bonjour Service Not Installed",
"Bonjour service is not installed on your system. Please install "
"it to enable AirPlay functionality.");
DiagnoseDialog *diagnoseDialog = new DiagnoseDialog();
diagnoseDialog->show();
QTimer::singleShot(0, this, &AirPlayWindow::close);
return;
}
#endif
QTimer::singleShot(500, this, &AirPlayWindow::startAirPlayServer);
}
@@ -154,8 +175,6 @@ AirPlayWindow::~AirPlayWindow()
void AirPlayWindow::setupUI()
{
setWindowTitle("AirPlay Receiver - iDescriptor");
setMinimumSize(800, 600);
resize(1000, 700);
// Create stacked widget
m_stackedWidget = new QStackedWidget(this);
@@ -163,7 +182,7 @@ void AirPlayWindow::setupUI()
m_tutorialWidget = new QWidget();
m_tutorialLayout = new QVBoxLayout(m_tutorialWidget);
m_tutorialLayout->setContentsMargins(40, 40, 40, 40);
m_tutorialLayout->setContentsMargins(0, 0, 0, 0);
m_tutorialLayout->setSpacing(20);
m_loadingIndicator = new QProcessIndicator();
@@ -173,7 +192,7 @@ void AirPlayWindow::setupUI()
QHBoxLayout *loadingLayout = new QHBoxLayout();
m_loadingLabel = new QLabel("Starting AirPlay Server...");
loadingLayout->setContentsMargins(0, 40, 0, 0);
loadingLayout->addStretch();
loadingLayout->addWidget(m_loadingLabel);
loadingLayout->addSpacing(5);
@@ -211,7 +230,6 @@ void AirPlayWindow::setupUI()
// Video display
m_videoLabel = new QLabel();
m_videoLabel->setMinimumSize(640, 480);
m_videoLabel->setAlignment(Qt::AlignCenter);
m_videoLabel->setScaledContents(false);
streamingLayout->addWidget(m_videoLabel, 1);
+7 -13
View File
@@ -18,34 +18,29 @@
*/
#include "diagnosedialog.h"
#include "iDescriptor-ui.h"
#include <QApplication>
DiagnoseDialog::DiagnoseDialog(QWidget *parent) : QDialog(parent)
{
setupUI();
setWindowTitle("System Dependencies");
setModal(true);
resize(500, 400);
// Set clean close behavior
setAttribute(Qt::WA_DeleteOnClose, true);
}
void DiagnoseDialog::setupUI()
{
setMinimumSize(MIN_MAIN_WINDOW_SIZE.width(), MIN_MAIN_WINDOW_SIZE.height() / 2);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QScrollArea *scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
mainLayout->setContentsMargins(10, 10, 10, 10);
// Add the main diagnose widget
/*
TODO: either subclass DiagnoseWidget or
modify its layout to better fit dialog
*/
m_diagnoseWidget = new DiagnoseWidget();
scrollArea->setWidget(m_diagnoseWidget);
// Close button
QHBoxLayout *buttonLayout = new QHBoxLayout();
buttonLayout->addStretch();
@@ -56,8 +51,7 @@ void DiagnoseDialog::setupUI()
buttonLayout->addWidget(m_closeButton);
// Layout assembly
mainLayout->addWidget(scrollArea);
mainLayout->addWidget(m_diagnoseWidget);
mainLayout->addLayout(buttonLayout);
}
+1
View File
@@ -45,6 +45,7 @@
#define COLOR_RED QColor(255, 0, 0) // Red
#define COLOR_BLUE QColor("#2b5693")
#define COLOR_ACCENT_BLUE QColor("#0b5ed7")
#define MIN_MAIN_WINDOW_SIZE QSize(900, 600)
class ResponsiveGraphicsView : public QGraphicsView
{
+2 -3
View File
@@ -136,9 +136,8 @@ MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
const QSize minSize(900, 600);
setMinimumSize(minSize);
resize(minSize);
setMinimumSize(MIN_MAIN_WINDOW_SIZE);
resize(MIN_MAIN_WINDOW_SIZE);
m_ZTabWidget = new ZTabWidget(this);
m_ZTabWidget->setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);