ConnectionValidator::Status use Q_ENUM

So no need to have a manual conversion to QString
This is only used in debug message anyway.
This commit is contained in:
Olivier Goffart 2018-02-21 15:12:21 +01:00 committed by Camila San
parent 311307e8cb
commit 1b587a1241
No known key found for this signature in database
GPG key ID: 7A4A6121E88E2AD4
4 changed files with 4 additions and 40 deletions

View file

@ -77,11 +77,6 @@ QStringList AccountState::connectionErrors() const
return _connectionErrors;
}
QString AccountState::connectionStatusString(ConnectionStatus status)
{
return ConnectionValidator::statusString(status);
}
AccountState::State AccountState::state() const
{
return _state;
@ -258,7 +253,7 @@ void AccountState::checkConnectivity()
void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status status, const QStringList &errors)
{
if (isSignedOut()) {
qCWarning(lcAccountState) << "Signed out, ignoring" << connectionStatusString(status) << _account->url().toString();
qCWarning(lcAccountState) << "Signed out, ignoring" << status << _account->url().toString();
return;
}
@ -281,8 +276,8 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta
if (_connectionStatus != status) {
qCInfo(lcAccountState) << "AccountState connection status change: "
<< connectionStatusString(_connectionStatus) << "->"
<< connectionStatusString(status);
<< _connectionStatus << "->"
<< status;
_connectionStatus = status;
}
_connectionErrors = errors;

View file

@ -94,7 +94,6 @@ public:
ConnectionStatus connectionStatus() const;
QStringList connectionErrors() const;
static QString connectionStatusString(ConnectionStatus status);
State state() const;
static QString stateString(State state);

View file

@ -41,35 +41,6 @@ ConnectionValidator::ConnectionValidator(AccountPtr account, QObject *parent)
{
}
QString ConnectionValidator::statusString(Status stat)
{
switch (stat) {
case Undefined:
return QLatin1String("Undefined");
case Connected:
return QLatin1String("Connected");
case NotConfigured:
return QLatin1String("Not configured");
case ServerVersionMismatch:
return QLatin1String("Server Version Mismatch");
case CredentialsNotReady:
return QLatin1String("Credentials not ready");
case CredentialsWrong:
return QLatin1String("Credentials Wrong");
case SslError:
return QLatin1String("SSL Error");
case StatusNotFound:
return QLatin1String("Status not found");
case ServiceUnavailable:
return QLatin1String("Service unavailable");
case MaintenanceMode:
return QLatin1String("Maintenance mode");
case Timeout:
return QLatin1String("Timeout");
}
return QLatin1String("status undeclared.");
}
void ConnectionValidator::checkServerAndAuth()
{
if (!_account) {

View file

@ -98,8 +98,7 @@ public:
MaintenanceMode, // maintenance enabled in status.php
Timeout // actually also used for other errors on the authed request
};
static QString statusString(Status);
Q_ENUM(Status);
// How often should the Application ask this object to check for the connection?
enum { DefaultCallingIntervalMsec = 32 * 1000 };