mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-13 14:02:15 -07:00
[App] Send diagnostics on server connection
Took 32 seconds Took 22 seconds
This commit is contained in:
parent
bbd8671e6e
commit
b9198d99e9
13 changed files with 258 additions and 9 deletions
|
|
@ -278,6 +278,34 @@ void RemoteClient::passwordSaltResponse(const Response &response)
|
|||
}
|
||||
}
|
||||
|
||||
Command_ClientDiagnostics RemoteClient::generateClientDiagnostics()
|
||||
{
|
||||
Command_ClientDiagnostics diag;
|
||||
|
||||
diag.set_clientver(VERSION_STRING);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
diag.set_os("windows");
|
||||
#elif defined(Q_OS_MAC)
|
||||
diag.set_os("macos");
|
||||
#elif defined(Q_OS_LINUX)
|
||||
diag.set_os("linux");
|
||||
#else
|
||||
diag.set_os("unknown");
|
||||
#endif
|
||||
|
||||
diag.set_arch(QSysInfo::currentCpuArchitecture().toStdString());
|
||||
|
||||
return diag;
|
||||
}
|
||||
|
||||
void RemoteClient::addDiagnosticsFeature(Command_ClientDiagnostics *diag, const QString &name, const QString &value)
|
||||
{
|
||||
FeatureFlag *flag = diag->add_feature_flags();
|
||||
flag->set_name(name.toStdString());
|
||||
flag->set_value(value.toStdString());
|
||||
}
|
||||
|
||||
void RemoteClient::loginResponse(const Response &response)
|
||||
{
|
||||
const Response_Login &resp = response.GetExtension(Response_Login::ext);
|
||||
|
|
@ -302,6 +330,15 @@ void RemoteClient::loginResponse(const Response &response)
|
|||
ignoreList.append(resp.ignore_list(i));
|
||||
emit ignoreListReceived(ignoreList);
|
||||
|
||||
// send diagnostics if enabled
|
||||
SendDiagnosticsMode mode = SendDiagnosticsMode(networkSettingsProvider->getSendDiagnostics());
|
||||
|
||||
if (mode == SendDiagnosticsUnprompted) {
|
||||
emit notifyUserAboutDiagnostics();
|
||||
} else if (mode == SendDiagnosticsBasic || mode == SendDiagnosticsFull) {
|
||||
sendDiagnostics();
|
||||
}
|
||||
|
||||
if (newMissingFeatureFound(possibleMissingFeatures) && resp.missing_features_size() > 0 &&
|
||||
networkSettingsProvider->getNotifyAboutUpdates()) {
|
||||
networkSettingsProvider->setKnownMissingFeatures(possibleMissingFeatures);
|
||||
|
|
@ -320,6 +357,13 @@ void RemoteClient::loginResponse(const Response &response)
|
|||
}
|
||||
}
|
||||
|
||||
void RemoteClient::sendDiagnostics()
|
||||
{
|
||||
Command_ClientDiagnostics diag = generateClientDiagnostics();
|
||||
PendingCommand *pend = prepareSessionCommand(diag);
|
||||
sendCommand(pend);
|
||||
}
|
||||
|
||||
void RemoteClient::registerResponse(const Response &response)
|
||||
{
|
||||
const Response_Register &resp = response.GetExtension(Response_Register::ext);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ signals:
|
|||
const QString &_realname);
|
||||
void sigActivateToServer(const QString &_token);
|
||||
void sigDisconnectFromServer();
|
||||
void notifyUserAboutDiagnostics();
|
||||
void notifyUserAboutUpdate();
|
||||
void sigRequestForgotPasswordToServer(const QString &hostname, unsigned int port, const QString &_userName);
|
||||
void sigForgotPasswordSuccess();
|
||||
|
|
@ -80,6 +81,8 @@ private slots:
|
|||
void doLogin();
|
||||
void doHashedLogin();
|
||||
Command_Login generateCommandLogin();
|
||||
Command_ClientDiagnostics generateClientDiagnostics();
|
||||
void addDiagnosticsFeature(Command_ClientDiagnostics *diag, const QString &name, const QString &value);
|
||||
void doDisconnectFromServer();
|
||||
void doActivateToServer(const QString &_token);
|
||||
void doRequestForgotPasswordToServer(const QString &hostname, unsigned int port, const QString &_userName);
|
||||
|
|
@ -120,6 +123,9 @@ private:
|
|||
protected slots:
|
||||
void sendCommandContainer(const CommandContainer &cont) override;
|
||||
|
||||
public slots:
|
||||
void sendDiagnostics();
|
||||
|
||||
public:
|
||||
explicit RemoteClient(QObject *parent = nullptr, INetworkSettingsProvider *networkSettingsProvider = nullptr);
|
||||
~RemoteClient() override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue