Add prefix for NvLogLevel enum values

This commit is contained in:
Cameron Gutman 2019-01-19 21:32:35 -08:00
parent 75f631599c
commit e944c819d9
3 changed files with 13 additions and 13 deletions

View File

@ -31,7 +31,7 @@ private:
QString serverInfo; QString serverInfo;
try { try {
serverInfo = http.getServerInfo(NvHTTP::NvLogLevel::NONE); serverInfo = http.getServerInfo(NvHTTP::NvLogLevel::NVLL_NONE);
} catch (...) { } catch (...) {
return false; return false;
} }
@ -511,12 +511,12 @@ private:
// around this issue, we will issue the request again after a few seconds if // around this issue, we will issue the request again after a few seconds if
// we see a ServiceUnavailableError error. // we see a ServiceUnavailableError error.
try { try {
serverInfo = http.getServerInfo(NvHTTP::NvLogLevel::VERBOSE); serverInfo = http.getServerInfo(NvHTTP::NVLL_VERBOSE);
} catch (const QtNetworkReplyException& e) { } catch (const QtNetworkReplyException& e) {
if (e.getError() == QNetworkReply::ServiceUnavailableError) { if (e.getError() == QNetworkReply::ServiceUnavailableError) {
qWarning() << "Retrying request in 5 seconds after ServiceUnavailableError"; qWarning() << "Retrying request in 5 seconds after ServiceUnavailableError";
QThread::sleep(5); QThread::sleep(5);
serverInfo = http.getServerInfo(NvHTTP::NvLogLevel::VERBOSE); serverInfo = http.getServerInfo(NvHTTP::NVLL_VERBOSE);
qInfo() << "Retry successful"; qInfo() << "Retry successful";
} }
else { else {

View File

@ -223,7 +223,7 @@ NvHTTP::quitApp()
// Newer GFE versions will just return success even if quitting fails // Newer GFE versions will just return success even if quitting fails
// if we're not the original requestor. // if we're not the original requestor.
if (getCurrentGame(getServerInfo(NvHTTP::ERROR)) != 0) { if (getCurrentGame(getServerInfo(NvHTTP::NVLL_ERROR)) != 0) {
// Generate a synthetic GfeResponseException letting the caller know // Generate a synthetic GfeResponseException letting the caller know
// that they can't kill someone else's stream. // that they can't kill someone else's stream.
throw GfeHttpResponseException(599, ""); throw GfeHttpResponseException(599, "");
@ -264,7 +264,7 @@ NvHTTP::getAppList()
"applist", "applist",
nullptr, nullptr,
REQUEST_TIMEOUT_MS, REQUEST_TIMEOUT_MS,
NvLogLevel::ERROR); NvLogLevel::NVLL_ERROR);
verifyResponseStatus(appxml); verifyResponseStatus(appxml);
QXmlStreamReader xmlReader(appxml); QXmlStreamReader xmlReader(appxml);
@ -332,7 +332,7 @@ NvHTTP::getBoxArt(int appId)
"appid="+QString::number(appId)+ "appid="+QString::number(appId)+
"&AssetType=2&AssetIdx=0", "&AssetType=2&AssetIdx=0",
REQUEST_TIMEOUT_MS, REQUEST_TIMEOUT_MS,
NvLogLevel::VERBOSE); NvLogLevel::NVLL_VERBOSE);
QImage image = QImageReader(reply).read(); QImage image = QImageReader(reply).read();
delete reply; delete reply;
@ -440,7 +440,7 @@ NvHTTP::openConnection(QUrl baseUrl,
if (timeoutMs) { if (timeoutMs) {
QTimer::singleShot(timeoutMs, &loop, SLOT(quit())); QTimer::singleShot(timeoutMs, &loop, SLOT(quit()));
} }
if (logLevel >= NvLogLevel::VERBOSE) { if (logLevel >= NvLogLevel::NVLL_VERBOSE) {
qInfo() << "Executing request:" << url.toString(); qInfo() << "Executing request:" << url.toString();
} }
loop.exec(QEventLoop::ExcludeUserInputEvents); loop.exec(QEventLoop::ExcludeUserInputEvents);
@ -448,7 +448,7 @@ NvHTTP::openConnection(QUrl baseUrl,
// Abort the request if it timed out // Abort the request if it timed out
if (!reply->isFinished()) if (!reply->isFinished())
{ {
if (logLevel >= NvLogLevel::ERROR) { if (logLevel >= NvLogLevel::NVLL_ERROR) {
qWarning() << "Aborting timed out request for" << url.toString(); qWarning() << "Aborting timed out request for" << url.toString();
} }
reply->abort(); reply->abort();
@ -461,7 +461,7 @@ NvHTTP::openConnection(QUrl baseUrl,
// Handle error // Handle error
if (reply->error() != QNetworkReply::NoError) if (reply->error() != QNetworkReply::NoError)
{ {
if (logLevel >= NvLogLevel::ERROR) { if (logLevel >= NvLogLevel::NVLL_ERROR) {
qWarning() << command << " request failed with error " << reply->error(); qWarning() << command << " request failed with error " << reply->error();
} }

View File

@ -117,9 +117,9 @@ class NvHTTP
{ {
public: public:
enum NvLogLevel { enum NvLogLevel {
NONE, NVLL_NONE,
ERROR, NVLL_ERROR,
VERBOSE NVLL_VERBOSE
}; };
explicit NvHTTP(QString address, QSslCertificate serverCert); explicit NvHTTP(QString address, QSslCertificate serverCert);
@ -150,7 +150,7 @@ public:
QString command, QString command,
QString arguments, QString arguments,
int timeoutMs, int timeoutMs,
NvLogLevel logLevel = NvLogLevel::VERBOSE); NvLogLevel logLevel = NvLogLevel::NVLL_VERBOSE);
void setServerCert(QSslCertificate serverCert); void setServerCert(QSslCertificate serverCert);