Parcourir la source

Further cleanup

Andreas Fetzer il y a 10 ans
Parent
commit
66fe788a6a

+ 0 - 3
Libs/XNAT/Core/ctkXnatFile.cpp

@@ -21,12 +21,9 @@
 
 
 #include "ctkXnatFile.h"
 #include "ctkXnatFile.h"
 
 
-#include "ctkXnatException.h"
 #include "ctkXnatObjectPrivate.h"
 #include "ctkXnatObjectPrivate.h"
 #include "ctkXnatSession.h"
 #include "ctkXnatSession.h"
 
 
-#include <QDebug>
-
 const QString ctkXnatFile::FILE_NAME = "Name";
 const QString ctkXnatFile::FILE_NAME = "Name";
 const QString ctkXnatFile::FILE_TAGS = "file_tags";
 const QString ctkXnatFile::FILE_TAGS = "file_tags";
 const QString ctkXnatFile::FILE_FORMAT = "file_format";
 const QString ctkXnatFile::FILE_FORMAT = "file_format";

+ 1 - 2
Libs/XNAT/Core/ctkXnatObject.cpp

@@ -236,7 +236,6 @@ void ctkXnatObject::add(ctkXnatObject* child)
     {
     {
       d->children.replace(d->children.indexOf(existingChild), child);
       d->children.replace(d->children.indexOf(existingChild), child);
       childExists = true;
       childExists = true;
-      qWarning() << "ctkXnatObject::add(): Child already exists -> Replaced child!";
     }
     }
   }
   }
   if (!childExists)
   if (!childExists)
@@ -383,7 +382,7 @@ void ctkXnatObject::saveImpl(bool /*overwrite*/)
     // If the object has been modified on the server, perform an update
     // If the object has been modified on the server, perform an update
     if (d->lastModifiedTime < remoteModTime)
     if (d->lastModifiedTime < remoteModTime)
     {
     {
-      qDebug()<<"Object maybe overwritten on server!";
+      qWarning()<<"Uploaded object maybe overwritten on server!";
       // TODO update from server, since modification time is not really supported
       // TODO update from server, since modification time is not really supported
       // by xnat right now this is not of high priority
       // by xnat right now this is not of high priority
       // something like this->updateImpl + setLastModifiedTime()
       // something like this->updateImpl + setLastModifiedTime()

+ 1 - 1
Libs/XNAT/Core/ctkXnatResource.cpp

@@ -27,8 +27,8 @@
 const QString ctkXnatResource::TAGS = "tags";
 const QString ctkXnatResource::TAGS = "tags";
 const QString ctkXnatResource::FORMAT = "format";
 const QString ctkXnatResource::FORMAT = "format";
 const QString ctkXnatResource::CONTENT = "content";
 const QString ctkXnatResource::CONTENT = "content";
-
 const QString ctkXnatResource::ID = "xnat_abstractresource_id";
 const QString ctkXnatResource::ID = "xnat_abstractresource_id";
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 class ctkXnatResourcePrivate : public ctkXnatObjectPrivate
 class ctkXnatResourcePrivate : public ctkXnatObjectPrivate
 {
 {

+ 12 - 13
Libs/XNAT/Core/ctkXnatSession.cpp

@@ -63,7 +63,7 @@ public:
   QScopedPointer<ctkXnatAPI> xnat;
   QScopedPointer<ctkXnatAPI> xnat;
   QScopedPointer<ctkXnatDataModel> dataModel;
   QScopedPointer<ctkXnatDataModel> dataModel;
   QString sessionId;
   QString sessionId;
-  QString defaultFilePath;
+  QString defaultDownloadDir;
 
 
   QMap<QString, QString> sessionProperties;
   QMap<QString, QString> sessionProperties;
 
 
@@ -90,7 +90,7 @@ ctkXnatSessionPrivate::ctkXnatSessionPrivate(const ctkXnatLoginProfile& loginPro
                                              ctkXnatSession* q)
                                              ctkXnatSession* q)
   : loginProfile(loginProfile)
   : loginProfile(loginProfile)
   , xnat(new ctkXnatAPI())
   , xnat(new ctkXnatAPI())
-  , defaultFilePath("")
+  , defaultDownloadDir("")
   , q(q)
   , q(q)
 {
 {
   // TODO This is a workaround for connecting to sites with self-signed
   // TODO This is a workaround for connecting to sites with self-signed
@@ -478,27 +478,27 @@ QString ctkXnatSession::sessionId() const
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
-void ctkXnatSession::setDefaultFilePath(const QString &path)
+void ctkXnatSession::setDefaultDownloadDir(const QString &path)
 {
 {
   Q_D(ctkXnatSession);
   Q_D(ctkXnatSession);
 
 
   QDir directory(path);
   QDir directory(path);
   if (directory.exists() && path.size() != 0)
   if (directory.exists() && path.size() != 0)
   {
   {
-    d->defaultFilePath = path;
+    d->defaultDownloadDir = path;
   }
   }
   else
   else
   {
   {
-    d->defaultFilePath = QDir::currentPath();
-    qWarning() << "Specified directory: ["<<path<<"] does not exists! Setting default filepath to :"<<d->defaultFilePath;
+    d->defaultDownloadDir = QDir::currentPath();
+    qWarning() << "Specified directory: ["<<path<<"] does not exists! Setting default filepath to :"<<d->defaultDownloadDir;
   }
   }
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
-QString ctkXnatSession::defaultFilePath() const
+QString ctkXnatSession::defaultDownloadDir() const
 {
 {
   Q_D(const ctkXnatSession);
   Q_D(const ctkXnatSession);
-  return d->defaultFilePath;
+  return d->defaultDownloadDir;
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
@@ -639,13 +639,13 @@ void ctkXnatSession::upload(ctkXnatFile *xnatFile,
   // of the parent resource. Unfortunately for XNAT versions <= 1.6.4
   // of the parent resource. Unfortunately for XNAT versions <= 1.6.4
   // this is the only way to get the file's MD5 hash form the server.
   // this is the only way to get the file's MD5 hash form the server.
   QString md5Query = xnatFile->parent()->resourceUri();
   QString md5Query = xnatFile->parent()->resourceUri();
-  QUuid md5ID = this->httpGet(md5Query);
-  QList<QVariantMap> result = this->httpSync(md5ID);
+  QUuid md5QueryID = this->httpGet(md5Query);
+  QList<QVariantMap> result = this->httpSync(md5QueryID);
 
 
   QString md5ChecksumRemote ("0");
   QString md5ChecksumRemote ("0");
   // Newly added files are usually at the end of the catalog
   // Newly added files are usually at the end of the catalog
-  // and hence at the end of the result list. So iterating backwards
-  // is for performance reasons.
+  // and hence at the end of the result list.
+  // So iterating backward is for performance reasons.
   QList<QVariantMap>::const_iterator it = result.constEnd()-1;
   QList<QVariantMap>::const_iterator it = result.constEnd()-1;
   while (it != result.constBegin()-1)
   while (it != result.constBegin()-1)
   {
   {
@@ -683,7 +683,6 @@ void ctkXnatSession::upload(ctkXnatFile *xnatFile,
   {
   {
     qWarning()<<"Could not validate file upload! Remote MD5: "<<md5ChecksumRemote;
     qWarning()<<"Could not validate file upload! Remote MD5: "<<md5ChecksumRemote;
   }
   }
-  // End file validation
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------

+ 7 - 7
Libs/XNAT/Core/ctkXnatSession.h

@@ -147,23 +147,23 @@ public:
   QString sessionId() const;
   QString sessionId() const;
 
 
   /**
   /**
-    * @brief Sets the default location where files will be save after being downloaded
+    * @brief Sets the default location where files will be saved after being downloaded
     *
     *
     * Sets the default directory into which file downloads will be saved.
     * Sets the default directory into which file downloads will be saved.
-    * By default this value is empty and files will be stored into the directory
-    * of the executable.
+    * By default this value is empty and files will be stored into the current
+    * working directory.
     * If the path does not exists a warning will be printed and the path will be
     * If the path does not exists a warning will be printed and the path will be
-    * set to the current working directory
+    * set to the current working directory.
     *
     *
     * @param path the path to the download location
     * @param path the path to the download location
     */
     */
-  void setDefaultFilePath(const QString& path);
+  void setDefaultDownloadDir(const QString& path);
 
 
   /**
   /**
     * @brief returns the default download location
     * @brief returns the default download location
     * @return the default download directory as string
     * @return the default download directory as string
     */
     */
-  QString defaultFilePath() const;
+  QString defaultDownloadDir() const;
 
 
   ctkXnatDataModel* dataModel() const;
   ctkXnatDataModel* dataModel() const;
 
 
@@ -268,7 +268,7 @@ public:
    */
    */
   Q_SIGNAL void sessionAboutToBeClosed();
   Q_SIGNAL void sessionAboutToBeClosed();
 
 
-  Q_SIGNAL void uploadFinished();
+//  Q_SIGNAL void uploadFinished();
 
 
   Q_SIGNAL void progress(QUuid, double);
   Q_SIGNAL void progress(QUuid, double);
 
 

+ 1 - 1
Libs/XNAT/Widgets/ctkXnatLoginDialog.cpp

@@ -212,7 +212,7 @@ void ctkXnatLoginDialog::accept()
     return;
     return;
     }
     }
   d->Session = session.take();
   d->Session = session.take();
-  d->Session->setDefaultFilePath(ui->edtDownloadDir->text());
+  d->Session->setDefaultDownloadDir(ui->edtDownloadDir->text());
 
 
   QDialog::accept();
   QDialog::accept();
 }
 }