Browse Source

cosmetic changes

Andreas Fetzer 10 years ago
parent
commit
a5c5cc3cdc

+ 5 - 5
Applications/ctkXnatTreeBrowser/ctkXnatTreeBrowserMainWindow.cpp

@@ -119,11 +119,11 @@ void ctkXnatTreeBrowserMainWindow::itemSelected(const QModelIndex &index)
   downloadable |= dynamic_cast<ctkXnatReconstructionFolder*>(xnatObject)!=NULL;
   ui->downloadButton->setEnabled(downloadable);
   ui->downloadLabel->setVisible(!downloadable);
-  bool canHaveFolder = false;
-  canHaveFolder |= dynamic_cast<ctkXnatProject*>(xnatObject) != NULL;
-  canHaveFolder |=  dynamic_cast<ctkXnatSubject*>(xnatObject) != NULL;
-  canHaveFolder |=  dynamic_cast<ctkXnatExperiment*>(xnatObject) != NULL;
-  ui->addResourceButton->setEnabled(canHaveFolder);
+  bool canHaveResource = false;
+  canHaveResource |= dynamic_cast<ctkXnatProject*>(xnatObject) != NULL;
+  canHaveResource |=  dynamic_cast<ctkXnatSubject*>(xnatObject) != NULL;
+  canHaveResource |=  dynamic_cast<ctkXnatExperiment*>(xnatObject) != NULL;
+  ui->addResourceButton->setEnabled(canHaveResource);
   bool uploadFilePossible = false;
   uploadFilePossible |= dynamic_cast<ctkXnatResource*>(xnatObject) != NULL;
   uploadFilePossible |=  dynamic_cast<ctkXnatScan*>(xnatObject) != NULL;

+ 1 - 1
Libs/XNAT/Core/ctkXnatObject.h

@@ -184,7 +184,7 @@ private:
   /// The implementation of the download mechanism, called by the download(const QString&) function.
   virtual void downloadImpl(const QString&) = 0;
 
-  /// The implementation of the upload mechanism, called by the upload() function.
+  /// The implementation of the upload mechanism, called by the save() function.
   /// Subclasses of ctkXnatObject can overwrite this function if needed
   virtual void saveImpl();
 

+ 11 - 18
Libs/XNAT/Core/ctkXnatResource.cpp

@@ -169,25 +169,18 @@ void ctkXnatResource::downloadImpl(const QString& filename)
 //----------------------------------------------------------------------------
 void ctkXnatResource::saveImpl()
 {
-  if (!this->session()->exists(this))
-  {
-    QString query = this->resourceUri();
+  QString query = this->resourceUri();
 
-    query.append(QString("?%1=%2").arg("xsi:type", this->schemaType()));
-    const QMap<QString, QString>& properties = this->properties();
-    QMapIterator<QString, QString> itProperties(properties);
-    while (itProperties.hasNext())
-    {
-      itProperties.next();
-      if (itProperties.key() == ID || itProperties.key() == "xsiType")
-        continue;
-      query.append(QString("&%1=%2").arg(itProperties.key(), itProperties.value()));
-    }
-    QUuid queryId = this->session()->httpPut(query);
-    session()->httpResults(queryId, ctkXnatDefaultSchemaTypes::XSI_RESOURCE);
-  }
-  else
+  query.append(QString("?%1=%2").arg("xsi:type", this->schemaType()));
+  const QMap<QString, QString>& properties = this->properties();
+  QMapIterator<QString, QString> itProperties(properties);
+  while (itProperties.hasNext())
   {
-    // TODO Update resource
+    itProperties.next();
+    if (itProperties.key() == ID || itProperties.key() == "xsiType")
+      continue;
+    query.append(QString("&%1=%2").arg(itProperties.key(), itProperties.value()));
   }
+  QUuid queryId = this->session()->httpPut(query);
+  session()->httpResults(queryId, ctkXnatDefaultSchemaTypes::XSI_RESOURCE);
 }

+ 0 - 3
Libs/XNAT/Core/ctkXnatResource.h

@@ -65,9 +65,6 @@ public:
   void setContent(const QString& content);
   QString content() const;
 
-  void setLocalFilePath(const QString& filepath);
-  QString localFilePath() const;
-
   void reset();
 
   void saveImpl();