mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 14:40:56 +00:00
Add an option to disable the automatic connection testing
This commit is contained in:
@@ -637,10 +637,19 @@ private:
|
|||||||
return serverInfo;
|
return serverInfo;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (!m_Mdns) {
|
if (!m_Mdns) {
|
||||||
// We failed to connect to the specified PC. Let's test to make sure this network
|
StreamingPreferences prefs;
|
||||||
// isn't blocking Moonlight, so we can tell the user about it.
|
int portTestResult;
|
||||||
int portTestResult = LiTestClientConnectivity("qt.conntest.moonlight-stream.org", 443,
|
|
||||||
|
if (prefs.detectNetworkBlocking) {
|
||||||
|
// We failed to connect to the specified PC. Let's test to make sure this network
|
||||||
|
// isn't blocking Moonlight, so we can tell the user about it.
|
||||||
|
portTestResult = LiTestClientConnectivity("qt.conntest.moonlight-stream.org", 443,
|
||||||
ML_PORT_FLAG_TCP_47984 | ML_PORT_FLAG_TCP_47989);
|
ML_PORT_FLAG_TCP_47984 | ML_PORT_FLAG_TCP_47989);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
portTestResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
emit computerAddCompleted(false, portTestResult != 0 && portTestResult != ML_TEST_RESULT_INCONCLUSIVE);
|
emit computerAddCompleted(false, portTestResult != 0 && portTestResult != ML_TEST_RESULT_INCONCLUSIVE);
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
|
|||||||
@@ -842,6 +842,25 @@ Flickable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: detectNetworkBlocking
|
||||||
|
width: parent.width
|
||||||
|
text: "Automatically detect blocked connections (Recommended)"
|
||||||
|
font.pointSize: 12
|
||||||
|
checked: StreamingPreferences.detectNetworkBlocking
|
||||||
|
onCheckedChanged: {
|
||||||
|
// This is called on init, so only do the work if we've
|
||||||
|
// actually changed the value.
|
||||||
|
if (StreamingPreferences.detectNetworkBlocking != checked) {
|
||||||
|
StreamingPreferences.detectNetworkBlocking = checked
|
||||||
|
|
||||||
|
// We must save the updated preference to ensure
|
||||||
|
// ComputerManager can observe the change internally.
|
||||||
|
StreamingPreferences.save()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#define SER_GAMEPADMOUSE "gamepadmouse"
|
#define SER_GAMEPADMOUSE "gamepadmouse"
|
||||||
#define SER_DEFAULTVER "defaultver"
|
#define SER_DEFAULTVER "defaultver"
|
||||||
#define SER_PACKETSIZE "packetsize"
|
#define SER_PACKETSIZE "packetsize"
|
||||||
|
#define SER_DETECTNETBLOCKING "detectnetblocking"
|
||||||
|
|
||||||
#define CURRENT_DEFAULT_VER 1
|
#define CURRENT_DEFAULT_VER 1
|
||||||
|
|
||||||
@@ -67,6 +68,7 @@ void StreamingPreferences::reload()
|
|||||||
connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool();
|
connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool();
|
||||||
richPresence = settings.value(SER_RICHPRESENCE, true).toBool();
|
richPresence = settings.value(SER_RICHPRESENCE, true).toBool();
|
||||||
gamepadMouse = settings.value(SER_GAMEPADMOUSE, true).toBool();
|
gamepadMouse = settings.value(SER_GAMEPADMOUSE, true).toBool();
|
||||||
|
detectNetworkBlocking = settings.value(SER_DETECTNETBLOCKING, true).toBool();
|
||||||
packetSize = settings.value(SER_PACKETSIZE, 0).toInt();
|
packetSize = settings.value(SER_PACKETSIZE, 0).toInt();
|
||||||
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
||||||
static_cast<int>(AudioConfig::AC_STEREO)).toInt());
|
static_cast<int>(AudioConfig::AC_STEREO)).toInt());
|
||||||
@@ -113,6 +115,7 @@ void StreamingPreferences::save()
|
|||||||
settings.setValue(SER_RICHPRESENCE, richPresence);
|
settings.setValue(SER_RICHPRESENCE, richPresence);
|
||||||
settings.setValue(SER_GAMEPADMOUSE, gamepadMouse);
|
settings.setValue(SER_GAMEPADMOUSE, gamepadMouse);
|
||||||
settings.setValue(SER_PACKETSIZE, packetSize);
|
settings.setValue(SER_PACKETSIZE, packetSize);
|
||||||
|
settings.setValue(SER_DETECTNETBLOCKING, detectNetworkBlocking);
|
||||||
settings.setValue(SER_AUDIOCFG, static_cast<int>(audioConfig));
|
settings.setValue(SER_AUDIOCFG, static_cast<int>(audioConfig));
|
||||||
settings.setValue(SER_VIDEOCFG, static_cast<int>(videoCodecConfig));
|
settings.setValue(SER_VIDEOCFG, static_cast<int>(videoCodecConfig));
|
||||||
settings.setValue(SER_VIDEODEC, static_cast<int>(videoDecoderSelection));
|
settings.setValue(SER_VIDEODEC, static_cast<int>(videoDecoderSelection));
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public:
|
|||||||
Q_PROPERTY(bool connectionWarnings MEMBER connectionWarnings NOTIFY connectionWarningsChanged)
|
Q_PROPERTY(bool connectionWarnings MEMBER connectionWarnings NOTIFY connectionWarningsChanged)
|
||||||
Q_PROPERTY(bool richPresence MEMBER richPresence NOTIFY richPresenceChanged)
|
Q_PROPERTY(bool richPresence MEMBER richPresence NOTIFY richPresenceChanged)
|
||||||
Q_PROPERTY(bool gamepadMouse MEMBER gamepadMouse NOTIFY gamepadMouseChanged)
|
Q_PROPERTY(bool gamepadMouse MEMBER gamepadMouse NOTIFY gamepadMouseChanged)
|
||||||
|
Q_PROPERTY(bool detectNetworkBlocking MEMBER detectNetworkBlocking NOTIFY detectNetworkBlockingChanged);
|
||||||
Q_PROPERTY(AudioConfig audioConfig MEMBER audioConfig NOTIFY audioConfigChanged)
|
Q_PROPERTY(AudioConfig audioConfig MEMBER audioConfig NOTIFY audioConfigChanged)
|
||||||
Q_PROPERTY(VideoCodecConfig videoCodecConfig MEMBER videoCodecConfig NOTIFY videoCodecConfigChanged)
|
Q_PROPERTY(VideoCodecConfig videoCodecConfig MEMBER videoCodecConfig NOTIFY videoCodecConfigChanged)
|
||||||
Q_PROPERTY(VideoDecoderSelection videoDecoderSelection MEMBER videoDecoderSelection NOTIFY videoDecoderSelectionChanged)
|
Q_PROPERTY(VideoDecoderSelection videoDecoderSelection MEMBER videoDecoderSelection NOTIFY videoDecoderSelectionChanged)
|
||||||
@@ -93,6 +94,7 @@ public:
|
|||||||
bool connectionWarnings;
|
bool connectionWarnings;
|
||||||
bool richPresence;
|
bool richPresence;
|
||||||
bool gamepadMouse;
|
bool gamepadMouse;
|
||||||
|
bool detectNetworkBlocking;
|
||||||
int packetSize;
|
int packetSize;
|
||||||
AudioConfig audioConfig;
|
AudioConfig audioConfig;
|
||||||
VideoCodecConfig videoCodecConfig;
|
VideoCodecConfig videoCodecConfig;
|
||||||
@@ -121,5 +123,6 @@ signals:
|
|||||||
void connectionWarningsChanged();
|
void connectionWarningsChanged();
|
||||||
void richPresenceChanged();
|
void richPresenceChanged();
|
||||||
void gamepadMouseChanged();
|
void gamepadMouseChanged();
|
||||||
|
void detectNetworkBlockingChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ private:
|
|||||||
else {
|
else {
|
||||||
portFlags = 0;
|
portFlags = 0;
|
||||||
}
|
}
|
||||||
if (portFlags != 0) {
|
if (portFlags != 0 && m_Session->m_Preferences->detectNetworkBlocking) {
|
||||||
portTestResult = LiTestClientConnectivity("qt.conntest.moonlight-stream.org", 443, portFlags);
|
portTestResult = LiTestClientConnectivity("qt.conntest.moonlight-stream.org", 443, portFlags);
|
||||||
|
|
||||||
// Ignore an inconclusive result
|
// Ignore an inconclusive result
|
||||||
|
|||||||
Reference in New Issue
Block a user