|
@@ -72,13 +72,13 @@ public:
|
|
|
|
|
|
QTimer* timer;
|
|
|
|
|
|
- // The time in milliseconds untill the signal sessionAboutToBeTimedOut gets emitted
|
|
|
- int timeToSessionTimeOutWarning;
|
|
|
+ // The time in milliseconds until the signal aboutToTimeOut gets emitted
|
|
|
+ int timeOutWarningPeriod;
|
|
|
|
|
|
- // The time in milliseconds untill the signal sessionTimedOut gets emitted
|
|
|
+ // The time in milliseconds until the signal timedOut gets emitted
|
|
|
// Default XNAT session timeout setting. This value will be updated after
|
|
|
// "updateExpirationDate" is called the first time.
|
|
|
- int timeToSessionTimedOut = 60000;
|
|
|
+ int timeOutPeriod = 60000;
|
|
|
|
|
|
ctkXnatSessionPrivate(const ctkXnatLoginProfile& loginProfile, ctkXnatSession* q);
|
|
|
~ctkXnatSessionPrivate();
|
|
@@ -224,10 +224,10 @@ QDateTime ctkXnatSessionPrivate::updateExpirationDate(qRestResult* restResult)
|
|
|
}
|
|
|
QByteArray timeSpan = expirationCookie[1];
|
|
|
timeSpan.chop(1);
|
|
|
- this->timeToSessionTimeOutWarning = timeSpan.toLong() - this->timeToSessionTimedOut;
|
|
|
+ this->timeOutWarningPeriod = timeSpan.toLong() - this->timeOutPeriod;
|
|
|
expirationDate = expirationDate.addMSecs(timeSpan.toLong());
|
|
|
sessionProperties[SESSION_EXPIRATION_DATE] = expirationDate.toString(Qt::ISODate);
|
|
|
- this->timer->start(this->timeToSessionTimeOutWarning);
|
|
|
+ this->timer->start(this->timeOutWarningPeriod);
|
|
|
emit q->sessionRenewed(expirationDate);
|
|
|
}
|
|
|
}
|
|
@@ -377,7 +377,7 @@ void ctkXnatSession::open()
|
|
|
QScopedPointer<qRestResult> restResult(d->xnat->takeResult(uuid));
|
|
|
if (restResult)
|
|
|
{
|
|
|
- QObject::connect(d->timer, SIGNAL(timeout()), this, SLOT(emitSessionTimeOut()));
|
|
|
+ QObject::connect(d->timer, SIGNAL(timeout()), this, SLOT(emitTimeOut()));
|
|
|
|
|
|
QString sessionId = restResult->result()["content"].toString();
|
|
|
d->sessionId = sessionId;
|
|
@@ -530,7 +530,7 @@ QUuid ctkXnatSession::httpGet(const QString& resource, const ctkXnatSession::Url
|
|
|
{
|
|
|
Q_D(ctkXnatSession);
|
|
|
d->checkSession();
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
return d->xnat->get(resource, parameters, rawHeaders);
|
|
|
}
|
|
|
|
|
@@ -545,7 +545,7 @@ QList<ctkXnatObject*> ctkXnatSession::httpResults(const QUuid& uuid, const QStri
|
|
|
{
|
|
|
d->throwXnatException("Http request failed.");
|
|
|
}
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
return d->results(restResult.data(), schemaType);
|
|
|
}
|
|
|
|
|
@@ -554,7 +554,7 @@ QUuid ctkXnatSession::httpPut(const QString& resource, const ctkXnatSession::Url
|
|
|
{
|
|
|
Q_D(ctkXnatSession);
|
|
|
d->checkSession();
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
return d->xnat->put(resource, parameters);
|
|
|
}
|
|
|
|
|
@@ -583,7 +583,7 @@ const QMap<QByteArray, QByteArray> ctkXnatSession::httpHeadSync(const QUuid &uui
|
|
|
{
|
|
|
Q_D(ctkXnatSession);
|
|
|
QScopedPointer<qRestResult> result (d->xnat->takeResult(uuid));
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
if (result == NULL)
|
|
|
{
|
|
|
d->throwXnatException("Sending HEAD request failed.");
|
|
@@ -596,7 +596,7 @@ QUuid ctkXnatSession::httpHead(const QString& resourceUri)
|
|
|
{
|
|
|
Q_D(ctkXnatSession);
|
|
|
QUuid queryId = d->xnat->head(resourceUri);
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
return queryId;
|
|
|
}
|
|
|
|
|
@@ -607,7 +607,7 @@ bool ctkXnatSession::exists(const ctkXnatObject* object)
|
|
|
|
|
|
QString query = object->resourceUri();
|
|
|
bool success = d->xnat->sync(d->xnat->get(query));
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
|
|
|
return success;
|
|
|
}
|
|
@@ -619,7 +619,7 @@ void ctkXnatSession::remove(ctkXnatObject* object)
|
|
|
|
|
|
QString query = object->resourceUri();
|
|
|
bool success = d->xnat->sync(d->xnat->del(query));
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
|
|
|
if (!success)
|
|
|
{
|
|
@@ -637,7 +637,7 @@ void ctkXnatSession::download(const QString& fileName,
|
|
|
|
|
|
QUuid queryId = d->xnat->download(fileName, resource, parameters, rawHeaders);
|
|
|
d->xnat->sync(queryId);
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
@@ -666,7 +666,7 @@ void ctkXnatSession::upload(ctkXnatFile *xnatFile,
|
|
|
QUuid md5QueryID = this->httpGet(md5Query);
|
|
|
QList<QVariantMap> result = this->httpSync(md5QueryID);
|
|
|
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
|
|
|
QString md5ChecksumRemote ("0");
|
|
|
// Newly added files are usually at the end of the catalog
|
|
@@ -702,7 +702,7 @@ void ctkXnatSession::upload(ctkXnatFile *xnatFile,
|
|
|
{
|
|
|
// Remove corrupted file from server
|
|
|
xnatFile->erase();
|
|
|
- d->timer->start(d->timeToSessionTimeOutWarning);
|
|
|
+ d->timer->start(d->timeOutWarningPeriod);
|
|
|
throw ctkXnatException("Upload failed! An error occurred during file upload.");
|
|
|
}
|
|
|
}
|
|
@@ -720,18 +720,18 @@ void ctkXnatSession::processResult(QUuid queryId, QList<QVariantMap> parameters)
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
-void ctkXnatSession::emitSessionTimeOut()
|
|
|
+void ctkXnatSession::emitTimeOut()
|
|
|
{
|
|
|
Q_D(ctkXnatSession);
|
|
|
|
|
|
- if (d->timer->interval() == d->timeToSessionTimeOutWarning)
|
|
|
+ if (d->timer->interval() == d->timeOutWarningPeriod)
|
|
|
{
|
|
|
- d->timer->start(d->timeToSessionTimedOut);
|
|
|
- emit sessionAboutToBeTimedOut();
|
|
|
+ d->timer->start(d->timeOutPeriod);
|
|
|
+ emit aboutToTimeOut();
|
|
|
}
|
|
|
- else if (d->timer->interval() == d->timeToSessionTimedOut)
|
|
|
+ else if (d->timer->interval() == d->timeOutPeriod)
|
|
|
{
|
|
|
d->timer->stop();
|
|
|
- emit sessionTimedOut();
|
|
|
+ emit timedOut();
|
|
|
}
|
|
|
}
|