Rework session initialization to return to the Qt event loop while connecting

We also display multiple launch warnings at the same time
This commit is contained in:
Cameron Gutman
2025-11-22 16:51:45 -06:00
parent 6313129603
commit 54283ce0a1
3 changed files with 84 additions and 143 deletions
+9 -11
View File
@@ -1,7 +1,7 @@
#pragma once
#include <QSemaphore>
#include <QWindow>
#include <QQuickWindow>
#include <Limelight.h>
#include <opus_multistream.h>
@@ -96,13 +96,14 @@ class Session : public QObject
friend class SdlInputHandler;
friend class DeferredSessionCleanupTask;
friend class AsyncConnectionStartThread;
friend class ExecThread;
public:
explicit Session(NvComputer* computer, NvApp& app, StreamingPreferences *preferences = nullptr);
virtual ~Session();
Q_INVOKABLE void exec(QWindow* qtWindow);
Q_INVOKABLE bool initialize(QQuickWindow* qtWindow);
Q_INVOKABLE void start();
Q_PROPERTY(QStringList launchWarnings MEMBER m_LaunchWarnings NOTIFY launchWarningsChanged);
static
void getDecoderInfo(SDL_Window* window,
@@ -132,8 +133,6 @@ signals:
void displayLaunchError(QString text);
void displayLaunchWarning(QString text);
void quitStarting();
void sessionFinished(int portTestResult);
@@ -141,10 +140,10 @@ signals:
// Emitted after sessionFinished() when the session is ready to be destroyed
void readyForDeletion();
private:
void execInternal();
void launchWarningsChanged();
bool initialize();
private:
void exec();
bool startConnectionAsync();
@@ -256,13 +255,12 @@ private:
bool m_AudioDisabled;
bool m_AudioMuted;
Uint32 m_FullScreenFlag;
QWindow* m_QtWindow;
bool m_ThreadedExec;
QQuickWindow* m_QtWindow;
bool m_UnexpectedTermination;
SdlInputHandler* m_InputHandler;
int m_MouseEmulationRefCount;
int m_FlushingWindowEventsRef;
QList<QString> m_LaunchWarnings;
QStringList m_LaunchWarnings;
bool m_ShouldExitAfterQuit;
bool m_AsyncConnectionSuccess;